Skip to content
Tutorials Center
My learning

Topics

Lesson 25 of 38 ยท Post-exploitation and Privilege Escalation

Post-Exploitation Rules, Evidence and Cleanup

Learn what post-exploitation is for, which actions need approval, how to track every change you make, and how to clean up so the client is left safer than before.

Post-exploitation is everything a tester does after gaining a first foothold: working out what the access is worth, what else it can reach, and what real damage an attacker could do. This phase turns "we found a bug" into "this bug lets someone read the payroll database", which is what makes findings persuasive to decision makers.

It is also the riskiest phase. You now hold real access inside a real environment, so discipline matters more than cleverness. This lesson covers the goals, the rules, evidence handling and cleanup. The next lessons cover Linux and Windows privilege escalation and lateral movement. Everything here is taught from a defensive viewpoint, using sample data and stand-ins rather than tools.

Goals of the phase

  1. Understand the foothold: which account, which host, which privileges, which network segment.
  2. Measure impact: which sensitive data or systems are reachable from here (the "crown jewels" named in scope).
  3. Show the attack path: how one weakness chains into others, so fixes can break the chain at the cheapest point.
  4. Test detection and response: did the defenders notice? how fast? That is often as valuable as the finding itself.
  5. Stay inside the rules: stop when you have proof, not when you run out of things to try.
flowchart LR
    A["Initial foothold"] --> B["Situational awareness"]
    B --> C["Privilege escalation"]
    C --> D["Lateral movement"]
    D --> E["Reach agreed objective"]
    E --> F["Collect minimal proof"]
    F --> G["Clean up and report"]

The post-exploitation loop. Each arrow is a decision to continue only if the rules allow it.

  • Objectives, not trophies. Agree upfront what counts as "done" (for example "show access to the finance file share"). Reaching it is the end, not a starting point for more.
  • No destructive actions: no deleting data, disabling security tools, encrypting files or denial-of-service unless the contract says so.
  • Data handling: avoid copying real personal, health or card data. Prove access with file names, sizes and hashes, or a screenshot with the content masked.
  • Third parties: if you discover a system belongs to a partner, cloud provider or customer, stop. It is probably out of scope.
  • Persistence needs explicit approval. Leaving access behind (a scheduled task, a new account) can be abused by someone else and must be removed. Many tests forbid it entirely and just document that it would be possible.
  • Credential use: use only credentials found within scope, and record where each came from.
  • Report critical findings immediately (an exposed domain admin password, evidence of an existing breach) rather than waiting for the final report.

A tester's access is a liability as much as an asset. Whatever you can do, a real attacker who finds the same path could do too, and anything you leave behind could outlast your engagement.

Keep an activity ledger

Treat every action as something you will have to undo or explain. Write each one down as you do it: time, host, account, action, change made, how to revert. This ledger drives your cleanup list and answers "was that you?" when the client's security team sees something odd at 2 a.m.

Python An activity ledger that produces a cleanup list

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The final list contains exactly the items you must remove and confirm, and the count shows how many actions were harmless reads. If your list is long, ask whether every change was really needed.

Evidence that is enough

Good evidence is minimal, repeatable and verifiable:

  • A timestamped screenshot or terminal capture showing the command and the host name.
  • A file hash (SHA-256) of any file you cite, so the client can confirm it is the same one.
  • Names and counts instead of contents ("2,184 rows in table customers", not the rows).
  • Redactions applied before the evidence leaves your laptop, with the original stored encrypted according to the contract.

The next stand-in builds an evidence record with a hash and a masked excerpt.

Python Hash and mask evidence

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The hash ties the screenshot to a specific file, and the masked excerpt shows the kind of data exposed without spreading it further. (The card numbers above are well-known fake test numbers.)

Cleanup and handover

When the test ends:

  • Work through the cleanup list and verify each item is gone, not just that you ran the command.
  • Remove tools, scripts and temporary files from client systems; restore any changed configuration.
  • Give the client your list of hosts touched, accounts used, source IP addresses and times, so they can separate your activity from real attackers in their logs.
  • Securely delete or encrypt your own copies of sensitive data, and note the retention date from the contract.
  • If you could not remove something, say so in the report and tell the client how to do it.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is the main purpose of the post-exploitation phase?

    Post-exploitation turns a bug into a demonstrated business impact, within the agreed objectives.
  2. 2. Which is the best way to prove access to a table of customer data?

    You can show exposure without copying personal data.
  3. 3. Why keep an activity ledger during the test?

    A record of time, host, account and change makes cleanup complete and supports client incident response.
  4. 4. You find a system that appears to belong to a business partner. What do you do?

    Reachable does not mean authorized. Systems owned by third parties need their own permission.

Summary

  • Post-exploitation measures what a foothold is worth and shows the path an attacker could take.
  • Define objectives up front, avoid destructive actions, and never keep persistence without approval.
  • Log every action as you go; the ledger becomes your cleanup checklist and a shield against confusion.
  • Use minimal, hashed and masked evidence rather than copies of real data.
  • Verify cleanup and hand the client a list of your hosts, accounts and times.

Next: Linux privilege escalation review