The system must register all exceptional and security events in logs.
The organization must properly record the exceptional and security events in duly protected logs (confidentiality), considering that an event of this type should not show confidential or detailed information of the problem in error messages to prevent the use of that information on the part of an attacker or malicious user.
Recorded events allow error pages to display simple generic messages, alerting end users that an error has occurred, with some option to contact support.
The detail of how to address these problems should be kept securely stored in a previously defined log storage. When an event of these types is not properly recorded, a malicious behavior can be proven difficult to detect or a forensic analysis can be obstructed in case an attack is successful.
Use a centralized logging mechanism that supports several levels of detail. Make sure all events related to successes and failures are recorded.
Make sure that the logging level is properly configured for production environments. Enough information must be recorded to allow a system administrator to detect attacks, diagnose errors and recover from attacks. On the other hand, recording too much information can lead to the same problems (CWE-779).
Given the scenario that critical security information is not recorded, an attacker can perform an attack that won’t leave a trace during a forensic analysis, therefore discovering the cause of the problem or the origin of one or several attacks can prove to be very difficult or impossible.
Layer: Application Layer.
Type of Control: Procedure.
CWE-390: Detection of Error Condition Without Action. The software detects a specific error, but takes no actions to handle the error.
CWE-544: Missing Standardized Error Handling Mechanism. The software does not use a standardized method for handling errors throughout the code, which might introduce inconsistent error handling and resultant weaknesses.
CWE-778: Insufficient Logging. When a security-critical event occurs, the software either does not record the event or omits important details about the event when logging it.
GDPR. Art. 33: Notification of a personal data breach to the supervisory authority.(5) The controller shall document any personal data breaches, comprising the facts relating to the personal data breach, its effects and the remedial action taken.
HIPAA Security Rules 164.312(b): Audit Controls: Implement hardware, software, and/or procedural mechanisms that record and examine activity in information systems that contain or use electronic protected health information.
OWASP-ASVS v4.0.1 V1.7 Errors, Logging and Auditing Architectural Requirements.(1.7.1) Verify that a common logging format and approach is used across the system.
OWASP-ASVS v4.0.1 V7.1 Log Content Requirements.(7.1.3) Verify that the application logs security relevant events including successful and failed authentication events, access control failures, deserialization failures and input validation failures.
OWASP-ASVS v4.0.1 V7.1 Log Content Requirements.(7.1.4) Verify that each log event includes necessary information that would allow for a detailed investigation of the timeline when an event happens.
OWASP-ASVS v4.0.1 V7.2 Log Processing Requirements.(7.2.1) Verify that all authentication decisions are logged, without storing sensitive session identifiers or passwords. This should include requests with relevant metadata needed for security investigations.
OWASP-ASVS v4.0.1 V7.2 Log Processing Requirements.(7.2.2) Verify that all access control decisions can be logged and all failed decisions are logged. This should include requests with relevant metadata needed for security investigations.
OWASP-ASVS v4.0.1 V8.3 Sensitive Private Data.(8.3.5) Verify accessing sensitive data is audited (without logging the sensitive data itself), if the data is collected under relevant data protection directives or where logging of access is required.
OWASP-ASVS v4.0.1 V9.2 Server Communications Security Requirements.(9.2.5) Verify that backend TLS connection failures are logged.
OWASP-ASVS v4.0.1 V11.1 Business Logic Security Requirements.(11.1.7) Verify the application monitors for unusual events or activity from a business logic perspective. For example, attempts to perform actions out of order or actions which a normal user would never attempt.