More websites use CDNs for speed and DDoS protection. But if the origin's real IP is exposed, attackers can bypass the CDN entirely.

How CDNs Work
User Request
→DNS → CDN
→CDN Edge Node
→Origin Pull
→Response
7 Ways Real IPs Get Exposed
| # | Vector | How | Risk |
|---|---|---|---|
| 1 | DNS History | Pre-CDN A records cached by SecurityTrails | High |
| 2 | Subdomains | mail/ftp resolve directly to origin | High |
| 3 | Certificate Transparency | Censys shows which IPs serve your cert | Med |
| 4 | Email headers | Received headers reveal origin IP | Med |
| 5 | SSRF | Callbacks make server connect to attacker | Med |
| 6 | IPv6 not behind CDN | AAAA records point to origin | High |
| 7 | Direct IP access | Default page matched by Shodan | Med |
Detection Methods
Method 1: DNS History
# SecurityTrails API - query historical DNS records
curl "https://api.securitytrails.com/v1/history/example.com/dns/a" \
-H "apikey: YOUR_API_KEY"
# Example output:
# 2024-01-15: 203.0.113.42 <-- Real IP before CDN setup
# 2024-03-01: 104.18.32.5 <-- CDN node IP (Cloudflare)Method 2: Subdomain Enumeration
# Enumerate subdomains with subfinder
subfinder -d example.com -silent | while read sub; do
ip=$(dig +short "$sub" A | head -1)
echo "$sub -> $ip"
done
# Common finds:
# mail.example.com -> 203.0.113.42 ⭐ Origin IP!
# ftp.example.com -> 203.0.113.42 ⭐ Origin IP!
# www.example.com -> 104.18.32.5 CDN nodeMethod 3: Certificate Reverse Lookup
# Search Censys for IPs serving a specific domain's certificate
# Query: services.tls.certificates.leaf.names: example.com
# Results may reveal non-CDN IPs serving that certificate⚠️ Warning: Do not actively probe or attack sites you don't own. These methods are for self-security audits only. Unauthorized probing may violate applicable laws.
🛡️ Origin IP Protection Checklist:
- Migrate origin IP after CDN setup
- Route ALL subdomains through CDN
- Use third-party email services
- Firewall whitelist: CDN IPs only on 80/443
- Return 444 on direct IP access
- IPv6 behind CDN too
CDN Provider Comparison
| Feature | Cloudflare | CloudFront | Akamai | Fastly |
|---|---|---|---|---|
| Origin hiding | ✅ | ✅ | ✅ | ✅ |
| DDoS | ✅ Free | ✅ Shield | ✅ | ✅ |
| WAF | ✅ | ✅ | ✅ | ✅ |
| Free plan | ✅ | ❌ | ❌ | ❌ |
Self-Audit Checklist
- Search SecurityTrails for historical DNS
- Enumerate subdomains with subfinder
- Search Censys for certificate matches
- Use ipinfo.im CDN Real IP Detection tool
- Check outbound email Received headers