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