Web Mass Assignment Vulnerabilities
Several frameworks offer handy mass-assignment features to lessen the workload for developers.
Ruby on Rails
Ruby on Rails is a web application framework that is vulnerable to this type of attack. The following example shows how attackers can exploit mass assignment vulnerability in Ruby on Rails. Assuming we have a User
model with the following attributes:
By tampering with the parameters sent to the server we could send the following parameters:
Although the User
model does not explicitly state that the admin
attribute is accessible, the attacker can still change it because it is present in the arguments. Bypassing any access controls that may be in place, the attacker can send this data as part of a POST request to the server to establish a user with admin privileges.
Another example
Suppose we come across the following application that features an Asset Manager web application. Also suppose that the application's source code has been provided to us. Completing the registration step, we get the message Success!!
, and we can try to log in.
After login in, we get the message Account is pending approval
. The administrator of this web app must approve our registration. Reviewing the python code of the /opt/asset-manager/app.py
file reveals the following snippet.
We can see that the application is checking if the value k
is set. If yes, then it allows the user to log in. In the code below, we can also see that if we set the confirmed
parameter during registration, then it inserts cond
as True
and allows us to bypass the registration checking step.
In that case, what we should try is to register another user and try setting the confirmed
parameter to a random value. Using Burp Suite, we can capture the HTTP POST request to the /register
page and set the parameters username=new&password=test&confirmed=test
.
We can now try to log in to the application using the new:test
credentials.
The mass assignment vulnerability is exploited successfully and we are now logged into the web app without waiting for the administrator to approve our registration request.
Last update: 2025-06-01 Created: June 1, 2025 11:12:15