Jul 31, 2025
Real-world Critical Vulnerabilities: CSRF + Mass-Assignment = Privilege Escalation to Admin ๐ฅท
๐๐ง๐ฎ๐ฆ๐๐ซ๐๐ญ๐ข๐จ๐ง
During a pentest a while ago, I saw that the 'GET /user' endpoint returned a JSON with user information and a ton of permission flags (all booleans), most notably 'isAdmin'.
The app also had a 'POST /user' endpoint, which allowed editing our current user.
๐๐๐๐ง๐ญ๐ข๐๐ฒ๐ข๐ง๐ ๐๐ข๐ฌ๐๐จ๐ง๐๐ข๐ ๐ฎ๐ซ๐๐ญ๐ข๐จ๐ง๐ฌ
Naturally, I tried updating my user and setting the 'isAdmin' flag to 'true' but that didn't work.
Interestingly, the app didn't have any CSRF tokens, and the cookie was set to 'SameSite=none', meaning the developers relied on the app using JSON to mitigate CSRF. Fortunately, the app also accepted URL-encoded POST requests, which means that we have successfully identified a CSRF vulnerability!
๐๐ฌ๐๐๐ฅ๐๐ญ๐ข๐ง๐ ๐๐๐๐
Now, a CSRF vulnerability is nice, but it would be of Medium severity. So the next thing we have to do is escalate it.
For this, I went back to the 'POST /user' endpoint and realized that it was vulnerable to Mass Assignment, meaning an admin user can set the 'isAdmin' flag for any user (it's hard to say if this was intended or not).
๐๐ฑ๐ฉ๐ฅ๐จ๐ข๐ญ๐๐ญ๐ข๐จ๐ง
This means that we can create an HTML snippet like the one I attached to this post, and host this on dub-flow[.]com. Then, lure an admin user of the app onto this page. Once they open the page, a POST request is sent to the app that makes my user an admin.
Subscribe to our Patreon Channel!
Subscribe to our Patreon Channel, to access excusilve pentesting content from our leading expert Florian.