hypnguyen1209/offensive-claude / skills/privesc-linux
privesc-linux
FlaggedUse when escalating privileges on a Linux host — SUID/SGID & GTFOBins, sudo LPE (CVE-2025-32462/32463), capabilities & LD_PRELOAD, kernel LPE (CVE-2024-1086, Dirty Pipe, GameOver(lay)), service misconfig (PwnKit, Looney Tunables), container/namespace escape
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.7 KB |
| references/container-namespace-escape.md | markdown | 10.7 KB |
| references/enumeration-tooling.md | markdown | 9.7 KB |
| references/kernel-exploits.md | markdown | 11.9 KB |
| references/service-misconfig-lpe.md | markdown | 11.0 KB |
| references/suid-sudo-capabilities.md | markdown | 12.1 KB |
| scripts/cap_suid_hunter.sh | script | 6.0 KB |
| scripts/container_escape_check.sh | script | 7.4 KB |
| scripts/kernel_exploit_suggester.py | script | 11.4 KB |
| scripts/linpriv_enum.py | script | 21.6 KB |
| scripts/sudo_cve_2025_check.sh | script | 5.4 KB |
scripts/kernel_exploit_suggester.py
View on GitHub#!/usr/bin/env python3
"""
kernel_exploit_suggester.py - Map a Linux host's kernel/glibc/distro/protections to applicable
2024-2026 local-privilege-escalation CVEs, ranked by reliability.
Pure Python 3 stdlib. Reads uname, /etc/os-release, glibc version, and the unprivileged-feature
sysctls that gate modern kernel LPEs. Does NOT download or run any exploit - it tells you which
CVEs apply and how to obtain/launch them.
USAGE:
python3 kernel_exploit_suggester.py # ranked table for this host
python3 kernel_exploit_suggester.py --json out.json # machine-readable
python3 kernel_exploit_suggester.py --kernel 6.5.0 --glibc 2.35 # offline what-if
OPSEC: read-only enumeration. Running the suggested exploits is the risky part - kernel LPEs can
crash the host. Match the exact build to the PoC's tested kernels and snapshot VMs first.
"""
import os
import re
import sys
import json
import argparse
import subprocess
def sh(cmd):
try:
return subprocess.run(cmd, capture_output=True, text=True, timeout=8).stdout
except Exception:
return ""
def read(p):
try:
with open(p, "r", errors="replace") as f:
return f.read()
except Exception:
return ""
def parse_ver(s, parts=3):
m = re.match(r"(\d+)\.(\d+)(?:\.(\d+))?", s or "")
if not m:
return None
g = [int(x) if x is not None else 0 for x in m.groups()]
return tuple(g[:parts])
def ge(a, b): # tuple >=
return a is not None and a >= b
def in_range(v, lo, hi):
return v is not None and lo <= v <= hi
# ---------------------------------------------------------------------------
# CVE knowledge base. Each entry: name, cwe, applies(ctx)->(bool, reliability, note), refs.
# reliability: high (public reliable PoC), med (works w/ tuning), low (research/emerging).
def build_kb():
return [
dict(
cve="CVE-2024-1086", name="nf_tables double-free LPE", cwe="CWE-416",
verified=True, kev=True,
check=lambda c: (
in_range(c["kver2"], (5, 14), (6, 6)),
"high" if c["userns"] else "med",
"Needs CAP_NET_ADMIN. unprivileged_userns_clone={} -> {} route. PoC: Notselwyn/CVE-2024-1086".format(
c["userns_raw"], "unshare -rn" if c["userns"] else "requires existing CAP_NET_ADMIN"),
),
ref="https://github.com/Notselwyn/CVE-2024-1086",
),
dict(
cve="CVE-2026-23111", name="nftables catchall UAF LPE (UNVERIFIED CVE)", cwe="CWE-416",
verified=False, kev=False,
check=lambda c: (
ge(c["kver2"], (5, 10)) and not ge(c["kver2"], (7, 0)),
"med",
"Emerging 2026 nftables UAF; confirmed Debian Bookworm/Trixie, Ubuntu 22.04/24.04, RHEL10. Verify build.",
),
ref="Exodus Intelligence nftables catchall UAF write-up",
),
dict(
cve="CVE-2026-23412", name="BPF netfilter link slab-UAF LPE (UNVERIFIED CVE)", cwe="CWE-416",
verified=False, kev=False,
check=lambda c: (
in_range(c["kver2"], (6, 4), (6, 99)),
"low",
"kmalloc-192 slab-UAF in nfnl_hook_dump_one; reproduced on 6.14.0. Fixed 7.0-rc5. Emerging.",
),
ref="Aretiq AI CVE-2026-23412 research",
),
dict(
cve="CVE-2024-0582", name="io_uring page-reuse LPE", cwe="CWE-416",
verified=True, kev=False,
check=lambda c: (
ge(c["kver2"], (6, 0)) and not ge(c["kver2"], (6, 7)) and c["iouring_on"],
"med",
"io_uring_disabled={} (need 0/1). Write-up: 'CVE-2024-0582, or Easy Kernel Exploitation'.".format(
c["iouring_raw"]),
),
ref="https://github.com/xairy/linux-kernel-exploitation",
),
dict(
cve="CVE-2025-21836", name="io_uring memory-sharing LPE", cwe="CWE-416",
verified=True, kev=False,
check=lambda c: (
ge(c["kver2"], (6, 1)) and c["iouring_on"],
"low",
"'Deja Vu in Linux io_uring' - re-breaks memory sharing. io_uring_disabled={}. Verify build.".format(
c["iouring_raw"]),
),
ref="Pumpkin Chang, 'Deja Vu in Linux io_uring' (CVE-2025-21836)",
),
dict(
cve="CVE-2022-0847", name="Dirty Pipe page-cache overwrite", cwe="CWE-787",
verified=True, kev=False,
check=lambda c: (
in_range(c["kver2"], (5, 8), (5, 16)),
"high",
"Overwrite any read-only-openable file; no KASLR/heap work. 5.8-5.16.11. Hits embedded/LTS.",
),
ref="https://dirtypipe.cm4all.com/",
),
dict(
cve="CVE-2023-2640 / CVE-2023-32629", name="GameOver(lay) OverlayFS LPE", cwe="CWE-269",
verified=True, kev=False,
check=lambda c: (
c["ubuntu"] and c["userns"] and in_range(c["kver2"], (5, 4), (6, 5)),
"high" if c["ubuntu"] else "low",
"Ubuntu-specific OverlayFS xattr cap-stamping. Needs userns. unshare -rm one-liner.",
),
ref="Wiz / Ubuntu USN GameOver(lay)",
),
dict(
cve="CVE-2023-4911", name="Looney Tunables (glibc ld.so)", cwe="CWE-787",
verified=True, kev=True,
check=lambda c: (
c["glibc"] is not None and c["glibc"] <= (2, 37),
"high" if (c["glibc"] and c["glibc"] <= (2, 37)) else "low",
"glibc {} - vuln if <=2.37 (Fedora37/38, Ubuntu22.04/23.04, Debian12/13). Not musl. PoC: blasty gnu-acme.py".format(
"%d.%d" % c["glibc"] if c["glibc"] else "unknown"),
),
ref="https://blog.qualys.com/.../cve-2023-4911-looney-tunables",
),
dict(
cve="CVE-2025-6019 (+6018)", name="udisks/libblockdev loop-mount LPE", cwe="CWE-250",
verified=True, kev=True,
check=lambda c: (
c["udisks"],
"high" if c["udisks"] else "low",
"udisks2 present. SUID loop-mount via Filesystem.Resize/Check. Needs allow_active (or chain 6018 on SUSE).",
),
ref="https://blog.qualys.com/.../qualys-tru-uncovers-chained-lpe-suse-15-pam-...",
),
dict(
cve="CVE-2021-4034", name="PwnKit (pkexec)", cwe="CWE-787",
verified=True, kev=False,
check=lambda c: (
c["pkexec"],
"high" if c["pkexec"] else "low",
"pkexec present. polkit 0.113-0.118 vulnerable (legacy/long-LTS). PoC: ly4k/PwnKit one-shot.",
),
ref="https://kudelskisecurity.com/research/pwnkit-...",
),
dict(
cve="CVE-2024-21626", name="runc Leaky Vessels container escape", cwe="CWE-668",
verified=True, kev=False,
check=lambda c: (
c["container"] and (c["runc"] is None or c["runc"] <= (1, 1, 11)),
"high" if c["container"] else "low",
"Inside a container; runc<=1.1.11 -> set cwd /proc/self/fd/8. See container-namespace-escape.md.",
),
ref="https://labs.snyk.io/resources/leaky-vessels-...",
),
]
def gather(args):
kver = args.kernel or sh("uname -r").strip() or read("/proc/sys/kernel/osrelease").strip()
osr = read("/etc/os-release")
glibc_raw = args.glibc or sh("ldd --version 2>&1").strip().splitlines()[:1]
glibc_str = args.glibc if args.glibc else (glibc_raw[0] if glibc_raw else "")
gm = re.search(r"(\d+)\.(\d+)", glibc_str)
glibc = (int(gm.group(1)), int(gm.group(2))) if gm else None
userns_raw = read("/proc/sys/kernel/unprivileged_userns_clone").strip()
iouring_raw = read("/proc/sys/kernel/io_uring_disabled").strip()
cg = read("/proc/1/cgroup")
runc_raw = sh("runc --version")
rm = re.search(r"runc version (\d+)\.(\d+)\.(\d+)", runc_raw)
runc = tuple(map(int, rm.groups())) if rm else None
ctx = {
"kernel": kver,
"kver2": parse_ver(kver, 2),
"kver3": parse_ver(kver, 3),
"glibc": glibc,
"ubuntu": "ubuntu" in osr.lower() or "Ubuntu" in sh("uname -v"),
"userns_raw": userns_raw or "n/a",
"userns": userns_raw == "1" or os.geteuid() == 0 if hasattr(os, "geteuid") else userns_raw == "1",
"iouring_raw": iouring_raw or "n/a",
"iouring_on": iouring_raw in ("0", "1"),
"udisks": bool(sh("command -v udisksctl")) or os.path.exists("/usr/libexec/udisks2/udisksd"),
"pkexec": bool(sh("command -v pkexec")) or os.path.exists("/usr/bin/pkexec"),
"container": bool(re.search(r"docker|kubepods|lxc|containerd|libpod", cg)) or os.path.exists("/.dockerenv"),
"runc": runc,
}
return ctx
RANK = {"high": 0, "med": 1, "low": 2}
COLOR = {"high": "\033[91m", "med": "\033[93m", "low": "\033[96m", "rst": "\033[0m"}
def main():
ap = argparse.ArgumentParser(description="Map host to modern Linux LPE CVEs")
ap.add_argument("--kernel", help="override kernel version (e.g. 6.5.0)")
ap.add_argument("--glibc", help="override glibc version (e.g. 2.35)")
ap.add_argument("--json", help="write JSON to PATH")
args = ap.parse_args()
nocolor = not sys.stdout.isatty()
ctx = gather(args)
print("kernel_exploit_suggester.py")
print(" kernel : %s" % ctx["kernel"])
print(" glibc : %s" % ("%d.%d" % ctx["glibc"] if ctx["glibc"] else "unknown"))
print(" distro : %s" % ("ubuntu-like" if ctx["ubuntu"] else "other"))
print(" userns_clone=%s io_uring_disabled=%s udisks=%s pkexec=%s container=%s runc=%s" % (
ctx["userns_raw"], ctx["iouring_raw"], ctx["udisks"], ctx["pkexec"], ctx["container"],
(".".join(map(str, ctx["runc"])) if ctx["runc"] else "n/a")))
hits = []
for e in build_kb():
try:
applies, reliability, note = e["check"](ctx)
except Exception:
applies, reliability, note = (False, "low", "evaluation error")
if applies:
hits.append((reliability, e, note))
hits.sort(key=lambda x: RANK.get(x[0], 9))
print("\n=== Applicable LPE candidates (ranked) ===")
if not hits:
print(" none matched - host may be patched/hardened; fall back to misconfig LPE (sudo/SUID/caps).")
out = []
for reliability, e, note in hits:
c = "" if nocolor else COLOR.get(reliability, "")
r = "" if nocolor else COLOR["rst"]
flags = []
if e.get("kev"):
flags.append("KEV")
if e.get("verified"):
flags.append("verified")
print("%s[%s]%s %-22s %s (%s)" % (c, reliability.upper(), r, e["cve"], e["name"],
",".join(flags)))
print(" cwe=%s %s" % (e["cwe"], note))
print(" ref: %s" % e["ref"])
out.append({"cve": e["cve"], "name": e["name"], "cwe": e["cwe"],
"reliability": reliability, "note": note, "ref": e["ref"],
"kev": e.get("kev", False)})
if args.json:
with open(args.json, "w") as f:
json.dump({"context": {k: (list(v) if isinstance(v, tuple) else v) for k, v in ctx.items()},
"candidates": out}, f, indent=2)
print("\n[+] JSON written to %s" % args.json)
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |