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
Login, access control, and input validation failures not logged
Warnings and errors generate no, inadequate, or unclear log messages
Logs not monitored for suspicious activity
Logs stored only locally without centralized backup
No alerting thresholds or escalation processes
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: 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: 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 });
});