Broken Object Level Authorization

Broken Object Level Authorization in Node.js (Express) [GHSA-xhmj-rg95-44hv]

[Updated Apr 2026] Updated GHSA-xhmj-rg95-44hv

Overview

Broken Object Level Authorization (BOLA) vulnerabilities allow attackers to access or manipulate resources belonging to other users by manipulating object identifiers. In production, this can lead to data leakage, privacy violations, or unauthorized actions such as viewing, updating, or deleting data across accounts. There are no CVE IDs provided in this guide. In Node.js with Express, BOLA often shows up when endpoints expose resource IDs in the path (for example /users/:id or /documents/:id) and the server uses those IDs to fetch data without verifying that the authenticated user owns the object or has permission. This class of vulnerability is dangerous because it can lead to data leaks, account takeover, and evasion of audit controls; even when authentication exists, authorization checks may be missing or too coarse, enabling cross-user access. Remediation involves centralizing per-resource authorization checks, enforcing ownership at the data layer, and employing RBAC/ABAC policies. Validate ownership in route handlers or dedicated middleware, filter queries by owner, and implement tests and monitoring to catch regressions.

Code Fix Example

Node.js (Express) API Security Remediation
Vulnerable:
app.get('/users/:id', (req, res) => {
  const userId = req.params.id;
  User.findById(userId).then(user => res.json(user));
});

Fix:
const authenticate = require('./middleware/authenticate');

app.get('/users/:id', authenticate, (req, res) => {
  const userId = req.params.id;
  User.findOne({ _id: userId, ownerId: req.user.id }).then(user => {
    if (!user) return res.status(403).json({ error: 'Forbidden' });
    res.json(user);
  }).catch(err => res.status(500).json({ error: 'Server error' }));
});

CVE References

Choose which optional cookies to allow. You can change this any time.