Skip to content
RCE Write-up Advanced

What happens when a vulnerability is reported?

Several command injection and privilege escalation flaws in Cloudflare Pages' build pipeline allowed attackers to execute arbitrary code, read environment variables containing secrets, and potentially access other customers' private repositories. The issues were fixed and customers notified where logs could not prove no exploitation.

blog.cloudflare.com

Published on blog.cloudflare.com

Cloudflare cares deeply about security and protecting our users and customers — in fact, it’s a big part of the reason we’re here. But how does this manifest in terms of how we run our business?

The author, on blog.cloudflare.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

Likely multiple root causes: attacker-controlled input (root_dir) passed to shell commands, overly permissive file permissions (777) on a build helper, unsafe PATH directories, privileged containers with docker socket, and missing network restrictions in Kubernetes.

Impact

Attackers could execute arbitrary code, steal secrets, and potentially read other customers' private repositories; for one bug, logs could not prove no exploitation, so all affected customers were notified.

What the attacker needed

Ability to trigger a Pages build; control over build configuration; none for some bugs

The fix

The issues were fixed by input validation, rotating secrets, correcting file permissions, adding iptables rules, and re-architecting the platform to use gVisor and Kubernetes with minimal credentials.

How it was found

  1. Craft a malicious root_dir value to dump environment variables to a file.
  2. Read the file to obtain the GitHub bot's authorization key.
  3. Use the key to access other Pages customers' repositories.
  4. Overwrite the pages-metadata-generator program with a reverse shell.
  5. Run the build to execute the reverse shell and read environment variables.
  6. Escape the container by mounting the host root directory using docker.

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 Pages builds customer code in a shared environment. Mistakes in how that build process handled inputs and file permissions let attackers run their own commands and steal secret keys, which could give access to other customers' private code. The company fixed the bugs and changed the architecture to isolate builds better.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.