ΣύνδεσηΕγγραφή
A01 · 2025

Broken Access Control

Users can see or change data that is not theirs.

What it is

Access control decides who may do what. It is broken when the server trusts the client to ask only for its own data. Changing an id in the URL, calling an admin route directly, or skipping a check on one route is often enough.

What can happen

Example: Fetching a record by id only

✕ Vulnerable
app.get("/scans/:id", async (req, res) => {
  // Any logged-in user can read ANY scan by guessing its id.
  const scan = await Scan.findById(req.params.id);
  res.json({ scan });
});
✓ Fixed
app.get("/scans/:id", requireAuth, async (req, res) => {
  // The owner is part of the query, so other users' scans don't match.
  const scan = await Scan.findOne({
    _id: req.params.id,
    userId: req.session.userId,
  });
  if (!scan) return res.status(404).json({ error: "Scan not found" });
  res.json({ scan });
});

Return the same 404 for "does not exist" and "not yours", so attackers can't learn which ids exist.

How to prevent it

What CrimsonScan checks

Partly detected

The light scan finds open redirects and exposed admin or backup paths. Most access-control bugs need two logged-in users to test, which an outside URL scan cannot do.

Read more on owasp.org ↗