Skip to content
Pwnversity
AUD-CLOUDFLAREintermediate · 13 min · upd. 2026-11

Auditing Cloudflare

CloudflareSSL/TLSWAF

Cloudflare sits in front of a website as DNS, reverse proxy, CDN and WAF. It also offers its own platform: Workers, Pages, R2 storage and Zero Trust access. The protection it provides depends on two things the customer configures: that all traffic really goes through Cloudflare, with no direct path to the origin server, and that the leg between Cloudflare and the origin is encrypted and authenticated. A perfect WAF is worthless if the origin answers anyone who knows its IP.

Cloudflare runs the network, the authoritative DNS and the services. The customer decides:

  • which records go through the proxy;
  • the encryption mode to the origin;
  • how the origin is protected;
  • which rules the WAF applies;
  • who administers the account and with which credentials;
  • what is exposed on Pages, Workers and R2.
flowchart LR
    V["Visitor"] -->|"HTTPS"| CF(("Cloudflare<br/>WAF, cache, bots"))
    CF -->|"SSL/TLS mode:<br/>Flexible = HTTP"| O[("Origin")]
    A["Attacker"] -. "origin IP:<br/>old DNS, MX, unproxied record" .-> O
    CF -->|"mTLS: Authenticated<br/>Origin Pulls"| O
    T["Cloudflare Tunnel<br/>(outbound connection)"] --- O
    CF --> P["Pages / Workers<br/>previews"]
    CF --> R["R2<br/>custom domain or r2.dev"]
Item What to look for Recommended
Super Administrators Too many; unused personal accounts Two or three named people, with phishing-resistant 2FA
2FA Members without 2FA 2FA Enforcement turned on by a Super Administrator
Global API Key Used in scripts or integrations Don’t use it: it has full access to everything in the account. Roll it if it was exposed
API tokens Broad permissions, no IP restriction or expiry Account tokens with minimal per-zone permissions, source IP and expiry date
Audit log Nobody reviews it Periodic review or shipping to a SIEM

New credential formats carry a prefix so secret scanners can recognize them:

  • cfk_: Global API Key.
  • cfut_: user token.
  • cfat_: account token.

A Global API Key in the old format (a hex string) found in a repository stays valid until someone rolls it.

Mode Visitor → Cloudflare Cloudflare → origin Notes
Off HTTP HTTP No encryption
Flexible HTTPS HTTP The browser padlock misleads: the leg to the origin is in cleartext
Full HTTPS HTTPS without certificate validation Encrypts, but accepts any certificate (including a self-signed or intercepting one)
Full (strict) HTTPS HTTPS with a valid certificate The recommended one. The certificate can come from Cloudflare’s Origin CA
Strict (SSL-only origin pull) HTTP/HTTPS Always validated HTTPS Enterprise

Today the default is Automatic SSL/TLS: Cloudflare probes the origin and raises the zone to the most secure mode it supports. Even so, an old zone on a custom setting can still be on Flexible. Cloudflare states that if the application handles personal data or logins, Full or Full (strict) should be used.

Ventana de terminal
# API with a read-only zone token
curl -s -H "Authorization: Bearer $CF" "https://api.cloudflare.com/client/v4/zones/$ZONE/settings/ssl" | jq '.result.value'
curl -s -H "Authorization: Bearer $CF" "https://api.cloudflare.com/client/v4/zones/$ZONE/settings/always_use_https" | jq '.result.value'
curl -s -H "Authorization: Bearer $CF" "https://api.cloudflare.com/client/v4/zones/$ZONE/settings/min_tls_version" | jq '.result.value'

If someone discovers the origin IP, they can send traffic to it directly and skip the WAF, bot protection and DDoS mitigation (see WAF bypass). The usual leaks listed in Cloudflare’s documentation:

  • DNS-only (grey cloud) records pointing to the same server: ftp, mail, dev, cpanel, old subdomains.
  • TXT and SPF records containing the server IP.
  • Mail on the same machine: a bounce to a non-existent address reveals the mail server IP.
  • Historical DNS: the IP the site had before moving to Cloudflare stays in history services. Cloudflare recommends rotating the origin IPs after onboarding.

Lab: does everything go through the proxy?

Section titled “Lab: does everything go through the proxy?”

A Python script queries A, AAAA, MX and DS records over DNS over HTTPS. It compares each IP with the ranges Cloudflare publishes at cloudflare.com/ips-v4 and ips-v6 (14 and 6 ranges on November 21, 2026).

import ipaddress, json, sys, urllib.request
RANGES = [ipaddress.ip_network(l.strip()) for f in ("ips-v4.txt", "ips-v6.txt") for l in open(f) if l.strip()]
TYPES = {"A": 1, "AAAA": 28, "MX": 15, "DS": 43}
def doh(name, rtype):
req = urllib.request.Request(f"https://cloudflare-dns.com/dns-query?name={name}&type={rtype}&do=1",
headers={"accept": "application/dns-json"})
r = json.load(urllib.request.urlopen(req, timeout=15))
return r, [a["data"] for a in r.get("Answer", []) if a["type"] == TYPES[rtype]]
def is_cf(ip):
return any(ipaddress.ip_address(ip) in net for net in RANGES)
for domain in sys.argv[1:]:
for rtype in ("A", "AAAA"):
for ip in doh(domain, rtype)[1]:
print(rtype, ip, "Cloudflare (proxy)" if is_cf(ip) else "NOT Cloudflare: origin or DNS-only")
for mx in doh(domain, "MX")[1]:
host = mx.split()[-1].rstrip(".")
for ip in doh(host, "A")[1]:
print("MX", host, ip, "(Cloudflare)" if is_cf(ip) else "")
resp, ds = doh(domain, "DS")
print("DNSSEC: DS", "present" if ds else "absent", "| AD =", resp.get("AD"))

Output (trimmed) for three public domains: two behind Cloudflare and one that isn’t:

$ python3 cf_check.py cloudflare.com example.com github.com
A 104.16.132.229 Cloudflare (proxy)
AAAA 2606:4700::6810:84e5 Cloudflare (proxy)
MX mxa.global.inbound.cf-emailsecurity.net 141.101.90.40 (Cloudflare)
DNSSEC: DS present | AD = True
A 104.20.23.154 Cloudflare (proxy)
DNSSEC: DS present | AD = True
A 140.82.113.4 NOT Cloudflare: origin or DNS-only
MX github-com.mail.protection.outlook.com 52.101.60.148
DNSSEC: DS absent | AD = False

In an audit, run it against every known name of the domain: the ones in the inventory plus those found in certificates and subdomain enumeration (see subdomains). Any IP that isn’t Cloudflare’s and serves the same site is a finding.

Layer Control Notes
Network Origin firewall that only accepts Cloudflare ranges on 80 and 443 Simple. It doesn’t tell your Cloudflare account apart from another customer’s
Transport Authenticated Origin Pulls (mTLS): the origin requires a client certificate Doesn’t work with Off or Flexible. The global certificate is shared across all accounts and only proves the request came from Cloudflare’s network. A per-zone or per-hostname certificate of your own is exclusive to your account
Connection Cloudflare Tunnel: the origin opens an outbound connection and needs no public IP Not compatible with Authenticated Origin Pulls
Application The origin only answers the expected Host; JWT tokens or verified headers Complements the above
Plan Managed rules available
Free Cloudflare Free Managed Ruleset (severe, widespread vulnerabilities)
Pro, Business, Enterprise Also the Cloudflare Managed Ruleset and the Cloudflare OWASP Core Ruleset

In the audit, check:

  • that the rulesets are deployed and blocking, not just logging;
  • skip rules: an exception by IP or a broad path cancels everything else;
  • rate limiting rules on login and the API;
  • that the security events log gets looked at.
  • DNSSEC on, with the DS record published at the registrar. Without the DS, signing the zone does nothing.
  • Dangling records: CNAMEs to decommissioned services (buckets, apps, deleted Pages projects) allow taking over the subdomain (see subdomain takeover).
  • CAA records, to limit which certificate authorities can issue certificates for the domain.
  • Pages previews. They’re public by default. The project’s Access policy protects the previews (<hash>.<project>.pages.dev), but not the production *.pages.dev domain or the custom domain, which need their own configuration. Workers preview URLs are protected with Access from Domains & Routes.

  • R2. Buckets are private by default. Making them public has two paths:

    • a custom domain, which supports WAF, caching and Access;
    • the Public Development URL (r2.dev), meant for development, rate-limited and without WAF, Access or bot management.

    If the bucket is served through a custom domain with Access or WAF, turn off r2.dev. Otherwise the content stays public through that other door.

  • Workers secrets: with wrangler secret put, never as vars in wrangler.toml, which ends up in the repository.

Ventana de terminal
wrangler secret list
wrangler r2 bucket dev-url get <bucket> # r2.dev URL status
wrangler r2 bucket domain list <bucket>
wrangler pages deployment list

Customers can scan and pentest their own assets: their own IPs and the public IPs Cloudflare assigns to their zones, within the restrictions of its policy. Cloudflare’s own domains are only tested within its public bug bounty program.

  • Cloudflare incident (November 2023). After the October 2023 Okta compromise, Cloudflare rotated the leaked credentials, but left one service token and three service accounts unrotated, out of thousands. It believed they were unused.

    • The attacker, which Cloudflare attributes to a likely nation-state, used them from November 14 to get into its self-hosted Atlassian (Jira, Confluence, Bitbucket).
    • Cloudflare detected it on November 23.
    • Afterwards it rotated more than 5,000 production credentials.

    Segmentation kept the attacker out of its Okta and its Cloudflare dashboard. For an audit, the lesson is the inventory of service credentials: one that “isn’t used” stays valid until it’s revoked.

  • The origin as the weak point. Cloudflare’s documentation dedicates a whole guide to protecting the origin because it’s the most common failure. An origin reachable by IP voids the WAF and DDoS mitigation.

  • Few Super Administrators; 2FA Enforcement on
  • Global API Key unused and rolled; account API tokens with minimal permissions, IP and expiry
  • Audit log reviewed or shipped to a SIEM
  • SSL/TLS mode Full (strict), or Automatic resolving to strict; never Flexible with sensitive data
  • Always Use HTTPS, HSTS and minimum TLS version reviewed
  • Every domain name checked: no origin IP exposed by unproxied, TXT or MX records
  • Origin IP rotated after onboarding; firewall limited to Cloudflare
  • Authenticated Origin Pulls with your own certificate, or Cloudflare Tunnel
  • WAF: managed rulesets deployed and blocking; no broad exceptions; rate limiting on login and API
  • DNSSEC with the DS published; no dangling records; CAA defined
  • Pages and Workers previews protected with Access
  • R2 buckets private or on a custom domain; r2.dev off when WAF or Access are in place
  • Workers secrets stored as secrets, not in wrangler.toml