When you audit a Linux jump host against GTFOBins, which sudo and set-user-ID inventories do you compare, and how do you read a match?
answer
- two inventories, one catalogue
- filter by the matching context
- match is a prompt, not a verdict
- same name, same program?
basics
~20 sCompare each account's sudo grants, the set-user-ID files and any file capabilities with GTFOBins entries under the matching context. A match shows which functions the grant hands over; it prompts a decision and is not itself a finding.
solid answer
~40 sBuild the two lists first: what each account may run through `sudo -l`, and the files that carry the set-user-ID bit, plus `getcap` output for file capabilities. Look each program up in GTFOBins and read only the functions under the matching context: Sudo for grants, SUID for the bit, Capabilities for file capabilities. Check the program at that path really is the catalogued one, since a name is not an identity. A match says which function the grant hands over; compare it with why the grant exists. Unneeded ones are removed, needed ones are narrowed or accepted as a documented exception with an owner. Run it read-only, on hosts you are authorised to audit, and repeat after package or configuration changes.
code
bash · 10 lines# Read-only inventories for a host you are authorised to audit
# 1. Sudo grants for one account (run as root); repeat per account
sudo -l -U alice
# 2. Files with the set-user-ID bit, skipping pseudo-filesystems
find / \( -path /proc -o -path /sys \) -prune -o -type f -perm -4000 -ls 2>/dev/null
# 3. Files that carry file capabilities
getcap -r / 2>/dev/nullgo deeper
Know that the audit compares sudo grants and set-user-ID files with the catalogue, and that a match is a prompt to review, not a verdict.
Run the inventories, read only the functions under the matching context, confirm the program at the path is the catalogued one, and compare with the grant's purpose.
Prioritise by function and owner, keep a baseline, report exceptions with expiry, and state which catalogue date the audit used.
Make the comparison a recurring control with owners and exception handling instead of a one-off report.
## What you are comparing The audit joins two things that live on different sides: **your host's privilege grants** and **GTFOBins' entries**. The grants are lists you can produce with read-only commands on a host you are authorised to audit; the catalogue is the reference you look them up in. | Your inventory | GTFOBins context to read | What a match means | |---|---|---| | Sudo grants per account (`sudo -l -U <account>`, plus the sudoers files and includes) | Sudo | The named program, run through the grant, can perform the listed functions as the privileged user. | | Files with the set-user-ID bit | SUID | The program can perform the listed functions with the file owner's privileges. | | Files with file capabilities (`getcap -r /`) | Capabilities | The program can perform the listed functions with the capabilities named in the entry. | The Unprivileged context is not part of this comparison, because no grant is involved. ## Procedure 1. **Collect.** Gather the three inventories into one table: account or file, program path, and how it is granted. Include grants in sudoers include files and group-based rules, not only per-user lines. 2. **Normalise.** Resolve symlinks and alternatives, and note programs that are aliases of another catalogued name. Two paths may be one program; one name may be two programs. 3. **Confirm identity.** A same-named file in an unusual directory, or a local script that shares a name with a catalogued program, is not the catalogued program. Check the path and the package that owns it. 4. **Look up** each program and read the functions listed under the context that matches how it is granted. 5. **State the risk** in the catalogue's words: function under context. For example, "File read under Sudo for the backup account". 6. **Compare with intent** by asking the grant's owner what it is for. A documented function that the purpose does not need is a finding; one the purpose does need is an exception that records an owner and a review date. 7. **Act and re-run.** Remove, narrow or constrain, then repeat the inventory to confirm the match is gone. ## Reading the result - **No match** is not clearance. It means no catalogued name appeared in this inventory; the blind spots are a separate topic. - **A match with a narrow function** (for example File read of a log) still matters if the privileged account can read secrets that the grant's owner did not intend to expose. - **A match with Shell or Command** under Sudo or SUID is the strongest signal because the grant then covers whatever the privileged account can do, which is more than the stated purpose. - **Many matches on one account** usually point to a grant that is too broad rather than to many separate problems. - **Matches on package-managed SUID files** such as long-standing system utilities are expected; the review decides whether the bit is needed on this host's role. ## Rules of engagement Run the commands read-only. Do the audit on hosts you own or hold written authority to review, and keep the inventory itself protected: a list of privileged grants with their weaknesses is sensitive. Do not test the functions on production to prove a match; reading the entry and the grant is enough for the finding, and any confirmation belongs on a lab copy with the system owner's agreement. ## False positives and noise A match is a prompt for a decision. A jump host will legitimately carry SUID utilities and sudo rules for administrators, and flagging all of them without context produces a report nobody acts on. Group results by owner, rank by function (Shell and Command before File read), and report exceptions separately from findings. ## A worked reading, without any command Suppose the inventory shows three rows on the jump host. A deploy account may run one general-purpose program through `sudo`, and the entry lists it under Shell and File write for the Sudo context. A long-standing system utility carries the set-user-ID bit, and its entry lists File read under SUID. A monitoring agent holds one file capability, and no entry names it under Capabilities. The report reads: row one is a finding, because a deploy task rarely needs a shell as the privileged user, so the grant should be replaced with a command that performs the deployment step only. Row two is an expected package-managed bit; the review asks whether this host's role needs it and records the answer. Row three is not cleared by the lack of a match; its capability list is judged on its own terms. Each row carries an owner and a decision, in the catalogue's vocabulary of function under context. ## Keeping it current Package updates can add or restore the set-user-ID bit, and configuration management can add sudo rules. Store the baseline and diff against it on a schedule, rather than reading the full list each time, and record the catalogue's date or commit with the report so a reader knows which version of the reference you used.
- A sudo rule for an account lists ALL rather than named programs. What does that do to a catalogue-based audit?It makes the per-program lookup beside the point: with ALL the grant covers every executable, so the finding is the breadth of the rule, not any one catalogued name. Report it as an over-broad grant to replace with a named list; sudoers semantics are a separate topic.
- How often should the comparison be repeated, and how do you keep it cheap?Rerun it after package updates, role changes and configuration-management runs, and on a fixed schedule. Keep the previous inventory and diff against it, so reviewers read only new grants and new set-user-ID files, and record the catalogue date or commit with each run.
- Where does the Unprivileged context fit in this audit?It does not, for grants: no privilege is conferred. It becomes relevant when you review a confined account or image, such as a restricted shell or a minimal container, to see whether an allowed program can do more than the confinement intended.
- Compares only package names with the catalogue
- Treats every match as an automatic failed audit
- Reads clean output as proof the host is safe
- Skips file capabilities because few entries use them
- Tests the listed functions on production to prove a match