T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/server.py:62
- Finding
- Flask Development Debugger Exposed on All Network Interfaces<![CDATA[ ## Vulnerability Details **File Location**: `scripts/server.py:62-70` **Vulnerability Type**: Exposed development debugger **Risk Level**: High ```python if __name__ == '__main__': p = argparse.ArgumentParser() p.add_argument('--faq', default='skills/auto-customer-support/data/faq.csv') p.add_argument('--port', type=int, default=5005) args = p.parse_args() FAQ = load_faq(args.faq) app.run(host='0.0.0.0', port=args.port, debug=True) ``` ### Technical Analysis The application unconditionally enables Flask debug mode while binding the server to `0.0.0.0`. This makes the development server and its verbose debugging behavior reachable through every available network interface unless an external firewall prevents access. When an unhandled exception occurs, Flask debug responses can disclose source code, local filesystem paths, configuration details, stack frames, and runtime values. Depending on the Werkzeug version, deployment environment, and debugger protections, access to the interactive debugger could potentially permit execution of Python code in the server process context. Flask's built-in server is not designed for production deployment and should not be exposed to untrusted networks. ### Attack Path 1. An operator starts the application using the documented command. 2. The server listens on every network interface with debug mode enabled. 3. A network-reachable attacker sends requests designed to trigger an unhandled exception. 4. The resulting debug response exposes internal application and environment information. 5. If the interactive debugger is exposed and its protection is bypassed or compromised, the attacker may execute Python statements with the privileges of the server process. ### Impact Assessment A successful attack can disclose application source, local paths, runtime data, and configuration details. Under conditions where interactive debugger access is obtained, the attacker could execute arbitrary co ...[truncated 281 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Disable debug mode by default: ```python app.run(host='127.0.0.1', port=args.port, debug=False) ``` - Bind to `127.0.0.1` during local development unless remote access is explicitly required. - Use a production WSGI server such as Gunicorn or Waitress for deployed environments. - If development debugging is needed, require an explicit development-only flag and ensure it cannot be enabled in production. - Place the service behind a properly configured reverse proxy and firewall. - Add centralized exception handling that returns generic errors without exposing stack traces or runtime values. - Run the service under a dedicated, minimally privileged operating-system account. ]]>
