πInfrastructure Enumeration
Overview
Footprinting is the first phase of penetration testing that involves gathering information about the target organization without direct interaction. This phase is crucial for understanding the target's infrastructure, technologies, and potential attack vectors.
Core Principles
What we see - Visible services and information
What we don't see - Hidden infrastructure and services
Developer's perspective - Understanding technical requirements
Domain Information Gathering
1. Certificate Transparency
Why Certificate Transparency works:
SSL certificates often include multiple domains/subdomains
Certificate logs are publicly accessible
Provides historical data about domains
crt.sh - Certificate Transparency Search:
# Basic search in browser
https://crt.sh/?q=example.com
# JSON output for parsing
curl -s https://crt.sh/\?q\=example.com\&output\=json | jq .
# Extract unique subdomains
curl -s https://crt.sh/\?q\=example.com\&output\=json | jq . | grep name | cut -d":" -f2 | grep -v "CN=" | cut -d'"' -f2 | awk '{gsub(/\\n/,"\n");}1;' | sort -uExample Output:
2. Company Hosted vs Third-Party
Identify directly accessible hosts:
3. Shodan Intelligence
Why Shodan is valuable:
Shows open ports and services
Reveals technology stack
Provides geolocation data
Historical scanning data
Shodan Usage:
Example Shodan Output Analysis:
Key Information Extracted:
Multiple web servers (ports 80, 81, 443, 444)
Mail services (SMTP on 25, POP3 on 110)
DNS services (port 53 TCP/UDP)
RPC services (port 111)
DNS Enumeration
Overview
Domain Name System (DNS) is an integral part of the Internet infrastructure that translates domain names into IP addresses. DNS operates without a central database - information is distributed across thousands of name servers globally. For penetration testing, DNS enumeration is crucial for discovering subdomains, mail servers, and internal infrastructure.
Key DNS Components:
DNS Root Servers: Responsible for top-level domains (TLD), managed by ICANN
Authoritative Name Servers: Hold authority for specific zones, provide binding information
Non-authoritative Name Servers: Collect information through recursive/iterative queries
Caching DNS Servers: Cache information from other servers for specified periods
Forwarding Servers: Forward DNS queries to other DNS servers
Resolvers: Perform local name resolution
DNS Record Types
A
Returns IPv4 address of requested domain
AAAA
Returns IPv6 address of requested domain
MX
Returns responsible mail servers
NS
Returns DNS servers (nameservers) of domain
TXT
Contains various information (SPF, DMARC, verification records)
CNAME
Alias record pointing to another domain name
PTR
Reverse lookup - converts IP addresses to domain names
SOA
Start of Authority - provides zone information and admin contact
DNS Configuration Analysis
BIND9 Configuration Files
Zone File Structure
Dangerous DNS Configurations
β οΈ High-Risk Settings:
allow-query
Medium
Defines which hosts can send requests
allow-recursion
High
Defines which hosts can send recursive requests
allow-transfer
Critical
Defines which hosts can perform zone transfers
zone-statistics
Medium
Collects statistical data (information disclosure)
DNS Enumeration Techniques
1. Basic DNS Queries
2. Name Server Discovery
3. DNS Version Detection
4. SOA Record Analysis
5. Zone Transfer Attacks
6. Reverse DNS Lookups
Advanced DNS Enumeration
Subdomain Discovery
Using DNSenum
Using Fierce
Using Sublist3r
DNS Security Assessment
Zone Transfer Testing
DNS Cache Poisoning Tests
DNS Amplification Testing
Information Extraction from DNS
Email Server Discovery
TXT Record Analysis
Internal Infrastructure Discovery
DNS Enumeration Checklist
Initial Discovery
Zone Transfer Testing
Subdomain Discovery
Information Analysis
Tools and Scripts
Essential DNS Tools
Custom Scripts
Defensive Measures
Secure DNS Configuration
Monitoring and Detection
Third-Party Service Identification
Services and Attack Vectors
Atlassian
JIRA/Confluence exploits, credential attacks
Software development platform
Google Gmail
Open GDrive folders, document access
Email management
LogMeIn
Centralized remote access, credential reuse
Single point of failure
Mailgun
API vulnerabilities (IDOR, SSRF)
Email API service
Outlook/Office365
OneDrive, Azure blob storage, SMB
Document management
INWX
Domain management, DNS poisoning
Hosting provider
IP Address Discovery from SPF
SPF Records reveal internal IPs:
Passive Information Gathering Workflow
Phase 1: Initial Domain Analysis
Certificate Transparency - crt.sh enumeration
DNS enumeration - All record types
Subdomain compilation - Unique list creation
Phase 2: Infrastructure Mapping
IP resolution - Direct vs CDN/third-party
Shodan reconnaissance - Port/service discovery
Technology stack - Service fingerprinting
Phase 3: Third-Party Analysis
TXT record analysis - Service identification
Provider mapping - Attack surface expansion
Integration points - API endpoints, SSO
Phase 4: Cloud Resource Discovery
Google dorking - Cloud storage enumeration
GrayHatWarfare - Bucket/container discovery
Source code analysis - Direct cloud links
Automated scanning - Cloud enumeration tools
Phase 5: Intelligence Synthesis
Attack vector prioritization
Credential attack targets
Technical debt identification
Cloud exposure assessment
Tools and Commands
Essential Tools
One-Liner Commands
Defensive Considerations
Information Leakage Prevention
Minimize certificate transparency exposure
Secure TXT record information
Implement proper SPF/DMARC policies
Regular third-party service audits
Monitoring and Detection
Certificate transparency monitoring
DNS query logging
Shodan/Censys alerts
Third-party integration reviews
Cloud Resources Discovery
Overview
Cloud services (AWS, Azure, GCP) are essential for modern companies but often misconfigured, leading to unauthorized access to sensitive data.
Common Cloud Storage Types
AWS
S3 Buckets
*.amazonaws.com
Azure
Blob Storage
*.blob.core.windows.net
GCP
Cloud Storage
*.storage.googleapis.com
Discovery Methods
1. DNS Enumeration
2. Google Dorking for Cloud Storage
AWS S3 Discovery:
Azure Blob Discovery:
GCP Storage Discovery:
3. Source Code Analysis
Check website source for cloud references:
Specialized Tools
1. Domain.Glass
2. GrayHatWarfare
GrayHatWarfare Search Examples:
3. Automated Tools
High-Value Targets
Critical Files to Search For
SSH Keys
id_rsa, id_rsa.pub, .pem
π΄ Critical
Configurations
config.xml, .env, settings.conf
π΄ Critical
Database Dumps
.sql, .db, .sqlite
π΄ Critical
Source Code
.git, .zip, .tar.gz
π‘ High
Documents
.pdf, .docx, .xlsx
π‘ Medium
Credentials
passwords.txt, .htpasswd
π΄ Critical
Example: SSH Key Discovery
Common Misconfigurations
AWS S3 Bucket Issues
Azure Blob Storage
Cloud Resource Workflow
Phase 1: Initial Discovery
DNS enumeration - Look for cloud storage references
Source code analysis - Check website for cloud links
Google dorking - Search for public cloud storage
Phase 2: Targeted Search
Company name variations - Full name, abbreviations, domains
GrayHatWarfare - Systematic bucket enumeration
Domain.glass - Infrastructure mapping
Phase 3: Content Analysis
File enumeration - List accessible files
Sensitive data identification - SSH keys, configs, databases
Access testing - Download capabilities
Phase 4: Exploitation
SSH key usage - Access to company servers
Configuration abuse - Database access, API keys
Data exfiltration - Sensitive document download
Detection and Prevention
Defensive Measures
Bucket policies - Restrict public access
IAM controls - Least privilege access
Monitoring - Log bucket access
Encryption - Encrypt data at rest
Regular audits - Check for public buckets
Detection Methods
Cloud security tools - AWS Config, Azure Security Center
Third-party scanners - Check for public exposure
Certificate monitoring - Track cloud-related certificates
Real-World Impact
Common Scenarios
Employee mistakes - Accidental public bucket creation
Legacy configurations - Old buckets left public
Development oversight - Test/dev buckets exposed
Third-party integrations - Vendor access misconfigurations
Business Impact
Data breaches - Customer information exposure
Intellectual property theft - Source code, documents
Compliance violations - GDPR, HIPAA penalties
Infrastructure compromise - SSH key-based access
Key Takeaways
Certificate Transparency is a goldmine for subdomain discovery
TXT records reveal extensive third-party integrations
Shodan provides detailed technical intelligence
SPF records can leak internal IP addresses
Third-party services expand attack surface significantly
Cloud resources are often misconfigured and publicly accessible
Google dorking is highly effective for cloud storage discovery
SSH keys in cloud storage provide direct server access
References
HTB Academy: Footprinting Module
Certificate Transparency: https://crt.sh/
Shodan: https://www.shodan.io/
RFC 6962: Certificate Transparency
Last updated