Lab 09: OWASP A09 — Security Logging and Monitoring Failures

Objective

Exploit and demonstrate logging failures on a live server from Kali Linux: perform attacks that go completely unlogged, inject malicious payloads into log files (log injection), demonstrate how an attacker can operate undetected for days without alerting, audit a server's log coverage, implement a tamper-evident audit log with integrity hashing, and verify which events should always be logged.

Background

Logging and Monitoring Failures is OWASP #9 (2021). The average time to detect a breach is 207 days (IBM Cost of a Data Breach 2023). Without logs, that detection time is infinite — the breach is only discovered when damage becomes visible. The 2013 Target breach compromised 40 million card numbers; security logs showed the malware installation and data exfiltration, but no one was monitoring them. Logging is a detective control — it doesn't prevent attacks, but it makes forensics possible and attackers accountable.

Architecture

┌─────────────────────┐        Docker Network: lab-a09         ┌─────────────────────┐
│   KALI ATTACKER     │ ─────── HTTP attacks ─────────────▶   │   VICTIM SERVER     │
│  innozverse-kali    │                                         │  innozverse-cybersec│
│  curl, python3      │ ◀────── responses ───────────────────  │  Flask :5000        │
└─────────────────────┘                                         │  (no logging,       │
                                                                │   log injection)    │
                                                                └─────────────────────┘

Time

35 minutes

Tools

  • Victim: zchencow/innozverse-cybersec:latest

  • Attacker: zchencow/innozverse-kali:latest (curl, python3)


Lab Instructions

Step 1: Environment Setup


Step 2: Launch Kali


Step 3: Brute-Force Attack — Goes Completely Unlogged

📸 Verified Output:

💡 If failed logins aren't logged, brute-force attacks are completely invisible. An attacker can try millions of passwords without leaving a trace. A properly configured application logs every failed login with: timestamp, username attempted, source IP, and user-agent. A SIEM alert triggers after 5 failures within 5 minutes from the same IP — this is how intrusion detection works.


Step 4: Admin Access and Destructive Actions — Not Logged

📸 Verified Output:


Step 5: Log Injection Attack

📸 Verified Output:


Step 6: Tamper-Evident Audit Log (Secure Pattern)

📸 Verified Output:


Step 7: Log Coverage Audit


Step 8: Cleanup


Remediation

Issue
Root Cause
Fix

Failed logins not logged

return before logging on error

Log ALL auth attempts (fail + succeed)

Admin access not logged

No logging middleware

Decorator/middleware logs every sensitive endpoint

Destructive actions not logged

No audit trail

Log before and after delete/modify with old values

Log injection

Raw user input in log line

Strip/escape \n, \r, ANSI sequences from user input

No tamper detection

Plain-text log

Chained SHA-256 hashes; write-once storage (WORM)

Summary

Test
Finding
Impact

60 brute-force attempts

0 log entries

Attacker invisible for entire attack

Admin data access

Not logged

No forensic trail after breach

User deletion

Not logged

Can't determine who deleted what, when

Log injection

Fake entries inserted

SIEM misled, attacker covers tracks

Tamper-evident log

Detects modification

Essential for incident response

Further Reading

Last updated