Common Penetration Testing Techniques, Phase by Phase With Commands
A penetration test follows a sequence: agree scope and authorisation, gather information, find and verify vulnerabilities, exploit them to show real impact, escalate privileges and move further where allowed, then report clearly with fixes. The techniques are the same ones attackers use, applied with written permission, inside a defined scope, and with every step recorded.
Topic: Penetration Testing in Cybersecurity & Ethical Hacking · Explainer
Quick answer: A penetration test follows a sequence: agree scope and authorisation, gather information, find and verify vulnerabilities, exploit them to show real impact, escalate privileges and move further where allowed, then report clearly with fixes. The techniques are the same ones attackers use, applied with written permission, inside a defined scope, and with every step recorded. What separates a professional test from running tools is judgement: knowing what a finding means, what to try next, and when to stop.
Key takeaways
- Authorisation and scope come before any technique. Without them, none of this is legal.
- Reconnaissance usually takes the most time and decides how good the test is.
- Exploitation is about proving impact safely, not causing it.
- Privilege escalation and lateral movement show how far one weakness really reaches.
- The report is the product. A finding nobody understands does not get fixed.
Table of Contents
- What Are the Phases of a Penetration Test?
- What Has to Happen Before Any Testing?
- What Happens During Reconnaissance?
- How Are Services Scanned and Enumerated?
- How Are Web Applications Tested?
- How Does Exploitation Work?
- What Is Privilege Escalation?
- What Is Lateral Movement?
- How Is a Penetration Test Reported?
- How Do You Practise These Techniques Legally?
- References
What Are the Phases of a Penetration Test?
Several public methodologies describe the same broad sequence. NIST SP 800-115 covers planning, discovery, attack and reporting; the Penetration Testing Execution Standard breaks it into pre-engagement, intelligence gathering, threat modelling, vulnerability analysis, exploitation, post-exploitation and reporting.
| Phase | Goal | Typical tools |
|---|---|---|
| Pre-engagement | Agree scope, rules and authorisation | Contract, scope document |
| Reconnaissance | Map what exists and what is exposed | whois, dig, subfinder, search engines |
| Scanning and enumeration | Find live hosts, services, versions and users | Nmap, enum4linux-ng, ldapsearch |
| Vulnerability analysis | Identify likely weaknesses | Scanners, manual review, searchsploit |
| Exploitation | Prove a weakness is real | Metasploit, Burp Suite, custom scripts |
| Post-exploitation | Escalate, move and show business impact | linpeas, winPEAS, BloodHound, NetExec |
| Reporting | Explain risk and how to fix it | Written report, debrief |
What Has to Happen Before Any Testing?
A signed authorisation from someone with authority over the systems, stating the exact scope, exclusions, test window, permitted methods and emergency contacts. Testing outside that is unauthorised access under the Information Technology Act, 2000. Our article on ethical hacking laws sets out what the document should contain.
What Happens During Reconnaissance?
Reconnaissance finds the attack surface before touching it. Passive reconnaissance uses public sources and does not interact with the target's systems; active reconnaissance does, and must be within scope.
# who owns the domain and which name servers it uses
whois example.com
dig +short NS example.com
# mail servers and published text records, including SPF
dig +short MX example.com
dig +short TXT example.com
# subdomains from public sources such as certificate transparency logs
subfinder -d example.com -silent
Each subdomain found is a possible target, but only the ones listed in scope may be tested. Old forgotten subdomains are often where the interesting findings are, which is why recon deserves time.
How Are Services Scanned and Enumerated?
Scanning finds live hosts and open ports; enumeration pulls detailed information from the services found, such as users, shares and versions. The Nmap reference guide documents every option used here.
# all TCP ports with service and version detection and default scripts
nmap -sC -sV -p- -oA initial 192.168.56.101
# SMB shares and users from a Windows host (lab only)
enum4linux-ng -A 192.168.56.110
# anonymous LDAP query to a domain controller, if allowed
ldapsearch -x -H ldap://192.168.56.110 -s base namingcontexts
Our guide to enumeration in cyber security covers this phase in depth.
How Are Web Applications Tested?
Web testing is largely manual, with an intercepting proxy such as Burp Suite or OWASP ZAP between browser and application. The OWASP Web Security Testing Guide is the reference checklist, covering authentication, session management, access control, input validation and business logic.
# discover hidden directories and files with a wordlist
ffuf -u https://app.example.lab/FUZZ -w /usr/share/wordlists/dirb/common.txt -mc 200,301,403
# check security headers on the response
curl -sI https://app.example.lab | grep -iE 'strict-transport|content-security|x-frame'
The most valuable web findings, such as one user reading another user's data by changing an ID, come from understanding the application, not from tools.
How Does Exploitation Work?
Exploitation proves that a weakness is real and shows what it allows. Testers look up known exploits for the versions found, read them before running anything, and choose the least disruptive way to demonstrate impact.
# search the local copy of Exploit-DB for a service version found earlier
searchsploit vsftpd 2.3.4
# read an exploit before using it, by the EDB-ID shown in the results
searchsploit -x <EDB-ID>
Rules of thumb: never run code you have not read, avoid exploits that may crash production services unless that is explicitly allowed, and stop to inform the client immediately if you find something critical such as live access to payment data.
What Is Privilege Escalation?
Initial access is often as a low-privileged user. Privilege escalation turns that into administrator or root access by abusing misconfiguration, weak permissions or unpatched local vulnerabilities. In MITRE ATT&CK it is a tactic of its own, because real attackers rely on it.
# Linux: what can this user run with sudo?
sudo -l
# Linux: files with the SUID bit set, a classic escalation path
find / -perm -4000 -type f 2>/dev/null
# automated enumeration scripts (upload only within scope)
./linpeas.sh # Linux
.\winPEASx64.exe # Windows
What Is Lateral Movement?
Lateral movement uses access to one machine to reach others, usually with credentials or tokens found along the way. In Windows domains this is where tests show their biggest impact: one compromised workstation can lead to domain administrator through a chain of small weaknesses.
# check where a captured credential is valid across a lab subnet
netexec smb 192.168.56.0/24 -u labuser -p 'Lab-Password-1'
Tools such as BloodHound map the paths from one account to high-privilege groups. For defensive context, our guide to Active Directory attack methods explains each path and how to close it.
How Is a Penetration Test Reported?
A good report serves two readers. The executive summary tells leadership the overall risk and what it means for the business, in plain language. The technical section gives each finding with evidence, steps to reproduce, impact, severity and a specific fix.
- Lead with the attack chains that matter, not a long list of low-severity items.
- Show evidence: screenshots, commands and output, with sensitive data redacted.
- Give fixes engineers can act on, and state what you did not test.
- Offer a retest so fixes are verified.
How Do You Practise These Techniques Legally?
Build a lab of your own virtual machines, including deliberately vulnerable ones, on an isolated network; use legal training platforms; and enter capture-the-flag events. Our guide to setting up a penetration testing lab covers the build, and What Is Metasploit? covers the exploitation framework safely.
Talk to a WebAsha training advisor about penetration testing courses, batches and current fees.
References
- NIST SP 800-115, Technical Guide to Information Security Testing and Assessment
- Penetration Testing Execution Standard
- OWASP Web Security Testing Guide
- MITRE ATT&CK
- Nmap reference guide
Related reading
Frequently Asked Questions
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0