Privilege escalation to root in Pages build image v2
A user-readable directory in the Cloudflare Pages build process (v2) allowed an attacker to replace two executable files that run during the build, potentially gaining root access to the build container. The keys were scoped to the user's own Pages site data, and Cloudflare remediated by tightening file system permissions.
Originally disclosed on HackerOne
- Triaged in under an hour
- Fixed in 25 hours
- Paid in 17 hours
- Disclosed after 17 days
Summary by the program
Due to a user-readable directory in the Cloudflare Pages build process (v2), an attacker could replace the contents of 2 executable files (that are executed during the build process) present in this directory with arbitrary content, leading to potential root access to the container running the build. While all the keys were scoped to allow access to the user's own Pages site data and not the data of others, Cloudflare's Engineering team chose to remediate the issue by tightening permissions on the file system.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a permissions mistake: a directory writable by the build user contained executable files that the build process later ran with elevated privileges, allowing replacement of those files.
Impact
An attacker could potentially gain root access to the container running their own build, but the keys were scoped to the user's own Pages site data and not the data of others.
What the attacker needed
Access to a Pages build (v2)
The fix
Cloudflare's Engineering team remediated the issue by tightening permissions on the file system.
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 report has not been written yet. The Original tab links to the source.
In a cloud build service, your code runs inside a container (a lightweight isolated environment). If a directory that your build user can write to contains programs that the build later runs with higher privileges, you can swap those programs for your own and take over the container. Here, the build process ran two such programs from a writable location, so replacing them could give root (full administrator) access inside that container.
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.