How Attackers Find Your Origin IP Behind Cloudflare
Proxied DNS hides your origin from a lookup, not from an attacker. Six leak paths, a verification order, and four containment layers.
Short answer: Proxying your DNS records means a lookup of your domain returns a Cloudflare address instead of your server — but that only protects people who resolve the hostname. Anyone who already knows the address, or can find it in DNS history, certificate logs, mail headers or an unproxied subdomain, can send traffic straight to the origin and nothing on the edge runs. Containment has four layers: allow only Cloudflare’s published IP ranges (all plans, medium security, affected by IP spoofing), Authenticated Origin Pulls (all plans, needs Full or Full strict, incompatible with Tunnel), Cloudflare Tunnel (all plans, outbound-only, no inbound listener), and Enterprise-only options such as dedicated egress IPs, Magic Transit or Network Interconnect. Cloudflare also recommends rotating the origin IP after onboarding, because DNS records are public information.
Correct the premise first: what a CDN actually hides
When you proxy a DNS record, visitors who look up your domain receive a Cloudflare IP address instead of your origin server’s real one. That is genuinely useful, and it is the source of a persistent misunderstanding: it hides the answer to a DNS query, not the server.
Cloudflare’s own documentation puts the limitation plainly. If someone discovers your origin IP — “for example, through historical DNS records or mail server configuration” — they can send traffic directly to your server, “bypassing Cloudflare’s security protections entirely”.
So the question is never “does the CDN hide me”. It is “has the address leaked somewhere already, and if it has, what happens when someone uses it”.
Why direct-to-origin traffic is a different problem
Traffic that reaches your origin through the edge is subject to everything you configured: WAF rules, bot detection, rate limiting, caching, DDoS mitigation. Traffic that goes straight to the origin is subject to none of it — no rule evaluated, no cache consulted, no attack traffic absorbed at the edge.
That changes the economics of an attack. Instead of generating enough volume to saturate an anycast network with hundreds of data centers, an attacker needs only enough to saturate one server or one load balancer. It also changes the failure mode: your Cloudflare dashboards can look healthy while the origin is down, which makes the incident harder to diagnose.
Six common paths to an origin IP
Each of these has a distinct way to check for it.
1. Historical DNS records. Before you proxied the record, the A record pointed somewhere, and that answer was public. DNS history services keep it. Cloudflare’s documentation names this as the first example of how an origin is discovered.
2. DNS-only records pointing at the same host. Not every record needs to be proxied, but every unproxied record that resolves to your origin is a published answer. MX, TXT and SPF records are frequently overlooked, and so are records created for verification or for a partner integration years ago.
3. Mail on the same machine. If the origin also runs mail, the address appears in MX records, in SMTP banners, and in the headers of every message your application sends — password resets, invoices, notifications. Reading one of your own outbound emails is often the fastest confirmation.
4. Subdomains and side services. Staging environments, admin panels, direct object-storage endpoints, monitoring agents, API hosts created for a single integration. Any of them that resolve to the same host, proxied or not, publish the address.
5. Certificate transparency logs. Public CAs publish issued certificates to append-only logs that anyone can search. Hostnames in those logs reveal naming patterns and, where an origin certificate was issued directly, information about the host itself.
6. Application output. Error stacks that include an internal address, webhook callbacks that disclose where they came from, API responses containing internal hostnames, redirect targets, and debug endpoints left enabled in production.
How to check yourself: a verification order
Run this from outside your network, and record the results — it is the baseline you will want during an incident.
- Enumerate every record. Walk your zone record by record and list everything that is DNS-only rather than proxied. Note which resolve to the same address as your origin.
- Test the direct path. Connect to the origin’s address over HTTPS with the correct
Hostheader and compare the response to the same request through the edge. If the direct path returns your application rather than a refusal or a timeout, the origin is reachable. - Search certificate transparency logs for your domain and for hostnames you do not recognise.
- Query DNS history services for your apex domain and every subdomain you can name.
- Trigger an outbound email or webhook and read the raw headers and payload for addresses you did not intend to publish.
- Check every subdomain’s proxy status, including ones created for one-off projects.
If step 2 succeeds, treat the address as compromised regardless of whether you can find the leak. Rotate and contain first; the forensic question is secondary.
Four layers of containment, weakest to strongest
Cloudflare’s guidance groups origin protection into four layers and rates each one. The ratings matter: they tell you what you are actually buying.
| Layer | Method | Security | Availability | Cost / effort |
|---|---|---|---|---|
| Network | Allow only Cloudflare’s published IP ranges | Medium — IP spoofing can bypass it | All plans | Low, but you must track range changes |
| Transport | Authenticated Origin Pulls | Strong | All plans, requires Full or Full strict SSL | Certificate management; not compatible with Tunnel |
| Application | Cloudflare Tunnel | Strong | All plans, requires cloudflared |
Changes the network architecture; no inbound listener |
| Network (Enterprise) | Magic Transit, Network Interconnect, dedicated egress IPs | Strong | Enterprise only | Contracted separately |
Three operational details decide whether these work as intended:
- Allowlisting means maintaining the list. Cloudflare publishes its ranges and notes that they do not change frequently, that new ranges are added to the published list before going into production, and that the API can keep your configuration updated. Automate it; a stale allowlist eventually blocks legitimate edge traffic.
- Authenticated Origin Pulls needs the right SSL mode. It has no effect when the SSL mode is Off or Flexible, and the zone-level, per-hostname and global configurations are independent of each other — enabling one does not enable the others.
- Authenticated Origin Pulls and Tunnel are mutually exclusive. Cloudflare states that AOP “has no effect on hostnames routed through Cloudflare Tunnel”, because tunnel traffic is already authenticated using the connector’s credentials. Pick one per hostname.
Enterprise options when shared IP ranges are not enough
Allowlisting works, but Cloudflare’s IP ranges are shared by all proxied hostnames — which means allowing them permits traffic sourced from other customers’ zones. For teams where that is unacceptable, the documented alternatives are:
- Dedicated egress IPs (Smart Shield Advanced), giving your origin firewall a smaller, stable set of source addresses.
- Bring Your Own IP (BYOIP), where Cloudflare announces an address range you own or lease from all of its locations.
- Static IP addresses for your domain, arranged through your account team.
- Magic Transit, which protects an entire IP prefix at the network layer via BGP announcement rather than proxying web requests — a different architecture for a different problem.
- Cloudflare Network Interconnect for direct connectivity.
One intermediate option is worth knowing: Business and Enterprise customers can upload a custom SSL certificate, which reduces the number of Cloudflare IPs their domain shares with other customers’ domains without changing the plan.
Two things to do after containment
Rotate the origin IP. Cloudflare recommends this explicitly, precisely because DNS records are public information. Allowlisting does not undo the fact that the old address is already in someone’s notes. If your origin is a cloud instance with a mutable address, this is a routine change; if it is a fixed physical address, it is a project, and worth planning before the incident rather than during it.
Then monitor the result. Origin error rate alerting tells you when requests are failing at the origin; health checks and load balancing give you somewhere to send traffic when one origin is unhealthy. These are complementary to containment, not substitutes — containment reduces who can reach the origin, monitoring tells you when it is in trouble regardless of who is reaching it.
One more thing worth checking if you run on AWS: Cloudflare uses 172.64.0.0/13 as public egress space, which is not RFC 1918 private space. A VPC route table that sends a broad 172.16.0.0/12 or 172.16.0.0/8 route to an internal target can capture that traffic before it reaches an internet gateway, producing 521 and 522 errors from data centers using that range. The fix is a more-specific route for 172.64.0.0/13 pointing at the internet gateway. This does not show up in security group audits because security groups are evaluated at the instance level.
What these measures do not solve
- Origin capacity. Containment stops unwanted callers; it does not add headroom. If the origin is undersized for legitimate peak traffic, it will fail on a good day.
- Application-layer vulnerabilities. Direct-to-origin is one path. Exploiting a bug through the edge is another, and AOP and Tunnel do nothing about it.
- Internal lateral movement. Once something inside your network is compromised, none of these controls are in the path.
- Third-party dependency failures. Your origin can be unreachable because a dependency is down, with no attacker involved.
- Availability of the edge itself as a dependency. Concentrating all ingress on one provider is a deliberate trade-off; see whether a CDN solves your DDoS problem for where that trade-off ends.
FAQ
Does Cloudflare hide my origin IP completely? It hides it from anyone who resolves your hostname: proxied DNS records return Cloudflare addresses. It does not remove addresses that were public before you onboarded or that leak through other channels. Treat “hidden” as “not advertised by DNS”, not as “unknown”.
Is allowlisting Cloudflare’s IP ranges enough? It is the baseline, and Cloudflare rates it as medium security because IP spoofing can bypass it. The stronger configurations are Authenticated Origin Pulls or Cloudflare Tunnel. In practice: allowlist to reduce noise, then add one of the two strong mechanisms.
Can I use Authenticated Origin Pulls together with Cloudflare Tunnel? Not on the same hostname. Cloudflare states that AOP has no effect on hostnames routed through Tunnel, because tunnel traffic is authenticated using the connector’s credentials instead. Choose per hostname.
Do I really need to change my origin IP? Cloudflare recommends it after onboarding, because DNS records are public information and the pre-proxy answer may already be recorded elsewhere. Whether it is urgent depends on whether the address is still reachable from the internet — which is what the verification order above establishes.
Do I need Enterprise for origin protection? Not for the main three. IP allowlisting, Authenticated Origin Pulls and Cloudflare Tunnel are all available on every plan. Enterprise is required for Magic Transit, Network Interconnect, dedicated egress IPs via Smart Shield Advanced, and BYOIP or static IPs.
Why am I seeing 521 or 522 errors from Cloudflare data centers? Among other causes, check your cloud routing. Cloudflare’s public egress space includes 172.64.0.0/13, which is not private address space; a VPC route table that routes a broader 172.x range to an internal target will capture it. Add a more-specific route for 172.64.0.0/13 to your internet gateway.
Related reading
- Can a CDN Protect Your Website from DDoS Attacks?
- How to Choose DDoS Protection for Global Businesses
- Cloudflare vs AWS, Alibaba Cloud and Tencent Cloud: Do You Need Both?
- How to Mitigate HTTP Flood and Layer 7 Attacks
If you want a second pair of eyes on whether your origin is reachable from the internet, the check takes minutes and needs no access to your infrastructure — review the architecture with us.
Sources
Official Cloudflare documentation. Where this article mentions availability, quotas or limits, these pages are the source of truth. Cloudflare features change over time — confirm what is visible in your dashboard before committing to a design.
- developers.cloudflare.com/fundamentals/security/protect-your-origin-server/
- developers.cloudflare.com/fundamentals/concepts/cloudflare-ip-addresses/
- developers.cloudflare.com/ssl/origin-configuration/authenticated-origin-pull/
- developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/
- developers.cloudflare.com/dns/proxy-status/
- developers.cloudflare.com/load-balancing/