Skip to main content
Post-Exploitation Enumeration & Safe Artifact Handling
Lesson 7 of 11

Post-Exploitation Enumeration & Safe Artifact Handling

Perform structured Linux and Windows host enumeration after initial access, scope automated enumerators safely, and track and clean up assessment artifacts without disrupting targets.

Advanced 28 min Pentesting
Authorised environments only — The techniques described here are used only in training labs and on systems you own or have written permission to test.

Learning objectives

  • Explain the four pillars of post-exploitation situational awareness on an unfamiliar host
  • Conduct targeted manual enumeration on Linux and Windows before launching noisy automated scripts
  • Scope and run automated enumerators such as LinPEAS and WinPEAS while minimizing host impact
  • Maintain an artifact log and safely clean up temporary files, outputs, and test evidence

Recommended first: Exploitation Basics, Payloads & Reverse/Bind ShellsCredential Reuse, Spraying Limits & Service Misconfigs

#Why this matters

Gaining an initial shell on a target is the start of the assessment phase, not the finish line. Without pausing to understand the system you have landed on, it is easy to run an unsuitable script, crash a fragile service, step outside the authorised scope, or trigger high-severity incident alarms that disrupt a client's operations.

Structured post-exploitation enumeration gives you clear answers before you take another action. Pairing that discipline with strict artifact handling ensures that every file you stage, every output you capture, and every session you close leaves the environment intact and verifiable.

#The four pillars of situational awareness

Right after obtaining command execution, orient yourself across four core questions: who you are, what system you are on, what is running, and what networks you can reach. Answering these in order prevents wasted effort and keeps your footprint small.

Pillar What you want to know Linux commands Windows commands
Identity and context Current user, groups, privileges, domain membership id, groups, env whoami /all, net user
Host and OS posture Kernel, OS build, architecture, mounted disks uname -a, cat /etc/os-release, df -h systeminfo, ver
Processes and jobs Running services, scheduled tasks, security agents ps -ef, systemctl list-units, ls -la /etc/cron* tasklist /v, schtasks /query
Network reachability IP addresses, routes, listening sockets, neighbors ip -br addr, ip route, ss -tulnp ipconfig /all, route print, netstat -ano

Pay special attention to network interfaces and listening sockets. Discovering a second interface on 10.10.20.0/24 or a localhost-only service bound to 127.0.0.1:8080 immediately changes your assessment plan, revealing internal paths or local privilege boundaries that external scans could not see.

  1. Land shellVerify user & scope (id / whoami)
  2. Orient hostCheck OS, processes & routes
  3. Target checksInspect interesting services or files
  4. Automated passRun scoped LinPEAS/WinPEAS if needed
  5. CleanupRemove temporary artifacts & verify log

#Manual triage before automated enumerators

A common mistake is uploading LinPEAS or WinPEAS in the first ten seconds. Automated enumeration scripts inspect hundreds of paths, invoke dozens of child binaries, and produce thousands of lines of output. On a heavily monitored host or a low-memory container, that burst can exhaust CPU, alert defenders prematurely, or bury the one clue that actually matters.

Start with a quick manual pass using native utilities already present on the host:

Manual triage on a lab Linux host (lab.local)
$ id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
$ uname -r
5.15.0-91-generic
$ ip -br addr
lo               UNKNOWN        127.0.0.1/8
eth0             UP             10.10.10.42/24
eth1             UP             192.0.2.15/24
$ ss -tulnp | head -n 6
Netid State  Recv-Q Send-Q Local Address:Port Peer Address:Port Process
tcp   LISTEN 0      128    127.0.0.1:5432     0.0.0.0:*
tcp   LISTEN 0      511    0.0.0.0:80         0.0.0.0:*
$ ps -ef | grep -E "postgres|backup|python"
postgres   912     1  0 08:10 ?        00:00:02 /usr/lib/postgresql/14/bin/postgres
root      1405     1  0 08:12 ?        00:00:00 /usr/bin/python3 /opt/scripts/sync.py

Look closely at what five short commands revealed:

  1. You are running as www-data, a non-privileged service account.
  2. The host is dual-homed (10.10.10.42/24 and 192.0.2.15/24), meaning it may bridge to another lab subnet.
  3. PostgreSQL is listening only on 127.0.0.1:5432, invisible from the outside.
  4. A root-owned Python script /opt/scripts/sync.py is running under PID 1405, making it a prime candidate to inspect for permissions.

If manual checks leave gaps, then turn to automated tools like LinPEAS (Linux) or WinPEAS (Windows). Run them deliberately:

  • Verify integrity first: Download the release on your own lab workstation and record its SHA-256 hash before transferring anything.
  • Limit noise and disk writes: Where your shell and RoE allow, stream output back to your own workstation (tee or redirected over your session) rather than writing large .txt reports to the target disk.
  • Filter checks: LinPEAS supports flags such as -s (stealth/fast checks) or -o (selecting specific modules like system_information,procs_crons_timers_srvcs_sockets) so you only run what you need.

#Safe artifact handling and scope hygiene

Every file you drop on a target and every change you make creates operational and forensic risk. Even in a training lab, building disciplined habits prepares you for real engagements where clients verify cleanup against their endpoint logs.

Follow four practical rules for artifact handling:

  1. Use an explicit staging directory and unique names. Avoid overwriting existing files in /tmp or C:\Windows\Temp. Pick a dedicated, easily tracked subfolder such as /tmp/.lab-check-01 (or C:\Users\Public\lab-check) when disk staging is unavoidable.
  2. Maintain an artifact log. Record every item you create or touch: timestamp (UTC), hostname, exact file path, SHA-256 hash, purpose, and deletion timestamp.
  3. Collect minimal proof, never bulk data. If you discover a readable configuration file containing database credentials or API keys, verify permissions (ls -la) and capture only what proves the risk under your RoE. Never copy bulk user tables, emails, or personal records to your workstation.
  4. Clean up and verify. Before closing your shell, delete uploaded scripts and temporary output files, then confirm removal with ls or dir.
bash
# Example artifact verification and cleanup on a Linux lab target
sha256sum /tmp/lab-enum/linpeas.sh
rm -rf /tmp/lab-enum
ls -la /tmp

#Defending and common mistakes

On the offensive side, the most frequent mistakes are predictable:

  • Running full automated enumerators immediately, flooding logs and hanging slow targets.
  • Ignoring 127.0.0.1 sockets or secondary network interfaces during initial orientation.
  • Forgetting to delete temporary scripts, archives, or captured output files from /tmp or C:\Temp.
  • Leaving bash or PowerShell history filled with ad-hoc test paths without documenting what was run.

From a defensive standpoint, post-exploitation enumeration is one of the highest-signal phases to detect. Service accounts like www-data, nginx, or NT AUTHORITY\NETWORK SERVICE rarely run interactive discovery commands (whoami /all, ipconfig, ss, or recursive permission searches) during normal operation. Defenders should:

  • Alert on discovery bursts: Correlate rapid sequences of identity, process, and network enumeration commands spawned by web or database service processes.
  • Restrict staging paths: Mount /tmp and /var/tmp with noexec where application compatibility allows, and monitor script execution from world-writable directories.
  • Enforce egress controls: Prevent application servers from fetching external enumeration scripts directly from public repositories.
  • Keep host posture clean: Remove stale backup scripts, unused interpreters, and redundant network interfaces that widen post-exploitation opportunities.

#Summary

  • Post-exploitation situational awareness starts with four manual pillars: identity, host posture, processes/services, and network reachability.
  • Running lightweight OS commands before automated tools like LinPEAS or WinPEAS reduces noise, avoids service disruption, and surfaces high-value targets like localhost services and dual-homed interfaces.
  • Safe artifact handling requires logging every file path and hash introduced into a target, collecting only minimal proof, and verifying complete cleanup before ending a session.
  • Defenders can catch post-exploitation early by monitoring service accounts for unexpected discovery command chains and locking down writable staging directories.

Knowledge check

Sign in to take the test, complete lessons and save your progress. Log in

Practice: test your knowledge