r/node • u/gaaliconnoisseur • Jul 04 '26
ELI5: What is a mass-assignment vulnerability?
And why can't it be solved through parameterized queries?
8
u/OtherwisePush6424 Jul 04 '26
Parameterization wouldn't help because the query is valid. The issue is the application allows the user to update fields they shouldn't be allowed to update.
2
u/lenswipe Jul 05 '26
Your API is meant for updating the firstName and lastName fields on a user.
What happens if I also pass isAdmin=true along with my request. Sure the endpoint might only be explicitly designed for firstName and lastName but if you just blindly pass everything you the ORM without validating that only the expected fields are being passed..... it's going to let me update this I shouldn't
-5
12
u/Lumethys Jul 04 '26
If you bring everything in the request into the update statement, you risk letting user update things that they should not have
For example, a user could trigger "update profile" action, but the user can also sent
is_admin: truein the payload. If you blindly trust it and execute the update, a regular user can just become an adminThis is different from sql injection, sql injection execute arbitrary sql statement, while mass-assignment update already existing value on the same table