Mass assignment vulnerability
Mass assignment (otherwise known as Autobinding in Spring MVC and ASP NET MVC, or Object injection in PHP) is a computer vulnerability where an active record pattern in a web application is abused to modify data items that the user should not normally be allowed to access such as password, granted permissions, or administrator status.[1] Mass assignment as a vulnerability was first demonstrated in 2012 by developer Egor Homakov against Github, which used the Rails web application framework.[2]
Many web application frameworks offer an active record and object-relational mapping features, where external data in serialization formats is automatically converted on input into internal objects and, in turn, into database record fields. If the framework's interface for that conversion is too permissive and the application designer doesn't mark specific fields as immutable, it is possible to overwrite fields that were never intended to be modified from outside (e.g. admin permissions flag).[3]
These vulnerabilities have been found in applications written in Ruby on Rails,[4] ASP.NET MVC,[5] and Java Play framework.[6]
In 2012 mass assignment on Ruby on Rails allowed bypassing of mapping restrictions and resulted in proof of concept injection of unauthorized SSH public keys into user accounts at GitHub.[7][8] Further vulnerabilities in Ruby on Rails allowed creation of internal objects through a specially crafted JSON structure.[9]
In ASP.NET Core mapping restriction can be declared using the [BindNever] attribute.[10]
Mitigation
[edit]A whitelist of bindable non-sensitive fields should be used to limit the modification and creation of objects. The server should ignore any fields not whitelisted.[11] A blacklist of non-bindable sensitive fields should also be used.[2]
See also
[edit]- Data transfer object (DTO)
References
[edit]- ↑ "Mass Assignment - OWASP Cheat Sheet Series". cheatsheetseries.owasp.org. Retrieved 2026-09-17.
- 1 2 "Mass Assignment, Rails, and You | Envato Tuts+". Code Envato Tuts+. 2013-05-13. Retrieved 2026-09-17.
- ↑ "CWE-915: Improperly Controlled Modification of Dynamically-Determined Object Attributes". Common Weakness Enumeration. NIST. Retrieved February 27, 2013.
- ↑ "Mass Assignment". Ruby On Rails Security Guide. Retrieved February 27, 2013.
- ↑ "Mass Assignment Vulnerability in ASP.NET MVC". IronsHay. Retrieved February 27, 2013.
- ↑ Alberto Souza (2014). "Playframework, how to protect against Mass Assignment".
- ↑ "GitHub suspends member over 'mass-assignment' hack". ZDnet. 2012. Retrieved February 27, 2013.
- ↑ "[SEC][ANN] Rails 3.2.12, 3.1.11, and 2.3.17 have been released!". Archived from the original on January 18, 2016. Retrieved January 7, 2016.
- ↑ "Denial of Service and Unsafe Object Creation Vulnerability in JSON (CVE-2013-0269)". Retrieved January 7, 2016.
- ↑ tdykstra (20 June 2023). "Model Binding in ASP.NET Core". docs.microsoft.com.
- ↑ nicolas (2023-06-15). "What is Mass Assignment? Attacks and Security Tips". Retrieved 2026-09-17.