Blog / A09:2021 Security Logging and Monitoring Failures
A09:2021 · Security Logging and Monitoring Failures

Your debug flag is dumping telemetry to the console

Flip on debug logging and the full event payload, user and device fields included, lands where any script on the page can read it.

debug flagenabledfull eventserializedwritten toconsolereadable by anyscriptATTACKER INPUTIMPACTwritten to logs
Attack path · debug flag enabled → full event serialized → written to console → readable by any script

Flip on debug logging and the full event payload, user and device fields included, lands where any script on the page can read it.

What goes wrong

Turn on debug mode and every telemetry event gets serialized straight into the browser console. Telemetry is rarely just counters. It carries user identifiers and device details, plus whatever activity you attached to the event.

The console is not a private channel. Any script running in the page can read it. So can browser extensions and injected tags, and anyone watching over a support screen share. A value you would never put in a response body ends up in plain text, one panel away in dev tools.

The error path makes it worse. When a send fails, the whole error object goes to the console too, server messages included. This stays Low because it needs debug logging on and someone with console access. It also ships to production by accident, because the flag was handy during a bad week.

The pattern

Vulnerable
if (debugEnabled) {
  console.log('telemetry', JSON.stringify(event));
}
sendTelemetry(event).catch(err => {
  console.log('telemetry failed', err);
});
Hardened
if (debugEnabled) {
  console.log('telemetry', summarize(event));  // field names, not values
}
sendTelemetry(event).catch(err => {
  console.log('telemetry failed', err.code);
});

// summarize() drops user, device, and payload fields
How the pipeline adjudicated itPROVEN
ABCDEFGH

Every gate held. The exploit path was reproduced against a negative control, the impact was calibrated, and the finding was signed report-ready.

Ed25519 · per-tenant signing key · gate ledger A–H · verify offline against the published payload hash

Why it matters to you

If your frontend logs rich objects behind a debug flag, assume that flag is on somewhere you did not intend. A support build, or staging that shares a domain with prod. A device someone kept after QA and forgot. The data never has to leave your servers to leak. It only has to be readable by code you do not control, and the console is exactly that.

Check your own code