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.