E2E test - vulnerable Python app
- Python 65.3%
- JavaScript 12.5%
- HCL 11.9%
- HTML 7.7%
- Dockerfile 2.6%
| static/js | ||
| templates | ||
| terraform | ||
| .env.example | ||
| .gitignore | ||
| app.py | ||
| config.py | ||
| Dockerfile | ||
| README.md | ||
| requirements.txt | ||
| utils.py | ||
| xml_parser.py | ||
Simple SAST Vulnerable Repository
This repository contains intentionally vulnerable code for testing SAST (Static Application Security Testing) tools. It includes up to 10 different vulnerability types that can be detected by tools like CodeQL, Opengrep, Bandit, DevSkim, and Checkov SAST.
Vulnerabilities Included
- SQL Injection - Unsanitized user input concatenated into SQL query
- Command Injection - Unsanitized user input passed to
os.system() - Path Traversal - User input used to construct file paths without validation
- Cross-Site Scripting (XSS) - Unsanitized user input rendered in HTML
- Hardcoded Secrets - API keys and passwords in source code
- Insecure Deserialization - Using
pickle.loads()on untrusted data - Weak Cryptography - Use of MD5 hash function
- Improper Input Validation - Missing validation for user inputs
- Sensitive Data Exposure - Debug information leakage
- Insecure Randomness - Using
randominstead ofsecretsfor tokens
Project Structure
app.py- Main Flask application with vulnerabilitiesutils.py- Utility functions with additional vulnerabilitiesconfig.py- Configuration with hardcoded secretstemplates/- HTML templates with XSS vulnerabilityrequirements.txt- Python dependenciesDockerfile- Docker configuration with security issuesterraform/- Terraform files for Checkov SAST testing
Usage
- Install dependencies:
pip install -r requirements.txt - Run the app:
python app.py - The app will be available at
http://localhost:5000
WARNING: This code is intentionally vulnerable. Do not deploy in production environments.
Testing with SAST Tools
- Bandit:
bandit -r . - CodeQL: Create database and run queries
- Opengrep: Use patterns to detect vulnerabilities
- DevSkim: Run against codebase
- Checkov SAST:
checkov --directory .
Each vulnerability is marked with a comment # VULNERABILITY: [type] for easy identification.