Performing Open Source Intelligence Gathering
Legal Notice: This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.
Overview
Open Source Intelligence (OSINT) gathering is the first active phase of a red team engagement, where operators collect publicly available information about the target organization to identify attack surfaces, potential targets for social engineering, technology stacks, and credential exposures. Effective OSINT directly shapes initial access strategies and reduces operational risk.
When to Use
Trigger phrases:
"performing open source intelligence gathering"
"Open Source Intelligence (OSINT) gathering is the first active phase of a red te"
When conducting security assessments that involve performing open source intelligence gathering
When following incident response procedures for related security events
When performing scheduled security testing or auditing activities
When validating security controls through hands-on testing
Prerequisites
- Familiarity with red teaming concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
Objectives
- Enumerate the target organization's external attack surface (domains, IPs, cloud assets)
- Identify employees and their roles for social engineering targeting
- Discover leaked credentials, API keys, and sensitive documents
- Map the organization's technology stack and vendors
- Identify physical locations, office layouts, and access control details
- Build target profiles for spearphishing campaign development
Core Concepts
This section covers core concepts for performing open source intelligence gathering.
- Ensure all prerequisites are met before proceeding
- Follow the documented workflow steps in sequence
- Record results and any anomalies encountered during this phase
OSINT Categories
| Category |
Sources |
Value |
| Domain Intelligence |
DNS records, WHOIS, CT logs, subdomain enumeration |
Network attack surface |
| Personnel Intelligence |
LinkedIn, social media, conference talks, publications |
Social engineering targets |
| Credential Intelligence |
Breach databases, paste sites, GitHub leaks |
Valid credential discovery |
| Technology Intelligence |
Job postings, Wappalyzer, Shodan, Censys |
Vulnerability identification |
| Physical Intelligence |
Google Maps, social media photos, Glassdoor |
Physical access planning |
| Document Intelligence |
SEC filings, public documents, metadata extraction |
Organizational structure |
MITRE ATT&CK Mapping
- T1595.001 - Active Scanning: Scanning IP Blocks
- T1595.002 - Active Scanning: Vulnerability Scanning
- T1592 - Gather Victim Host Information
- T1589 - Gather Victim Identity Information
- T1590 - Gather Victim Network Information
- T1591 - Gather Victim Org Information
- T1593 - Search Open Websites/Domains
- T1594 - Search Victim-Owned Websites
- T1596 - Search Open Technical Databases
Workflow
# Example: IOC detection
import re
IOC_PATTERNS = {
"ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",
"domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",
"hash_md5": r"\b[a-f0-9]{32}\b",
"hash_sha256": r"\b[a-f0-9]{64}\b",
}
def extract_iocs(text: str) -> dict:
return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}
- Scope and authorize — confirm written authorization and define target boundaries
- Reconnaissance — enumerate targets, services, and potential attack surfaces
- Exploitation — attempt exploitation of identified vulnerabilities within scope
- Post-exploitation — document access level, lateral movement, and data exposure
- Report and remediate — compile findings with reproduction steps and fix recommendations
Phase 1: Domain and Network Reconnaissance
- Perform WHOIS lookups for target domains
- Enumerate subdomains using Certificate Transparency logs, DNS brute-force, and web scraping
- Identify IP ranges and ASN ownership
- Scan for exposed services using Shodan/Censys
- Check for cloud storage buckets (S3, Azure Blob, GCS)
- Map CDN and hosting providers
Phase 2: Personnel and Social Intelligence
- Enumerate employees via LinkedIn, company website, and conference speaker lists
- Identify email naming conventions
- Discover personal social media accounts of key targets
- Map organizational hierarchy and reporting structure
- Identify recently hired IT/security personnel
- Check for conference presentations and technical publications
Phase 3: Credential and Data Leak Discovery
- Search breach databases (Have I Been Pwned, DeHashed)
- Check paste sites (Pastebin, GitHub Gists)
- Search GitHub/GitLab for leaked secrets and API keys
- Look for exposed configuration files and backups
- Check for leaked internal documents via Google dorking
Phase 4: Technology Stack Identification
- Analyze job postings for technology mentions
- Use Wappalyzer/BuiltWith for web technology fingerprinting
- Check for exposed admin panels and development environments
- Identify VPN and remote access technologies
- Map cloud services and SaaS applications
Defensive OSINT (Threat Intelligence)
When investigating external threat actors rather than preparing for red team operations, OSINT collection must remain strictly passive (no packets sent to target systems). Use this parallel workflow:
- Scope — Define research questions (e.g., "which threat actor targets our sector?"), identify data sources, set time boundaries
- Gather — Collect data from passive sources only: WHOIS records, passive DNS (SecurityTrails), certificate transparency logs (crt.sh), breach databases (Have I Been Pwned), dark web monitoring, Shodan historical data
- Synthesize — Enrich threat actor profiles with publicly observable indicators (IPs, domains, SSL certs, ASN data). Cross-reference findings with MITRE ATT&CK and known campaign indicators. Produce actionable threat intelligence reports
Key differences from offensive OSINT:
- No active scanning (no Nmap, no direct DNS queries to target)
- Focus on attribution and campaign tracking, not attack surface mapping
- Output is threat intelligence report, not red team recon report
- Emphasis on IOC extraction and enrichment, not exploitation planning
When NOT to Use
- You don't have explicit written authorization to test
- Task is about defense/detection, not offense (use detection skills)
- You need to implement security controls (use implementing-* skills)
- Task requires compliance auditing (use auditing-* skills)
- You're investigating an incident (use incident response skills)
- Target is out of scope for your engagement
- Task is about vulnerability scanning only (use scanning tools)
Red Flags
- Performing actions without explicit written authorization from the asset owner
- Testing against production systems without a defined scope and rules of engagement
- Exceeding the authorized scope of the engagement
- Leaving persistent access mechanisms without explicit approval
- Causing denial-of-service on production systems during testing
Verification
- All steps executed successfully against a test environment before production use
- Output documented with screenshots or logs demonstrating expected behavior
- All exploited vulnerabilities documented with reproduction steps
- Scope boundaries confirmed — only authorized targets were tested
- Remediation recommendations included for every finding
Tools and Resources
| Tool |
Purpose |
Type |
| Amass |
Subdomain enumeration and network mapping |
Open Source |
| Subfinder |
Passive subdomain discovery |
Open Source |
| theHarvester |
Email, subdomain, and name harvesting |
Open Source |
| Maltego |
Visual link analysis and data correlation |
Commercial |
| SpiderFoot |
Automated OSINT collection |
Open Source |
| Shodan |
Internet-connected device search |
Commercial |
| Censys |
Internet asset discovery |
Commercial |
| Recon-ng |
Web reconnaissance framework |
Open Source |
| SecurityTrails |
Passive DNS historical data |
Commercial |
| crt.sh |
Certificate transparency log search |
Free |
| Have I Been Pwned |
Breached credential search |
Free |
| DomainTools |
WHOIS history and domain intelligence |
Commercial |
| GitDorker |
GitHub secret scanning |
Open Source |
| Photon |
Web crawler for OSINT |
Open Source |
Validation Criteria
Process
- Analyze the task requirements
- Apply domain expertise
- Verify output quality
Anti-Rationalization Table
| Rationalization |
Reality |
| "We are too small to be targeted" |
Automated attacks target everyone. Size does not matter. |
| "Security slows us down" |
A breach slows you down 100x more. Build security in from the start. |
| "We will fix it after launch" |
Vulnerabilities in production are exploited within hours. Fix before deploy. |
1---2name: performing-open-source-intelligence-gathering3description: Use when open Source Intelligence (OSINT) gathering is the first active phase of a red team engagement, where operators collect publicly available information about the target organization to identify attack s. Use when working with performing open source intelligence gathering.4license: Apache-2.05---67# Performing Open Source Intelligence Gathering8910> **Legal Notice:** This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.1112## Overview1314Open Source Intelligence (OSINT) gathering is the first active phase of a red team engagement, where operators collect publicly available information about the target organization to identify attack surfaces, potential targets for social engineering, technology stacks, and credential exposures. Effective OSINT directly shapes initial access strategies and reduces operational risk.151617## When to Use18**Trigger phrases:**19- "performing open source intelligence gathering"20- "Open Source Intelligence (OSINT) gathering is the first active phase of a red te"212223- When conducting security assessments that involve performing open source intelligence gathering24- When following incident response procedures for related security events25- When performing scheduled security testing or auditing activities26- When validating security controls through hands-on testing2728## Prerequisites2930- Familiarity with red teaming concepts and tools31- Access to a test or lab environment for safe execution32- Python 3.8+ with required dependencies installed33- Appropriate authorization for any testing activities3435## Objectives3637- Enumerate the target organization's external attack surface (domains, IPs, cloud assets)38- Identify employees and their roles for social engineering targeting39- Discover leaked credentials, API keys, and sensitive documents40- Map the organization's technology stack and vendors41- Identify physical locations, office layouts, and access control details42- Build target profiles for spearphishing campaign development4344## Core Concepts4546This section covers core concepts for performing open source intelligence gathering.4748- Ensure all prerequisites are met before proceeding49- Follow the documented workflow steps in sequence50- Record results and any anomalies encountered during this phase51### OSINT Categories5253| Category | Sources | Value |54|----------|---------|-------|55| Domain Intelligence | DNS records, WHOIS, CT logs, subdomain enumeration | Network attack surface |56| Personnel Intelligence | LinkedIn, social media, conference talks, publications | Social engineering targets |57| Credential Intelligence | Breach databases, paste sites, GitHub leaks | Valid credential discovery |58| Technology Intelligence | Job postings, Wappalyzer, Shodan, Censys | Vulnerability identification |59| Physical Intelligence | Google Maps, social media photos, Glassdoor | Physical access planning |60| Document Intelligence | SEC filings, public documents, metadata extraction | Organizational structure |6162### MITRE ATT&CK Mapping6364- **T1595.001** - Active Scanning: Scanning IP Blocks65- **T1595.002** - Active Scanning: Vulnerability Scanning66- **T1592** - Gather Victim Host Information67- **T1589** - Gather Victim Identity Information68- **T1590** - Gather Victim Network Information69- **T1591** - Gather Victim Org Information70- **T1593** - Search Open Websites/Domains71- **T1594** - Search Victim-Owned Websites72- **T1596** - Search Open Technical Databases7374## Workflow7576```python77# Example: IOC detection78import re7980IOC_PATTERNS = {81 "ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",82 "domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",83 "hash_md5": r"\b[a-f0-9]{32}\b",84 "hash_sha256": r"\b[a-f0-9]{64}\b",85}8687def extract_iocs(text: str) -> dict:88 return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}89```90911. **Scope and authorize** — confirm written authorization and define target boundaries922. **Reconnaissance** — enumerate targets, services, and potential attack surfaces933. **Exploitation** — attempt exploitation of identified vulnerabilities within scope944. **Post-exploitation** — document access level, lateral movement, and data exposure955. **Report and remediate** — compile findings with reproduction steps and fix recommendations96### Phase 1: Domain and Network Reconnaissance971. Perform WHOIS lookups for target domains982. Enumerate subdomains using Certificate Transparency logs, DNS brute-force, and web scraping993. Identify IP ranges and ASN ownership1004. Scan for exposed services using Shodan/Censys1015. Check for cloud storage buckets (S3, Azure Blob, GCS)1026. Map CDN and hosting providers103104### Phase 2: Personnel and Social Intelligence1051. Enumerate employees via LinkedIn, company website, and conference speaker lists1062. Identify email naming conventions1073. Discover personal social media accounts of key targets1084. Map organizational hierarchy and reporting structure1095. Identify recently hired IT/security personnel1106. Check for conference presentations and technical publications111112### Phase 3: Credential and Data Leak Discovery1131. Search breach databases (Have I Been Pwned, DeHashed)1142. Check paste sites (Pastebin, GitHub Gists)1153. Search GitHub/GitLab for leaked secrets and API keys1164. Look for exposed configuration files and backups1175. Check for leaked internal documents via Google dorking118119### Phase 4: Technology Stack Identification1201. Analyze job postings for technology mentions1212. Use Wappalyzer/BuiltWith for web technology fingerprinting1223. Check for exposed admin panels and development environments1234. Identify VPN and remote access technologies1245. Map cloud services and SaaS applications125126### Defensive OSINT (Threat Intelligence)127128When investigating external threat actors rather than preparing for red team operations, OSINT collection must remain strictly passive (no packets sent to target systems). Use this parallel workflow:1291301. **Scope** — Define research questions (e.g., "which threat actor targets our sector?"), identify data sources, set time boundaries1312. **Gather** — Collect data from passive sources only: WHOIS records, passive DNS (SecurityTrails), certificate transparency logs (crt.sh), breach databases (Have I Been Pwned), dark web monitoring, Shodan historical data1323. **Synthesize** — Enrich threat actor profiles with publicly observable indicators (IPs, domains, SSL certs, ASN data). Cross-reference findings with MITRE ATT&CK and known campaign indicators. Produce actionable threat intelligence reports133134**Key differences from offensive OSINT:**135- No active scanning (no Nmap, no direct DNS queries to target)136- Focus on attribution and campaign tracking, not attack surface mapping137- Output is threat intelligence report, not red team recon report138- Emphasis on IOC extraction and enrichment, not exploitation planning139140## When NOT to Use141142- You don't have explicit written authorization to test143- Task is about defense/detection, not offense (use detection skills)144- You need to implement security controls (use implementing-* skills)145- Task requires compliance auditing (use auditing-* skills)146- You're investigating an incident (use incident response skills)147- Target is out of scope for your engagement148- Task is about vulnerability scanning only (use scanning tools)149150151## Red Flags152153- Performing actions without explicit written authorization from the asset owner154- Testing against production systems without a defined scope and rules of engagement155- Exceeding the authorized scope of the engagement156- Leaving persistent access mechanisms without explicit approval157- Causing denial-of-service on production systems during testing158159## Verification160161- All steps executed successfully against a test environment before production use162- Output documented with screenshots or logs demonstrating expected behavior163- All exploited vulnerabilities documented with reproduction steps164- Scope boundaries confirmed — only authorized targets were tested165- Remediation recommendations included for every finding166167## Tools and Resources168169| Tool | Purpose | Type |170|------|---------|------|171| Amass | Subdomain enumeration and network mapping | Open Source |172| Subfinder | Passive subdomain discovery | Open Source |173| theHarvester | Email, subdomain, and name harvesting | Open Source |174| Maltego | Visual link analysis and data correlation | Commercial |175| SpiderFoot | Automated OSINT collection | Open Source |176| Shodan | Internet-connected device search | Commercial |177| Censys | Internet asset discovery | Commercial |178| Recon-ng | Web reconnaissance framework | Open Source |179| SecurityTrails | Passive DNS historical data | Commercial |180| crt.sh | Certificate transparency log search | Free |181| Have I Been Pwned | Breached credential search | Free |182| DomainTools | WHOIS history and domain intelligence | Commercial |183| GitDorker | GitHub secret scanning | Open Source |184| Photon | Web crawler for OSINT | Open Source |185186## Validation Criteria187188- [ ] Complete list of target domains and subdomains189- [ ] Employee list with roles and email addresses190- [ ] Technology stack identified191- [ ] Credential leak assessment completed192- [ ] Attack surface map documented193- [ ] OSINT report compiled for engagement team194195## Process1961971. Analyze the task requirements1982. Apply domain expertise1993. Verify output quality200201## Anti-Rationalization Table202203| Rationalization | Reality |204|---|---|205| "We are too small to be targeted" | Automated attacks target everyone. Size does not matter. |206| "Security slows us down" | A breach slows you down 100x more. Build security in from the start. |207| "We will fix it after launch" | Vulnerabilities in production are exploited within hours. Fix before deploy. |