During web application penetration testing, we often encounter a scenario where the target domain is hidden behind a CDN or anti-DDoS protection layer (such as Cloudflare, Incapsula, or AWS WAF). In this situation, network traffic hits proxy servers first, effectively masking the actual IP address of the target server and hindering direct vulnerability scanning or infrastructure testing.
In this article, we will discuss the most effective methods and techniques used by pentesters to discover the original server IP address (known as the Origin IP).
1. Passive DNS History Analysis
One of the simplest and most effective ways to find a real IP is to check the historical DNS records of a domain. Before the site owners implemented Cloudflare protection, the server might have responded directly to a public IP address for quite some time.
Tools and databases used for this purpose include:
- SecurityTrails: Features a massive archive of historical DNS records for almost any domain.
- Shodan / Censys: Internet-connected device search engines that might have indexed the server by its unique HTTP headers, SSL certificates, or open ports.
- Security Headers / CRT.sh: Analyzing SSL/TLS certificate history sometimes allows linking a domain to certificates previously issued to a specific IP address.
2. Finding Leaks in SPF, MX, and TXT Records
Domain configurations often accidentally leak the real server IP address in less obvious DNS records that are not routed through the CDN proxy:
- MX Records (Mail Exchange): The mail server belonging to the same organization is very often located in the same subnet or directly on the same server as the web application. Checking what IP address the mail MX record points to often leads straight to the target.
- SPF and TXT Records: The SPF policy defines which servers can send emails on behalf of the domain. It frequently lists the direct IP address of the mail server or primary hosting provider.
Pentester's Tip: If the domain's mail is self-hosted, the chances of discovering the original web server IP (which often sits on the same network or with the same VPS provider) increase dramatically.
3. Forcing Direct Application Contact (Server-Side Requests)
If passive reconnaissance fails, pentesters use active techniques, forcing the server to reveal its real IP address by initiating a direct connection with the client (bypassing the proxy layer).
A. Email Delivery Functionality (Contact Forms / Password Reset)
Web applications frequently send notification emails (e.g., registration confirmation, password reset). If we analyze the raw headers of the received email, fields like Received: from or X-Originating-IP may reveal the actual IP address of the SMTP server used for dispatch.
B. External Service Integrations (SSRF and Webhooks)
If the application allows fetching external resources (e.g., avatars via URL) or supports webhooks, we can set up our own listening server. Forcing the application to send an HTTP request to a server under our control allows us to read the direct IP address from which the data packet originated.
4. IP Space Scanning and Misconfigurations
Sometimes administrators make configuration mistakes, leaving "backdoors" directly to the server:
- Subdomain Enumeration: Development or staging applications (e.g.,
dev.domain.com,staging.domain.com,test.domain.com) are often unprotected by Cloudflare and point directly to the origin server. - Shared Hosting: If other websites were previously hosted on the same server under a given IP address, tools like ViewDNS.info (Reverse IP Lookup) can help correlate them.
Summary
Discovering the original IP address of a server protected by a CDN/WAF requires a combination of passive methods (DNS analysis, certificate history, MX records) and active ones (email header analysis, subdomain enumeration). For a pentester, finding the real IP opens the path to directly testing infrastructure vulnerabilities while bypassing application-layer filtering mechanisms.
Need help with technical documentation, infrastructure or security?
If you want to organize your IT documentation, run a security audit or need engineering support, feel free to get in touch.
Contact me