Penetration Testing
Ethical Hacking and Security Assessments
Penetration Testing (Pen-testing) is the practice of simulating a cyberattack against a computer system, network, or web application to identify exploitable vulnerabilities before malicious hackers can find them.
A professional penetration test is vastly different from a simple automated vulnerability scan. It requires creative thinking, chaining minor flaws into critical exploits, and proving business impact.
The 5 Phases of Penetration Testing
- Reconnaissance (Information Gathering): The most critical phase. Testers map the attack surface without actively attacking. This includes finding subdomains, discovering exposed APIs, analyzing open-source intelligence (OSINT), and identifying the tech stack (Wappalyzer).
- Scanning and Enumeration: Active probing. Testers use tools like Nmap to find open ports and running services, and directory fuzzers (like Gobuster) to find hidden administrative panels or forgotten backup files.
- Gaining Access (Exploitation): The attack phase. Testers exploit vulnerabilities found in the scanning phase. This could be injecting SQL to dump a database, uploading a malicious PHP shell via a file upload form, or exploiting a known CVE in an outdated web server.
- Maintaining Access & Privilege Escalation: Once a foothold is gained (often as a low-privileged user), the tester attempts to escalate to Administrator or Root. They may install backdoors to maintain persistence if the machine reboots.
- Reporting: The ultimate deliverable. A comprehensive document detailing every vulnerability found, the exact steps to reproduce it, the business risk, and clear remediation advice for the developers.
The Toolchain
Ethical hackers rely on a specialized toolkit, often packaged within operating systems like Kali Linux. - Burp Suite: The absolute industry standard for web app testing. It acts as a proxy, intercepting and modifying HTTP requests in real-time between the browser and the server. - Nmap: The premier network mapper for discovering devices and open ports. - Metasploit Framework: A massive ruby-based framework containing thousands of pre-written exploits for known vulnerabilities. - SQLmap: An automated tool that detects and exploits SQL injection flaws, capable of dumping entire database schemas. - Wireshark: A network protocol analyzer used to capture and inspect packet data on a network wire.
Black Box vs White Box
- Black Box: The tester is given zero prior knowledge of the internal architecture (simulating an external threat).
- White Box: The tester is given full source code, architecture diagrams, and admin credentials. This is significantly more thorough and time-efficient for finding deep logic flaws.
- Gray Box: A hybrid, where the tester is given standard user accounts to test internal application logic.
Rules of Engagement: The Legal Backbone
Penetration testing is only legal inside an explicit, written authorization. A professional engagement begins with a Scope of Work (the exact hostnames, IPs, and applications in scope), a rules-of-engagement document (what techniques are allowed — no DoS unless approved, no access to other clients' data, no social engineering unless contracted), the testing window, and an emergency contact. Without this paper trail, discovering a vulnerability on a system you do not own is a crime in most jurisdictions regardless of intent. When you practice on your own, use deliberately vulnerable labs (DVWA, OWASP Juice Shop, HackTheBox, PortSwigger's Web Security Academy) whose owners authorize the attacks — never live third-party sites.
The Chain That Makes a Finding
A professional finding is worthless unless it is reproducible and risk-rated. Each report entry lists: the vulnerable asset and where exactly it was found, step-by-step reproduction (usually referencing a captured request/response), a severity rating (e.g., CVSS score or OWASP-style High/Medium/Low), the business impact in plain terms ("an unauthenticated attacker could read every customer's PII"), and a concrete remediation. The skill is not the exploit — it is translating "this endpoint reflects input" into "about $X of exposure in legal liability" so a business owner can prioritize it. This is why testers keep immaculate notes and screenshots: the report is the deliverable, the pentest is just how you gather the raw material.
Test Early, Often, Automatically
Pentesting is a point-in-time check, not a guarantee, which is why the modern shift is shift-left: bundle scanning into CI (SAST for static code, dependency scanning for vulnerable libraries), schedule regular manual pentests (quarterly or before major releases), and treat an annual "we got audited" as the floor, not the target. The tools — Nmap, Burp, SQLmap, Metasploit — stay the same, but their best use is automating the grunt work so the human brain can chase the business-logic flaws no scanner can see: authorization gaps, race conditions, and the chained exploit.