1 Over-Posting and Model Binding
Mass assignment occurs when a framework automatically binds HTTP request parameters to model fields. If all fields are accepted, attackers can set fields they should not control.
Vulnerable Node.js/Mongoose:
app.put("/users/:id", async (req, res) => {
// VULNERABLE: spreads all request body fields into user object
const user = await User.findByIdAndUpdate(
req.params.id,
{ $set: req.body }, // Attacker can set any field!
{ new: true }
);
res.json(user);
});
// Attacker sends: { "name": "Alice", "isAdmin": true, "creditBalance": 1000000 }Rails strong parameters bypass:
# Vulnerable — permits all params
User.update(params[:user]) # Without permit() filter
# Attacker sends: user[role]=adminThis vulnerability was behind the GitHub mass assignment vulnerability in 2012, where an attacker added their SSH key to an organization repo by setting the org_id field.