Introduction

Every penetration test that actually goes somewhere starts long before anyone sends a packet at the target. The scope document is step zero. What happens before step one — before scanning, before exploitation, before anything that touches the client's infrastructure — is reconnaissance. And the highest-leverage part of reconnaissance is OSINT: Open-Source Intelligence.

OSINT is just the practice of collecting and analyzing information that's already public to build a real picture of a target. It sounds almost too simple to matter. In practice, it's usually what decides whether an engagement finds something real or turns into a week of scanning dead ends.

The information is already out there. The skill is finding it before someone else does — and knowing whether it's actually worth anything once you have it.

In this post, you'll get:

  • Why OSINT matters more than people think in a modern pentest
  • A structured methodology for passive reconnaissance (process over tools)
  • Five tools I'd reach for on almost any engagement
  • The ethics, legal boundaries, and OPSEC that separate a professional from someone who's going to have a bad time

Let's get into it.


Why OSINT Matters in Penetration Testing

Here's the thing about scope documents: they're the cleaned-up version of reality. Three domains, one application, one API — that's what's on paper. The internet, as usual, is messier and more honest than the paperwork.

Dig into public sources on almost any organization and you'll turn up things like:

  • A staging server sitting in certificate transparency logs
  • An old support portal nobody decommissioned that still answers requests
  • A PDF with internal naming conventions baked into the metadata
  • A GitHub repo that reveals more about the stack than the kickoff call did
  • Employee email patterns that quietly expose the authentication scheme

That's usually where the engagement starts to feel real.

The numbers back this up. IBM's 2025 Cost of a Data Breach Report put the average time to identify and contain a breach at 241 days — the lowest it's been in nine years, but still long enough to turn a single intrusion into a multimillion-dollar mess. Attackers generally aren't breaking down doors. They're walking through ones that were left open in public. OSINT is how you find those doors before they do.

MITRE ATT&CK mapping: OSINT maps directly to the Reconnaissance tactic (TA0043) in the MITRE ATT&CK framework — the initial stage of an attack lifecycle, where adversaries gather information about a target before attempting any direct action. It's the phase that most cheaply determines whether the rest of an engagement succeeds, and it's where you build the picture before you touch anything in production.

The more intelligence you gather up front, the more the rest of the test becomes execution instead of exploration.


The OSINT Methodology: A Structured Workflow

A lot of people jump straight into tools — theHarvester, Shodan, Maltego — but OSINT is a process first and a toolset second. Tools rotate in and out of fashion. The methodology underneath them doesn't.

Phase 1: Define the Intelligence Requirement

Before you open a single browser tab, write down the actual question you're trying to answer. There's a real difference between:

"What can I find about this company?"

and:

"Do public sources reveal staging environments, exposed credentials, or third-party integrations that extend the attack surface beyond the scoped domains?"

The second version gives you something to prove, disprove, or leave unresolved — and it tells you when to stop. Skip this step and you'll end up with 40 browser tabs open and nothing you can actually hand to the client.

Phase 2: Passive Collection

Passive means exactly what it sounds like: you never touch the target's infrastructure directly. You query search engines, certificate transparency logs, DNS aggregators, code repositories, breach databases, and public registries. The target's logs show nothing.

Why this matters:

  • It leaves no trace on the target's own systems
  • It's legal in essentially every jurisdiction — you're accessing data that's already public
  • It's the ethical starting point before any active scanning begins

Common passive sources:

  • Certificate Transparency (CT) logs — subdomains, internal hostnames
  • Search engines — indexed files, login portals, stray error messages
  • WHOIS/RDAP records — registrant info, name servers, org data
  • Shodan/Censys — open ports, service banners, known CVEs
  • Breach databases — leaked email/password pairs
  • Public code repositories — hardcoded secrets, internal naming patterns

Phase 3: Correlation and Analysis

Raw data isn't intelligence. Intelligence is data that's been connected.

You find a hostname in a CT log. That leads to a PDF revealing a naming convention. That pattern surfaces another host. That host has an exposed Jenkins login. Every step should hand you something useful for the next one — that's the whole game.

Typical pivots:

  • Subdomain → email address → breach → credential reuse
  • Employee name → LinkedIn → GitHub → hardcoded API key
  • IP address → Shodan → open port → vulnerable service version

You're not trying to collect everything. You're trying to collect enough high-confidence intelligence to support real testing decisions.

Phase 4: Know When to Stop

OSINT has a stopping condition, even though it doesn't always feel like it. You're not mapping the entire internet — you're answering a specific question inside a defined scope.

When the obvious sources are exhausted, when returns are diminishing, when you're collecting data just to feel like you're doing something — stop. Document what you found, turn it into something actionable, and move to the next phase of the engagement.


Five OSINT Tools Worth Knowing

These are five tools that cover the core passive collection surfaces: infrastructure mapping, email harvesting, service discovery, certificate analysis, and breach data. Treat the exact commands below as a starting point — check each project's current docs before you run anything against a real engagement, because flags and data sources on tools like these do shift between releases.

1. Google Dorks: Still the Highest-Yield Tool You Own

Before installing anything, get comfortable with advanced search operators. General searches miss what dorking finds.

Common operators:

  • site:example.com — restrict a search to one domain
  • filetype:pdf — find a specific document type
  • intitle:"admin" — pages with "admin" in the page title
  • inurl:login — URLs containing "login"
  • "exact phrase" — match an exact string

Example queries:

site:example.com filetype:pdf "confidential"
site:example.com inurl:admin
"index of /" "parent directory" site:example.com

The Google Hacking Database (GHDB), hosted at Exploit-DB, maintains a curated set of dorks for finding exposed files, authentication pages, and misconfigured systems. Worth bookmarking.

Why it matters: Google indexes more of the public web than anything else you'll use. If something's online and not properly locked down, Google probably found it first.

2. theHarvester: Subdomains, Emails, and Names

theHarvester pulls emails, subdomains, hostnames, and employee names from dozens of passive sources, including Certificate Transparency logs, HackerTarget, and Shodan. It still ships with Kali Linux, so there's often nothing to install.

Basic usage (keyless sources):

theHarvester -d example.com -b crtsh,certspotter,hackertarget

If you installed it outside Kali via the project's own instructions, you may be running it through uv:

uv run theHarvester -d example.com -b crtsh,certspotter,hackertarget

What you get:

  • Email addresses (reveals naming conventions: first.last@, flast@, first@)
  • Subdomains (exposes staging, dev, and test environments)
  • Employee names (useful for LinkedIn pivots on an authorized engagement)

Why it matters: Two or three confirmed email addresses reveal the naming convention. Combine that with an employee list and you've got an account list to test on an authorized red team engagement. The source list and available flags change between releases, so run --list-sources (or check the project's wiki) rather than assuming a command from an old blog post still works verbatim.

3. Shodan: The Search Engine for Devices, Not Websites

Shodan scans the internet and indexes open ports, service banners, products, and known vulnerabilities. It's not indexing web pages — it's indexing devices.

Basic usage:

  • Web interface: shodan.io
  • By organization: org:"Example Corp"
  • By product: product:"Apache httpd"
  • By known vulnerability: vuln:CVE-2021-44228

What you find:

  • Open ports and running services
  • Service versions (which point straight at unpatched CVEs)
  • Rough geographic location of infrastructure
  • Exposed databases, management interfaces, and the occasional forgotten test server

Why it matters: Shodan shows you what's actually running, not what the scope document claims is running. You'll routinely find systems the client genuinely forgot existed.

4. crt.sh: Certificate Transparency for Subdomain Discovery

Certificate Transparency logs are public records of every SSL/TLS certificate issued anywhere. crt.sh is a free, fast interface for querying them.

Basic usage:

  • Web interface: crt.sh
  • Search %.example.com to pull every certificate issued for that domain and its subdomains

What you get:

  • Historical subdomains, including ones that no longer resolve
  • Internal hostnames (certs issued for things like internal.example.com or staging.example.com)
  • Certificate issuance patterns that hint at infrastructure changes

Why it matters: Every certificate a company issues gets logged publicly, whether they meant to advertise it or not. If they stood up a staging environment, crt.sh usually saw it. It's one of the fastest ways to surface forgotten or shadow infrastructure.

5. Have I Been Pwned: Breach Data for Credential Intelligence

Have I Been Pwned (HIBP) aggregates known data breaches and lets you check whether an email address or password has shown up in one. On an authorized engagement, it helps map the credential exposure landscape.

Basic usage:

  • Web interface: haveibeenpwned.com — checking a single email here is still free
  • The API for automated, per-email checks now sits behind a paid subscription (plans currently start in the low single digits per month); the free, keyless tier still covers things like the public breach list and the Pwned Passwords endpoint
  • If you do use the API, respect the documented rate limits for your tier

What you learn:

  • Which services the target's people use, or used
  • Whether credentials from old breaches might still be valid somewhere
  • The rough scope of exposure if the target has suffered a breach before

Legal note: Only check addresses you're authorized to test. Don't brute-force or enumerate accounts you weren't scoped to look at.


Ethics, Legal Boundaries, and OPSEC

This is where amateurs separate themselves from professionals. OSINT is powerful, and that power comes with responsibility attached.

Legal Boundaries

Public doesn't mean unrestricted. Just because information is accessible doesn't mean you can use it however you like.

  • Terms of Service: Many platforms explicitly prohibit automated scraping. Violating ToS can carry real consequences, legal and otherwise.
  • Data protection laws: GDPR, CCPA, and similar regimes regulate how you handle personal data — even public personal data.
  • Authorization: Only collect intelligence on assets you're explicitly authorized to test. If it's not in scope, leave it alone.
  • CFAA / Computer Misuse Act: In most jurisdictions, accessing systems without authorization is a crime, even if you "found" the credentials sitting in public.

The golden rule: if you wouldn't want someone collecting this about you, think twice before collecting it about someone else.

Operational Security (OPSEC)

Your own investigation can leak. Get sloppy and the target will know you're watching before you've sent a single packet.

Basic OPSEC practices:

  • Separate browser profiles: don't mix OSINT research with your personal browsing
  • VPNs and proxies: route research traffic so you're not leaking your real IP
  • Research personas: if you need to touch social media or forums, use accounts that don't trace back to you, aged enough to not look brand new
  • Isolated hardware: for sensitive investigations, use devices you can wipe or discard without consequence

The goal: nothing about the investigation points back to you, your client, or your organization.

Responsible Disclosure

If passive recon turns up exposed credentials, sensitive data, or a clear vulnerability:

  1. Document it — source, timestamp, evidence
  2. Report it — through the organization's disclosure policy or bug bounty program
  3. Don't exploit it — unless the asset is explicitly in your authorized scope
  4. Minimize what you retain — if you collected personal data along the way, keep only what you need and secure it properly

The difference between a penetration tester and a threat actor isn't just authorization. It's conduct.


Final Thoughts

OSINT is arguably the highest-ROI phase of a penetration test. It's the cheapest way to see what attackers see first — and the same techniques work just as well for defenders. A team that runs its own CT logs, IP ranges, and breach exposure against itself before an attacker does removes the easy wins before anyone else finds them.

Treat external attack-surface monitoring as a continuous control, not a once-a-year pentest line item. Run it against yourself on a schedule. Fix what you find. Run it again.

Stay curious, stay ethical, and remember that the best findings usually come from asking the right question before you ever touch a keyboard against the target.


References and Further Reading