Mass-assignment protection
In the computing world, where software frameworks make life of developer easier, there are problems associated with it which the developer does not intend. Software frameworks use object-relational mapping (ORM) tool or active record pattern for converting data of different types and if the software framework does not have a strong mechanism to protect the fields of a class (the types of data), then it becomes easily exploitable by the attackers. These frameworks allow developers to bind parameters with HTTP and manipulate the data externally. The HTTP request that is generated carries the parameters that is used to create or manipulate objects in the application program. The phrase mass assignment[1] or overposting refers to assigning values to multiple attributes in a single go. It is a feature available in frameworks like Ruby on Rails that allows the modifications of multiple object attributes at once using modified URL. For example, @person = Person.new(params[:person]) #params contains multiple fields like name, email, isAdmin and contact
This Mass Assignment saves substantial amount of work for developers as they need not set each value individually. ThreatsIn Mass Assignment, a malicious agent can attack and manipulate the data in various ways. It can send the tags which can make him assign various permissions which would otherwise be forbidden. For example, a database schema has a table "users" having field "admin" which specifies if corresponding user is admin or not. Malicious agent can easily send the value for this field to the server through HTTP request and mark himself as an admin. This is called Mass assignment vulnerability. It explores the security breaches that can be done using mass assignment. [2] GitHub got hacked in 2012 by exploiting mass assignment feature. Homakov who attacked the GitHub gained private access to Rails by replacing his SSH with SSH key of one of the members of Rails GitHub. ProtectionASP.NET CoreIn ASP.NET Core use the [HttpPost]
public IActionResult OnPost(
[Bind("LastName,FirstMidName,HireDate")] Instructor instructor)
RubyWe can perform some changes in the active record models to ensure the protection of our data.
Sometimes developer might forget adding attributes as accessible. So as to avoid this, recent versions of Rail has config setting References
|