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

Mishandling of Exceptional Conditions

Errors are handled in a way that leaks details or fails open.

What it is

Every app hits errors: timeouts, bad input, a database that is down. The risk is in what happens next: a stack trace sent to the user, a crash that takes the server down, or a check that says "allowed" because it threw.

What can happen

Example: Fail open vs fail closed

✕ Vulnerable
let allowed = false;
try {
  allowed = await checkPermission(user, scan);
} catch {
  allowed = true; // service down -> everyone allowed
}
✓ Fixed
let allowed = false;
try {
  allowed = await checkPermission(user, scan);
} catch (err: unknown) {
  logger.error({ event: "permission_check_failed", err });
  allowed = false; // when in doubt, deny
}

If the check can't finish, the answer is "no".

Example: Error responses

✕ Vulnerable
app.use((err, req, res, next) => {
  res.status(500).json({ error: err.stack });
});
✓ Fixed
app.use((err: unknown, req: Request, res: Response, _next: NextFunction) => {
  logger.error({ err });                 // details stay on the server
  res.status(500).json({ error: "Something went wrong" });
});

The user gets a generic message. The details go to the logs.

How to prevent it

What CrimsonScan checks

Partly detected

The heavy scan (ZAP) flags error pages that leak stack traces or framework details. Fail-open logic can only be found by reading the code.

Read more on owasp.org ↗