SECURITY ENGINEERING · PART 5 · ETHICAL HACKING, STEP BY STEP · RECON · 60 OF 229

OSINT and Reconnaissance: Tools and Techniques

Reconnaissance is finding out what a target exposes before touching it. This episode covers open-source intelligence (OSINT): passive versus active recon, what DNS, WHOIS, certificate logs, search engines, code repositories, job adverts, staff profiles and breach data reveal, the tools used (theHarvester, Shodan, Amass), and how a security engineer runs the same recon on their own company to shrink the exposure.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 9
  9. 10
  10. 11
  11. 12
  12. 13
  13. 14
  14. 15
  15. 16
  16. 17
  17. 18
  18. 19
  19. 20
  20. 21
  21. 22
  22. 23
  23. 24
  24. 25
  25. 26
  26. 27
  27. 28
  28. 29
  29. 30
  30. 31
  31. 32
  32. 33
  33. 34
  34. 35
  35. 36
  36. 37
  37. 38
  38. 39
  39. 40
  40. 41
  41. 42
  42. 43
  43. 44
  44. 45
  45. 46
  46. 47
  47. 48
  48. 49
  49. 50
  50. 51
  51. 52
  52. 53
  53. 54
  54. 55
  55. 56
  56. 57
  57. 58
  58. 59
  59. 60
  60. 61
  61. 62
  62. 63
  63. 64
  64. 106
  65. 107
  66. 108
  67. 109
  68. 110
  69. 111
  70. 112
  71. 113
  72. 114
  73. 115
  74. 116
  75. 117
  76. 118
  77. 119
  78. 120
  79. 121
  80. 122
  81. 123
  82. 124
  83. 125
  84. 126
  85. 127
  86. 128
  87. 129
  88. 130
  89. 131
  90. 132
  91. 133
  92. 134
  93. 135
  94. 136
  95. 137
  96. 138
  97. 139
  98. 140
  99. 141
  100. 142
  101. 143
  102. 144
1 / 14

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • Passive recon is invisible
  • names, certificates, search, code, people, leaks
  • end with a map
  • run it on yourself

Notes

Passive vs active

There are two kinds of reconnaissance. Passive recon uses only third-party sources: search engines, public records and archives. The target's systems are never contacted, so it sees nothing and can detect nothing. Active recon contacts the target: queries to its DNS servers, requests to its websites, scans. That can be logged. A careful tester starts passive and stays passive as long as possible. For defenders, the lesson is uncomfortable: you cannot alert on passive recon.

Two kinds of recon
  • passive: third-party sources only; search engines, public records, archives the target sees nothing
  • active: you contact the target; DNS queries to its servers, web requests, scans it can be logged
  • start passive, stay passive as long as you can

Domains and DNS

The map starts with names. Registration records show the registrar and dates. DNS records show mail servers and name servers, and the text records are surprisingly revealing: verification entries show which email, marketing and collaboration services the company uses. Certificate transparency logs list every hostname that ever received a public certificate, including that forgotten staging site. And network registries show which address ranges the organisation owns.

What names reveal
  • WHOIS / RDAP: registrar, dates, sometimes contacts
  • DNS records: A, MX, TXT, NS
  • MX and TXT show the mail provider and SaaS in use (verification records)
  • certificate transparency: every hostname that ever got a public certificate
  • ASN lookups: IP ranges owned

Search engines

Search engines index far more than companies intend. Search operators narrow a query to one site, one file type or one word in the address. With them you find exposed documents, login and administration pages, open directory listings and forgotten subdomains. This is often called Google dorking. Run these against your own domain today. Finding a spreadsheet of customer data in a search result is unpleasant, but much better than an attacker finding it first.

search operators
site:example.com filetype:pdf
site:example.com inurl:admin
site:example.com intitle:"index of"
site:example.com -www
"@example.com" password

# known as "Google dorking"
# finds: exposed documents, login
# pages, directory listings,
# forgotten subdomains

Shodan and Censys

Shodan and Censys are search engines for devices. They continuously scan every public address and index the open ports, the service banners and the certificates. You can search by organisation, domain, product or version. They reveal exposed databases, remote desktop services, administration panels and outdated software. And it is still passive: you are reading their data, not contacting the target. Attackers use these to find victims for a new vulnerability within hours.

Device search engines
  • they scan every public IP and index open ports, banners and certificates
  • search by organisation, domain, product or version
  • finds: exposed databases, remote desktops, cameras, admin panels, old software
  • still passive: you query their data, not the target

Code and secrets

Public code is one of the richest sources. Commits contain API keys, tokens and passwords, and deleting them later does not remove them from history. Code reveals internal hostnames and addresses. Employees push work code to personal accounts. The same applies to public container images, package registries, paste sites and shared API collections. Scanners such as gitleaks and TruffleHog find secrets automatically, and attackers run them against public repositories all day.

What leaks in code
  • API keys, tokens, passwords in commits and history
  • internal hostnames and URLs
  • config files, .env files
  • personal repos of employees with work code in them
  • public Docker images, package registries, paste sites, Postman collections
  • tools: gitleaks, TruffleHog

People

People are a source too. Professional profiles give names and roles, who joined last week and who administers what. From a few addresses you learn the email format, and can then build a list for the whole company. Job adverts list the exact technology stack, down to product versions. Engineers describe their architecture in talks and ask about it on forums. Photos show badges, screens and whiteboards. All of this feeds phishing and password guessing.

What people reveal
  • professional profiles: names, roles, who is new, who is an administrator
  • email format: first.last@
  • job adverts: the exact technology stack in use
  • conference talks, blog posts, forum questions
  • photos: badges, screens, whiteboards

Breach data

Then there is breach data. Billions of email and password pairs from past breaches circulate, and people reuse passwords between personal sites and work. More recently, malware called infostealers collects saved passwords and session cookies from infected home computers, and those logs are sold. This is how many large incidents now begin. As a defender, check your domain's exposure through a legitimate service, block known-breached passwords, and require multi-factor authentication.

Leaked credentials
  • billions of email and password pairs from past breaches are in circulation
  • people reuse passwords between personal and work
  • infostealer malware logs: fresh passwords and session cookies
  • defenders: check exposure (Have I Been Pwned domain search), enforce MFA

Tools

The collection is automated. TheHarvester gathers emails and hostnames. Amass and Subfinder list subdomains. The site c r t dot s h searches certificate logs. Shodan and Censys show exposure. SpiderFoot and Maltego collect from many sources and link the results. The Wayback Machine shows old pages and endpoints that may still work. Gitleaks and TruffleHog find secrets. The tools produce lists. Deciding which items matter is the skill.

A recon toolkit
  • theHarvester: emails, hosts
  • Amass, Subfinder: subdomains
  • crt.sh: certificate logs
  • Shodan, Censys: exposure
  • SpiderFoot, Maltego: collect and link everything
  • Wayback Machine: old pages and old endpoints
  • gitleaks, TruffleHog: secrets
  • whois, dig: the basics

The output

Good reconnaissance ends with a map, not a pile of data. An asset list: domains, hosts, address ranges, cloud accounts. The technologies and versions in use. The entry points: login pages, VPNs, APIs, mail. A list of people and roles. Often some findings already, such as exposed files or leaked keys. And priorities: experienced testers look for what is old, forgotten or unusual, because that is where the weaknesses usually are.

What recon should produce
  • asset list: domains, hosts, IP ranges, cloud accounts
  • technologies and versions
  • entry points: logins, VPNs, APIs, mail
  • people: email list, roles
  • findings already: exposed files, leaked keys
  • priorities: what looks old, forgotten or unusual

Defend: recon yourself

The defense is to run this on yourself, continuously. Inventory your assets and remove forgotten hosts and DNS records. Monitor certificate logs for your domains. Scan every repository for secrets, and rotate anything that leaked. Check device search engines for your address ranges. Limit the technical detail in job adverts and public documents. Require multi-factor authentication and block breached passwords. This discipline has a name: attack surface management.

Shrink the exposure
  • inventory and remove forgotten hosts and DNS records
  • monitor certificate logs for your domains
  • secret scanning on all repos, and rotate what leaked
  • check Shodan for your ranges
  • limit detail in job adverts and public documents
  • MFA, breached-password checks
  • staff awareness of oversharing

Common mistakes

Mistakes. Skipping reconnaissance and going straight to scanning, which misses the forgotten assets where the real problems are. Actively probing a host found in recon before confirming it is in scope; a similar name may belong to another company. Handling breach data in ways the engagement does not allow. Trusting stale results. And on the defender side: having no asset inventory, and removing a leaked key from a repository without rotating it.

Avoid these
  • skipping recon and going straight to scanning
  • active probing of hosts not confirmed in scope
  • using stolen data in ways the engagement forbids
  • trusting stale results
  • defenders: no asset inventory at all
  • deleting a leaked key from git without rotating it

Say it like this

In the interview: I start passively, with DNS and registration records, certificate transparency logs, search operators, device search engines, public code repositories and breach exposure, to build a list of domains, hosts, technologies and people. I confirm everything against the scope before any active probing. And as a defender I run the same process continuously against our own organisation, as attack surface management, so we find forgotten assets and leaked secrets first.

In the interview
  • "Passive first: DNS, WHOIS, certificate transparency, search operators, Shodan, public code and breach data, to list domains, hosts, tech
  • and people. Then confirm
  • scope before active checks.
  • As a defender I run this
  • continuously on ourselves."

Interview questions

Q1What is OSINT?

Open-source intelligence: collecting and analysing information from publicly available sources such as DNS records, websites, search engines, social media, code repositories and public records. In security it is used to map an organisation's attack surface.

Q2What is the difference between passive and active reconnaissance?

Passive reconnaissance gathers information from third-party sources without interacting with the target's systems, so it is undetectable by the target. Active reconnaissance sends traffic to the target, such as DNS queries, web requests or scans, and can be logged.

Q3What is Google dorking?

Using advanced search operators such as site:, filetype:, inurl: and intitle: to find information that is indexed but not intended to be easy to find, including exposed documents, login pages, directory listings and configuration files.

Q4What is Shodan used for?

Shodan is a search engine that indexes internet-connected devices and services by scanning public IP addresses. It is used to find exposed services, outdated software and misconfigured devices, by researchers, defenders and attackers alike.

Q5What information can certificate transparency logs reveal?

Every publicly trusted TLS certificate is logged, including the hostnames it covers. Searching the logs reveals subdomains, internal naming patterns, staging and test environments and newly launched services.

Q6Is OSINT legal?

Collecting publicly available information is generally legal, but laws on privacy, data protection and terms of service still apply, and using the information to access systems without authorisation is not. Professional engagements define what recon is permitted.

Q7What is attack surface management?

The continuous discovery, inventory, classification and monitoring of an organisation's internet-facing assets and exposures, so that unknown or forgotten systems, leaked credentials and misconfigurations are found and fixed before attackers use them.

Q8How can a company reduce its OSINT exposure?

Maintain an asset inventory, remove unused hosts and DNS records, scan repositories for secrets, monitor certificate logs and breach exposure, restrict detail in public documents and job adverts, enforce MFA and train staff about oversharing.