What is GTFOBins and why does a CTF player need it?
GTFOBins (gtfobins.github.io) is a curated directory of standard Unix binaries that can be used to bypass local security restrictions on misconfigured systems. The key word is "standard." This is not an exploit database or a list of vulnerabilities. find, vim, python, awk, env, docker— legitimate utilities present on most Linux machines. The problem isn't with the binaries, but with how the administrator configured their execution permissions. For more details, see our article on Linux for pentesters .
For each binary, GTFOBins displays the exact exploitation command in several contexts: Shell (launch an interactive shell), File read (read arbitrary files), File write (write), Reverse shell, SUID, Sudo, and Capabilities. A finding like "user has sudo on find" is converted into a ready-made root shell in seconds—without writing exploits, without compiling, in a single one-liner.
In MITRE ATT&CK terms, GTFOBins covers two techniques: Setuid and Setgid (T1548.001, Privilege Escalation) for SUID binaries and Sudo and Sudo Caching (T1548.003, Privilege Escalation) for sudo misconfigurations. On CTF platforms, these are the most common vectors—and the fastest to exploit. As the project's authors describe it, it's a "compendium about how to live off the land when you only have certain binaries available." We live with what's available on the machine—and gain root access.
Three Contexts for Privilege Escalation via GTFOBins
GTFOBins classifies each binary based on the context in which it becomes dangerous. Three are critical for CTF players: sudo, SUID, and capabilities. The difference between them determines the search command, the exploit command, and even the one-liner syntax.
Exploiting sudo privileges via GTFOBins
sudo -l— is literally the first thing I type after getting a shell. The command shows which programs the current user can run via sudo and under what conditions. If the output contains NOPASSWDand any binary from GTFOBins - root is actually already obtained.
Typical conclusion: User www-data may run the following commands on target: (root) NOPASSWD: /usr/bin/findYou open GTFOBins and search find, look at the "Sudo" section, copy the one-liner: sudo find . -exec /bin/sh \; -quit. Shell as root. That's it.
But sudo -lNOPASSWD doesn't always show. Sometimes the binary is allowed with a password—if the current user's password is known (found in the config, .bash_history, environment variables), the vector still works. The main thing is to see the binary listed on GTFOBins.
What to check in the output sudo -lbesides the binary itself:
NOPASSWD - No password required, instant exploitation
SETENV — environment variables can be passed, which opens the vector via LD_PRELOAD
(ALL : ALL) — run as any user, including root
Argument restrictions - sudo is only allowed with certain flags; complicates, but does not always block
env_keep — which environment variables are saved; LD_PRELOAD And LD_LIBRARY_PATHhere are critical
Linux File SUID Search and Exploitation
The SUID (Set User ID) bit forces a file to be executed with the privileges of its owner, not the executing user. If the owner is root, any user executing a file receives root's execution context. In MITRE ATT&CK, this technique is called Setuid and Setgid (T1548.001, Privilege Escalation).
Command to request SUID binaries: find / -perm -4000 -type f -ls 2>/dev/null. The result is a list of files with the SUID bit set. Standard ones like /usr/bin/passwd, /usr/bin/mount, /usr/bin/ping— It's normal, they're here by design. I'm interested in non-standard ones: binaries in /opt/, /usr/local/bin/, or familiar utilities ( find, vim, python, bash) with SUID, which should not be there.
The fundamental difference with the sudo context is that SUID exploitation via GTFOBins requires a flag. -pfor the shell to preserve the privileged context. For findwith SOUTH: find . -exec /bin/sh -p \; -quit(please note -p). In sudo context -pIt's not needed. GTFOBins shows this difference clearly—the "SUID" section is different from the "Sudo" section for each binary. Forgot -p— I got a shell from myself. It's a shame.
One more thing: if the SUID binary is custom (not from the standard GTFOBins set), analyze it through strings And ltrace. If the binary calls the utility without an absolute path (just cpinstead of /usr/bin/cp), this is PATH injection - I will analyze it below.
Linux Capabilities: An Invisible Privilege Escalation Vector
Capabilities is a mechanism for granularly separating root privileges into individual "abilities." The capability binary cap_setuid+epcan change the UID of a process, which is essentially equivalent to the SUID bit. But—and here's the catch—capabilities aren't exposed through ls -laand are not standard find -perm -4000.
Search command: getcap -r / 2>/dev/nullIf the output shows something like /usr/bin/python3.8 = cap_setuid+ep— this is a direct path to root. The "Capabilities" section for Python on GTFOBins lists a one-liner that can be used via os.setuid(0)resets UID to root and starts the shell.
On CTF platforms, capabilities are often the final step, after sudo and SUID have failed. Many players forget about getcapand skip this vector completely. LinPEAS checks capabilities automatically and highlights dangerous ones, but manual checking through getcapfaster if you know what to look for. Besides cap_setuid, are dangerous cap_dac_read_search(reading any files) and cap_dac_override(write to any files).
Step-by-step Linux Privilege Escalation Chain in CTF
The specific algorithm I use on every Linux CTF machine. Three steps: enumeration, matching, exploitation.
Stage 1 – Rapid Reconnaissance. Three teams, in this order:
sudo -l 2>/dev/null
find / -perm -4000 -type f 2>/dev/null
getcap -r / 2>/dev/null
The first one shows sudo privileges. The second one shows SUID binaries. The third one shows capabilities. On nine out of ten CTF machines, one of the three will yield a result. If all three are empty, we move on to advanced reconnaissance: cat /etc/crontab, checking writable scripts, uname -aFor kernel exploits, run LinPEAS.
First, it is worth doing some basic orientation: whoami, id(check groups - docker, lxd, diskgive separate vectors), hostname, uname -a. Это System Owner/User Discovery (T1033) и System Information Discovery (T1082) по MITRE ATT&CK.
Step 2: Matching with GTFOBins. We check each found binary on gtfobins.github.io. Search by utility name. If the binary is listed in the directory, we look in the corresponding section (Sudo, SUID, or Capabilities, depending on how we found it). If it's not listed, we analyze it manually using strings And strace.
Step 3 – exploitation. Copy the one-liner from GTFOBins and paste it into the terminal. For sudo context – as is. For SUID – with the flag. -pin the shell. For capabilities, make sure you're using the correct interpreter ( python3 vs python).
The entire chain takes from 10 seconds (sudo -l immediately shows NOPASSWD for a known binary) to 5-10 minutes (if you need to analyze a custom binary). It's faster than any kernel exploit and more reliable.
GTFOBins (gtfobins.github.io) is a curated directory of standard Unix binaries that can be used to bypass local security restrictions on misconfigured systems. The key word is "standard." This is not an exploit database or a list of vulnerabilities. find, vim, python, awk, env, docker— legitimate utilities present on most Linux machines. The problem isn't with the binaries, but with how the administrator configured their execution permissions. For more details, see our article on Linux for pentesters .
For each binary, GTFOBins displays the exact exploitation command in several contexts: Shell (launch an interactive shell), File read (read arbitrary files), File write (write), Reverse shell, SUID, Sudo, and Capabilities. A finding like "user has sudo on find" is converted into a ready-made root shell in seconds—without writing exploits, without compiling, in a single one-liner.
In MITRE ATT&CK terms, GTFOBins covers two techniques: Setuid and Setgid (T1548.001, Privilege Escalation) for SUID binaries and Sudo and Sudo Caching (T1548.003, Privilege Escalation) for sudo misconfigurations. On CTF platforms, these are the most common vectors—and the fastest to exploit. As the project's authors describe it, it's a "compendium about how to live off the land when you only have certain binaries available." We live with what's available on the machine—and gain root access.
Three Contexts for Privilege Escalation via GTFOBins
GTFOBins classifies each binary based on the context in which it becomes dangerous. Three are critical for CTF players: sudo, SUID, and capabilities. The difference between them determines the search command, the exploit command, and even the one-liner syntax.
Exploiting sudo privileges via GTFOBins
sudo -l— is literally the first thing I type after getting a shell. The command shows which programs the current user can run via sudo and under what conditions. If the output contains NOPASSWDand any binary from GTFOBins - root is actually already obtained.
Typical conclusion: User www-data may run the following commands on target: (root) NOPASSWD: /usr/bin/findYou open GTFOBins and search find, look at the "Sudo" section, copy the one-liner: sudo find . -exec /bin/sh \; -quit. Shell as root. That's it.
But sudo -lNOPASSWD doesn't always show. Sometimes the binary is allowed with a password—if the current user's password is known (found in the config, .bash_history, environment variables), the vector still works. The main thing is to see the binary listed on GTFOBins.
What to check in the output sudo -lbesides the binary itself:
NOPASSWD - No password required, instant exploitation
SETENV — environment variables can be passed, which opens the vector via LD_PRELOAD
(ALL : ALL) — run as any user, including root
Argument restrictions - sudo is only allowed with certain flags; complicates, but does not always block
env_keep — which environment variables are saved; LD_PRELOAD And LD_LIBRARY_PATHhere are critical
Linux File SUID Search and Exploitation
The SUID (Set User ID) bit forces a file to be executed with the privileges of its owner, not the executing user. If the owner is root, any user executing a file receives root's execution context. In MITRE ATT&CK, this technique is called Setuid and Setgid (T1548.001, Privilege Escalation).
Command to request SUID binaries: find / -perm -4000 -type f -ls 2>/dev/null. The result is a list of files with the SUID bit set. Standard ones like /usr/bin/passwd, /usr/bin/mount, /usr/bin/ping— It's normal, they're here by design. I'm interested in non-standard ones: binaries in /opt/, /usr/local/bin/, or familiar utilities ( find, vim, python, bash) with SUID, which should not be there.
The fundamental difference with the sudo context is that SUID exploitation via GTFOBins requires a flag. -pfor the shell to preserve the privileged context. For findwith SOUTH: find . -exec /bin/sh -p \; -quit(please note -p). In sudo context -pIt's not needed. GTFOBins shows this difference clearly—the "SUID" section is different from the "Sudo" section for each binary. Forgot -p— I got a shell from myself. It's a shame.
One more thing: if the SUID binary is custom (not from the standard GTFOBins set), analyze it through strings And ltrace. If the binary calls the utility without an absolute path (just cpinstead of /usr/bin/cp), this is PATH injection - I will analyze it below.
Linux Capabilities: An Invisible Privilege Escalation Vector
Capabilities is a mechanism for granularly separating root privileges into individual "abilities." The capability binary cap_setuid+epcan change the UID of a process, which is essentially equivalent to the SUID bit. But—and here's the catch—capabilities aren't exposed through ls -laand are not standard find -perm -4000.
Search command: getcap -r / 2>/dev/nullIf the output shows something like /usr/bin/python3.8 = cap_setuid+ep— this is a direct path to root. The "Capabilities" section for Python on GTFOBins lists a one-liner that can be used via os.setuid(0)resets UID to root and starts the shell.
On CTF platforms, capabilities are often the final step, after sudo and SUID have failed. Many players forget about getcapand skip this vector completely. LinPEAS checks capabilities automatically and highlights dangerous ones, but manual checking through getcapfaster if you know what to look for. Besides cap_setuid, are dangerous cap_dac_read_search(reading any files) and cap_dac_override(write to any files).
Step-by-step Linux Privilege Escalation Chain in CTF
The specific algorithm I use on every Linux CTF machine. Three steps: enumeration, matching, exploitation.
Stage 1 – Rapid Reconnaissance. Three teams, in this order:
sudo -l 2>/dev/null
find / -perm -4000 -type f 2>/dev/null
getcap -r / 2>/dev/null
The first one shows sudo privileges. The second one shows SUID binaries. The third one shows capabilities. On nine out of ten CTF machines, one of the three will yield a result. If all three are empty, we move on to advanced reconnaissance: cat /etc/crontab, checking writable scripts, uname -aFor kernel exploits, run LinPEAS.
First, it is worth doing some basic orientation: whoami, id(check groups - docker, lxd, diskgive separate vectors), hostname, uname -a. Это System Owner/User Discovery (T1033) и System Information Discovery (T1082) по MITRE ATT&CK.
Step 2: Matching with GTFOBins. We check each found binary on gtfobins.github.io. Search by utility name. If the binary is listed in the directory, we look in the corresponding section (Sudo, SUID, or Capabilities, depending on how we found it). If it's not listed, we analyze it manually using strings And strace.
Step 3 – exploitation. Copy the one-liner from GTFOBins and paste it into the terminal. For sudo context – as is. For SUID – with the flag. -pin the shell. For capabilities, make sure you're using the correct interpreter ( python3 vs python).
The entire chain takes from 10 seconds (sudo -l immediately shows NOPASSWD for a known binary) to 5-10 minutes (if you need to analyze a custom binary). It's faster than any kernel exploit and more reliable.