SUID / SGID exploitation
A SUID binary runs with the file owner's privileges (root) regardless of who starts it. If the binary is on the GTFOBins list, it can usually be abused to run arbitrary code as root.
When to use
confirmesc reports a finding like:
[CONFIRMED] Exploitable SUID/SGID binary: /opt/vulnapp/python3
root shell: /opt/vulnapp/python3 -c 'import os,pty;os.setuid(0);pty.spawn("/bin/bash")'The CONFIRMED label means the SUID bit and a known GTFOBins technique were
both directly observed (real os.stat mode bits, owner uid 0).
How to exploit
- Use the
exploit_commandfrom the report directly. It is built to work on a modern box: it callssetuid(0)before touching a shell, usesbash -p, or execs directly, so it does not hit thedash/bashprivilege drop that makes many copied one-liners fail. - If no
exploit_commandis present (binary not in the verified-reliable set), look the binary up on GTFOBins under the "SUID" function and adapt, keeping the privilege-drop issue in mind.
Verify
Run id in the resulting shell and confirm uid=0(root).
Rules
- Authorized targets only.
- The operator runs the command; do not auto-execute it.