Insufficient Logging and Monitoring
Description
Insufficient Logging and Monitoring occurs when an application fails to adequately record, store, or analyze security-related events, making it difficult to detect and respond to intrusions, fraud, data breaches, or malicious activity. Without proper logging, attackers can operate undetected for long periods, potentially compromising sensitive data or escalating privileges without being noticed.
Inadequate monitoring may also result in delayed or missing alerts for brute-force attacks, privilege escalations, unauthorized access, or API abuses. Even when logs are recorded, if they are not protected from tampering, stored securely, and regularly reviewed, they lose their value in forensic investigations and incident response.
Examples
Lack of Login and Authentication Event Logging
An application that does not log successful and failed login attempts allows attackers to perform brute-force attacks or credential stuffing without detection.
POST /login
username=admin&password=wrongpassword
No log entry is created, making it impossible to detect repeated failed login attempts.
No Logging of Privileged Actions
If an application does not log privileged user actions, an attacker or insider threat may modify account roles, change configurations, or delete data without being detected.
Example: An admin creates a new user with superuser privileges, but the event is not logged.
Failure to Monitor API and Sensitive Requests
APIs that handle financial transactions, password changes, or authentication tokens should log relevant activity. Without this, an attacker can transfer funds, change credentials, or manipulate requests without detection.
POST /update-balance
{ "user": "attacker", "balance": "9999999" }
If the API does not log this request, fraud detection systems cannot flag it.
Logs Are Stored But Not Monitored
Even if logs are generated, failing to actively monitor them allows real-time attacks to go unnoticed. Without automated alerts, security teams must manually sift through logs—often too late.
Remediation
-
Implement Comprehensive Logging
- Log all authentication events (successful logins, failed attempts, password resets).
- Capture privileged actions (admin access, permission changes, financial transactions).
- Include API activity logs for sensitive operations.
-
Use Secure and Tamper-Proof Log Storage
- Store logs in append-only formats or write-once storage (WORM) to prevent attackers from deleting traces of their activity.
- Use log integrity mechanisms such as cryptographic signing or HMAC to prevent log tampering.
-
Enable Real-Time Monitoring and Alerts
- Integrate logs with Security Information and Event Management (SIEM) solutions like Splunk, ELK Stack, or Wazuh.
- Set up alerts for suspicious activity (e.g., repeated failed logins, privilege escalations, unusual API requests).
-
Mask or Encrypt Sensitive Data in Logs
-
Avoid logging plaintext credentials, API keys, or personal data.
-
Example of secure logging:
[INFO] User login attempt: user=admin, IP=192.168.1.10, status=FAILED
-
Example of insecure logging:
[DEBUG] User login: username=admin, password=admin123
-
-
Regularly Review and Audit Logs
- Conduct periodic log analysis to detect anomalies.
- Use machine learning or behavioral analytics to spot patterns of compromise.
-
Ensure Log Retention Policies
- Retain logs for 6-12 months to support forensic investigations.
- Apply log rotation and archiving to maintain storage efficiency.