Skip to content
Access control Write-up Intermediate

Hijacking email with Cloudflare Email Routing

Cloudflare Email Routing did not verify domain ownership when configuring routing, allowing an attacker to add a victim's domain to their own account and overwrite the destination address. This let the attacker read all email sent to the domain and block delivery to the legitimate address.

Albert Pedersen Follow

Published on albertpedersen.com

On Tuesday, December 7th 2021 I discovered a critical vulnerability in Cloudflare’s Email Routing service. This vulnerabilty enabled anyone to modify the routing configuration of any domain using the service.

Albert Pedersen, on albertpedersen.com

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

The API did not verify domain ownership before allowing Email Routing configuration changes on an unverified zone.

Impact

An attacker could read all email sent to the target domain and prevent delivery to the original destination, potentially leading to account takeover via password reset emails.

What the attacker needed

A Cloudflare account; victim domain uses Cloudflare Email Routing; victim domain not verified in attacker's account

The fix

The bug was fixed by Cloudflare.

How it was found

  1. Intercept the dashboard response and change the beta flag to true to gain access to Email Routing.
  2. Set up Email Routing on a domain in the primary account with a personal email as destination.
  3. Add the same domain to a secondary account where it remains unverified.
  4. Set up Email Routing on the unverified domain with a different destination email.
  5. Send an email to the domain and observe it arriving at the rogue destination.

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.

Email Routing is a service that forwards email sent to a domain to another address. The bug was that the service did not check whether the person setting up the forwarding actually owned the domain. So an attacker could add someone else's domain to their account and redirect all its email to themselves.

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 by Albert Pedersen

View all

1 more disclosed report, best first.

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.