How to fix: Debug Mode Toggled via Cookie
A cookie named debug=true (or similar) was detected that enables debug behavior in the application. Debug cookies are an easy way for an attacker to trigger verbose error output, disable security checks, or access debug endpoints.
Why it matters
An attacker who sets debug=true in their browser can trigger verbose error pages containing stack traces, SQL queries, and internal configuration. This can expose credentials, architecture details, and exploitable code paths.
Using a cookie to toggle debug mode is common during development but frequently leaks to production. Unlike environment variables, cookies are client-controlled, so any user can set debug=true and receive verbose application output.
How to fix it
- 1Remove debug cookie detection entirely from production code.
- 2Use environment variables (NODE_ENV=development) gated in the deployment pipeline instead.
- 3If developer-only debug output is needed, gate it behind an internal-IP check or a signed admin token, not a plain cookie.
Code examples
Correct: environment-variable based debug gate
// Never use cookies for debug flags
const isDebug = process.env.NODE_ENV === 'development';
if (isDebug) {
console.error(err.stack);
} else {
console.error('[ERROR]', err.message);
}References
Detected automatically by VulnRadar. The check id is debug-via-cookie, stable across every scan so you can filter or diff on it.
More config checks
- MediumNo Rate-Limit Policy Detected
- MediumVary: Cookie Missing on Cookie-Bearing Response
- LowSet-Cookie Header Exceeds 4 KB
- LowVary Header Missing on Compressed Responses
- InfoDownloadable Content Served as inline
- InfoX-XSS-Protection Header Is Deprecated
- LowServer-Timing Exposes Cache Timings
- LowVary: Cookie on Static Resource
Questions
- How severe is Debug Mode Toggled via Cookie?
- VulnRadar rates this medium severity in the config category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id debug-via-cookie, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Debug Mode Toggled via Cookie map to?
- It maps to CWE-489. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.