The Vuln Less Common series, Part 1: Mass Assignment Vulnerabilities

Part 1: Mass Assignment Vulnerabilities

 

ce1124c2ec9f0e62839422dbbe1f6577.pngBackground

 

Before you can understand mass assignment vulnerabilities, you should have a basic understanding of the Model-View-Controller application design pattern.

Presented below is a somewhat generic and over-simplified view of its components and relevant features.

 

Model

In MVC, the model provides an interface (API) to the controller for the retrieval and manipulation of core data.

 

View

The view is responsible for the presentation of data as provided by the controller or from direct interaction with the model.

 

Controller

In MVC, the controller is responsible for accepting, handling and validating user input as provided by the view. This input is then used to interact with and update the model accordingly.

 

Active Record

Ubiquitous application design pattern where database tables are wrapped in a class and database records are treated as objects. Take for an example, a database record of a user. This record likely has the following columns: name, address, email, password, role, etc. By modeling this user in memory, the application allows for manipulation of the record's state in an object-oriented manner. This approach takes the place of classic direct interaction with the database.

 

        Classic approach: UPDATE users SET name = 'joe' WHERE id = 2

        Active record-based approach: user.name = 'joe'

 

Mass Assignment

Mass assignment is an MVC feature that allows all parameters of an HTTP request to be assigned as variables to an active record. Let's use our user-record again for an example:

 

https://example/updateUsers.aspx?id=2&name=joe&email=joe@cool.com&password=foobar

 

Our model would then be updated for the user where user.id = 2 as:

 

        user.name = 'joe'

        user.email = 'joe@cool.com'

        user.password = 'foobar'

 

 

The Vulnerabilitybullet-hole-in-glass-md.png

Mass assignment vulnerabilities arise in instances where the application allows mass assignment, but does not limit or provide proper access control around the attributes which can be updated.

 

Here's a classic example whereby a user creates a new account and assigns himself administrative access through mass assignment:

 

https://example/updateUsers.aspx?id=2&name=joe&email=joe@cool.com&password=foobar&isAdmin=True

 

This is a common example, as its is quite easy grasp the concepts from it, but the situations where these vulnerabilities can and will arise are endless. Here at Fortify on Demand, we've uncovered a number of mass assignment vulnerabilities in various applications allowing for mostly privilege-related and data corruption-based attacks. The risks involved are usually quite significant but can run the entire risk spectrum depending of course on the nature of the application and the value of the stored data.

 

Prevention


Implementation will vary by framework, but restricted properties and methods should be explicitly declared to prevent their unwanted manipulation and modification.  Input validation using a whitelist approach can additionally be employed as part of a defense in depth strategy. Consult your framework's documentation for specific details.

 

 

search-icon-red-th.png

Detection


Uncovering mass assignment vulnerabilities requires the web penetration tester to manually interact with the application using some type of interception proxy, closely observing parameter names and values and with careful attention paid to key state-changing functionality. Educated guesses are then made by the tester as to what additional attributes maybe added and manipulated.

 

FoD provides this high-level of manual testing as part of our advanced dynamic testing offerings. Click here to learn more about our dynamic application testing services and of course feel free to reach out to me with any questions via Twitter (@antunesdennis) or via email (fodsales@hp.com). 

 

 

Tags: fod| Fortify
Labels: HP| security
Leave a Comment

We encourage you to share your comments on this post. Comments are moderated and will be reviewed
and posted as promptly as possible during regular business hours

To ensure your comment is published, be sure to follow the Community Guidelines.

Be sure to enter a unique name. You can't reuse a name that's already in use.
Be sure to enter a unique email address. You can't reuse an email address that's already in use.
Type the characters you see in the picture above.Type the words you hear.
Search
Showing results for 
Search instead for 
Do you mean 
About the Author
Featured


Follow Us
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.