agentleFS
sentineldesksentineldesk/agent/skills/privilege-escalation-audit/SKILL.md

privilege-escalation-audit

Skill0 starsChanged 3 months agoApache-2.0View on GitHub

Audit this Linux host for local privilege-escalation exposure — SUID/SGID binaries, sudo rules, writable service files and cron, PATH and capability issues, world-writable sensitive paths, known-vulnerable versions — defensively, to find and fix the paths before someone else uses them. For the machine you are on or hosts you were asked to assess. Read-only discovery; every remediation is stated before it runs.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run as a job if it drags. Compare against a known-good baseline — a SUID binary that should not be one (a shell, an interpreter, a text …

    line 26

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

What this is for

This is the defender's version of the attacker's first hour on a box: enumerate every way a local user could become root, so they can be closed. It is discovery, and discovery is read-only — nothing here escalates anything. When it finds a path, the fix is stated and confirmed before it runs, because tightening sudo or a permission is exactly where you lock the legitimate user out too.

Scope is the machine you are on or hosts a person named (ssh_exec). The trail is what makes this an audit: every find is on the action log, which is what distinguishes enumerating your own host from probing someone else's.

The enumeration — all read-only

  • SUID / SGID: run_command "find / -perm -4000 -o -perm -2000 -type f 2>/dev/null". Run as a job if it drags. Compare against a known-good baseline — a SUID binary that should not be one (a shell, an interpreter, a text editor) is the finding.
  • sudo rules: run_command "sudo -l" for the current user; read_file /etc/sudoers and list_directory /etc/sudoers.d. NOPASSWD on anything that can spawn a shell or write a file, and any wildcard, is a path.
  • Capabilities: run_command "getcap -r / 2>/dev/null". cap_setuid, cap_dac_override and friends on an unexpected binary are SUID by another name.
  • Writable units and timers: service files, cron, and systemd timers a non-root user can edit run as whoever the unit runs as. run_command "find /etc/systemd /etc/cron* -writable -type f 2>/dev/null".
  • PATH and wrappers: a writable directory early on root's PATH, or a writable script a root job calls, is game over. Check the crontabs and the service ExecStarts for scripts, then the permissions on those scripts.
  • World-writable in sensitive trees, unowned files, weak ~/.ssh perms, and /etc/passwd//etc/shadow writability.
  • Versions with known local exploits: run_command "uname -a", the libc and sudo versions. A version number is a finding to report, not a thing to exploit — name it and let a person decide.

Remediating — the same lock-out warning as any hardening

Each finding gets: what it is, how it would be used, the fix, and what the fix might break. Removing a SUID bit, tightening a sudo rule, or fixing a service file permission can stop something legitimate that quietly depended on it — say so, and use ask_human when the trade-off is the person's to make. Re-run the matching enumeration after each fix and show it is closed.

The line this skill does not cross

Enumerate and report; do not run an exploit to "prove" a path, on this or any host. A version number, a writable file, a loose sudo rule — those are the evidence, and they are enough. Actually escalating leaves a different kind of trace and answers a question nobody asked. If a person wants a proof-of-concept, that is their explicit call to make, on a host they own, said out loud — not an assumption this skill makes for them.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.