Another fun one is “Mass Assignment Vulnerability”
It happens when an application automatically maps user provided data (e.g. from an HTTP request) into internal objects or models without controlling which fields can be set. If the developer doesn’t explicitly whitelist allowed fields, attackers can supply extra parameters to modify sensitive attributes they shouldn’t be able to touch like admin flags, account balances, discounts, etc… (as long as they map to the internal systems)
Example 1: You are updating your own user profile and you see this in the swagger & network tab:
{
“name”: “Kristof”,
“email”: “kristof@example.com”
}
When you then could do is change the request body to this:
{
“name”: “Kristof”,
“email”: “kristof@example.com”,
”isAdmin”:true
}
The value “isAdmin” is highly unlikely to be called that. That’s why it’s often enumerated and tested with scripting. Since it could be role, roles, admin, … anything really. BUT when whitebox testing, you know the value in the code. Also it might not be “true” but it might be a number or a name of a specific role.
So it could also be:
{
“name”: “Kristof”,
“email”: “kristof@example.com”,
”tenantRole”:”Admin”
}
That’s the beauty of blackbox pentesting, you’ll have to try a lot blindly.
A tip: Often in the reponses of the API it might note the correct name of the field, which can already help you.
So if you were to do a GET Profile request of yourself it might say this:
{
“name”: “Kristof”,
“email”: “kristof@example.com”,
”RoleId”:2
}
And then you can easily try all the different values to see if it gets updated or not.
People often think mass assignment is only used in access management but you can totally do this in a webshop also to provide discounts.
{
“orderId”: 12345,
“address”: “123 Main Street”,
“phone”: “555-1234”,
”item”:”X-Box”
}
And add in something like:
{
“orderId”: 12345,
“address”: “123 Main Street”,
“phone”: “555-1234”,
”item”:”X-Box”,
”discount”: 0.9
}