Exposure
A Cloudflare WAF, rate limits and bot rules only help if every request goes through Cloudflare. If the origin answers anyone who finds its address, an attacker can skip all of it. pqdoctor exposure checks that, with proof.
export CLOUDFLARE_API_TOKEN=… # read-only is enoughpqdoctor exposure list example.com # proxied hostnames and their originspqdoctor exposure consent example.com --hosts www.example.com,api.example.com# place the canary on the origin (the command prints how), then:pqdoctor exposure canary verifypqdoctor exposure example.com --html report.html --sign signing.key --out report.jsonThree states
Section titled “Three states”| State | What it means | Example |
|---|---|---|
| Confirmed bypass | The origin served this run’s canary, an exact random nonce, to a request that didn’t come through your zone. Confirmed twice, seconds apart. | Fetching the canary from the origin’s IP with your hostname as SNI and Host works. |
| Verified weakness | A setting read from the API or the origin leaves a way around Cloudflare, but no bypass was shown. | SSL/TLS on Flexible or Full; AOP with Cloudflare’s shared certificate; an origin that relies on an IP allowlist only; a classical origin hop. |
| Potential | A passive signal that may reveal the origin’s address. | A DNS-only record, MX host or SPF ip4: on the origin’s address; a certificate-transparency name that resolves to it. |
A confirmed bypass is never inferred. The origin has to return the exact nonce, twice. An origin that answers with a different page, with the nonce inside HTML, or with the canary only once, is reported as potential, never confirmed.
Consent and the canary
Section titled “Consent and the canary”Nothing is sent to an origin until two things are true:
- You selected the hostname.
pqdoctor exposure consent ZONE --hosts …records which proxied hostnames may be actively tested, and makes a fresh 128-bit nonce. - The canary was verified through Cloudflare. The canary is the text
flarebox-canary <nonce>, served at/.well-known/flarebox/<nonce>by every allowed hostname.pqdoctor exposure canary verifyfetches it athttps://<hostname>with the certificate checked. Placing it proves you control the origin.
To place it:
- Static file: create the file under the web root (
pqdoctor exposure canary write --webroot DIRdoes this on the origin, after asking;canary removeundoes it). - nginx: a
location = /.well-known/flarebox/<nonce>block. Caddy: arespondline. Apache: anAlias. - The exact lines are printed by
consent.
Settings and passive signals are read without consent: they come from the API and public DNS, not from requests to your origin.
The checks
Section titled “The checks”- Direct origin. For each address of each allowed hostname (up to six),
GET /.well-known/flarebox/<nonce>over TLS on 443 (any certificate accepted) and over plain HTTP on 80, with your hostname as SNI and Host. An exact match, repeated two seconds later, is a confirmed bypass. Every direct request refused or timing out, with AOP off, is the IP allowlist only weakness. - Cross-account. From a separate, Flarebox-owned zone on a different Cloudflare account (
--cross-account testzone.toml): a temporary proxied record pointing at your origin’s address, an origin rule giving it your hostname as Host and SNI, then the canary through Cloudflare. A match means any Cloudflare account can reach your origin. The record and rule are removed afterwards, and the zone’s other rules are kept. - AOP and SSL mode. Read from the API. Zone-level AOP with Cloudflare’s shared certificate is a weakness: every Cloudflare account presents it. Per-hostname or zone AOP with your own certificate is not. SSL Off, Flexible or Full is a weakness; Full (strict) is not.
- Classical origin hop. pqdoctor’s handshake-only key-exchange probes against the origin. Not post-quantum is a weakness.
- Passive leaks. DNS-only A/AAAA records on an origin address, MX hosts that resolve to one, SPF
ip4:/ip6:ranges that cover one, and (with--ct) certificate-transparency names that resolve to one.
Tunnels, Workers, Pages and private or placeholder addresses are skipped, with the reason shown.
Safety rules
Section titled “Safety rules”- Non-destructive: the only HTTP request to an origin is
GET /.well-known/flarebox/<nonce>. Nothing else is requested, posted or changed, and at most 16 KB is read. The only other traffic is handshake-only TLS connections for the key-exchange check (no HTTP request;--no-pqskips it), and in Flarebox a certificate pre-check before Full (strict), on consented hostnames only. - Paced: at least 200 ms between requests (1 s by default,
--gap MS), at most 20 hostnames a run. - Recorded: every request a run sent is listed in the report (
requests). - Never Cloudflare’s own addresses: a proxied name whose CNAME points back into Cloudflare resolves to Cloudflare’s edge, not an origin. Such a hostname is skipped with the reason, and an answer carrying a CF-Ray header never counts as a bypass.
- The cross-account test is careful with the test zone: it reads the zone’s rules before creating anything (and creates nothing if it can’t), uses a rule of its own per run, removes only that rule, sweeps up probes left by a crashed run, and reports any cleanup problem.
- Changes are separate: the CLI reports fixes; Flarebox applies them through its approved-change path.
| Finding | Fix |
|---|---|
| Direct origin (confirmed) | A Cloudflare Tunnel, or per-zone AOP with your own certificate plus a firewall to Cloudflare’s ranges |
| Cross-account (confirmed), AOP shared certificate | Per-hostname AOP with its own certificate; the origin trusts only that CA |
| IP allowlist only | AOP with your own certificate, required at the origin |
| SSL mode | Full (strict), after checking the origin’s certificate |
| DNS-only record | Proxy the record, or move the origin to a new address |
| MX, SPF, CT | Move mail or the name elsewhere, then move the origin to a new address |
| Classical origin hop | pqdoctor fix on the origin |
In Flarebox, each Cloudflare fix is planned, confirmed, applied and verified, then the finding is re-tested from outside. If the site stops serving the canary through Cloudflare, the change is rolled back.
The signed report
Section titled “The signed report”--out report.json writes the report. --sign KEY signs it with ML-DSA as a compact JWS (pqdoctor-exposure+jwt, the same signing as assure certify) next to it. --html report.html writes the one-page report (A4, or --letter), which prints to one PDF page. Every field of the report JSON, the signature’s claims, the consent file and the fleet push is in the JSON reference.
pqdoctor identity-bridge keygen keys/ # an ML-DSA key and its jwks.jsonpqdoctor exposure example.com --out report.json --sign keys/signing.key --html report.htmlpqdoctor exposure verify-report report.json report.json.jws --jwks keys/jwks.jsonEvery day, from an agent
Section titled “Every day, from an agent”[exposure]zone = "example.com"consent = "/etc/pqdoctor/exposure-consent.json"token_env = "CLOUDFLARE_API_TOKEN"# cross_account = "/etc/pqdoctor/testzone.toml"# every_hours = 24The agent runs it at most once a day and pushes only the sanitized findings to the fleet:
- Never sent: tokens, the nonce, or evidence lines.
- Addresses: sent only if the consent allows it (
consent --share-ips).
The fleet alerts on regressions, confirm-before-alert:
- A confirmed bypass alerts at once, since the agent already confirmed it twice.
- A new weakness or leak alerts only if the next run still shows it.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
| 0 | Nothing to fix (or potential signals only) |
| 1 | A verified weakness |
| 3 | A confirmed bypass |
| 2 | Couldn’t run |
| 64 | Usage error |
Limits
Section titled “Limits”- One vantage point, IPv4 and IPv6 as the machine can reach them. A geo-routed origin may answer differently elsewhere.
- The cross-account test needs a zone on a second Cloudflare account. Without one, it’s reported as not configured. Host-header override in origin rules may need a paid plan; without it the probe name is tried alone.
- A firewall that allows Cloudflare’s ranges looks like IP allowlist only from here. Only the cross-account test can show whether another account gets through.