skip to content

A SaaS app proxied through Cloudflare still sees attack traffic hitting its origin directly; how did the origin IP likely leak, and in what order do you close it?

level: seniorimportance: must knowfreq 60%

answer

  1. something outside the proxy
  2. DNS-only records, mail, history
  3. the app's own outbound calls
  4. lock down, close leaks, then rotate

basics

~20 s

Through a path the proxy never covers: a DNS-only record on the same server, mail on that host, DNS history from before onboarding, or the app's outbound calls. Lock the origin to Cloudflare, close every leak, then rotate the IP.

solid answer

~40 s

Attackers reach an origin directly because its address escaped through a path the proxy never touched. The usual ones: a DNS-only record (a `staging` or `direct` hostname, an SPF or other TXT value) pointing at the same server; a mail service on that host, whose bounces and outgoing messages carry its address; DNS history and the pending period before the zone was activated, when records were answered DNS-only; the origin's own certificate answering on its IP; and outbound requests the app makes from the same address. The order matters. First lock the origin to Cloudflare (allow only its ranges, add Authenticated Origin Pulls) so the known address stops being useful. Then close every leak. Only then rotate to a new IP: rotate earlier and an open leak publishes the new one too.

go deeper

for a junior

Recall that a proxied hostname hides the origin only for that record, and that DNS-only records and mail on the same server are the classic leaks.

for a middle

Explain each leak path, from DNS history and the pending period to SPF values and outbound calls, and what closes each one.

for a senior

Demonstrate the order: lock the origin first, close every leak, rotate last, then verify from the origin's logs that only Cloudflare reaches it.

for a principal

Argue for treating origin addresses as discoverable and making refusal, not secrecy, the control, with Tunnels for new services and monitoring that alerts on direct hits.

## Why the proxy did not help A proxied record hides the origin's address only from DNS lookups of that one record. Everything else that touches the server still happens in the open: other records, mail, history, the server's own outbound traffic. Once any of them gives the address away, attackers skip Cloudflare entirely, and nothing configured at the edge, WAF, rate limiting rules or DDoS protection, ever sees their requests. The origin's access log shows it plainly: requests whose source is not in Cloudflare's ranges. ## Reading the evidence Before changing anything, confirm the traffic really is direct: - The attacking requests' source addresses are **outside** Cloudflare's published ranges. - They usually carry no `CF-Connecting-IP` header, which Cloudflare adds only on its own traffic to the origin; a direct client can forge one, so its presence proves nothing. - Cloudflare's security events and analytics for the zone show **nothing** matching them, because they never entered the zone. If the requests do come from Cloudflare's ranges, the problem is different: either they passed your zone's rules, or they were relayed for another zone, which only an Authenticated Origin Pulls certificate of your own or a Tunnel can rule out. ## Where origin addresses usually leak | Path | How it gives the address away | Fix | |---|---|---| | DNS-only records | A gray-cloud `A`, `AAAA` or `CNAME` (`staging`, `ftp`, `direct`) resolves to the same server | Proxy the record, or move that service to another host | | TXT and SPF values | An SPF `ip4:` mechanism or other TXT record names the web server's address | Send mail from a separate host or service, then clean the records | | Mail on the web server | Bounces for non-existent addresses, and mail the app sends itself, carry the server's address in their headers | Keep mail off the origin | | DNS history | Records from before onboarding, and from the pending period when proxied records were answered DNS-only, stay in public history | Rotate the address after activation | | Certificates | Public certificate logs list hostnames, and the origin presents its own certificate to anyone who connects to its IP | Firewall the web ports so the handshake never starts | | Outbound calls | Webhooks, URL fetches and callbacks to third parties leave from the same address | Send outbound traffic through a separate egress address | Two less obvious ones are worth checking in a review: - A **break-glass setting**, enforce DNS-only, answers every proxied record in the account with its real target while it is on. If it was ever used, assume every origin address was published. - A **subdomain that was once DNS-only**, even briefly, is in history from that day on; the fix is the same rotation. ## The order that actually closes it 1. **Lock the origin to Cloudflare now.** Accept web traffic only from Cloudflare's published ranges and turn on Authenticated Origin Pulls (with your own certificate, so a request relayed for some other zone also fails). This stops the current attack whatever the leak was. 2. **Find and close every leak.** Audit DNS-only and TXT records, move mail off the host, move outbound calls to a separate egress, and stop publishing the address anywhere. 3. **Rotate to a new address**, put it only behind proxied records (or a Tunnel), and never in a DNS-only record, an SPF value or a mail header. 4. **Verify.** The origin's log should show no web requests from outside Cloudflare's ranges, and a direct request to the new address should fail. Why rotate at all once the firewall is in place? A host firewall still has to receive the packets it drops, so a known address can still be flooded below the HTTP layer, and an old address keeps attracting scans. Why not rotate first? Because every leak still open would publish the new address just as it published the old one, and the team is back where it started a week later. ## Making the next leak harmless - Treat origin addresses as **discoverable, not secret**: the defence is that the origin refuses anything that did not come through Cloudflare, not that nobody knows where it is. - Prefer a **Cloudflare Tunnel** for new services: with no inbound port, a leaked address gives an attacker nothing to connect to. - Add the check "no web request from outside Cloudflare's ranges" to monitoring, so the next leak shows up as an alert rather than an incident.

  • Why can a pending zone leak the origin even if every record was set to proxied?
    Until the zone is activated on Cloudflare's nameservers, its records are served DNS-only, so lookups during that window return the origin's real address, and DNS history keeps it. Cloudflare recommends rotating origin addresses at the hosting provider after activation for exactly this reason.
  • How do you confirm the leak is closed after the rotation?
    Check that the new address appears in no DNS-only record, SPF or other TXT value and no outgoing mail header, and that outbound calls leave from a different address. Then confirm the origin's log shows no web requests from sources outside Cloudflare's ranges, and that a request sent straight to the new address fails.
  • Does a mail record leak the origin if mail runs on a different server?
    Not the web origin's address, as long as the mail server shares nothing with it: a separate host or a mail service has its own address. The leak comes from running mail on the protected server, or from SPF and other TXT records that list the web server's address.

  • Rotate the origin IP first, then work out how it leaked.
  • Proxying the main hostname hides the origin, whatever other records point at it.
  • Mail on the web server is safe because MX lookups never return an address.
  • Once the firewall allows only Cloudflare, a known origin address is harmless.
  • The attack must be getting past Cloudflare's WAF, so tighten the WAF rules.