HomeTopicsA09 Security Logging & Alerting Failures
Lesson 9 / 10

A09: Security Logging & Alerting Failures

Without proper logging and monitoring, breaches cannot be detected. This category covers insufficient logging, failure to monitor, missing alerting, and inadequate incident response plans.

Key Vulnerabilities

1

Login, access control, and input validation failures not logged

2

Warnings and errors generate no, inadequate, or unclear log messages

3

Logs not monitored for suspicious activity

4

Logs stored only locally without centralized backup

5

No alerting thresholds or escalation processes

6

Penetration testing and DAST scans don't trigger alerts

Prevention Strategies

Log all login, access control, and server-side validation failures

Use centralized log management with tamper-proof storage

Encode log data correctly to prevent log injection attacks

Establish effective monitoring and alerting with quick response times

Create incident response and recovery plans (NIST 800-61r2+)

Use SIEM tools for real-time detection and correlation

Real-World Example

A major airline discovered a 4-month long breach only after a third-party researcher reported it. The lack of monitoring meant 9.4 million passenger records were exposed before detection.

Code Comparison

Vulnerable Code
// VULNERABLE: No logging of security events
app.post('/login', async (req, res) => {
  const user = await authenticate(req.body);
  if (!user) {
    return res.status(401).json({ error: 'Invalid' });
    // No record of failed attempt!
  }
  createSession(user);
});
Secure Code
// SECURE: Comprehensive security logging
app.post('/login', async (req, res) => {
  const user = await authenticate(req.body);
  if (!user) {
    securityLogger.warn('LOGIN_FAILED', {
      email: req.body.email,
      ip: req.ip,
      userAgent: req.headers['user-agent'],
      timestamp: new Date().toISOString()
    });
    alertIfThresholdExceeded(req.ip);
    return res.status(401).json({ error: 'Invalid' });
  }
  securityLogger.info('LOGIN_SUCCESS', { userId: user.id });
});