Use when operating from an authorized Linux shell after initial access to build a host privilege graph, validate sudo/SUID/capability/systemd/container escalation edges, locate credentials with provenance, assess persistence and lateral paths, measure audit or EDR visibility, and prove cleanup.
Use this skill to turn a Linux foothold into an evidence-backed host model. Enumerate with a question, validate one privilege edge at a time, preserve credential provenance, and pair every state change with rollback evidence.
When to use
Use this skill after obtaining an approved Linux shell when the task involves:
persistence assessment, artifact inventory, audit/EDR visibility, and verified cleanup.
Do not use it for initial-access delivery. Route a kernel vulnerability to linux-kernel-exploitation, an eBPF-specific path to ebpf-offensive, and a container-runtime root cause to the dedicated container owner when present.
Completion standard
A completed case records initial and final identity, builds a privilege graph with evidenced edges, classifies secrets without uncontrolled disclosure, validates only selected paths with negative controls, records telemetry, and proves rollback. A command dump with no boundary model or provenance is not completion.
Core workflow
1. Start an action and artifact ledger
Before broad enumeration, record:
engagement/case ID and approved host identity;
UTC time plus local timezone and measured clock offset;
access method, current shell, parent process, TTY, and network source;
current UID/GID/groups, capabilities, namespace IDs, SELinux/AppArmor context, and container evidence;
allowed identities, networks, credential classes, persistence tests, and cleanup requirements;
commands or APIs that are prohibited because they disrupt service, retrieve cloud tokens, or modify controls.
Store the authoritative ledger off-host when possible. If a local working directory is required, use restrictive permissions, list it in the cleanup manifest immediately, and never write secret values to it.
Each action record should contain:
UTC | operator | current identity | command/API | purpose | expected signal
exit/status | files/processes/network touched | evidence location | rollback status
Hash collected artifacts on acquisition. Record owner, mode, ACL, inode, mount, timestamps, and collection method without changing content merely to inspect it.
2. Establish identity and host truth
Use quiet local sources first:
id -a
umask
printf 'shell=%s tty=%s\n' "$SHELL" "$(tty 2>/dev/null)"
uname -a
cat /etc/os-release
cat /proc/self/status
readlink /proc/self/ns/*
findmnt -rn -o TARGET,SOURCE,FSTYPE,OPTIONS
cat /proc/1/cgroup
systemd-detect-virt --vm --container 2>/dev/null
When available, capture capsh --print, lsns -p $$, getenforce, aa-status, sestatus, systemctl --version, package-manager identity, secure-boot/lockdown state, and kernel command line. Preserve permission failures; they describe the current boundary.
Do not infer the host from the prompt or hostname. Correlate machine ID, boot ID, primary addresses, default routes, cloud/provider evidence, and approved asset inventory. Treat cloned machine IDs and container hostnames as non-unique.
State the current boundary in one sentence:
identity and namespace -> candidate broker/resource -> stronger identity or broader host/network scope
3. Build a privilege graph, not a checklist
Represent nodes as identities, services, namespaces, files, sockets, devices, credentials, and remote principals. An edge records:
source identity and required groups/capabilities;
exact executable, config, file, socket, API, or scheduler;
interpreter and environment behavior;
target identity and namespace;
preconditions and race/lifetime assumptions;
evidence, negative control, side effects, and rollback.
Inventory candidate edge families:
Family
Evidence sources
Questions
sudo
sudo -n -l, sudoers includes, command metadata
Exact argv, env policy, digest, runas, working directory, wildcard behavior
SUID/SGID
local-filesystem metadata, package verification
Effective IDs, secure-exec behavior, config/plugin/file control
file capabilities
getcap, xattrs, package database
Permitted/effective/inheritable caps, user namespace, bounding set
Rootless/rootful daemon, host path, capability and userns boundary
Collect only metadata needed to rank candidates. Restrict recursive searches to intended local mounts; skip procfs, sysfs, devfs, network filesystems, snapshots, and large application trees unless the hypothesis requires them.
Do not execute a candidate during inventory. First read its exact unit/config, resolve symlinks with namei -l, inspect ACLs with getfacl, verify package ownership and hashes, and trace how stronger code reaches attacker-controlled state.
4. Rank and validate one edge at a time
Score each edge on:
stronger identity or boundary reached;
control over executable, arguments, environment, config, input, or IPC method;
trigger availability and whether it is automatic;
reliability and concurrency;
service impact and rollback quality;
audit, process, file, and network visibility;
dependence on an unverified version-specific bug.
For the selected edge, capture a clean baseline. Create a benign marker whose content, path, owner, and lifetime are explicit. Use a negative control that preserves the expected security check, then the minimal positive test. Verify stronger identity using id, /proc/self/status, namespace links, and a harmless operation the original identity cannot perform.
Do not use interactive sudo merely to test policy; sudo -n prevents an unexpected password prompt or timestamp refresh. Record whether a sudo timestamp already existed and whether the test changed it.
If an edge needs a public vulnerability, pin package/build/config and reproduce the root cause in a disposable analog before target validation. Route kernel memory-safety work to linux-kernel-exploitation and generic exploit construction to exploit-dev.
5. Handle capabilities and namespaces correctly
Linux capabilities are per-thread and split into permitted, effective, inheritable, ambient, and bounding sets. File capabilities interact with UID transitions, no_new_privs, securebits, user namespaces, and mount options. Capture all sets before and after an edge.
For namespace context, compare the current process with PID 1 and the approved host boundary:
for n in cgroup ipc mnt net pid time user uts; do
printf '%-8s self=%s init=%s\n' "$n" \
"$(readlink /proc/self/ns/$n 2>/dev/null)" \
"$(readlink /proc/1/ns/$n 2>/dev/null)"
done
cat /proc/self/uid_map 2>/dev/null
cat /proc/self/gid_map 2>/dev/null
UID 0 in a user namespace does not prove host root. A container runtime socket may represent host-level control, rootless-user control, or a remote daemon; identify the peer process, socket owner/ACL, daemon mode, API endpoint, and mounted host resources before assigning impact.
Map seccomp, AppArmor/SELinux, Landlock when observable, cgroups, mount propagation, read-only mounts, device policy, and no_new_privs. A stronger UID may still remain inside the same constrained boundary.
6. Discover secrets by provenance and scope
Start with likely locators, metadata, and process ownership; do not dump every readable file. Classify each candidate:
Class
Provenance and scope to record
SSH key/certificate
Principal, CA, constraints, agent/file source, known destinations, expiry
Potential sources include shell history, environment, process arguments, /proc, service configs, deployment manifests, backups, cloud CLI stores, kubeconfigs, credential helpers, keyrings, and application databases. Access to /proc/PID/environ, memory, agent sockets, or keyrings is itself a security-relevant action; log it and minimize reads.
For each secret, prefer fingerprint, hash, metadata query, or low-impact identity call over printing the value. Keep raw values only in the approved secret store. Never copy them into terminal transcripts, chat, screenshots, case markdown, or command history.
Cloud metadata endpoints are not generic enumeration targets. First establish provider and instance context, then record the exact endpoint, token flow, role, and audit effect. Do not probe every provider address or retrieve role credentials merely to see whether they exist.
7. Validate a credential without expanding scope
Before use, record the approved destination, protocol, principal, expected role, expiry, and one low-impact identity operation. Use host-key validation and a dedicated known-hosts record for SSH. Do not disable TLS or SSH verification to make a credential work.
A valid authentication is not proof of useful authorization. Capture the remote identity and the smallest authorization query, then update the privilege graph. Do not enumerate unrelated projects, shares, clusters, databases, or hosts.
For agents, test a signature or key listing without exporting private material. For Kerberos, preserve cache provenance and ticket flags. For cloud and Kubernetes tokens, avoid refresh unless explicitly needed; refreshing changes lifetime and often creates a new audit event.
Candidate channels include SSH certificates/agents, Kerberos keytabs/caches, NFS, database credentials, orchestration APIs, configuration management, CI runners, cloud roles, and existing tunnels. Identify routing and DNS from current state before adding a tunnel or route.
If a tunnel is required, define bind address, destination allowlist, protocol, lifetime, keepalive, authentication, process owner, logs, and teardown. Bind to loopback unless exposure is intentional. Confirm the listener and route are gone at cleanup.
9. Assess persistence with paired rollback
Persistence testing is a configuration transaction, not a list of startup tricks. For each approved mechanism capture:
authoritative owner and parser;
trigger and resulting identity;
original bytes, metadata, labels, ACLs, links, enablement, and package ownership;
atomic application method and service impact;
expected audit/process/file evidence;
exact rollback and post-rollback verification.
Relevant families include system and user systemd units/timers, cron/anacron, shell/profile hooks, SSH authorized_keys or certificates, PAM, loader configuration, package hooks, containers, desktop autostart, and service-specific plugins.
Prefer a benign marker and one trigger. Do not install multiple mechanisms to prove the same boundary. Do not change authentication, logging, EDR, firewall, or update controls as a side effect.
For systemd, retain unit plus drop-ins, FragmentPath, DropInPaths, enablement symlinks, effective properties, service user, sandbox settings, and reload/start events. Removing a unit file without disabling links, reloading the manager, and stopping owned processes is incomplete cleanup.
10. Measure visibility while operating
Inventory active telemetry without disabling it:
auditd rules/status and relevant audit records;
journald persistence, forwarding, namespaces, and rate limits;
auth, sudo, SSH, cron, systemd, package, and kernel logs;
process accounting and shell/session recording;
eBPF/Falco/Tetragon-style sensors and their loaded programs;
EDR agent processes, services, kernel modules, sockets, and health state;
network DNS/proxy/firewall/flow visibility.
Establish a clean baseline and one known positive control when the test plan includes detection validation. Missing local logs do not prove missing remote ingestion. Record sensor health, clock alignment, event delay, field schema, and collection boundaries.
Correlate each validated edge with process ancestry, effective IDs/capabilities, file changes, service events, network connections, and remote authentication. Route deep detection work to threat-hunting; route BPF sensor mechanics to ebpf-offensive.
11. Clean up and prove final state
Maintain the cleanup manifest from the first write or process creation. It includes files, directories, links, xattrs, ACLs, labels, units, timers, cron entries, keys, credentials, agents, processes, sockets, routes, tunnels, namespaces, containers, mounts, package state, and temporary logs.
Rollback in dependency order:
stop tasking, tunnels, listeners, and recurring triggers;
terminate owned children and verify no orphan remains;
disable and remove persistence, then reload the owning manager;
restore original bytes and metadata atomically where possible;
remove test credentials/keys and revoke remote artifacts when created;
remove local work files after evidence transfer and hash verification;
repeat targeted enumeration and compare against baseline;
record residual state that cannot safely be reversed.
Do not falsify timestamps or delete platform audit records. Cleanup means removal of operator-created state and restoration of modified configuration, not destruction of evidence.
Key structures & interfaces
/proc/PID/status, attr, ns, cgroup, fd, maps, cmdline, and environ: identity, confinement, process, and secret provenance.
UID/GID plus capability sets, securebits, no_new_privs, and user-namespace ID maps: actual privilege state.
Automated enumeration scripts are collectors, not conclusions. Pin their version, inspect what they execute, constrain output, and map every finding back to a manually evidenced edge.
Never put raw secret values in these files. Reference the approved secret-store record instead.
Pitfalls & OPSEC
Do not run noisy recursive searches across network mounts, procfs, sysfs, backups, or application data without a specific hypothesis.
Do not execute SUID, sudo, service, cron, polkit, or socket candidates during inventory.
Do not assume UID 0 means host root; prove namespaces, capabilities, mounts, cgroups, LSM, and daemon boundary.
Do not print secrets to stdout or copy them into shell history, transcripts, process arguments, or markdown.
Do not disable host-key or TLS verification to validate a credential.
Do not probe every cloud metadata service; establish provider context and retrieval impact first.
Do not refresh short-lived credentials unless the operation requires it and the new lifetime is tracked.
Do not use fixed sleeps for service, scheduler, or race validation; await the exact event with a bounded timeout.
Do not let an enumeration script silently install packages, change limits, mount filesystems, or upload findings.
Record command history behavior, TTY/session recording, auditd, journald forwarding, eBPF sensors, and remote ingestion.
Do not erase audit records or falsify timestamps during cleanup.
If rollback cannot restore a security-sensitive file, service, namespace, route, or credential, stop changing state and record the residual precisely.
Routing
Route a Linux kernel bug, allocator primitive, page-table UAF, credential overwrite, or kernel ROP chain to batch-B sibling linux-kernel-exploitation.
Route verifier/JIT bugs, BPF hooks, maps, links, or BPF sensor mechanics to batch-B sibling ebpf-offensive.
Route custom beacon runtime, task protocol, module ABI, transport failover, or update behavior to batch-B sibling c2-implant-engineering.
Route BOF/COFF module development to batch-A sibling bof-coff-development.
Route Windows RPC, COM/DCOM, NDR, or ALPC service boundaries to batch-A sibling windows-rpc-com-attack.
Route Windows telemetry-provider and ETW/WPP/TraceLogging work to batch-A sibling windows-telemetry-etw.
Route Hyper-V guest/root partitions, VMBus, hypercalls, or HCS/worker boundaries to batch-A sibling hyper-v-offensive.
Route cloud/Kubernetes authorization to cloud-k8s, Windows-domain pivots to offensive-active-directory, generic exploit construction to exploit-dev, and detection correlation to threat-hunting.
Route a container runtime implementation flaw to container-runtime-exploitation when that catalog target is available; until then keep the boundary evidence with exploit-dev and cloud-k8s rather than improvising host impact.
Final gate
Initial identity, host, clock, controls, namespaces, mounts, and access path are recorded.
Privilege graph identifies source, mechanism, stronger target, evidence, and rollback for each tested edge.
Selected escalation has a negative control and proves the resulting identity and boundary.
Secret records contain provenance, scope, expiry, and disposition but no raw values.
Lateral and persistence tests remain within named destinations and use paired rollback.
Telemetry evidence distinguishes local visibility, sensor health, and remote ingestion.
Final targeted enumeration and cleanup manifest prove operator-created state is gone.
1---2name: linux-host-post-exploitation3description: Use when operating from an authorized Linux shell after initial access to build a host privilege graph, validate sudo/SUID/capability/systemd/container escalation edges, locate credentials with provenance, assess persistence and lateral paths, measure audit or EDR visibility, and prove cleanup.4license: MIT5---6# Linux host post-exploitation78Use this skill to turn a Linux foothold into an evidence-backed host model. Enumerate with a question, validate one privilege edge at a time, preserve credential provenance, and pair every state change with rollback evidence.910## When to use1112Use this skill after obtaining an approved Linux shell when the task involves:1314- host identity, users, groups, namespaces, mounts, services, routes, packages, or security controls;15- sudoers, SUID/SGID, file capabilities, systemd, cron, polkit, PAM/NSS, loader paths, or privileged sockets;16- secret discovery in process state, service configuration, SSH/GPG agents, cloud CLIs, Kubernetes files, CI runners, databases, or backups;17- local privilege escalation validation, including container and user-namespace boundary checks;18- SSH, Kerberos, NFS, database, orchestration, cloud-token, tunnel, or route-based lateral pivots;19- persistence assessment, artifact inventory, audit/EDR visibility, and verified cleanup.2021Do not use it for initial-access delivery. Route a kernel vulnerability to `linux-kernel-exploitation`, an eBPF-specific path to `ebpf-offensive`, and a container-runtime root cause to the dedicated container owner when present.2223## Completion standard2425A completed case records initial and final identity, builds a privilege graph with evidenced edges, classifies secrets without uncontrolled disclosure, validates only selected paths with negative controls, records telemetry, and proves rollback. A command dump with no boundary model or provenance is not completion.2627## Core workflow2829### 1. Start an action and artifact ledger3031Before broad enumeration, record:3233- engagement/case ID and approved host identity;34- UTC time plus local timezone and measured clock offset;35- access method, current shell, parent process, TTY, and network source;36- current UID/GID/groups, capabilities, namespace IDs, SELinux/AppArmor context, and container evidence;37- allowed identities, networks, credential classes, persistence tests, and cleanup requirements;38- commands or APIs that are prohibited because they disrupt service, retrieve cloud tokens, or modify controls.3940Store the authoritative ledger off-host when possible. If a local working directory is required, use restrictive permissions, list it in the cleanup manifest immediately, and never write secret values to it.4142Each action record should contain:4344```text45UTC | operator | current identity | command/API | purpose | expected signal46exit/status | files/processes/network touched | evidence location | rollback status47```4849Hash collected artifacts on acquisition. Record owner, mode, ACL, inode, mount, timestamps, and collection method without changing content merely to inspect it.5051### 2. Establish identity and host truth5253Use quiet local sources first:5455```bash56id -a57umask58printf 'shell=%s tty=%s\n' "$SHELL" "$(tty 2>/dev/null)"59uname -a60cat /etc/os-release61cat /proc/self/status62readlink /proc/self/ns/*63findmnt -rn -o TARGET,SOURCE,FSTYPE,OPTIONS64cat /proc/1/cgroup65systemd-detect-virt --vm --container 2>/dev/null66```6768When available, capture `capsh --print`, `lsns -p $$`, `getenforce`, `aa-status`, `sestatus`, `systemctl --version`, package-manager identity, secure-boot/lockdown state, and kernel command line. Preserve permission failures; they describe the current boundary.6970Do not infer the host from the prompt or hostname. Correlate machine ID, boot ID, primary addresses, default routes, cloud/provider evidence, and approved asset inventory. Treat cloned machine IDs and container hostnames as non-unique.7172State the current boundary in one sentence:7374```text75identity and namespace -> candidate broker/resource -> stronger identity or broader host/network scope76```7778### 3. Build a privilege graph, not a checklist7980Represent nodes as identities, services, namespaces, files, sockets, devices, credentials, and remote principals. An edge records:8182- source identity and required groups/capabilities;83- exact executable, config, file, socket, API, or scheduler;84- interpreter and environment behavior;85- target identity and namespace;86- preconditions and race/lifetime assumptions;87- evidence, negative control, side effects, and rollback.8889Inventory candidate edge families:9091| Family | Evidence sources | Questions |92| --- | --- | --- |93| sudo | `sudo -n -l`, sudoers includes, command metadata | Exact argv, env policy, digest, runas, working directory, wildcard behavior |94| SUID/SGID | local-filesystem metadata, package verification | Effective IDs, secure-exec behavior, config/plugin/file control |95| file capabilities | `getcap`, xattrs, package database | Permitted/effective/inheritable caps, user namespace, bounding set |96| systemd | unit/drop-in definitions, enablement, timers, D-Bus policy | Writable path, expansion, service user, sandbox, reload/start authority |97| cron/anacron | crontabs, directories, spool metadata | Parser, PATH, owner, schedule, writable executable/config |98| polkit | actions, rules, D-Bus service | Subject attributes, active session, action defaults, helper boundary |99| PAM/NSS | service stacks, module/library paths | Triggering service, load ownership, identity database behavior |100| loader/package | `ld.so` config, rpath/runpath, package hooks | Secure-exec, writable search path, trusted signer/package authority |101| sockets/devices | UNIX socket ACL, peer credentials, ioctl/API schema | Server identity, authentication, method-level authorization, host reach |102| containers | runtime socket, namespaces, mounts, devices, cgroups | Rootless/rootful daemon, host path, capability and userns boundary |103104Collect only metadata needed to rank candidates. Restrict recursive searches to intended local mounts; skip procfs, sysfs, devfs, network filesystems, snapshots, and large application trees unless the hypothesis requires them.105106Useful candidate commands include:107108```bash109sudo -n -l110find /usr /bin /sbin /opt -xdev -type f -perm /6000 -printf '%m %u %g %p\n' 2>/dev/null111getcap -r /usr /bin /sbin /opt 2>/dev/null112systemctl list-unit-files --state=enabled --no-pager113systemctl list-timers --all --no-pager114ss -lxnp 2>/dev/null115```116117Do not execute a candidate during inventory. First read its exact unit/config, resolve symlinks with `namei -l`, inspect ACLs with `getfacl`, verify package ownership and hashes, and trace how stronger code reaches attacker-controlled state.118119### 4. Rank and validate one edge at a time120121Score each edge on:122123- stronger identity or boundary reached;124- control over executable, arguments, environment, config, input, or IPC method;125- trigger availability and whether it is automatic;126- reliability and concurrency;127- service impact and rollback quality;128- audit, process, file, and network visibility;129- dependence on an unverified version-specific bug.130131For the selected edge, capture a clean baseline. Create a benign marker whose content, path, owner, and lifetime are explicit. Use a negative control that preserves the expected security check, then the minimal positive test. Verify stronger identity using `id`, `/proc/self/status`, namespace links, and a harmless operation the original identity cannot perform.132133Do not use interactive `sudo` merely to test policy; `sudo -n` prevents an unexpected password prompt or timestamp refresh. Record whether a sudo timestamp already existed and whether the test changed it.134135If an edge needs a public vulnerability, pin package/build/config and reproduce the root cause in a disposable analog before target validation. Route kernel memory-safety work to `linux-kernel-exploitation` and generic exploit construction to `exploit-dev`.136137### 5. Handle capabilities and namespaces correctly138139Linux capabilities are per-thread and split into permitted, effective, inheritable, ambient, and bounding sets. File capabilities interact with UID transitions, `no_new_privs`, securebits, user namespaces, and mount options. Capture all sets before and after an edge.140141For namespace context, compare the current process with PID 1 and the approved host boundary:142143```bash144for n in cgroup ipc mnt net pid time user uts; do145 printf '%-8s self=%s init=%s\n' "$n" \146 "$(readlink /proc/self/ns/$n 2>/dev/null)" \147 "$(readlink /proc/1/ns/$n 2>/dev/null)"148done149cat /proc/self/uid_map 2>/dev/null150cat /proc/self/gid_map 2>/dev/null151```152153UID 0 in a user namespace does not prove host root. A container runtime socket may represent host-level control, rootless-user control, or a remote daemon; identify the peer process, socket owner/ACL, daemon mode, API endpoint, and mounted host resources before assigning impact.154155Map seccomp, AppArmor/SELinux, Landlock when observable, cgroups, mount propagation, read-only mounts, device policy, and `no_new_privs`. A stronger UID may still remain inside the same constrained boundary.156157### 6. Discover secrets by provenance and scope158159Start with likely locators, metadata, and process ownership; do not dump every readable file. Classify each candidate:160161| Class | Provenance and scope to record |162| --- | --- |163| SSH key/certificate | Principal, CA, constraints, agent/file source, known destinations, expiry |164| SSH/GPG agent | Socket owner, process, namespace, loaded key fingerprints, confirmation policy |165| Kerberos | Principal, realm, cache/keytab path, enctype, validity, forwardable/delegation flags |166| Cloud credential | Provider, account/project, role, source, audience, expiry, refresh mechanism |167| Kubernetes | Cluster, namespace, service account/user, context, token/cert expiry, RBAC evidence |168| CI/CD | Runner identity, project/org scope, masking, job lifetime, protected-environment rules |169| Database/service | Endpoint, account, role, source config/process, rotation owner, expiry |170| Browser/app session | Profile/application, account, storage protection, audience, expiry |171172Potential sources include shell history, environment, process arguments, `/proc`, service configs, deployment manifests, backups, cloud CLI stores, kubeconfigs, credential helpers, keyrings, and application databases. Access to `/proc/PID/environ`, memory, agent sockets, or keyrings is itself a security-relevant action; log it and minimize reads.173174For each secret, prefer fingerprint, hash, metadata query, or low-impact identity call over printing the value. Keep raw values only in the approved secret store. Never copy them into terminal transcripts, chat, screenshots, case markdown, or command history.175176Cloud metadata endpoints are not generic enumeration targets. First establish provider and instance context, then record the exact endpoint, token flow, role, and audit effect. Do not probe every provider address or retrieve role credentials merely to see whether they exist.177178### 7. Validate a credential without expanding scope179180Before use, record the approved destination, protocol, principal, expected role, expiry, and one low-impact identity operation. Use host-key validation and a dedicated known-hosts record for SSH. Do not disable TLS or SSH verification to make a credential work.181182A valid authentication is not proof of useful authorization. Capture the remote identity and the smallest authorization query, then update the privilege graph. Do not enumerate unrelated projects, shares, clusters, databases, or hosts.183184For agents, test a signature or key listing without exporting private material. For Kerberos, preserve cache provenance and ticket flags. For cloud and Kubernetes tokens, avoid refresh unless explicitly needed; refreshing changes lifetime and often creates a new audit event.185186### 8. Model lateral movement as bounded edges187188For every pivot record:189190```text191source host/identity -> credential or trust -> protocol/route -> destination192remote identity -> allowed operation -> stronger boundary -> expiration/revocation193```194195Candidate channels include SSH certificates/agents, Kerberos keytabs/caches, NFS, database credentials, orchestration APIs, configuration management, CI runners, cloud roles, and existing tunnels. Identify routing and DNS from current state before adding a tunnel or route.196197If a tunnel is required, define bind address, destination allowlist, protocol, lifetime, keepalive, authentication, process owner, logs, and teardown. Bind to loopback unless exposure is intentional. Confirm the listener and route are gone at cleanup.198199### 9. Assess persistence with paired rollback200201Persistence testing is a configuration transaction, not a list of startup tricks. For each approved mechanism capture:202203- authoritative owner and parser;204- trigger and resulting identity;205- original bytes, metadata, labels, ACLs, links, enablement, and package ownership;206- atomic application method and service impact;207- expected audit/process/file evidence;208- exact rollback and post-rollback verification.209210Relevant families include system and user systemd units/timers, cron/anacron, shell/profile hooks, SSH `authorized_keys` or certificates, PAM, loader configuration, package hooks, containers, desktop autostart, and service-specific plugins.211212Prefer a benign marker and one trigger. Do not install multiple mechanisms to prove the same boundary. Do not change authentication, logging, EDR, firewall, or update controls as a side effect.213214For systemd, retain unit plus drop-ins, `FragmentPath`, `DropInPaths`, enablement symlinks, effective properties, service user, sandbox settings, and reload/start events. Removing a unit file without disabling links, reloading the manager, and stopping owned processes is incomplete cleanup.215216### 10. Measure visibility while operating217218Inventory active telemetry without disabling it:219220- auditd rules/status and relevant audit records;221- journald persistence, forwarding, namespaces, and rate limits;222- auth, sudo, SSH, cron, systemd, package, and kernel logs;223- process accounting and shell/session recording;224- eBPF/Falco/Tetragon-style sensors and their loaded programs;225- EDR agent processes, services, kernel modules, sockets, and health state;226- network DNS/proxy/firewall/flow visibility.227228Establish a clean baseline and one known positive control when the test plan includes detection validation. Missing local logs do not prove missing remote ingestion. Record sensor health, clock alignment, event delay, field schema, and collection boundaries.229230Correlate each validated edge with process ancestry, effective IDs/capabilities, file changes, service events, network connections, and remote authentication. Route deep detection work to `threat-hunting`; route BPF sensor mechanics to `ebpf-offensive`.231232### 11. Clean up and prove final state233234Maintain the cleanup manifest from the first write or process creation. It includes files, directories, links, xattrs, ACLs, labels, units, timers, cron entries, keys, credentials, agents, processes, sockets, routes, tunnels, namespaces, containers, mounts, package state, and temporary logs.235236Rollback in dependency order:2372381. stop tasking, tunnels, listeners, and recurring triggers;2392. terminate owned children and verify no orphan remains;2403. disable and remove persistence, then reload the owning manager;2414. restore original bytes and metadata atomically where possible;2425. remove test credentials/keys and revoke remote artifacts when created;2436. remove local work files after evidence transfer and hash verification;2447. repeat targeted enumeration and compare against baseline;2458. record residual state that cannot safely be reversed.246247Do not falsify timestamps or delete platform audit records. Cleanup means removal of operator-created state and restoration of modified configuration, not destruction of evidence.248249## Key structures & interfaces250251- `/proc/PID/status`, `attr`, `ns`, `cgroup`, `fd`, `maps`, `cmdline`, and `environ`: identity, confinement, process, and secret provenance.252- UID/GID plus capability sets, securebits, `no_new_privs`, and user-namespace ID maps: actual privilege state.253- sudoers grammar, aliases, `Runas_Spec`, tags, command digests, environment policy, and timestamp records: delegated execution contract.254- ELF mode bits, file capabilities, interpreter, `PT_INTERP`, RPATH/RUNPATH, and secure-exec behavior: executable privilege transitions.255- systemd units, drop-ins, generators, timers, D-Bus methods, enablement links, and manager reload state: service authority.256- cron/anacron/system crontab/user spools: parser, owner, environment, and trigger.257- polkit actions/rules plus D-Bus service policy: desktop/service authorization boundary.258- PAM stacks, NSS databases/modules, dynamic-loader config, and package hooks: identity and privileged load paths.259- UNIX-domain sockets, `SO_PEERCRED`, filesystem ACLs, abstract namespace, and protocol authorization: local broker boundary.260- mount, user, PID, network, IPC, cgroup, time, and UTS namespaces plus cgroups and LSM labels: container/host boundary.261- SSH agents/certificates, Kerberos caches/keytabs, cloud tokens, kubeconfigs, and service credentials: lateral identity objects.262263## Tooling264265| Need | Preferred tools |266| --- | --- |267| Host and identity truth | coreutils, procfs, `lsns`, `findmnt`, `capsh`, `getcap`, `getfacl`, `namei` |268| Service and scheduler analysis | `systemctl`, `systemd-analyze`, `busctl`, crontab metadata, package verification |269| Process/socket attribution | `ps`, `ss`, `lsof`, procfs, `strace` for one selected boundary |270| Privilege graph support | manual graph/CSV first; LinPEAS or similar only after source/version/output review |271| Quiet process observation | journald/audit records, process accounting, approved `pspy`, targeted eBPF probes |272| Credential metadata | `ssh-add -l`, `klist`, cloud identity APIs, `kubectl auth can-i` with bounded scope |273| Artifact integrity | `sha256sum`, `stat`, `getfacl`, `getfattr`, package-manager verify commands |274| Detection correlation | `ausearch`, `journalctl`, SIEM/EDR console, `threat-hunting` workflows |275276Automated enumeration scripts are collectors, not conclusions. Pin their version, inspect what they execute, constrain output, and map every finding back to a manually evidenced edge.277278## Evidence outputs279280```text281host.md asset identity, OS/kernel, clock, controls, namespaces, mounts282ledger.jsonl ordered actions, identity, purpose, effects, evidence, rollback283privilege-graph.csv source, edge, target, preconditions, proof, control, status284secrets.csv locator/fingerprint, provenance, scope, expiry, storage, disposition285telemetry.md sensors, health, events, delays, positive/negative controls286cleanup.csv created/modified state, original evidence, rollback, final proof287artifacts/ approved metadata, configs, logs, hashes, screenshots, captures288```289290Never put raw secret values in these files. Reference the approved secret-store record instead.291292## Pitfalls & OPSEC293294- Do not run noisy recursive searches across network mounts, procfs, sysfs, backups, or application data without a specific hypothesis.295- Do not execute SUID, sudo, service, cron, polkit, or socket candidates during inventory.296- Do not assume UID 0 means host root; prove namespaces, capabilities, mounts, cgroups, LSM, and daemon boundary.297- Do not print secrets to stdout or copy them into shell history, transcripts, process arguments, or markdown.298- Do not disable host-key or TLS verification to validate a credential.299- Do not probe every cloud metadata service; establish provider context and retrieval impact first.300- Do not refresh short-lived credentials unless the operation requires it and the new lifetime is tracked.301- Do not use fixed sleeps for service, scheduler, or race validation; await the exact event with a bounded timeout.302- Do not let an enumeration script silently install packages, change limits, mount filesystems, or upload findings.303- Record command history behavior, TTY/session recording, auditd, journald forwarding, eBPF sensors, and remote ingestion.304- Do not erase audit records or falsify timestamps during cleanup.305- If rollback cannot restore a security-sensitive file, service, namespace, route, or credential, stop changing state and record the residual precisely.306307## Routing308309- Route a Linux kernel bug, allocator primitive, page-table UAF, credential overwrite, or kernel ROP chain to batch-B sibling `linux-kernel-exploitation`.310- Route verifier/JIT bugs, BPF hooks, maps, links, or BPF sensor mechanics to batch-B sibling `ebpf-offensive`.311- Route custom beacon runtime, task protocol, module ABI, transport failover, or update behavior to batch-B sibling `c2-implant-engineering`.312- Route BOF/COFF module development to batch-A sibling `bof-coff-development`.313- Route Windows RPC, COM/DCOM, NDR, or ALPC service boundaries to batch-A sibling `windows-rpc-com-attack`.314- Route Windows telemetry-provider and ETW/WPP/TraceLogging work to batch-A sibling `windows-telemetry-etw`.315- Route Hyper-V guest/root partitions, VMBus, hypercalls, or HCS/worker boundaries to batch-A sibling `hyper-v-offensive`.316- Route cloud/Kubernetes authorization to `cloud-k8s`, Windows-domain pivots to `offensive-active-directory`, generic exploit construction to `exploit-dev`, and detection correlation to `threat-hunting`.317- Route a container runtime implementation flaw to `container-runtime-exploitation` when that catalog target is available; until then keep the boundary evidence with `exploit-dev` and `cloud-k8s` rather than improvising host impact.318319## Final gate320321- [ ] Initial identity, host, clock, controls, namespaces, mounts, and access path are recorded.322- [ ] Privilege graph identifies source, mechanism, stronger target, evidence, and rollback for each tested edge.323- [ ] Selected escalation has a negative control and proves the resulting identity and boundary.324- [ ] Secret records contain provenance, scope, expiry, and disposition but no raw values.325- [ ] Lateral and persistence tests remain within named destinations and use paired rollback.326- [ ] Telemetry evidence distinguishes local visibility, sensor health, and remote ingestion.327- [ ] Final targeted enumeration and cleanup manifest prove operator-created state is gone.
Run npx skillmds@latest add netvar1337/linux-host-post-exploitation in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Use when operating from an authorized Linux shell after initial access to build a host privilege graph, validate sudo/SUID/capability/systemd/container escalation edges, locate credentials with provenance, assess persistence and lateral paths, measure audit or EDR visibility, and prove cleanup. It is listed under Security on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free. This skill is licensed under MIT.
netvar1337 (@netvar1337) published this skill. Their other Agent Skills are listed on their SkillMD profile.