Andres Diaz

andres@diaz:~$ whoami

Andres Diaz

Defect Reproduction Engineer at Filevine

andresdiaztech@gmail.com

LinkedIn GitHub Blog



andres@diaz:~/notes$ cat five-stages-of-ethical-hacking.md

cd ..

Five Stages of Ethical Hacking

Oct 19, 2026 · Methodology

One line

Every pentest follows the same 5 stages: Reconnaissance > Scanning and Enumeration > Gaining Access > Maintaining Access > Covering Tracks. Recon is where most of the time goes.

Related: Recon Tools · TCP and UDP · Subnetting
Reference: Acronyms · Ports

The 5 stages at a glance

#StageThe question it answers
1ReconnaissanceWhat can I learn about the target?
2Scanning and EnumerationWhat is running, and is any of it weak?
3Gaining AccessCan I get in?
4Maintaining AccessCan I stay in if the machine restarts?
5Covering TracksDid I clean up everything I added?

1. Reconnaissance

Gathering as much information as possible about the target to understand it and find possible ways in. There are two kinds:

  • Passive: learning about the target without touching its systems. Searching public info, browsing their website, looking at DNS (Domain Name System) records.
  • Active: interacting with the target directly. This blends into scanning (stage 2).

Passive recon: what to look for

Physical and social

  • Location info: satellite images, drone recon, badge readers, building layout, security guards, fencing.
  • Job info: employees online, their names, job titles, phone numbers, managers. Photos of badges, desks and computer screens people post online.
  • On-site visits and phishing assessments are part of this area too, but they only happen when the client puts them in scope.

Web and host

  • Target validation: make sure the IP or domain the client gave you is really theirs before testing it. Tools: whois, nslookup, dnsrecon.
  • Finding subdomains: Google fu (advanced Google searches) and subfinder.
  • Fingerprinting: what is running? Which web server, which ports are open, which version of FTP (File Transfer Protocol)? Tools: Nmap, netcat.

Data breaches

  • Old breaches that leaked employee emails and passwords. This is worth digging into heavily at the start, because people reuse passwords.
  • Tools: Have I Been Pwned, breach-parse.

All the recon tools I've seen so far are in Recon Tools.

Corrections to my first notes

  • Fingerprinting with Nmap or netcat is active, not passive. It sends packets to the target, so it only happens inside the agreed scope.

2. Scanning and Enumeration

Actively probing the target to find open ports, services and vulnerabilities, with port scans, network mapping and vulnerability scans.

Enumeration means looking at what the scan found and digging into each item for anything of value.

Enumeration example

A scan shows port 80 (HTTP) is open and running Apache 1.2. That version is very old, so the next step is researching whether Apache 1.2 has known exploits.

3. Gaining Access (exploitation)

Running an exploit against a vulnerable service to get into a machine, network or environment, using what stage 2 found. Common ways in: exploiting software bugs, cracking passwords and social engineering.

Once inside, scanning and enumeration start again from the new position.

4. Maintaining Access

Staying in after I get in. If the user shuts down their computer, how do I get back in? For example, by leaving a backdoor or a remote access tool on the machine.

5. Covering Tracks

Cleaning up everything I added during the test: deleting any malware I uploaded and any accounts I created, so the client's systems end up the way they were.