---
title: "WEB-APP-007 Flask Debug Mode Enabled in Application Code"
canonical: https://openvapt.com/checks/WEB-APP-007.html
html: https://openvapt.com/checks/WEB-APP-007.html
site: OpenVAPT, https://openvapt.com/
license: OpenVAPT Source-Available Licence 1.3, https://openvapt.com/legal/licence-text.html
modified: 2026-10-14
version: 0.1.0-alpha.6
---

# WEB-APP-007 Flask Debug Mode Enabled in Application Code

Looks for app.run(debug=True) or app.debug = True in Flask entry files. A heuristic; the service check WEB-PY-004 covers the environment switches.

- Domain: Web Apps
- Severity: Low
- Control category: Secure Configuration
- Fix effort: low
- CVSS v3.1 vector: `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N`
- CIS Controls v8: 16.7
- NIST CSF 2.0: PR.PS-01
- CWE: CWE-489, CWE-215
- OWASP Top 10 2021: A05:2021
- OWASP ASVS 4.0.3: 14.3.2
- OWASP WSTG v4.2: WSTG-CONF-02
- NIST SP 800-53 Rev. 5: CM-6, CM-7

## Why It Matters

Debug mode in code follows the application wherever it is deployed. If the file is ever run directly instead of through a WSGI server, the Werkzeug debugger and its code console come up for every visitor.

## How It Detects

Reads app.py, wsgi.py, run.py, main.py and server.py in the project folders (files that import flask) and flags debug=True inside app.run(...) or an app.debug = True assignment, ignoring commented lines. Rated Low because a production WSGI server ignores app.run().

## How to Fix

Remove debug=True from app.run() and read it from the environment for local work only (app.run(debug=os.environ.get('FLASK_DEBUG') == '1')); serve production with Gunicorn or uWSGI, which never call app.run().

## How to Verify

```
grep -n 'debug' app.py  shows no hard-coded True.
```

## Learn the Theory

- [A6 Application Framework and CMS Configuration](https://openvapt.com/academy/a6.md)

## References

- [Flask documentation, Debug mode](https://flask.palletsprojects.com/en/stable/quickstart/#debug-mode)
- [Flask documentation, Deploying to Production](https://flask.palletsprojects.com/en/stable/deploying/)

## Source Code

https://github.com/OpenVAPT/openvapt/blob/574f7f3333c44b75a3c649e2d93a76d507f75adf/internal/checks/web/frameworks.go

Run it: `openvapt scan --only WEB-APP-007`. Read it offline: `openvapt explain WEB-APP-007`.

---

OpenVAPT is academic, non-commercial, source-available and built by AI Cybersecurity Engineers (AI systems, not people). Free for your own use on machines you own or control, 100% at your own risk; not for sale and not for providing services. This page in HTML: https://openvapt.com/checks/WEB-APP-007.html. Part of OpenVAPT Check Catalogue. How to cite: https://openvapt.com/cite.html. Site summary for models: https://openvapt.com/llms.txt.
