Challenge Web & API Security +50 XP

Flask Error

Start the machine, hack the system, and find the hidden flags to complete this challenge and earn XP!

88% solve it 33 hackers played 1 flag Updated Oct 06, 2026 First blood Mazer72
FlaskDebug ModePythonWeb SecurityMemory Analysis
Start Your Challenge
  1. 1Create a free account, then click "Start Lab"You'll get your own private machine with an IP address
  2. 2Explore the targetOpen the IP in your browser and look for vulnerabilities
  3. 3Find and submit flagsFlags are secret text strings hidden in the system - paste them below to score
  • ~1-2 min setup
  • Private instance
  • 30 min per session. Restart it for free, as often as you like.

Flask debug mode is a development feature that provides interactive error pages and automatic code reloading. While invaluable during development, leaving debug mode enabled in production is a critical security vulnerability that can lead to complete server compromise. Understanding the risks of debug mode exposure is essential for both web developers deploying Python applications and security professionals testing them.

What Flask Debug Mode Exposes

When a Flask application runs in debug mode and encounters an unhandled exception, it displays a detailed error page called the Werkzeug debugger. This page shows the full stack trace with source code for every frame, local variable values at each level, and most critically - an interactive Python console. This console allows anyone who can trigger an error to execute arbitrary Python code on the server, effectively granting remote code execution.

Exploiting Debug Mode

An attacker who discovers a Flask application running in debug mode can trigger errors by sending malformed input (like division by zero in a calculator, or invalid parameters). The resulting debug page exposes application source code, configuration variables (which may contain database credentials, API keys, and secret keys), and provides an interactive console for executing commands. Through this console, an attacker can read and write files, access environment variables, execute system commands, and pivot to other systems on the network.

Securing Flask Applications for Production

Flask applications must never run with debug=True in production. Developers should use environment-based configuration to ensure debug mode is only active in development. Production deployments should use WSGI servers like Gunicorn or uWSGI behind a reverse proxy like Nginx, with proper error handling that returns generic error pages to users. Application secrets should be stored in environment variables, not in source code. Regular security scanning should check for exposed debug interfaces and other common Python web application misconfigurations.

What You Will Learn

  • How Flask debug mode works and what it exposes
  • The security risks of Werkzeug interactive debugger in production
  • Techniques for triggering and exploiting debug error pages
  • Extracting sensitive data from application memory and configuration
  • Secure Flask deployment practices for production environments

Prerequisites

Basic understanding of web applications No Python experience required Familiarity with web browsers