#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.
- Land shellVerify user & scope (id / whoami)
- Orient hostCheck OS, processes & routes
- Target checksInspect interesting services or files
- Automated passRun scoped LinPEAS/WinPEAS if needed
- 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:
$ 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.pyLook closely at what five short commands revealed:
- You are running as
www-data, a non-privileged service account. - The host is dual-homed (
10.10.10.42/24and192.0.2.15/24), meaning it may bridge to another lab subnet. - PostgreSQL is listening only on
127.0.0.1:5432, invisible from the outside. - A root-owned Python script
/opt/scripts/sync.pyis running underPID 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 (
teeor redirected over your session) rather than writing large.txtreports to the target disk. - Filter checks: LinPEAS supports flags such as
-s(stealth/fast checks) or-o(selecting specific modules likesystem_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:
- Use an explicit staging directory and unique names. Avoid overwriting existing files in
/tmporC:\Windows\Temp. Pick a dedicated, easily tracked subfolder such as/tmp/.lab-check-01(orC:\Users\Public\lab-check) when disk staging is unavoidable. - Maintain an artifact log. Record every item you create or touch: timestamp (UTC), hostname, exact file path, SHA-256 hash, purpose, and deletion timestamp.
- 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. - Clean up and verify. Before closing your shell, delete uploaded scripts and temporary output files, then confirm removal with
lsordir.
# 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.1sockets or secondary network interfaces during initial orientation. - Forgetting to delete temporary scripts, archives, or captured output files from
/tmporC:\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
/tmpand/var/tmpwithnoexecwhere 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.