Vulnerable Bank Application 🏦
A deliberately vulnerable web application for practicing application security testing of Web, APIs and LLMs, secure code review and implementing security in CI/CD pipelines.
⚠️ WARNING: This application is intentionally vulnerable and should only be used for educational purposes in isolated environments.
Overview
This project is a simple banking application with multiple security vulnerabilities built in. It's designed to help security engineers, developers, interns, QA analyst and DevSecOps practitioners learn about:
- Common web application and API vulnerabilities
- AI/LLM Vulnerabilities
- Secure coding practices
- Security testing automation
- DevSecOps implementation
Features & Vulnerabilities
Core Banking Features
- 🔐 User Authentication & Authorization
- 💰 Account Balance Management
- 💸 Money Transfers
- 📝 Loan Requests
- 👤 Profile Picture Upload
- 📊 Transaction History
- 📈 Transaction Analytics Dashboard (GraphQL-backed)
- 🔑 Password Reset System (3-digit PIN)
- 💳 Multi-Currency Virtual Cards Management
- 💱 Virtual Card Funding from Main USD Balance with built-in currency conversion (
USD,GBP,NGN,JPY,EUR,QAR,BTC,ETH) - 🛒 Public Merchant Payment API for intentionally vulnerable ecommerce/demo integrations
- 📱 Bill Payments System
- 🤖 AI Customer Support Agent (Real LLM with DeepSeek API / Mock Mode)
Implemented Vulnerabilities
Authentication & Authorization
- SQL Injection in login
- Weak JWT implementation
- Broken object level authorization (BOLA)
- Broken object property level authorization (BOPLA)
- Mass Assignment & Excessive Data Exposure
- Weak password reset mechanism (3-digit PIN)
- Token stored in localStorage
- No server-side token invalidation
- No session expiration
Data Security
- Information disclosure
- Sensitive data exposure
- Plaintext password storage
- SQL injection points
- Debug information exposure
- Detailed error messages exposed
Transaction Vulnerabilities
- No amount validation
- Negative amount transfers possible
- No transaction limits
- Race conditions in transfers and balance updates
- Transaction history information disclosure
- No validation on recipient accounts
File Operations
- Unrestricted file upload
- Path traversal vulnerabilities
- No file type validation
- Directory traversal
- No file size limits
- Unsafe file naming
- Server-Side Request Forgery (SSRF) via URL-based profile image import
Session Management
- Token vulnerabilities
- No session expiration
- Weak secret keys
- Token exposure in URLs
Client and Server-Side Flaws
- Cross Site Scripting (XSS)
- Cross Site Request Forgery (CSRF)
- Insecure direct object references
- No rate limiting
Virtual Card Vulnerabilities
- Mass Assignment in card limit updates
- Mass Assignment in card funding exchange-rate handling
- Predictable card number generation
- Plaintext storage of card details
- No validation on card limits
- BOLA in card operations
- Race conditions in balance updates
- Card detail information disclosure
- No transaction verification
- Lack of card activity monitoring
- Client-controlled currency conversion during card funding
Bill Payment Vulnerabilities
- No validation on payment amounts
- SQL injection in biller queries
- Information disclosure in payment history
- Predictable reference numbers
- Transaction history exposure
- No validation on biller accounts
- Race conditions in payment processing
- BOLA in payment history access
- Missing payment limits
Merchant Payment API Vulnerabilities
- Plaintext merchant passwords and API keys
- API keys returned in registration and login responses
- Raw card number/CVV accepted by merchant payment APIs
- SQL injection-prone merchant and card lookups
- Missing idempotency, replay protection, payment limits, and rate limiting
- Object-level authorization gaps in merchant payment lookup
- Detailed payment decline reasons and debug data exposure
- Predictable authorization code generation
AI Customer Support Vulnerabilities
- Prompt Injection (CWE-77)
- AI-based Information Disclosure (CWE-200)
- Broken Authorization in AI context (CWE-862)
- AI System Information Exposure (CWE-209)
- Insufficient Input Validation for AI prompts (CWE-20)
- Direct Database Access through AI manipulation
- AI Role Override attacks
- Context Injection vulnerabilities
- AI-assisted unauthorized data access
- Exposed AI system prompts and configurations
- GraphQL Vulnerabilities
- Enabled schema introspection on the transaction analytics endpoint
- Weak JWT-based authentication inherited by
/graphql - SQL injection in GraphQL resolver query construction
- Missing GraphQL depth / complexity controls
- Raw GraphQL error disclosure
- Transaction analytics exposure through admin-scoped queries
Installation & Setup 🚀
Prerequisites
- Docker and Docker Compose (for containerized setup)
- PostgreSQL (if running locally)
- Python 3.9 or higher (for local setup)
- Git
Option 1: Using Docker (Recommended)
Using Docker Compose (Easiest)
- Clone the repository:
git clone https://github.com/Commando-X/vuln-bank.git
cd vuln-bank
- Start the application:
docker-compose up -d --build
The application will be available at http://localhost:5000
Container recovery behavior
The Docker setup includes a few operational safeguards so the app can recover without manual SSH intervention:
webanddbuserestart: unless-stopped, so Docker restarts them automatically if the process exits.dbexposes a health check, andwebwaits for Postgres readiness before starting.webruns the Flask development server withdebug=True(intentional — preserves the training scenarios that target the Werkzeug debugger).webexposesGET /healthzso the container can report whether the app and database are actually usable.
This keeps the intentionally vulnerable application behavior intact while making the container lifecycle more resilient.
Local smoke test
You can validate the local runtime wiring without starting real containers:
python3 -m unittest discover -s tests -v
This checks the /healthz endpoint behavior and verifies that start.sh waits for the database and then launches the Flask app.
If the Flask app dependencies are not installed in your current Python environment, the /healthz route test is skipped and the startup-script smoke test still runs.
Using Docker Only
- Clone the repository:
git clone https://github.com/Commando-X/vuln-bank.git
cd vuln-bank
- Build the Docker image:
docker build -t vuln-bank .
- Run the container:
docker run -p 5000:5000 vuln-bank
Option 2: Local Installation
Prerequisites
- Python 3.9 or higher
- PostgreSQL installed and running
- pip (Python package manager)
- Git
Steps
- Clone the repository:
git clone https://github.com/Commando-X/vuln-bank.git
cd vuln-bank
- Create and activate a virtual environment (recommended):
# On Windows
python -m venv venv
venv\Scripts\activate
# On Linux/Mac
python3 -m venv venv
source venv/bin/activate
- Install required packages:
pip install -r requirements.txt
- Create necessary directories:
# On Windows
mkdir static\uploads
# On Linux/Mac
mkdir -p static/uploads
Modify the .env file:
- Open .env and change DB_HOST from 'db' to 'localhost' for local PostgreSQL connection
Run the application:
# On Windows
python app.py
# On Linux/Mac
python3 app.py
Environment Variables
The .env file is intentionally included in this repository to facilitate easy setup for educational purposes. In a real-world application, you should never commit .env files to version control.
Current environment variables:
DB_NAME=vulnerable_bank
DB_USER=postgres
DB_PASSWORD=postgres
DB_HOST=db # Change to 'localhost' for local installation
DB_PORT=5432
Database Setup
The application uses PostgreSQL. The database will be automatically initialized when you first run the application, creating:
- Users table
- Transactions table
- Loans table
Accessing the Application
- Main application:
http://localhost:5000 - API documentation:
http://localhost:5000/api/docs - GraphQL analytics endpoint:
http://localhost:5000/graphql - Admin analytics view: available from the admin dashboard after login as an admin user