Skip to content
LATEST

🚀 Welcome to Upgradix by Shrash Studio – Your destination for free technology learning and career growth.

Upgradix
Upgradix Code. Learn. Ship.
Updated Dec 01, 2026

Ethical Hacking - Passive Reconnaissance & OSINT (Open-Source Intelligence)

Passive Reconnaissance & OSINT (Open-Source Intelligence)

Before a penetration tester runs a single port scan—or before a defender can lock down an organization's perimeter—they need a complete picture of what is exposed on the internet. Passive Reconnaissance and OSINT (Open-Source Intelligence) let you map domains, subdomains, cloud infrastructure, tech stacks, and even leaked credentials using publicly indexed data, without ever sending a direct packet to the target's servers.

Because passive recon interacts only with third-party registries, search engines, and certificate logs, it leaves zero footprint in the target's firewall or intrusion detection logs. For security engineers and blue teams, running this exact workflow against your own organization is the fastest way to discover shadow IT before an attacker does.

What you will learn
  • How passive reconnaissance differs from active scanning and why it stays invisible to target logs.
  • How to extract intelligence from WHOIS, DNS records (A, MX, TXT, NS, CNAME), and Certificate Transparency logs.
  • How to uncover exposed files, leaked API keys, and internet-facing services using Google Dorking, GitHub search, and Shodan/Censys.
  • Hands-On Lab: Map an organization's external attack surface, enumerate subdomains with crt.sh, subfinder, and amass, and check for leaked keys—without touching target servers.
Authorization & Ethics: Always perform reconnaissance only on domains you own, have explicit written permission to test, or that fall within an authorized bug bounty program's scope. In this guide, we use example.com as a safe placeholder.

1. Passive vs. Active Reconnaissance

Understanding the boundary between passive and active recon is critical in security assessments. Sending an HTTP request or a SYN packet directly to a target server crosses into active recon.

Attribute Passive Reconnaissance (OSINT) Active Reconnaissance
Target Interaction None – queries only third-party caches and public indexes Direct – sends packets directly to target IPs/hosts
Detection Risk Zero in target WAF/IDS/SIEM logs High – triggers rate limits, IDS alerts, and firewall logs
Data Freshness Slightly cached (hours to days old) Real-time live state of ports and services
Common Tools crt.sh, subfinder, amass -passive, Shodan, Censys, Google, GitHub nmap, masscan, ffuf, nuclei

2. Architecture: Zero-Touch OSINT Data Flow

In a passive workflow, your workstation never communicates with the target's servers. Instead, you query public aggregators that have already collected DNS records, SSL/TLS certificates, code repositories, and internet-wide port banners.

Passive OSINT Workflow (Zero Direct Traffic to Target)

1. Recon Analyst subfinder / amass crt.sh / shodan Passive Mode Only WHOIS & Public DNS A, MX, TXT, NS, CNAME CT Logs (crt.sh) TLS Certs & Subdomains Shodan & Censys Open Ports & Banners Google & GitHub Dorks & Leaked API Keys 2. Attack Surface Map ✓ Subdomain Inventory ✓ Cloud / IP Footprint ✓ Exposed Secret Alerts Target Servers Zero Direct Packets Sent WAF / IDS Logs: Clean

All intelligence flows from public third-party registries and search engines into your attack surface inventory, leaving the target's servers completely untouched.

3. Core Passive OSINT Techniques

WHOIS & ASN Ownership

WHOIS records reveal domain registrars, creation/expiration dates, name servers, and sometimes registrant organization names. Combining WHOIS with ASN (Autonomous System Number) lookups helps you discover entire IPv4/IPv6 CIDR blocks owned by an enterprise.

DNS Records Breakdown

Querying public DNS resolvers (1.1.1.1 or 8.8.8.8) gives you a blueprint of an organization's cloud providers, email gateways, and SaaS integrations.

Record Type What It Maps Security & OSINT Value
A / AAAA Domain to IPv4 / IPv6 address Identifies hosting provider (AWS, Azure, Cloudflare, on-prem)
MX Mail Exchange servers Reveals email platform (Google Workspace, Microsoft 365, Proofpoint)
TXT Arbitrary verification & policy text Exposes SPF/DMARC policies and third-party SaaS tools (Atlassian, Stripe, DocuSign, AWS SES)
NS Authoritative Name Servers Shows DNS provider (Route 53, Cloudflare, self-hosted BIND)
CNAME Canonical Name (alias) Points to external SaaS/CDN endpoints; dangling CNAMEs indicate subdomain takeover risk

Certificate Transparency (CT) Logs

Every time a Certificate Authority (like Let's Encrypt or DigiCert) issues a public TLS certificate, it must append it to public Certificate Transparency logs. Even internal-sounding subdomains like staging-api.example.com or vpn-dev.example.com appear in CT logs the moment an HTTPS certificate is issued.

Google Dorking

Search engines index far more than marketing pages—they frequently cache forgotten admin panels, directory listings, and configuration files. Useful operators include:

  • site:example.com filetype:pdf OR filetype:xlsx – Locate public documents that may contain metadata or internal diagrams.
  • site:example.com inurl:admin OR inurl:login OR inurl:staging – Discover exposed portals and non-production environments.
  • site:example.com intitle:"index of" – Find misconfigured open directory listings.
  • site:example.com ext:env OR ext:log OR ext:bak – Spot accidentally indexed environment or backup files.

GitHub Secret Leaks

Developers occasionally commit .env files, cloud access keys, or internal webhook URLs to public repositories or personal gists. Searching GitHub with targeted queries uncovers these leaks passively:

  • "example.com" AND ("AKIA" OR "api_key" OR "secret_key")
  • org:target-org filename:.env OR filename:appsettings.json
  • "example.com" AND ("Bearer " OR "ghp_" OR "xoxb-")

Shodan & Censys Infrastructure Discovery

Shodan and Censys continuously scan the entire IPv4 internet and index open ports, service banners, HTTP titles, and TLS certificate metadata. Instead of running nmap against a target, you query their databases:

  • Shodan: ssl.cert.subject.cn:"example.com" or org:"Example Corporation" port:22,3389,8080
  • Censys: services.tls.certificates.leaf_data.names: "example.com"

4. Hands-On Lab: Map an Organization's External Attack Surface

In this lab, you will build a repeatable passive recon workflow that maps DNS records, discovers exposed subdomains using crt.sh, subfinder, and amass, and checks for exposed infrastructure and leaked keys—without sending a single packet to the target.

Prerequisites

  • Linux, macOS, or WSL2 terminal with curl, jq, whois, and dig
  • subfinder (ProjectDiscovery) and amass (OWASP) installed
  • Optional: Shodan CLI (shodan init <API_KEY>) for infrastructure queries

Step 1: Collect WHOIS and DNS Intelligence

Create a workspace directory and query public WHOIS and DNS records via Cloudflare's public resolver (1.1.1.1).

Run WHOIS and DNS lookups

TARGET="example.com"
mkdir -p "osint-${TARGET}" && cd "osint-${TARGET}"

# 1. WHOIS registration details
whois "$TARGET" | grep -iE "Registrar:|Creation Date:|Name Server:|OrgName:" > whois-summary.txt

# 2. Query A, MX, TXT, NS, and CNAME records via public resolver
for rtype in A MX TXT NS CNAME; do
  echo "=== $rtype RECORDS ==="
  dig @1.1.1.1 "$TARGET" "$rtype" +short
done | tee dns-records.txt

Expected output (sample)

=== A RECORDS ===
93.184.215.14
=== MX RECORDS ===
10 aspmx.l.google.com.
=== TXT RECORDS ===
"v=spf1 include:_spf.google.com include:sendgrid.net ~all"
"atlassian-domain-verification=8f3a9c..."
=== NS RECORDS ===
a.iana-servers.net.
b.iana-servers.net.
=== CNAME RECORDS ===

Step 2: Passive Subdomain Enumeration (crt.sh, subfinder, amass)

Combine three independent passive sources to maximize coverage. Notice that we pass -passive to Amass so it never performs active DNS brute-forcing.

Enumerate subdomains passively

# 1. Query Certificate Transparency logs via crt.sh JSON API
curl -s "https://crt.sh/?q=%25.${TARGET}&output=json" \
  | jq -r '.[].name_value' \
  | sed 's/\*\.//g' \
  | sort -u > subs-crtsh.txt

# 2. Run ProjectDiscovery subfinder (passive by default)
subfinder -d "$TARGET" -silent -o subs-subfinder.txt

# 3. Run OWASP Amass in strict passive mode
amass enum -passive -d "$TARGET" -o subs-amass.txt

# 4. Merge and deduplicate into a master subdomain inventory
cat subs-crtsh.txt subs-subfinder.txt subs-amass.txt \
  | tr '[:upper:]' '[:lower:]' \
  | sort -u > all-subdomains.txt

echo "Total unique subdomains discovered: $(wc -l < all-subdomains.txt)"
head -n 10 all-subdomains.txt

Expected output (sample)

Total unique subdomains discovered: 24
api.example.com
auth.example.com
dev-portal.example.com
docs.example.com
mail.example.com
staging-api.example.com
status.example.com

Step 3: Passive Infrastructure & Secret Leak Checks

Use Shodan's passive index to see what ports and services are already known for the domain, and check for dangling CNAMEs or exposed secrets.

Query Shodan & check CNAME records passively

# 1. Shodan passive search by SSL certificate hostname (no packets sent to target)
shodan search --fields ip_str,port,org,http.title "ssl.cert.subject.cn:${TARGET}" > shodan-hosts.txt

# 2. Check discovered subdomains for CNAME records via public DNS
while read -r sub; do
  cname=$(dig @1.1.1.1 "$sub" CNAME +short)
  if [ -n "$cname" ]; then
    echo "$sub -> $cname"
  fi
done < all-subdomains.txt | tee cname-map.txt

Expected output (sample)

docs.example.com -> example-docs.github.io.
status.example.com -> stats.uptimerobot.com.
staging-api.example.com -> old-bucket.s3.amazonaws.com.
Why CNAME mapping matters: If staging-api.example.com points to an unclaimed S3 bucket or deleted Heroku/Azure app, an attacker could register that resource and take over the subdomain.

Step 4: Passive GitHub Secret Leak Verification

Using the GitHub CLI (gh) or GitHub's web search, check whether any public repositories mention your domain alongside sensitive key patterns.

Search public GitHub code passively

# Search for potential API keys or tokens referencing the target domain
gh search code "\"${TARGET}\" AND (\"AKIA\" OR \"api_key\" OR \"xoxb-\" OR \"ghp_\")" \
  --limit 20 \
  --json repository,path,url \
  | jq -r '.[] | "\(.repository.fullName) | \(.path) | \(.url)"' > github-leaks.txt

cat github-leaks.txt

5. Step-by-Step Execution Breakdown

Step 1 – Ownership & DNS Profiling: WHOIS and DNS (MX, TXT) immediately reveal the target's email provider, CDN, and third-party SaaS integrations.
Step 2 – Multi-Source Subdomain Aggregation: Combining crt.sh, subfinder, and amass -passive catches both newly issued TLS certificates and historical DNS entries.
Step 3 – Infrastructure & CNAME Mapping: Shodan/Censys expose open ports and banners from their global crawlers, while CNAME lookups highlight potential subdomain takeovers.
Step 4 – Leak Triage: Google Dorks and GitHub code searches surface accidentally published credentials, staging URLs, and internal configuration files so teams can rotate keys immediately.

6. Hands-On Practice

Beginner Exercise 1: SaaS Footprint Audit

Run dig @1.1.1.1 <your-domain> TXT +short on your own domain (or a public tech company's domain) and list at least three third-party SaaS vendors revealed solely by verification TXT records.

Intermediate Exercise 2: Filter Non-Production Subdomains

Using your all-subdomains.txt file, write a one-line grep command to isolate high-value targets containing keywords like dev, staging, uat, admin, or vpn.

Hint: Use grep -iE "(dev|staging|uat|admin|vpn)" all-subdomains.txt.

Advanced Exercise 3: Automate Weekly Passive Diffs

Wrap Steps 1–3 into a scheduled CI job that compares today's all-subdomains.txt against yesterday's snapshot using comm -13 and alerts your security channel whenever a new subdomain appears in CT logs.

7. Interview Questions

Q1. Why do Certificate Transparency logs reveal internal or staging subdomains?

Answer: Publicly trusted Certificate Authorities are required by browser vendors to log every issued TLS certificate to public, append-only CT logs. If a team uses Let's Encrypt or a public CA for an internal or staging host (like staging-db.example.com), that hostname becomes publicly searchable via tools like crt.sh.

Q2. What can a security engineer learn from a domain's TXT records?

Answer: TXT records often contain SPF and DMARC email authentication policies (showing whether email spoofing is possible) as well as domain-ownership verification tokens for SaaS platforms like Google Workspace, Microsoft 365, Atlassian, Slack, and cloud providers.

Q3. How do Shodan and Censys let you discover open ports without triggering the target's IDS?

Answer: Shodan and Censys operate their own distributed internet-wide scanners that continuously index banners, ports, and certificates. When you query their APIs or web portals, your requests go only to Shodan/Censys servers—never to the target organization.

Conclusion

Passive Reconnaissance and OSINT prove that you don't need noisy port scanners to understand an organization's external attack surface. By systematically combining WHOIS, DNS records, Certificate Transparency logs, Shodan/Censys, Google Dorks, and GitHub searches, you can map exposed subdomains, cloud dependencies, and leaked secrets cleanly and silently.

Run this workflow regularly against your own domains to catch shadow IT, dangling CNAMEs, and accidental key leaks before anyone else does.

Official Documentation

Upgradix by Shrash Studio – Learn Technology. Build Your Future.

Discussion & Comments

0
Guest mode · Login / Register
Post directly as a guest or log in first.

No comments yet

Start the discussion above — ask a question, share a tip, or reply to a comment.

This article is protected. Printing and saving as PDF are disabled.