COMP-221 · Lesson 2 of 12 · 22 min

Open-source intelligence

▶ Video coming soon A video version of this lesson is on the way.

On September 21, the first day the rules of engagement allowed passive research, Tobias arrived early with a fresh notebook. Dario told him to close the browser tabs he had already opened. Before searching anything, he said, write down what you are looking for, where you will look, and how you will record it. Open-source intelligence rewards patience and punishes wandering.

This lesson covers open-source intelligence (OSINT): information gathered from publicly available sources. It maps to objective 2.1, which lists OSINT sources such as social media, job boards, code repositories, DNS lookups, cached pages, cryptographic flaws and password dumps, along with search engine analysis and HTML scraping; to objective 2.2 for email account enumeration; and to objective 2.4, which names the OSINT tools you should recognize: the Wayback Machine, Maltego, Recon-ng, SpiderFoot, Hunter.io, theHarvester and OSINTframework.com.

What counts as open source

Open source here means legally and publicly available, not open-source software. It includes anything a member of the public could find without breaking in, deceiving anyone or breaching a service's terms: websites, public filings, news, social media posts visible to the public, job advertisements, conference talks, published code, registration records and data collected by internet-wide scanning services. It does not include information obtained by logging in with someone else's account, buying stolen data, or tricking an employee into revealing something. The first is OSINT; the rest are attacks, and only some of them, such as a phishing simulation, can be authorized in a test.

OSINT is passive in the sense that matters for most rules of engagement: it does not send attributable traffic to the client's systems. That makes it ideal for the period before active testing starts. It also mirrors what real attackers do first. Much of what a criminal group knows about a target before its first phishing email comes from exactly these sources, which is why a client benefits from seeing its own OSINT footprint laid out.

A central box labeled Prairiefold external profile with six sources pointing to it. Above: website and annual report revealing branches, executives and technology partners; job postings revealing products, versions and cloud services; code repositories revealing hostnames, configuration and leaked secrets. Below: social media and professional sites revealing staff names, roles and email format; breach and paste indexes revealing exposed accounts, to be reported and never reused; cached and archived pages revealing old portals, removed pages and past contacts.
The main OSINT sources and the kind of information each tends to reveal.

The organization's own publications

Start with what the client says about itself. Prairiefold's public website listed its roughly forty branches with addresses and opening hours, named its executive team and board, and linked to an annual report. The annual report mentioned a core banking modernization project and named the processor that hosted online banking. A news release from the previous year announced a move to Microsoft 365. A vendor's case study, easily found by searching the credit union's name, described how Prairiefold had deployed a particular brand of branch firewall.

None of this was secret, and none of it was a vulnerability on its own. Together, it told the team the shape of the organization: a hybrid environment with on-premises Active Directory and Microsoft cloud services, a known firewall vendor at branches, a third party for online banking and a public list of every physical location. That shape guided which questions to ask next.

Job postings

Job postings are among the richest OSINT sources for technology. An organization hiring a systems administrator will often list the products it runs, sometimes with versions, because it wants candidates with the right experience. Tobias found two current Prairiefold postings and one archived one.

What three job postings revealed about Prairiefold's technology.
Posting text (paraphrased)What it suggests
Experience administering Windows Server 2019 and 2022 and Active DirectoryOn-premises directory; servers that may span several versions
Familiarity with Microsoft Entra ID, Intune and Defender for EndpointCloud identity, device management and endpoint detection in use
Support for branch network equipment from a named firewall vendorConsistent branch firewall platform
Experience with a named IT service management platformA ticketing system that may be internet-facing
Archived posting: maintain legacy file transfer server for statement deliveryA file transfer service that may still exist

The defensive lesson is not to stop advertising jobs, but to describe skills rather than specific versions and internal system names. Ironwhistle's report later recommended exactly that.

People: social media and professional sites

Staff names, roles and reporting lines matter for two reasons. They help design a social engineering assessment, which in this engagement was a limited phishing simulation agreed with human resources. And they reveal patterns, such as email address format and account naming, that later enumeration depends on.

Professional networking sites showed dozens of Prairiefold employees with their job titles. Combined with the email addresses published on the website for branch managers, the team could infer the address format: first initial plus surname at the credit union's domain. Conference talk videos and slides by Prairiefold's IT staff mentioned the virtual desktop platform used at branches. A public photo on the credit union's social media account, celebrating a branch renovation, showed a staff badge clearly enough to note its design for the physical assessment.

Ironwhistle kept people data to a minimum. It recorded the email format, a count of identifiable employees by department, and the names of a small number of staff whose public profiles revealed technical details worth reporting. It did not build profiles of individuals' private lives, and it destroyed the working notes at the end of the engagement. That restraint is both an ethical choice and a legal one, because staff details are personal information.

Code repositories

Public code repositories are a classic source of serious findings. Developers sometimes publish code that contains internal hostnames, configuration files, connection strings, API keys or passwords, either by mistake or because a contractor reused code from a client project. Searching code hosting sites for the client's domain names, distinctive internal names and product names can reveal them.

Priyanka ran this part. She found a public repository belonging to a former Prairiefold contractor that contained a deployment script for an internal reporting tool. The script referenced an internal server name and included what looked like an API key for a test environment. Under the rules of engagement, found credentials were to be reported to the sponsor and not used unless Gwendolyn approved their use in writing. Priyanka recorded the repository address, the commit, and a partial, masked copy of the key, and Dario called Gwendolyn the same day. Prairiefold confirmed the key belonged to a retired test system, revoked it anyway, and asked the contractor to remove the repository.

Searching code repositories during OSINT.
What to search forWhy
The client's domains and subdomainsConfiguration files and scripts often contain hostnames
Distinctive internal names found elsewhereLinks code to the organization even without the domain
Product names plus the client's nameIntegration code written for the client
Commit history, not just current filesA secret removed from the latest version may survive in history
Staff and contractor accountsPersonal repositories sometimes hold work code

The defensive pairing is secret scanning on the organization's own repositories, contracts that forbid contractors from publishing client code, and a fast process to revoke any secret that leaks, because once a secret is public it must be treated as compromised even if it is removed.

Search engine analysis

Search engines index far more than organizations realize. Advanced search operators narrow results to the client's domain, particular file types or text in titles and addresses. The technique is sometimes called search engine dorking, after collections of useful queries.

Common search operators. Support and exact syntax vary between search engines.
OperatorEffectExample use
site:Limit results to one domain or subdomainFind indexed pages on a forgotten subdomain
filetype: or ext:Limit to a file typeFind public PDF or spreadsheet documents
intitle:Words in the page titleFind default login or index pages
inurl:Words in the addressFind paths containing admin or test
Quotation marksExact phraseSearch for a distinctive internal project name
Minus signExclude a term or siteRemove the main website to see other hosts

Tobias's searches found a public PDF of an old member brochure whose document properties named the author's Windows account, confirming the account naming format, and an indexed directory listing on a marketing subdomain. Document metadata is a frequent source of usernames, software versions and internal file paths. Tools exist to extract it in bulk, but reading the properties of a handful of documents is often enough to make the point.

Cached and archived pages

The Wayback Machine at the Internet Archive stores snapshots of web pages over time. Old snapshots can reveal pages the organization has since removed: an old member portal address, a former staff directory, a test page, or a list of partners. Search engine caches serve a similar purpose for recent changes. For Prairiefold, a 2019 snapshot of the website linked to a statement download page on a separate hostname, which matched the archived job posting about a legacy file transfer server. Neither proved the server still existed, but both went onto the list for DNS research and active confirmation later.

Password dumps and breach data

Objective 2.1 lists password dumps as an OSINT source, and this is where ethics matter most. Collections of credentials stolen in other organizations' breaches circulate widely. Staff who reused their work email for a personal account may appear in them. An attacker would try those passwords against the client's login pages.

A professional tester handles this differently. Ironwhistle's rules of engagement allowed checking whether Prairiefold addresses appeared in breach notification services, which report that an address was involved in a breach without revealing passwords. Some services let a domain owner see all affected addresses after verifying ownership, so Ironwhistle asked Felix to run the domain search himself and share the counts. The team did not download or buy credential dumps, and did not try any breached password. The finding, that a number of staff addresses appeared in third-party breaches, went into the report with recommendations: enforce multifactor authentication everywhere, block known breached passwords at password change, and remind staff not to reuse work credentials.

Cryptographic flaws visible from outside

The objectives also list cryptographic flaws as an OSINT source. Some weaknesses can be seen without touching the target, because third parties have already recorded them. Internet scanning services store the certificates and TLS settings they observed; certificate transparency logs show every certificate issued for a domain, including weak key sizes, wildcard certificates spread across many hosts or certificates issued by an unexpected authority. Public code may contain hard-coded keys. These observations become hypotheses to confirm, and sometimes findings in their own right, such as a public service still offering outdated protocol versions.

OSINT tools

Manual searching teaches judgment, but tools save time and make results repeatable. The exam expects you to know what each named tool does.

OSINT tools named in objective 2.4.
ToolWhat it doesTypical output
theHarvesterQueries search engines and data sources for email addresses, names, subdomains and hosts related to a domainLists of emails, hostnames and IP addresses, with the source of each
Recon-ngA modular reconnaissance framework with workspaces, modules from a marketplace, and a database of resultsTables of hosts, contacts and credentials found, stored per workspace
MaltegoA graphical link-analysis tool that runs transforms to expand entities such as domains, people and addresses into related entitiesA graph showing relationships between entities
SpiderFootAutomates OSINT collection across many modules, with a passive mode that avoids touching the targetCategorized findings, from DNS names to leaked data mentions
Hunter.ioFinds published email addresses for a domain and infers the address patternEmail format with a confidence level and example addresses
OSINTframework.comA categorized directory of OSINT resources and toolsLinks to sources by category; it does not collect data itself
Wayback MachineArchived snapshots of web pages over timeHistorical versions of pages and lists of archived addresses

theHarvester is a command-line tool. A typical run names the domain, the data sources to query and a limit on results. Recon-ng works like a shell: you create a workspace for the engagement, install and load modules, set options such as the source domain, and run them, building up a database the team can export.

Illustrative theHarvester and Recon-ng usage. The -b option takes one or more source names, which change between versions; check the tool's help for the current list. Module paths in Recon-ng also change; search the marketplace.
# Passive collection of names and addresses for the client domain
theHarvester -d prairiefold.example -b <source> -l 200 -f pf-harvest

# Recon-ng: a workspace per engagement keeps results separate
recon-ng -w prairiefold
[recon-ng][prairiefold] > marketplace install recon/domains-hosts/certificate_transparency
[recon-ng][prairiefold] > modules load recon/domains-hosts/certificate_transparency
[recon-ng][prairiefold] > options set SOURCE prairiefold.example
[recon-ng][prairiefold] > run

Tools reflect their data sources. A source that is down, rate limited or requires an API key will silently return less. Good practice is to record which sources each run used and when, so a later reader understands why two runs differ.

Scraping and email enumeration

Objective 2.1 mentions HTML scraping: extracting structured information, such as names, email addresses and links, from web pages automatically. Scraping the client's own public website is normally within passive rules if done gently, but scraping third-party sites must respect their terms and robots directives. A short script that downloads a page and pulls out every email address is a typical example of the scripting covered in lesson 11.

Email account enumeration starts passively: collect published addresses, infer the format, and build a candidate list from staff names. Some techniques go further and ask a mail server or identity service whether an address exists, for example by observing how a server responds to a recipient during an SMTP conversation, or how a cloud sign-in page responds to a username. Those are active techniques, because they send requests to the client's systems, and they can lock accounts or trigger alerts if overused. Ironwhistle left them for the active window and kept them within the rate limits agreed in the rules of engagement. Lesson 9 returns to identity services in the cloud.

Worked problem

Building an email candidate list

The website lists three branch managers' addresses: jmorales, akowalczyk and pdesrosiers at the credit union's domain. A professional site lists 60 more employees by name. Hunter.io reports the pattern first initial plus last name with high confidence. How should Tobias build and qualify the list?

Show solution
  1. Confirm the pattern from at least two independent sources: the published addresses and Hunter.io agree.
  2. Generate candidate addresses for the 60 names using the pattern, noting edge cases such as hyphenated or duplicate names.
  3. Mark each candidate as inferred, not confirmed, with the source of the name.
  4. Do not validate addresses against the mail server until the active window, and then only within agreed rate limits.
  5. Store the list on the engagement share and include it in the data destruction plan.

Answer: A list of inferred addresses, labeled with sources and confidence, ready to support the phishing simulation design but not validated against live systems during the passive phase.

Turning OSINT into findings and defenses

By the end of the first week, the team had a long list of observations. Dario taught Tobias to sort them into three piles: facts that shape the test plan (technology, locations, address format), hypotheses to confirm in the active window (the legacy file transfer server, the marketing subdomain), and findings to report now because the client could act on them straight away (the leaked API key, the indexed directory listing). The third pile was short, which was good news for Prairiefold.

Every OSINT finding needs a defensive recommendation. Common ones include: an OSINT review of the organization's own footprint at least yearly; guidance for staff on what to share publicly about their work; metadata stripping for published documents; secret scanning and rapid revocation; removal of stale DNS records and archived pages where possible; and multifactor authentication to blunt the value of any breached password.

Common mistakes

  • MistakeDownloading leaked credential dumps to check staff passwords.

    InsteadUse breach notification services, ask the client to run owner-verified searches, and never use breached passwords.

  • MistakeUsing a found API key to see what it can access.

    InsteadRecord it, mask it, report it to the sponsor and use it only with written approval.

  • MistakeValidating email addresses against the client's mail server during the passive phase.

    InsteadTreat server-side validation as active and keep it to the testing window and rate limits.

  • MistakeRecording only the result of a tool run.

    InsteadRecord the sources queried, the date and any limits, so results can be reproduced.

  • MistakeBuilding detailed personal profiles of staff.

    InsteadKeep people data to what the test needs and destroy it at the end.

Summary and key terms

  • OSINT is information from legally and publicly available sources, gathered without attributable contact with target systems.
  • Key sources: the organization's own publications, job postings, social media, code repositories, search engines, archives, breach indexes and third-party scan data.
  • Job postings and document metadata often reveal technology, versions and account naming.
  • Found secrets are reported and masked, not used without written approval.
  • theHarvester, Recon-ng, Maltego, SpiderFoot, Hunter.io, OSINTframework.com and the Wayback Machine are the named OSINT tools.
  • Email enumeration is passive when inferring formats and active when querying the client's servers.
  • Every OSINT finding is paired with a way to reduce the footprint.
OSINT
Open-source intelligence: information gathered from publicly available sources.
Search engine dorking
Using advanced search operators to find specific exposed content.
Metadata
Data about a file, such as author, software and paths, stored inside documents and images.
Transform
In Maltego, an operation that expands one entity into related entities.
Workspace
In Recon-ng, a separate database for one engagement's results.
HTML scraping
Automatically extracting structured data from web pages.
Breach notification service
A service that reports whether an address appeared in known breaches without revealing passwords.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. A job posting asks for experience with a specific version of a VPN product. Why does that matter to a tester and to the client?

    Show answer

    It suggests the product and version in use, guiding later testing; the client should describe skills without disclosing exact versions.

  2. Which tool would you use to visualize relationships between a domain, its name servers, email addresses and people?

    Show answer

    Maltego, using transforms on a graph.

  3. Why search commit history and not just current files in a code repository?

    Show answer

    Secrets removed from the latest version can remain in earlier commits.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz