Why Cloudflare Proxying Alone Isn't Enough
Many organizations put Cloudflare in front of their web applications and assume they're protected. WAF rules, DDoS mitigation, bot management — all handled by Cloudflare's edge network.
But there's a fundamental problem with the most common setup: if your origin server accepts traffic from any Cloudflare IP, every Cloudflare customer can reach it directly.
The Problem: Shared IP Ranges
When you proxy your domain through Cloudflare, traffic flows like this:
User → Cloudflare Edge → Your Origin Server
To "protect" the origin, many teams add firewall rules:
Allow inbound HTTP/HTTPS from Cloudflare IP ranges
This seems logical. Only Cloudflare can reach your origin. Except...
Cloudflare's IP ranges are shared across all ~30 million domains on their network. Any Cloudflare customer can route traffic through those same IPs using:
httpHostHeader overrideAll three methods cause traffic to arrive at your origin from Cloudflare's IP ranges, bypassing your firewall rules completely.
Finding the Origin IP
The first step for an attacker is discovering your origin IP. Despite Cloudflare proxying, this is often trivial:
Non-proxied subdomains
mail.example.com → 203.0.113.10 (Oderland, direct)
www.example.com → 104.16.x.x (Cloudflare, proxied)
Mail servers, FTP, cPanel, staging environments — these commonly point directly to the origin.
Certificate Transparency logs
Every TLS certificate issued is logged publicly. Searching crt.sh reveals subdomains that may have existed before Cloudflare was added, or internal services with their own certificates.Historical DNS
Services like SecurityTrails, RapidDNS, and Shodan maintain historical DNS records. Even if you moved behind Cloudflare years ago, the old A record pointing to your origin is preserved.Shodan / Censys
Search engines for internet-connected devices index your origin's IP, ports, and TLS certificates — often revealing the exact hostname served.The Bypass in Practice
Once an attacker has the origin IP, they can:
In the second case, your Cloudflare WAF rules, rate limiting, bot management, and Access policies are completely bypassed. The attacker's traffic arrives at your origin through Cloudflare's network — but through their zone, not yours. Your WAF rules don't apply.
The Fix: Cloudflare Tunnel (cloudflared)
The correct architecture uses Cloudflare Tunnel (formerly Argo Tunnel):
User → Cloudflare Edge → cloudflared daemon → Your Origin
Key difference: the origin never listens on a public IP. The cloudflared daemon runs on your server and initiates an outbound connection to Cloudflare's edge. No inbound firewall rules are needed.
This means:
Alternative: Authenticated Origin Pulls
If you can't use Tunnel, enable Authenticated Origin Pulls — mTLS between Cloudflare's edge and your origin. Your origin verifies a client certificate that only YOUR zone presents.
This doesn't hide your origin IP, but it ensures that even if an attacker routes through Cloudflare, your origin rejects the connection because they don't have the right client certificate.
Checklist for Defenders
dig +short mail.example.com)Our Automated Detection
Pentesting.se now automatically detects Cloudflare origin bypass vulnerabilities as part of the discovery scan:
This runs on every discovery scan — no manual configuration needed.
---
Alexander Norman is the founder of Adminor AB and Pentesting.se, a continuous security monitoring platform for Nordic businesses.