Payload Delivery Networks - Abusing CDNs to bypass WAF and DDoS protections
Taylor (Red Teamer)
BSides Canberra VII (2024) · Day 2 · Main Track
Overview
In this insightful talk from BSides Canberra, red teamer Taylor delves into a critical but often overlooked vulnerability in modern web infrastructure: the direct exposure of origin servers behind Content Delivery Networks (CDNs). Titled "Payload Delivery Networks - Abusing CDNs to bypass WAF and DDoS protections," the presentation meticulously outlines how attackers can circumvent the security measures of leading CDN providers like Cloudflare, AWS CloudFront, and Azure Front Door by identifying and directly targeting the original web server.

Key moments
- 0:00 Introduction: Abusing CDNs to bypass WAF/DDoS
- 6:30 Techniques to find the origin server IP (passive)
- 18:30 Bypassing IP allow-listing using CDN products
- 22:00 Cloudflare Workers proxy and imposter domain attacks
- 37:30 Robust origin protections: Tunnels, VPNs, dedicated IPs
- 43:00 Key mitigations and secure configurations for defenders
- 49:00 Q&A: Cloudflare Tunnels cross-zone resolution confirmation
Payload Delivery Networks - Abusing CDNs to bypass WAF and DDoS protections
Speakers: Taylor (Red Teamer)
Conference: BSides Canberra
YouTube: https://www.youtube.com/watch?v=97qw3MoD1qk
Overview
In this insightful talk from BSides Canberra, red teamer Taylor delves into a critical but often overlooked vulnerability in modern web infrastructure: the direct exposure of origin servers behind Content Delivery Networks (CDNs). Titled "Payload Delivery Networks - Abusing CDNs to bypass WAF and DDoS protections," the presentation meticulously outlines how attackers can circumvent the security measures of leading CDN providers like Cloudflare, AWS CloudFront, and Azure Front Door by identifying and directly targeting the original web server.
The core premise is that while CDNs offer robust Web Application Firewall (WAF) and Distributed Denial of Service (DDoS) protections, these safeguards become irrelevant if an attacker can bypass the CDN entirely. Taylor, drawing from a red team perspective, provides a comprehensive toolkit of reconnaissance techniques to uncover hidden origin server IPs and demonstrates various sophisticated bypasses for common origin protection mechanisms. Crucially, the talk also offers concrete defensive strategies, making it invaluable for security professionals seeking to harden their infrastructure against these advanced bypass methods.
Background
▶ Watch: Introduction: Abusing CDNs to bypass WAF/DDoS (0:00)
Modern web applications increasingly rely on CDNs to enhance performance, availability, and security. In a typical setup, a CDN acts as an intermediary, caching content and filtering traffic between the user (or attacker) and the origin server – the actual web server hosting the application. This architecture is designed to offload traffic, reduce latency, and, critically, absorb malicious requests, preventing them from ever reaching the origin. The CDN's WAF inspects HTTP requests for malicious patterns, blocking exploits like cross-site scripting (XSS) or SQL injection, while its DDoS protections mitigate volumetric attacks.
The problem arises when the origin server, despite being behind a CDN, remains directly accessible from the internet. If an attacker can discover the origin server's true IP address, they can send malicious traffic straight to it, completely bypassing the CDN's security layers. Taylor highlights that while much research focuses on tricking the WAF (e.g., payload obfuscation, size manipulation), a more effective approach for an attacker is often to go around it entirely. This talk explores the various ways organizations inadvertently leak their origin IP and the surprising techniques attackers can use to exploit these leaks, even leveraging the CDN itself to bypass its own protections.
Key Findings
▶ Watch: Bypassing IP allow-listing using CDN products (18:30)
Taylor's presentation unveils a dual-pronged attack methodology: first, discovering the origin server's IP address, and second, bypassing any direct access protections implemented on that origin. The talk reveals a surprising number of ways origin IPs can be exposed and how even seemingly secure configurations can be circumvented.
Origin Server IP Discovery:
Attackers possess a wide array of passive reconnaissance and active reconnaissance techniques to uncover the origin IP:
- Passive DNS: Historical DNS records from services like VirusTotal or DomainTools can reveal the origin IP used before the CDN was onboarded, especially if the IP hasn't been rotated.
- Subdomains: Some subdomains might not be proxied by the CDN, directly exposing the origin for non-HTTP services (e.g., SSH, FTP) or specific application functions.
- SPF Records: Sender Policy Framework (SPF) records, used for email validation, may list the origin server's IP as an authorized sender.
- Email Headers: Application-generated emails (e.g., sign-up confirmations, password resets) can inadvertently leak the origin IP in headers like
Received: fromorX-Originating-IP. - Certificates: Searching for SSL/TLS certificates issued to the target domain on platforms like Censys or Shodan can reveal associated IPs, including historical ones.
- Favicons and Unique Identifiers: A unique favicon or other distinct elements (e.g., Google Analytics tokens, specific HTML titles) can be hashed and searched across internet scanners to find servers with the same identifier, potentially revealing the origin.
Active Reconnaissance:
If passive methods fail, active probing can yield results:
- Scanning ASN/IP Blocks: If an organization's IP ranges or Autonomous System Number (ASN) are known, scanning these blocks for the target application can uncover the origin.
- Headers and Cookies: Leaks in HTTP headers or cookies (e.g., F5 BIG-IP load balancer cookies sometimes include server IPs) can expose internal or public IPs.
- Server-Side Request Forgery (SSRF): Exploiting an SSRF vulnerability allows the attacker to coerce the web application into making requests to an attacker-controlled listener, revealing the origin's outbound IP.
- API Callbacks: If an application has a callback mechanism (e.g., for long-running jobs), controlling the callback URL can expose the origin's IP when it sends a notification.
- WordPress Pingback: This default WordPress feature, designed to notify blogs of mentions, can be abused to make the origin server initiate an outbound connection to an attacker-controlled endpoint.
Bypassing Origin Server Protections:
Once the origin IP is found, attackers face the challenge of origin protections, which Taylor also demonstrates can be bypassed:
- IP Allow-listing:
- Cloudflare: If the origin allow-lists a broad range (e.g., Cloudflare's entire ASN), attackers can use Cloudflare Warp (a free VPN client) or Cloudflare Workers to originate requests from a Cloudflare IP. Even if restricted to official IP lists, Workers can be used with a domain proxy (e.g.,
nip.io) or an imposter domain set up within the attacker's own Cloudflare zone, where WAF/DDoS are disabled. - Azure Front Door: Similar to Cloudflare, if allow-listing isn't strictly confined to the
FrontDoor.Backendservice tag, other Azure services (e.g., Functions, VMs) can be leveraged to reach the origin. An imposter Front Door profile is also possible if theX-Azure-FDIDheader isn't validated. - AWS CloudFront: If allow-listing extends beyond the
CLOUDFRONTservice tag, other AWS services (e.g., API Gateway, EC2, Lambda) can be used. An imposter CloudFront distribution is a viable bypass if a secret header isn't validated.
- Authenticated Origin Pools (Mutual TLS): Cloudflare's Mutual TLS (mTLS) feature, Authenticated Origin Pools, by default uses a public Cloudflare Certificate Authority (CA). This means an attacker setting up an imposter domain within their own Cloudflare zone can still present a valid Cloudflare-signed certificate, authenticating to the origin. To truly secure this, custom, tenancy-specific certificates are required. AWS and Azure lack native equivalents, requiring custom Lambda/Function solutions.
Technical Deep Dive
▶ Watch: Cloudflare Workers proxy and imposter domain attacks (22:00)
Taylor meticulously details the technical underpinnings of each discovery and bypass technique.
Passive Reconnaissance in Practice:
For passive DNS, the talk highlights VirusTotal's ability to show current and historical DNS records. An example showed a legittarget.com resolving to CDN IPs currently, but revealing a 192.53.168.172 origin IP from a prior record, which was still live. Similarly, for certificates, Censys and Shodan are demonstrated. A query like certificate.names: legit.target.com in Censys or ssl:legit.target.com in Shodan can quickly yield associated IPs. Favicon identification involves hashing the favicon and searching platforms like Shodan (which uses a MurmurHash3) or VirusTotal (MD5 hash). Taylor notes the importance of checking different favicon resolutions (e.g., favicon-32x32.png vs. favicon.ico) as hashes vary.
Active Reconnaissance Techniques:
Scanning ASN/IP blocks is straightforward, using curl -H "Host: legit.target.com" http://<IP> to ensure the correct virtual host is targeted. Headers and cookies can be inspected, with F5 BIG-IP load balancers cited as an example where Set-Cookie headers might leak server IPs in the pool name. Server-Side Request Forgery (SSRF) is explained through an image upload feature: instead of a legitimate image URL, an attacker provides their out-of-band testing tool listener URL (e.g., attacker.oast.com), and the origin server's request to this URL reveals its IP. The WordPress Pingback vulnerability is a specialized SSRF. An attacker sends an XML-RPC message to xmlrpc.php on the target WordPress site, specifying an attacker-controlled URL as the "source URI." The WordPress site then attempts to verify this mention by making an outbound request to the attacker's URL, revealing its IP. Taylor shows a default WordPress setting, "Allow link notifications from blogs," which enables this by default.
Cloudflare IP Allow-listing Bypass with Workers:
The talk provides a detailed walkthrough of using Cloudflare Workers to bypass IP allow-listing. Workers run serverless JavaScript code on Cloudflare's edge. An attacker can deploy a worker that makes a fetch request to an arbitrary URL. The key challenge: Workers cannot directly fetch IP addresses. Taylor's solution involves nip.io, a service that resolves subdomains like 192-53-168-172.nip.io back to 192.53.168.172. By having the Worker fetch the nip.io domain, the request is routed to the origin IP, originating from an official Cloudflare IP (which is in the documented IP ranges). The attacker can create a worker proxy where their browser or HTTP proxy (e.g., Burp Suite) redirects traffic to their worker, which then proxies it to the origin.
Imposter Domains and Host Header Validation:
The imposter domain technique involves an attacker setting up their own domain (e.g., attacker-controlled.xyz) within their own Cloudflare (or Azure/AWS) zone, configuring its DNS to point to the discovered origin IP. Since the CDN doesn't necessarily validate IP ownership for domain routing, this works. The attacker can then disable WAF, DDoS, and caching on their imposter domain, effectively getting unfettered access to the origin from a CDN IP.
This highlights the critical importance of host header validation on the origin server. If the origin's reverse proxy (e.g., Nginx, Apache, Caddy) is configured to only serve content for legittarget.com and rejects requests with other Host headers (like attacker-controlled.xyz or nip.io), the imposter domain attack fails. Taylor shows a Caddy file example demonstrating this. Cloudflare actively restricts users from modifying the Host header via transformation rules for security reasons, making direct host header spoofing via their platform difficult.
CDN-Specific Protections and Bypasses:
- Azure Front Door and AWS CloudFront both recommend IP filtering using service tags (e.g.,
FrontDoor.Backendfor Azure,CLOUDFRONTfor AWS). If defenders allow broader service tags (e.g., all Azure IPs), attackers can use other Azure/AWS services (e.g., Azure Functions, AWS Lambda/API Gateway/EC2) to originate traffic from a valid cloud provider IP. Taylor mentions Fireprox as an open-source tool for routing traffic through AWS API Gateway. - Azure Front Door also recommends validating the unique
X-Azure-FDIDheader, which ties traffic to a specific Front Door profile. This prevents imposter Front Door profiles. Similarly, for CloudFront, adding and validating a custom secret header is crucial. - Cloudflare Authenticated Origin Pools use mTLS. While convenient, the default setting uses a public Cloudflare CA. This means any Cloudflare customer (including an attacker with an imposter domain) can obtain a Cloudflare-signed certificate and authenticate to the origin. Defenders must upload their own custom CA and certificates for true tenancy-specific authentication.
Eliminating Public IP Exposure:
The talk emphasizes that the strongest defense is to completely eliminate the origin server's public IP exposure.
- Cloudflare Tunnels connect the origin server to the Cloudflare network via a WireGuard-like tunnel, making the origin's IP unroutable on the public internet. The CDN connects to the origin via this private tunnel, and all public inbound traffic to the origin IP can be dropped at the firewall. Cloudflare automatically adds a CNAME record (e.g.,
tunnel_id.cfargotunnel.com) to link the domain to the tunnel. Taylor demonstrates that Cloudflare prevents imposter CNAME records from resolving across different zones, making this a robust protection. - Azure VPN Gateway and AWS VPN offer similar solutions, connecting the origin to a Virtual Net or Virtual Private Cloud (VPC), respectively. Private links then connect the CDN (Front Door/CloudFront) to the origin within this private network.
- For large organizations, Direct Connect (AWS), ExpressRoute (Azure), or Network Interconnect (Cloudflare) establish direct, private network links between the CDN provider and the organization's data center, completely bypassing the public internet for origin traffic.
- Dedicated IPs (Cloudflare Enterprise only) provide a unique, static IP address tied to a specific Cloudflare tenancy, allowing for highly restricted IP allow-listing.
Demo / Proof of Concept
▶ Watch: Key mitigations and secure configurations for defenders (43:00)
While not a live hacking demonstration, Taylor effectively walked through several practical scenarios and command-line outputs that serve as proofs of concept for the discussed techniques.
- Cloudflare Workers for IP Bypass:
- Taylor showed the Cloudflare Workers playground interface where a simple JavaScript
fetchrequest was made to an attacker-controlled listener. The observed request's source IP confirmed it originated from an official Cloudflare IP address, validating the premise that Workers can make requests from within the CDN's IP space. - To overcome the Worker limitation of not being able to
fetchdirect IP addresses, the use ofnip.iowas demonstrated. An attacker's worker couldfetch192-53-168-172.nip.io, which transparently resolves to the target origin IP, allowing the Cloudflare Worker to proxy traffic to the origin.
- Imposter Cloudflare Domain:
- The concept was demonstrated by showing how an attacker could configure a DNS
Arecord within their own Cloudflare zone to point to the target origin IP. Taylor explained that this setup would allow the attacker to control WAF/DDoS settings for their imposter domain, effectively bypassing the legitimate domain's protections while still leveraging Cloudflare's network.
- WordPress Pingback Exploitation:
- Taylor presented the XML structure of a crafted pingback message. This message, containing an attacker-controlled listener URL as the
sourceURI, would be sent to the target WordPress site'sxmlrpc.phpendpoint. - The subsequent outbound request from the WordPress origin to the attacker's listener would then reveal the origin server's public IP address, proving the vulnerability. The talk included a screenshot of the
out-of-band testing toolshowing the incoming request and the leaked IP.
- Host Header Validation Example:
- A simple Caddy server configuration snippet was provided, illustrating how a reverse proxy could be configured to only serve traffic for
legittarget.com. This demonstrated that requests with a differentHostheader (e.g., from an imposter domain or anip.iorequest) would not be proxied to the application, thus blocking the bypass attempt.
These examples, backed by clear explanations and visual aids from the slides, provided concrete evidence of how the discussed vulnerabilities could be exploited and how certain defensive measures would function.
Defensive Implications
▶ Watch: Q&A: Cloudflare Tunnels cross-zone resolution confirmation (49:00)
The talk concludes with a strong emphasis on defensive strategies, providing a roadmap for organizations to secure their origin servers.
- Assume Origin IP is Discoverable: Defenders must operate under the assumption that their origin server's public IP address can be found. This necessitates rotating origin IPs after onboarding a CDN, as historical DNS records are a common leak source. Regular audits of subdomains, SPF records, email headers, certificates, and unique web page identifiers (favicons, analytics tokens) are crucial to identify and remediate potential leaks. Scrutinize any services (SSH, FTP) that might directly expose the origin.
- Rigorously Validate All Inbound Traffic:
- Host Header Validation: This is a fundamental and easily implementable defense. Configure reverse proxies (Apache, Nginx, Caddy) on the origin server to explicitly validate the
Hostheader, accepting only requests for the legitimate domain(s) and dropping all others. This prevents imposter domains andnip.iotricks from reaching the application. - Secret Headers: Implement a secret header (e.g.,
X-Secret-Header: <unique-secret>) that the CDN adds to all requests forwarded to the origin. The origin's reverse proxy should then validate this header, dropping any requests that lack it or present an incorrect value. Cloudflare's transformation rules and CloudFront's custom header options facilitate this. While potentially leakable (e.g., via LFI or debug logs), it adds a significant layer of defense when combined with other measures.
- Strict and Specific IP Allow-listing:
- Do not allow-list entire CDN ASNs or self-generated IP lists. Instead, strictly adhere to the official, documented IP ranges provided by the CDN for connections to your origin.
- For Azure and AWS, leverage service tags (e.g.,
FrontDoor.Backendfor Azure Front Door,CLOUDFRONTfor AWS CloudFront) to ensure only traffic from the specific CDN service is allowed, preventing other cloud services from reaching the origin.
- Strengthen Mutual TLS Configurations:
- If using Cloudflare's Authenticated Origin Pools, immediately configure it with a custom, tenancy-specific certificate authority (CA). The default Cloudflare CA is public and can be abused by attackers with imposter domains. This ensures that only requests from your specific Cloudflare zone can authenticate.
- Eliminate Public IP Exposure Entirely: This is the most robust defense.
- Cloudflare Tunnels: Implement Cloudflare Tunnels to connect the origin server directly to the Cloudflare network via a private, WireGuard-like tunnel. Once configured, drop all inbound public IP traffic to the origin server.
- VPN Gateways / Private Links: For Azure and AWS, use VPN Gateways to connect the origin to a virtual network or VPC, then link this privately to the CDN profile/distribution using private links. Again, block all public inbound traffic to the origin.
- Direct Connect / ExpressRoute / Network Interconnect: For organizations with the necessary infrastructure, establish direct, private network links between the CDN provider and your data center, ensuring origin traffic never traverses the public internet.
- Harden Application-Specific Vulnerabilities:
- For WordPress sites, disable pingbacks (
Allow link notifications from blogs) and other unnecessaryxmlrpc.phpfunctionality. Apply general hardening best practices for any web application. - Review applications for SSRF vulnerabilities and ensure API callbacks cannot be coerced into revealing internal IPs.
- General Security Hygiene:
- As highlighted by an audience question, enforce Multi-Factor Authentication (MFA) on all CDN accounts and administrative interfaces.
- Ensure comprehensive logging is enabled and regularly reviewed for CDN and origin server traffic, to detect anomalous access patterns.
By implementing these layered defenses, organizations can significantly reduce the risk of origin server bypasses, ensuring their CDN's WAF and DDoS protections remain effective.
Key Takeaways
- Origin server IPs are rarely truly hidden: Passive and active reconnaissance techniques make finding origin IPs almost inevitable, even behind CDNs. Rotate IPs and meticulously audit all potential leak points.
- CDN IP allow-listing is often insufficient: Simply allowing all CDN provider IPs (e.g., a broad ASN range) is dangerous. Strict allow-listing to official, specific service tags (e.g.,
FrontDoor.Backend,CLOUDFRONT) and validating unique headers are crucial. - Host header validation is critical: Configure your origin server's reverse proxy to strictly validate the
Hostheader, accepting only legitimate domain names. This single step can mitigate many imposter domain and proxy bypasses. - Secret headers add a vital defense layer: Implement a unique secret header added by the CDN and validated by the origin, tying traffic directly to your specific CDN configuration.
- Mutual TLS needs careful configuration: Cloudflare's Authenticated Origin Pools require custom certificates to ensure tenancy-specific authentication, as the default public CA can be abused.
- Eliminating public IP exposure is the strongest defense: Cloudflare Tunnels, VPN Gateways, and direct network interconnects are the most secure options, making the origin unroutable from the public internet.
About the Speaker(s)
Taylor is a red teamer by profession, whose daily work involves identifying and exploiting security vulnerabilities in organizations. This background deeply informs the perspective of the talk, focusing on practical attack methodologies. While approaching the topic from an offensive standpoint, Taylor is committed to ensuring that defenders gain actionable insights, providing detailed advice on how to fix the discussed issues and understand their root causes.