Hunting For Mass Assignment Vulnerabilities Using GitHub CodeSearch and grep.app
A mass assignment vulnerability in freeCodeCamp's user update endpoint allowed an attacker to set arbitrary user attributes, including all certification flags, by sending a single request. This enabled acquiring every coding certification without completing the required study.
Published on blog.includesecurity.com
This post discusses the process of searching top GitHub projects for mass assignment vulnerabilities. This led to a fun finding in the #1 most starred GitHub project, freeCodeCamp, where I was able to acquire every coding certification – supposedly representing over 6000 hours of study – in a single request.
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 updateUserFlag function passed the entire request body directly to user.updateAttributes without filtering or allow-listing the fields that a user is permitted to modify.
Impact
An attacker could acquire every coding certification on freeCodeCamp, which supposedly represent over 6000 hours of study, undermining the integrity of the platform's certifications.
What the attacker needed
A free account on freeCodeCamp dev environment; ability to send a crafted PUT request
The fix
The vulnerability was fixed by freeCodeCamp, and a GitHub security advisory was released.
How it was found
- Search for the pattern 'user.updateAttributes(' using grep.app and identify freeCodeCamp as a match.
- Confirm the function is reachable via a public route, a PUT request to /update-user-flag.
- Create an account on freeCodeCamp's dev environment and inspect the user model to find modifiable attributes.
- Send a PUT request to /update-user-flag with a JSON body containing all certification flags set to true.
- Observe that signed certifications appear on the profile.
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.
Mass assignment happens when a website takes all the data you send and saves it without checking which fields you are allowed to change. Here, the user update function saved every attribute from the request body, so an attacker could add fields like certification flags and grant themselves all certifications.
What is IDOR?
One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.