System Hacking: Access and Privilege Escalation
Examine access vectors, privilege escalation paths, persistence, and EDR-aware tradecraft.
Content
Attack Surface Mapping and Initial Access
Versions:
Attack Surface Mapping and Initial Access — The No-Chill Recon
Opening Section
Imagine you are a burglar with a PhD in reconnaissance. You dont try the front door first; you survey the property, find the unlocked basement window, and note which neighbor has the friendly dog. Thats attack surface mapping in a nutshell: a scientific, slightly menacing stroll around a target to find the soft spots.
You already learned how to classify, prioritize, and operationalize vulnerabilities and how to bake scans into CI/CD pipelines so new code doesn't bring new chaos. Now were stepping out of the dev lab and into the real world: how do attackers discover where to strike, and how does initial access actually happen? This lesson connects the dots between vulnerability management and the real-world vectors that lead to a compromise.
If vulnerability scanning is the lab work, attack surface mapping is the field reconnaissance. One helps the other: accurate maps make your prioritized fixes actually meaningful.
Why this matters (TL;DR)
- Finding exposure early prevents emergent, high-impact access paths.
- Contextual prioritization: A critical CVE on a machine with no internet-facing presence is less urgent than a medium CVE on an internet-exposed service.
- Blue team value: Mapping shows where to place detection and hardening controls.
Main Content
1) What's an attack surface, actually?
- Attack surface = all reachable paths an attacker could use to manipulate or read system behavior or data. That includes network services, exposed APIs, web apps, user accounts, third-party integrations, employee devices, and humans.
Think of it as a castle: walls, gates, secret tunnels, visiting merchants, and the guy who forgets to bolt the armory.
2) A step-by-step attack surface mapping workflow (ordered)
- Scope definition: Identify assets in-scope (domains, IP ranges, cloud accounts, org-owned apps).
- Passive discovery: WHOIS, certificate transparency logs, public DNS, Shodan, GitHub, job posts.
- Active discovery: Port scans, service enumeration, directory brute-force (careful with legal/ethics!), web crawling.
- Asset inventory & enrichment: Tag assets with owner, environment (prod/dev), exposure, and known vulns (linking back to CI/CD scan outputs).
- Threat modeling: For each asset, list potential attack vectors and impact scenarios.
- Prioritize initial access vectors: Rank by ease, gain, and detectability.
- Document and hand off: Create actionable tickets for remediation and detection improvements.
3) Passive vs Active Recon — quick compare
| Technique | Pros | Cons |
|---|---|---|
| Passive (OSINT, CT logs, Shodan) | Low risk, stealthy, legal-friendly | May miss internal assets, less up-to-date |
| Active (scans, brute-forcing) | High fidelity, finds live services | Noise, potential legal/ethical issues, easily detected |
4) Common tools and sample commands
- DNS discovery: Amass, Sublist3r
- IP/service scanning: Nmap, Masscan
- Web enumeration: Gobuster, Dirb, Burp
- Public exposure: Shodan, Censys
- Cloud: AWS CLI + IAM enumeration scripts, GCP asset inventory
Sample nmap scan (safe, targeted):
nmap -sS -p- -T4 --open -Pn 198.51.100.0/24 -oA initial-scan
Quick subdomain enum with amass:
amass enum -d example.com -o amass-subdomains.txt
Note: In a corporate pentest, follow the rules of engagement. Dont mass-scan the internet from an office connection.
5) Initial access vectors — where attackers actually get in
- Exposed services: RDP, SMB, VPNs, misconfigured database endpoints.
- Web application flaws: auth bypass, SSRF, SQLi, vulnerable SSO integrations.
- Credentials: leaked passwords, password spraying, credential stuffing.
- Phishing & social engineering: the human attack surface — still wildly effective.
- Supply chain: compromised third-party libs, CI/CD pipeline compromise (remember earlier lessons), or vendor access.
- Misconfigurations: overly permissive S3 buckets, IAM roles with wildcard trusts.
Real-world example: the attacker finds an exposed Jenkins instance (discovered via Shodan), uses a known unauthenticated RCE (CVE), and then drops credentials that allow access to production deployments — a straight path from reconnaissance to initial access to OMFG.
6) From discovery to foothold: a typical attacker playbook
- Map services and owners
- Probe for auth and misconfigurations
- Try credential stuffing or password spray where login forms exist
- Exploit reachable CVEs (with proof-of-concept) or chain misconfigurations
- Drop a web shell or persistent access
At each step, defenders can add friction: MFA, rate limits, WAFs, robust logging, and baked-in checks in CI/CD so risky exposures never make it to prod.
Contrasting perspectives: attacker vs defender
- Attackers value speed and stealth. They prioritize low-friction, high-return vectors.
- Defenders value coverage and assurance. They prioritize controllability and detection.
Both sides use similar reconnaissance tools; the difference is legal authority and intent. Ethical hackers must document methods and secure permissions.
Reconnaissance tools are like a hammer: useful for construction and destruction. Know which project youre on.
Practical defender checklist (actionable)
- Integrate asset discovery into CI/CD and inventory systems.
- Correlate external attack surface findings with internal vulnerability trackers.
- Harden internet-exposed services first (RDP, VPN, SSH, DBs).
- Enforce MFA and strong password policies (and monitor for credential stuffing).
- Add detection: atypical scanning patterns, new host registration, unexpected deploys.
- Review third-party trust boundaries and vendor access regularly.
Closing Section — Key takeaways and a slightly unnerving insight
- Attack surface mapping is the bridge between static vulnerability lists and the dynamic ways attackers actually get inside.
- Prioritization works better when you enrich vuln data with exposure context: that high-severity bug on an internal dev box is not the same as a medium bug on an internet-facing API.
- Humans and misconfigurations are still top initial access vectors. Technology is important, but discipline and process matter more.
Final challenge: go run a passive OSINT sweep on a test domain (with permission) and produce an attack surface inventory. For each asset, answer: "If I had 15 minutes, could I get in? How?" Then hand that to your CI/CD team and ask them to prevent one path from being exploitable. Small changes create huge friction for attackers.
Version note: this builds on CI/CD and automated scanning topics by taking vulnerability lists from the pipeline and mapping them to real exposure and likely initial-access vectors — turning noise into a prioritized action plan.
Further reading
- OWASP Testing Guide: external attack surface and authentication testing
- MITRE ATT&CK: initial access techniques
- Amass, Nmap, Burp docs
Good luck mapping. Be thorough, be ethical, and for the love of infosec, patch that Jenkins.
Comments (0)
Please sign in to leave a comment.
No comments yet. Be the first to comment!