Reconnaissance & OSINT

Penetration Testing Methodology

Chapter 4 · Reconnaissance & OSINT

pentest1-3 named this phase Intelligence Gathering in PTES's own terms. This chapter covers what that actually means in practice: building a real picture of a target before touching it, using techniques that range from completely invisible to directly observable by the target.

Passive vs. Active Reconnaissance

Passive recon gathers information without directly interacting with the target's own systems — nothing sent reaches the target, so nothing can appear in their logs. Public records, search engines, social media, cached pages, and WHOIS lookups against a third-party registry all count as passive. Active recon means direct interaction with the target's own infrastructure — even something as simple as a DNS query sent to the target's own authoritative nameserver, or a single ping, counts as active, since it touches systems the target actually controls and could show up in their own logs.

The distinction matters because it maps directly onto risk: passive recon carries essentially zero risk of detection or disruption, while active recon — however innocuous it seems — can be logged, can trigger alerts, and some scope agreements explicitly restrict it to specific time windows or exclude particular techniques entirely.

WHOIS & DNS Enumeration

WHOIS lookups reveal registrant information, registrar, and creation/expiration dates — though privacy services now redact much of what used to be public. DNS enumeration goes further, extending net1-9's own DNS resolution hierarchy material directly into an information-gathering technique: subdomain enumeration, MX records (revealing mail infrastructure and often which third-party provider handles it), TXT records (SPF/DKIM entries and verification tokens that leak which third-party services — analytics, marketing tools, cloud providers — an organization actually uses), and NS records.

A classic (often already-fixed) misconfiguration worth checking is an open zone transfer (AXFR) — a nameserver that will hand over its entire zone file to anyone who asks, rather than only to its own designated secondary servers.

This directly extends two chapters already on the site
net1-9 covered the DNS resolution hierarchy itself; host1 covered managing DNS at a registrar and through Cloudflare. Understanding how DNS is actually managed and configured — the subject of both those chapters — is exactly what makes it possible to know what to look for and what looks unusual during DNS-based recon.

OSINT — Public Records & Social Media

  • Job postings — a listing for "a Senior React Developer with AWS and PostgreSQL experience" reveals real technology-stack details for free.
  • Employee enumeration via LinkedIn — relevant specifically to the Social Engineering scope category from pentest1-2.
  • Public code repositories — accidentally committed credentials, internal hostnames, or revealing comments.
  • Public device search engines (Shodan/Censys-style) — searching pre-existing, already-collected scan data rather than scanning the target directly, keeping this technique passive.
  • Breach databases — checking whether an organization's own email addresses have appeared in known public breaches, directly relevant to bc1's own password-security material and previewing pentest1-7's credential-based exploitation.

Why Recon Quality Determines Everything Downstream

pentest1-5's scanning depends on already knowing what to scan — the IP ranges and subdomains this phase discovers. pentest1-6's vulnerability analysis depends on knowing what's actually running, using the technology-stack clues this phase surfaces. pentest1-7's exploitation sometimes depends directly on valid targets or credentials this phase turns up. A shallow recon phase doesn't just produce a smaller result on its own — it produces a shallow, incomplete attack surface map that every later phase inherits without ever knowing what was missed.

OSINT still has to respect scope, even though the information itself is public
Most OSINT is passive and deals only with publicly available information — but pentest1-2's own scope-precision lesson still applies here directly. Some organizations explicitly exclude social-engineering-relevant recon (like enumerating specific employees) from an engagement, or don't want personal social media research conducted on their staff at all, even using only public information. Whether OSINT of this kind is included has to be settled explicitly in the written scope, the same way pentest1-2 required for every other category — "it's public information" doesn't substitute for it being within the agreed scope.

Hands-On Exercises

Exercise 1

Classify each of the following as passive or active recon, and explain why: (a) a WHOIS lookup, (b) a port scan against the target's own server, (c) a LinkedIn search for the target's employees, (d) a DNS query sent directly to the target's own authoritative nameserver.

📄 View solution
Exercise 2

Explain, using this chapter's own "why recon quality determines everything downstream" section, specifically how a shallow reconnaissance phase would cause concrete problems in pentest1-5, pentest1-6, and pentest1-7.

📄 View solution
Exercise 3

Explain why OSINT research on an organization's employees needs to be explicitly addressed in the written scope agreement, even though the information being gathered is entirely public — tying your answer to pentest1-2's own scope-precision material.

📄 View solution

Chapter 4 Quick Reference

  • Passive — no interaction with target systems, essentially undetectable · Active — direct interaction, loggable/detectable even when innocuous
  • WHOIS + DNS enumeration (subdomains, MX, TXT, NS, zone transfer checks) extends net1-9's resolution hierarchy and host1's DNS-management material
  • OSINT sources: job postings, employee enumeration, public code repos, Shodan/Censys-style device search, breach databases (ties to bc1)
  • Recon quality bounds every later phase — pentest1-5/6/7 all inherit whatever this phase missed
  • Public information ≠ automatically in scope — OSINT scope must still be addressed explicitly, per pentest1-2
  • Next chapter: Scanning & Enumeration — building directly on net1-10's own diagnostic tooling (ping, traceroute, ss, tcpdump)