🌐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

  1. What we see - Visible services and information

  2. What we don't see - Hidden infrastructure and services

  3. 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 -u

Example 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

Record Type
Description

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:

Option
Risk Level
Description

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

Service
Attack Vectors
Notes

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

  1. Certificate Transparency - crt.sh enumeration

  2. DNS enumeration - All record types

  3. Subdomain compilation - Unique list creation

Phase 2: Infrastructure Mapping

  1. IP resolution - Direct vs CDN/third-party

  2. Shodan reconnaissance - Port/service discovery

  3. Technology stack - Service fingerprinting

Phase 3: Third-Party Analysis

  1. TXT record analysis - Service identification

  2. Provider mapping - Attack surface expansion

  3. Integration points - API endpoints, SSO

Phase 4: Cloud Resource Discovery

  1. Google dorking - Cloud storage enumeration

  2. GrayHatWarfare - Bucket/container discovery

  3. Source code analysis - Direct cloud links

  4. Automated scanning - Cloud enumeration tools

Phase 5: Intelligence Synthesis

  1. Attack vector prioritization

  2. Credential attack targets

  3. Technical debt identification

  4. 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

Provider
Storage Type
URL Pattern

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

File Type
Examples
Risk Level

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

  1. DNS enumeration - Look for cloud storage references

  2. Source code analysis - Check website for cloud links

  3. Google dorking - Search for public cloud storage

  1. Company name variations - Full name, abbreviations, domains

  2. GrayHatWarfare - Systematic bucket enumeration

  3. Domain.glass - Infrastructure mapping

Phase 3: Content Analysis

  1. File enumeration - List accessible files

  2. Sensitive data identification - SSH keys, configs, databases

  3. Access testing - Download capabilities

Phase 4: Exploitation

  1. SSH key usage - Access to company servers

  2. Configuration abuse - Database access, API keys

  3. 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

  1. Employee mistakes - Accidental public bucket creation

  2. Legacy configurations - Old buckets left public

  3. Development oversight - Test/dev buckets exposed

  4. 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

  1. Certificate Transparency is a goldmine for subdomain discovery

  2. TXT records reveal extensive third-party integrations

  3. Shodan provides detailed technical intelligence

  4. SPF records can leak internal IP addresses

  5. Third-party services expand attack surface significantly

  6. Cloud resources are often misconfigured and publicly accessible

  7. Google dorking is highly effective for cloud storage discovery

  8. 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