Skip to content
Access control Write-up Intermediate

Using Cloudflare to bypass Cloudflare by Stefan Proksch

Cloudflare's shared origin protection mechanisms (Authenticated Origin Pulls with the shared Cloudflare certificate and allowlisting Cloudflare IP ranges) trust any traffic from Cloudflare, regardless of tenant. An attacker can create their own Cloudflare domain pointing to the victim's origin IP, disable protections, and tunnel malicious requests through Cloudflare, bypassing the victim's WAF and other defences.

Stefan Proksch Follow

Published on certitude.consulting

Written by Stefan Proksch on 28.09.202305.10.2023

Stefan Proksch, Florian Schweitzer (@FSchweitzer), on certitude.consulting

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the origin protection mechanisms authenticate Cloudflare as a whole rather than the specific tenant, so any Cloudflare customer can reach the origin server through the shared infrastructure.

Impact

Attackers can bypass customer-configured protections such as WAF and DDoS prevention, potentially exposing origin servers to attacks those protections are meant to stop; the effective impact depends on the origin server configuration.

What the attacker needed

Attacker has a Cloudflare account; attacker knows victim origin IP; victim uses shared Cloudflare cert or IP allowlist

The fix

Cloudflare customers should use custom certificates for Authenticated Origin Pulls instead of the shared Cloudflare certificate, treat IP allowlisting as defence-in-depth, and consider tenant-specific authentication mechanisms; Cloudflare should implement protections against such attacks and warn…

How it was found

  1. The attacker creates a Cloudflare account and adds a domain (attacker.test).
  2. The attacker sets the DNS A record for attacker.test to the victim's origin server IP address.
  3. The attacker disables all protection features (WAF, security level) for attacker.test in their Cloudflare account.
  4. The attacker sends malicious requests to attacker.test, which Cloudflare forwards to the victim's origin server, bypassing the victim's WAF.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Cloudflare is a service that sits in front of a website to block attacks. To make sure only Cloudflare can reach the website, owners can either accept connections only from Cloudflare's IP addresses or require a special certificate that Cloudflare presents. The problem is that these checks accept any Cloudflare customer, not just the website owner. So an attacker can sign up for Cloudflare, point their own domain at the victim's server, turn off all protections, and use Cloudflare as a free pass to attack the server.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More from Cloudflare

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.