Skip to content

Commit 2e55528

Browse files
committed
Add cp file-write
Along the lines of GTFOBins#122.
1 parent 834cae8 commit 2e55528

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

_gtfobins/cp.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,24 @@ functions:
44
- code: |
55
LFILE=file_to_read
66
cp "$LFILE" /dev/stdout
7+
file-write:
8+
- code: |
9+
LFILE=file_to_write
10+
echo "DATA" | cp /dev/stdin "$LFILE"
711
suid:
12+
- code: |
13+
LFILE=file_to_write
14+
echo "DATA" | ./cp /dev/stdin "$LFILE"
815
- description: This can be used to copy and then read or write files from a restricted file systems or with elevated privileges.
916
code: |
1017
LFILE=file_to_write
1118
TF=$(mktemp)
1219
echo "DATA" > $TF
1320
./cp $TF $LFILE
1421
sudo:
22+
- code: |
23+
LFILE=file_to_write
24+
echo "DATA" | sudo cp /dev/stdin "$LFILE"
1525
- description: This can be used to copy and then read or write files from a restricted file systems or with elevated privileges.
1626
code: |
1727
LFILE=file_to_write

0 commit comments

Comments
 (0)