Skip to content
Tutorials Center
My learning

Topics

Lesson 11 of 38 ยท Reconnaissance

OSINT for Penetration Testers

Learn open-source intelligence for penetration tests: search operators, public code repositories, document metadata, breach data, job postings and how to handle personal data ethically.

Open-source intelligence (OSINT) is information that anyone can legally obtain from public sources. For a penetration tester it fills in the picture of an organization: what technology it runs, how it names its accounts, which documents it publishes and which secrets it may have leaked by accident. Because the data is public, OSINT is the safest recon you can do. It still needs discipline, because public does not mean harmless, and personal data deserves respect.

Sources worth checking

Search engines and operators

Search engines index far more than the home page. Operators narrow results to the organization:

  • site:example.test limits results to a domain.
  • filetype:pdf finds documents of a type.
  • inurl:admin and intitle:"index of" find certain paths and open directory listings.
  • Quotation marks match exact phrases, and a minus sign excludes words.

Combining them, such as site:example.test filetype:xlsx, may reveal spreadsheets the organization never meant to publish. This technique is often called Google dorking, though it works on any search engine. Querying a search engine is passive with respect to the target.

Public code repositories

Developers sometimes push secrets: API keys, passwords, database strings. Public hosting platforms support searching by organization name or domain. Look for configuration files, scripts and commit history. A secret that was deleted later may still be in history. If you find a live credential, do not use it unless the RoE allows it; report it as a finding.

Document metadata

Office files and PDFs carry metadata: author name, software, sometimes internal paths and printer names. A published brochure may reveal that staff use a specific naming format (jsmith) and an outdated office suite. Metadata is read with tools like exiftool.

Job postings and vendor pages

"Experience with Oracle 11g, Jenkins and Palo Alto firewalls" tells you the technology stack. Case studies on vendors' websites reveal customers' products. Neither contacts the target.

Archives and caches

The Internet Archive and search caches hold old copies of pages: removed admin panels, old contact pages, staff directories. Old content shows how the company used to be configured.

Breach and leak data

Public breach summaries show which employee emails appeared in past leaks. A tester uses this to advise password resets and to estimate risk, not to log in. Handling real leaked passwords is legally sensitive; use only what the contract allows.

Social media and business directories

Professional networks reveal roles, teams and technologies. They also expose personal information. Use them to understand the organization's structure and to build the people-facing part of the attack surface, for authorized social engineering tests only.

OSINT sources

Search operators Find hidden documents.
Code hosting Secrets in commits.
Metadata Names, software, paths.
Job posts Technology stack clues.

All public, all safe to read, all worth fixing.

1 / 2

Read-only: example commands

These commands show how metadata and search work in practice. The block is read-only and uses example output.

Terminal
exiftool annual-report.pdf
TEXT
Author                          : jsmith
Creator                         : Microsoft Word 2013
Producer                        : Microsoft Word 2013
Create Date                     : 2023:03:14 10:22:01Z

The author field reveals a username format; the product version suggests old office software.

Ethics of personal data

OSINT sits close to privacy. Keep these rules:

  • Collect only what the engagement needs. A staff list for a phishing simulation is justified; family photos are not.
  • Store personal data securely and delete it on schedule (see Note-Taking and Evidence).
  • Do not contact individuals or interact with their accounts unless authorized.
  • Never access accounts, even with leaked passwords, outside the RoE.
  • Report to the client what was exposed so they can reduce it.

Stand-in: analyze file metadata and a search plan

The first example parses invented document metadata and infers a username convention and software versions. This is the real analysis step, with sample data.

Python Infer naming patterns from metadata

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The second example builds search queries from a domain and a list of interesting file types. It only prints the queries; running them is up to you, in a search engine, against domains you are authorized to assess.

Python Generate search queries for a domain

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Turning OSINT into findings

OSINT results become findings when they show real exposure, for example:

  • A published spreadsheet with internal host names and passwords.
  • An API key in a public repository.
  • Staff email addresses plus a predictable format, making phishing easy.
  • Old admin panels visible in an archive but still live.

Each finding should name the source, the date you saw it, the potential impact and the fix: remove the item, rotate any secret, and add controls such as secret scanning in the code pipeline.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does the search operator site:example.test do?

    It tells the search engine to return only results from that domain.
  2. 2. You find a live API key in a public repository belonging to the client. What do you do?

    Using credentials outside the RoE would exceed your authorization. Report and recommend revoking the key.
  3. 3. What can document metadata reveal?

    Metadata often exposes usernames and software versions that help an attacker.
  4. 4. Why is OSINT considered a low-risk reconnaissance method?

    Because it relies on public data from third parties, the target sees no activity.

Summary

  • OSINT gathers publicly available information: search engines, code repositories, metadata, job posts, archives and breach summaries.
  • Search operators like site: and filetype: find documents that were never meant to be exposed.
  • Public does not mean harmless: handle personal data minimally and securely.
  • Never use discovered credentials outside the RoE; report them with a recommendation to rotate.
  • Defenders reduce exposure by removing documents, stripping metadata and scanning repositories for secrets.

Next: DNS and Subdomain Reconnaissance