6-Step Ethical Hacking Framework: A Practical Guide
TL;DR: A professional security assessment has six phases. They are pre-engagement, reconnaissance, vulnerability assessment, exploitation, post-exploitation and reporting. This guide walks through each phase with the goa
TL;DR: A professional security assessment has six phases. They are pre-engagement, reconnaissance, vulnerability assessment, exploitation, post-exploitation and reporting. This guide walks through each phase with the goal, the typical activities, example commands and the deliverable it should produce.
Table of Contents
- Important Notice
-
1. Pre-engagement
- Rules of Engagement
-
2. Reconnaissance
- Passive Information Gathering
- OSINT Tools
-
3. Vulnerability Assessment
- Infrastructure Analysis
- Web Application Assessment
- Triage: Separating Signal from Noise
-
4. Exploitation
- Vulnerability Verification
-
5. Post-exploitation
- Impact Assessment
- Documentation
- Clean-up
-
6. Reporting
- Executive Summary
- Technical Report
- Sample Report Structure
- Sample Finding
- Best Practices
- Tools and Resources
- Conclusion
Important Notice
This guide is for educational purposes. Only use it against systems you own or have explicit written permission to test. Unauthorized testing is illegal in most countries, including under the US Computer Fraud and Abuse Act and the UK Computer Misuse Act, even if your intentions are good.
The examples use example.com as a placeholder target. Don't scan it. It's a domain reserved by IANA for documentation, not a practice target. To follow along hands-on, use a lab you control:
- OWASP Juice Shop or DVWA running locally in Docker
-
scanme.nmap.org, which the Nmap project explicitly allows for light scanning - Platforms like Hack The Box, TryHackMe or PortSwigger Web Security Academy
1. Pre-engagement
Goal: agree in writing on what you may test, how, and when, before you send a single packet.
Pre-engagement is the least technical phase and the most important one. A missing signature or a vague scope is what turns a penetration test into an incident. Before beginning any security assessment:
- Obtain written authorization from the system owner (and make sure they actually own the asset, since cloud providers and third-party SaaS have their own rules)
- Define clear scope and boundaries: domains, IP ranges, applications and accounts that are in scope, and what is explicitly out of scope
- Establish a timeline and testing windows
- Set up emergency contacts on both sides
- Document allowed testing methods
- Agree on the reporting format and how findings will be delivered securely
- Sign the necessary legal documents (contract, NDA, authorization letter)
Rules of Engagement
For our example, the rules of engagement might look like this:
Target: example.com web application (https://example.com)
Out of scope: Mail servers, third-party payment provider, DoS testing
Timeline: MonβFri, 09:00β17:00 client time
Methods: Non-disruptive scanning; manual verification only
Test accounts: Two low-privilege users provided by the client
Emergency: Client SOC on-call, +XX-XXX-XXXX (24/7)
Stop condition: Any sign of service degradation or real customer data exposure
Deliverable: a signed scope and rules-of-engagement document.
2. Reconnaissance
Goal: build a map of the target's attack surface while touching it as little as possible.
Passive reconnaissance means gathering publicly available information without sending traffic to the target itself. The better your recon, the more focused (and quieter) the later phases will be.
Passive Information Gathering
- WHOIS lookup of example.com: registrar, name servers, sometimes organization details
- DNS record analysis: A, AAAA, MX, TXT (SPF/DMARC), and NS records reveal hosting and email providers
-
Search engine research: operators like
site:example.com filetype:pdforsite:*.example.com -wwwsurface forgotten pages and subdomains - Certificate transparency logs: every public TLS certificate is logged, which makes them a great source of subdomains
- Archive.org historical data: old endpoints, removed pages and leaked config files often live on in the Wayback Machine
- Code repositories: public GitHub/GitLab repos sometimes contain hostnames, API routes or, unfortunately, secrets
OSINT Tools
# DNS enumeration
dig example.com ANY +noall +answer
dig example.com MX +short
dig example.com TXT +short
whois example.com
host -t NS example.com
# Subdomains from certificate transparency logs (crt.sh)
curl -s "https://crt.sh/?q=%25.example.com&output=json" | jq -r '.[].name_value' | sort -u
# Certificate analysis
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null \
| openssl x509 -noout -subject -issuer -dates -ext subjectAltName
Tools such as Amass, Subfinder and theHarvester automate much of this.
Deliverable: an asset inventory (domains, subdomains, IPs, technologies, people and email formats) that you check against the agreed scope.
3. Vulnerability Assessment
Goal: actively identify services and weaknesses on the in-scope assets.
This is where you start sending traffic to the target, so double-check that every host on your list is in scope.
Infrastructure Analysis
# Service/version scan of the top 1000 TCP ports (with permission)
nmap -sV --top-ports 1000 -oA scans/example example.com
# Full TCP port range, slower but more thorough
nmap -sV -p- -T3 -oA scans/example-full example.com
# Web technology identification
whatweb https://example.com
The -oA flag saves results in all Nmap output formats. You'll want them as evidence for the report.
Web Application Assessment
-
Directory and content discovery: find hidden paths, backups and admin panels (
ffuf,gobuster) - SSL/TLS configuration check: outdated protocols, weak ciphers, certificate issues
-
HTTP security header analysis:
Content-Security-Policy,Strict-Transport-Security,X-Content-Type-Optionsand others - Technology stack identification: frameworks and versions, then check those versions against known CVEs
-
Authentication and session management: password policy, lockout, session cookie flags (
Secure,HttpOnly,SameSite) - Input validation testing: injection (SQLi, XSS, command injection), using the OWASP Web Security Testing Guide as your checklist
# Content discovery with a common wordlist (keep the rate low)
ffuf -u https://example.com/FUZZ -w /usr/share/wordlists/dirb/common.txt -rate 20 -mc 200,301,302,403
# Template-based checks for known misconfigurations
nuclei -u https://example.com -severity medium,high,critical
Triage: Separating Signal from Noise
Scanners produce a lot of false positives. Before anything goes into the next phase, check each result:
- Is the asset actually in scope?
- Can you reproduce the issue manually?
- What is the realistic impact if it's real?
Prioritize with a consistent scale such as CVSS v3.1/v4.0 so findings are comparable across assessments.
Deliverable: a triaged list of candidate vulnerabilities with preliminary severity.
4. Exploitation
Note: Only attempt exploitation with explicit permission, within the agreed methods, and preferably against a staging environment. In a professional test, the aim of exploitation is to prove a vulnerability is real and show its impact, not to cause damage.
Vulnerability Verification
- Develop a minimal, non-destructive proof of concept (read rather than write, use your own test accounts, avoid other users' data)
- Test each identified weakness to confirm or rule it out
- Document successful and failed attempts, since both matter for the report
- Maintain detailed, timestamped logs of every action and command
Example verification:
# 1. Confirm missing security headers
curl -sI https://example.com | grep -iE "strict-transport|content-security|x-frame|x-content-type"
# 2. Confirm the TLS configuration finding
sslyze example.com
# or
testssl.sh https://example.com
# 3. Confirm a reflected input (harmless marker, no payload)
curl -s "https://example.com/search?q=pentest-marker-1337" | grep -o "pentest-marker-1337"
If the marker comes back unencoded in the HTML, you have a candidate for reflected XSS. Confirm it in a browser with a benign proof such as displaying document.domain, and record it. Never use a payload that steals real session data.
For a structured way to describe attacker techniques in your findings, map them to MITRE ATT&CK.
Deliverable: verified vulnerabilities with reproducible proof of concept and evidence.
5. Post-exploitation
Goal: understand what a real attacker could achieve, then leave the environment exactly as you found it.
Impact Assessment
Once a vulnerability is confirmed, answer the business question: so what?
- What data could be read, modified or deleted?
- Could access be used to move to other systems (lateral movement) or gain higher privileges?
- Would the activity have been detected by the client's monitoring?
Stay within the rules of engagement. If a finding leads to systems that are out of scope, stop and contact the client.
Documentation
- Screenshot evidence with timestamps (redact sensitive data)
- Network or application flow mapping that shows the attack path
- Affected systems inventory
- An impact assessment for each finding
Clean-up
- Remove all test files, uploaded payloads and created accounts
- Restore modified configurations
- Document all changes made, including anything that could not be reverted
- Verify system stability with the client
- Securely store or destroy collected data according to the contract
Deliverable: an evidence package and a clean-up log confirming the environment has been restored.
6. Reporting
Goal: turn technical findings into decisions. The report is the only thing the client keeps, so a great test with a poor report is a poor test.
Write for two audiences: executives who decide what to fix, and engineers who need to know how.
Executive Summary
- Overview of findings in plain language
- Overall risk rating and risk ratings per finding
- Key recommendations, prioritized
- Short description of the testing methodology and scope
Technical Report
- Detailed findings
- Step-by-step reproduction instructions
- Evidence and screenshots
- Mitigation recommendations with references (OWASP, vendor advisories, CVEs)
Sample Report Structure
1. Executive Summary
2. Scope and Methodology
3. Findings Summary
3.1 Critical Issues
3.2 High Risk Issues
3.3 Medium Risk Issues
3.4 Low Risk Issues
3.5 Informational
4. Detailed Technical Findings
5. Remediation Roadmap
6. Appendices (tool output, scan logs, glossary)
Sample Finding
Each finding should be self-contained. Here's an example of what a single entry could look like:
### F-03: Missing HTTP Strict Transport Security (HSTS)
Severity: Medium (CVSS 3.1: 5.9, AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N)
Affected: https://example.com
Status: Open
Description:
The application does not send the Strict-Transport-Security header.
Users who type "example.com" into their browser are first connected
over plain HTTP, which allows a network attacker to intercept or
downgrade the connection (SSL stripping).
Evidence:
$ curl -sI https://example.com | grep -i strict-transport
(no output)
Recommendation:
Add the header to all HTTPS responses:
Strict-Transport-Security: max-age=31536000; includeSubDomains
After verifying all subdomains support HTTPS, consider HSTS preloading.
References:
- OWASP WSTG-CONF-07: Test HTTP Strict Transport Security
- https://developer.mozilla.org/docs/Web/HTTP/Headers/Strict-Transport-Security
After the client fixes the issues, offer a retest to confirm each fix and update the finding status.
Deliverable: the final report, delivered securely (encrypted, to the agreed recipients only).
Best Practices
- Always maintain detailed logs: timestamp, command, target and result. They protect you and the client.
- Never exceed scope: if in doubt, ask before you test.
- Stop testing if critical systems are affected, and notify the emergency contact immediately.
- Communicate regularly with stakeholders: report critical findings right away, not just in the final report.
- Follow responsible disclosure guidelines for anything discovered outside a contracted engagement.
- Maintain client confidentiality: encrypt evidence at rest and in transit, and delete it when the retention period ends.
- Prefer manual verification over blind tool output: tools find candidates, people confirm vulnerabilities.
Tools and Resources
| Category | Tools |
|---|---|
| Reconnaissance / OSINT |
dig, whois, crt.sh, Amass, Subfinder, theHarvester |
| Network scanning | Nmap, Masscan |
| Web application testing | OWASP ZAP, Burp Suite, ffuf, Nuclei |
| TLS testing | sslyze, testssl.sh |
| Vulnerability scanners | OpenVAS / Greenbone, Nessus |
| Reporting | SysReptor, Dradis, Markdown templates |
| Practice labs | OWASP Juice Shop, DVWA, Hack The Box, TryHackMe, PortSwigger Academy |
Methodologies worth reading:
- PTES: Penetration Testing Execution Standard
- OWASP Web Security Testing Guide
- NIST SP 800-115: Technical Guide to Information Security Testing and Assessment
- MITRE ATT&CK
Conclusion
Ethical hacking is less about clever exploits and more about discipline. That means authorization before action, evidence for every claim, and a report that helps someone fix things. Always prioritize system stability and data security over finding vulnerabilities.
This six-step framework gives you a repeatable structure, from the first scoping call to the final retest. It keeps your work professional, legally sound and useful to the people you're testing for. Start in a lab, practice each phase deliberately, and build your own checklists as you go.
What does your assessment workflow look like? Let me know in the comments which tools or steps you'd add.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.