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

Security Logging and Alerting Failures

Attacks happen and nobody notices, or the logs leak secrets.

What it is

Logging is how you find out you were attacked. It fails when important events (failed logins, access denied) aren't recorded, nobody is alerted, or the logs themselves contain passwords and tokens.

What can happen

Example: What to log

✕ Vulnerable
// Logs the password, and says nothing on failure.
console.log("login", req.body);
if (!ok) return res.status(401).json({ error: "Invalid login" });
✓ Fixed
if (!ok) {
  logger.warn({ event: "login_failed", email, ip: req.ip });
  return res.status(401).json({ error: "Invalid login" });
}
logger.info({ event: "login_ok", userId: user.id });

Log who, what, when and from where. Never passwords, tokens or full cookies.

How to prevent it

What CrimsonScan checks

Needs a code review

Not visible from outside. A scanner can't know whether your server logged its requests. This is a code and operations review item.

Read more on owasp.org ↗