Skip to content
leg3ndProjects & tools
01Home02Projects03Tools04Notes
GMT+8
O/ OSCP exploitation reference
Workspace controls Memory only · 0 steps
Visualize path ↗
Command values 0 filled

Temporary connection values clear on reload. Passwords, hashes and tickets remain placeholders. Check address-family syntax in the selected command.

Reference index ↗ Search all procedures & variants ↗
01Discovery02Enumeration03Initial access04Usable access05Local privilege06Active Directory07Internal access08Evidence & reporting

QUICK REFERENCE

Discovery›Services›Web mapping›Web exploitation›Credentials›Public exploits›Sessions & transfers›Linux escalation›Windows escalation›AD enumeration›AD identity attacks›Lateral movement›Pivoting & tunnels›Execution troubleshooting›Integration & evidence›
174 methods · 15 topicsFull reference on GitHub ↗Commands · scripts · next steps
Tools/OSCP/Local privilege/Linux escalation
← All linux escalation tasks

Turn wildcard-expanded filenames into privileged command options

CommandsIf → thenExplanation & examples

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

Shell commands

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

* in an attacker-writable directory

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

# * 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.

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

If it fails → A different utility build, -- separator, changed directory or absent glob can disprove this path. More detail ↓

If → then

  • Root-owned cron, systemd or recurring process activity uses a controllable object → Control a script, binary or configuration consumed by a privileged job/service

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

  • A new Linux foothold or an identity/privilege change → Establish Linux state and choose an escalation candidate

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

  • A root-consumed file or directory appears writable → Prove effective file, directory, ACL and mount control

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

No useful finding → another task in this topic. Failed check → resolve the failure before ruling out the path.

Explanation & examples

Turn wildcard-expanded filenames into privileged command options

USE WHEN
A privileged job passes an uncontrolled directory glob to an option-parsing utility
STARTING ACCESS
A verified Linux foothold with a known effective UID, groups and filesystem context
RESULT
A verified unintended privileged utility operation

Recognize the clue

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

cat /PATH/TO/REVIEWED_JOB_SCRIPT
ls -la /PATH/TO/JOB_DIRECTORY
namei -l /PATH/TO/JOB_DIRECTORY
SYNTHETIC EXAMPLE OUTPUT
Job command: tar ... *
Working directory: /CONTROLLED_DIRECTORY
Caller: root

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

Confirm: 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.

After validation
The actual invocation accepts the useful injected option and privileged effect is verified: select that mechanism.
Ruled out in this context
The job uses -- before expanded filenames or no compatible glob: reject that option-injection route.
Still inconclusive
A wildcard-looking string without execution/working-directory evidence is only a candidate.

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

Additional prerequisite checks

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

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

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

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.

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.

New identity, privilege, host or route? Re-enumerate → All topic tasks →

Study guide ↗Full procedure ↗Cheatsheet ↗
HomeProjectsToolsNotes
Interactive toolsOSCP notes ↗Extended OSCP workspace ↗Attack-path visualizer ↗

© 2026 Armaan. Built with curiosity.

GitHub ↗GMT+8