Skip to main content

Flask demo API application for resilience testing

Project description

Chimera - Flask Honeypot Application

A Python Flask application with 456+ intentionally vulnerable endpoints for testing WAF capabilities.

๐Ÿ“š Documentation

๐Ÿš€ Quick Start

Local Development

# 1. Install uv (https://github.com/astral-sh/uv) if you don't have it yet
curl -LsSf https://astral.sh/uv/install.sh | sh

# 2. Install project dependencies (creates .venv/ automatically)
uv sync --extra dev

# 3. Launch the vulnerable demo API
uv run python app.py

# Access at http://localhost:5000

Fallback: If you prefer pip/virtualenv, pip install -r requirements.txt still works, but uv gives faster, reproducible installs and is what the Docker image uses.

Docker Deployment

# As part of WAF demo
./waf-demo --sites=demo start

# Or standalone
docker build -t demo-api .
docker run -p 8080:80 demo-api

Running Tests

# All tests (runs the same uv environment used locally/Docker)
make test

# Quick tests
make test-quick

# With coverage
make test-coverage

Database Mode (Opt-In)

NEW: Enable real SQL injection vulnerabilities with SQLite backend.

# Enable database mode locally
USE_DATABASE=true uv run python app.py

# Enable in Docker
USE_DATABASE=true docker run -p 8080:80 demo-api

# Or via docker-compose (in apps/demo-targets/)
USE_DATABASE=true ./waf-demo --sites=demo start

What Database Mode Enables:

  • ๐Ÿ“Š Real SQLite database with banking, healthcare, insurance data
  • ๐Ÿ”“ 8 intentionally vulnerable endpoints for SQL injection testing
  • ๐Ÿ’‰ Multiple SQLi types: Classic, Blind Boolean, Time-based, UNION, Error-based
  • ๐Ÿ“ˆ Realistic demo data: 5 users, 3 bank accounts, 3 patient records, 3 policies
  • ๐ŸŽฏ Traffic generator support: PROFILE=database for baseline SQL queries

New Vulnerable Endpoints (only active with USE_DATABASE=true):

GET  /api/v1/patients/search?ssn=<ssn>              # Classic SQLi
POST /api/v1/auth/login-vulnerable                  # Auth bypass
GET  /api/v1/banking/accounts/search?account_number # UNION-based
GET  /api/v1/insurance/policies/lookup?policy_number # Blind Boolean
GET  /api/v1/transactions/history?account_id        # Time-based blind
GET  /api/v1/claims/search?policy_id&order_by       # ORDER BY injection
GET  /api/v1/users/profile?user_id                  # Error-based
POST /api/v1/healthcare/records                     # Second-order SQLi

Example SQL Injection Attack:

# Classic SQL injection to dump all patient records
curl 'http://localhost:8880/api/v1/patients/search?ssn=%27%20OR%20%271%27=%271'

# Authentication bypass
curl -X POST http://localhost:8880/api/v1/auth/login-vulnerable \
  -H "Content-Type: application/json" \
  -d '{"email":"admin@example.com'\'' OR '\''1'\''='\''1'\'' --","password":"anything"}'

# UNION-based data exfiltration
curl 'http://localhost:8880/api/v1/banking/accounts/search?account_number=ACC-1001'\'' UNION SELECT id,email,password,role,1,2,3,4 FROM users --'

Traffic Generation with Database Mode:

# Generate baseline database traffic (10 RPS for 60 seconds)
PROFILE=database RPS=10 DURATION=60 ./scripts/traffic-generator.sh

๐ŸŽฏ Key Features

  • 456+ Vulnerable Endpoints across Auth, Banking, Healthcare, and Admin domains
  • 50+ Vulnerability Types including SQL injection, XSS, command injection, and more
  • Thread-Safe Data Layer with validation bypass for testing
  • 200+ Unit Tests with 94% code coverage
  • Gunicorn Server with gevent workers for async handling

๐Ÿ“ Project Structure

api-demo/
โ”œโ”€โ”€ app/                    # Application code
โ”‚   โ”œโ”€โ”€ blueprints/        # Domain-specific endpoints
โ”‚   โ”œโ”€โ”€ models/           # Data access layer
โ”‚   โ””โ”€โ”€ utils/           # Helper utilities
โ”œโ”€โ”€ tests/                 # Test suite
โ”‚   โ”œโ”€โ”€ unit/           # Unit tests
โ”‚   โ”œโ”€โ”€ integration/   # Integration tests
โ”‚   โ””โ”€โ”€ vulnerability/ # Security tests
โ”œโ”€โ”€ docs/                 # Additional documentation
โ”œโ”€โ”€ static/              # Static assets
โ”œโ”€โ”€ app.py              # Main application
โ”œโ”€โ”€ requirements.txt    # Dependencies
โ”œโ”€โ”€ Dockerfile         # Container definition
โ””โ”€โ”€ Makefile          # Build automation

๐Ÿ”’ Security Warning

โš ๏ธ This application contains intentional security vulnerabilities for testing purposes.

DO NOT:

  • Deploy to production
  • Expose to the internet
  • Use with real data

DO:

  • Use only in isolated test environments
  • Run behind WAF protection
  • Reset regularly

๐Ÿงช Example Vulnerability Tests

# SQL Injection
curl -X POST http://localhost:5000/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"username":"admin'\'' OR '\''1'\''='\''1","password":"any"}'

# Command Injection
curl -X POST http://localhost:5000/api/v1/admin/execute \
  -H "Content-Type: application/json" \
  -d '{"command":"ls; cat /etc/passwd"}'

# Path Traversal
curl "http://localhost:5000/api/v1/admin/logs?file=../../../../etc/passwd"

๐Ÿ“š Feature Reference

The application simulates a wide range of industries and technical domains to provide a comprehensive attack surface.

Domain / Industry Endpoints Description
Admin ~19 User management, system configuration, data export, and administrative overrides.
Attack Sim ~24 Simulation of kill-chain phases: reconnaissance, lateral movement, persistence, and exfiltration.
Auth ~28 Authentication flows including OAuth, MFA, SAML, API keys, and session management.
Banking ~29 Core banking operations, wire transfers, loans, KYC, open banking, and remote check deposit.
Checkout ~12 E-commerce checkout flows: shipping, taxes, promotions, and payment processing.
Compliance ~16 Regulatory compliance features: AML monitoring, SAR reporting, and audit trails.
Database Vuln ~8 dedicated endpoints for demonstrating various SQL injection techniques (Classic, Blind, Time-based).
Ecommerce ~40 Online marketplace features: product catalog, vendor management, inventory, orders, and webhooks.
Energy ~22 Utility operations: grid dispatch, smart metering, outage management, and SCADA config.
GenAI ~4 LLM-based chat interfaces, RAG uploads, AI agent browsing (SSRF), and prompt injection targets.
Government ~30 Public sector services: benefits, permits, licensing, FOIA requests, and citizen records.
Healthcare ~27 Medical systems: patient records (EMR), prescriptions, appointments, and HIPAA data.
ICS / OT ~10 Industrial control systems: PLC commands, setpoints, HMI interfaces, and sensor readings.
Infrastructure ~19 Cloud & DevOps targets: Kubernetes pods, service mesh, gateway routes, and secrets.
Insurance ~42 InsurTech operations: claims processing, underwriting, policy management, and premiums.
Integrations ~13 Third-party connectivity: webhooks, CRM sync, email gateways, and analytics.
Loyalty ~14 Rewards programs: points transfer, tier management, referrals, and cashback.
Mobile ~13 Mobile app backend: device fingerprinting, biometric auth, and app configuration.
Payments ~19 Payment gateway features: card processing, fraud rules, settlements, and disputes.
SaaS ~30 B2B SaaS features: multi-tenancy, billing/invoices, SSO/SCIM, and API key management.
Security Ops ~8 SOC workflows: incident creation, threat intelligence, and automated remediation.
Telecom ~21 Telco operations: subscriber profiles, SIM swap, network provisioning, and CDRs.

Total Surface Area: 456+ Endpoints across 25+ domains.

๐Ÿ› ๏ธ Development

See docs/API-DOCUMENTATION.md for:

  • Adding new endpoints
  • Creating vulnerabilities
  • Writing tests
  • Configuration options
  • Troubleshooting guide

๐Ÿ“ˆ Test Coverage

  • Overall: 94%
  • Auth Module: 97%
  • Banking Module: 95%
  • Healthcare Module: 93%
  • Admin Module: 92%

๐Ÿค Contributing

  1. Add endpoints to appropriate blueprint
  2. Include intentional vulnerabilities
  3. Write comprehensive tests
  4. Update documentation
  5. Run test suite before committing

๐Ÿ“„ License

For testing and demonstration purposes only.


For detailed information, see docs/API-DOCUMENTATION.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chimera_api-0.1.5.tar.gz (478.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chimera_api-0.1.5-py3-none-any.whl (303.6 kB view details)

Uploaded Python 3

File details

Details for the file chimera_api-0.1.5.tar.gz.

File metadata

  • Download URL: chimera_api-0.1.5.tar.gz
  • Upload date:
  • Size: 478.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for chimera_api-0.1.5.tar.gz
Algorithm Hash digest
SHA256 7c7a5271dbc7a9c73e3f61a7b1d41d991a6be058e0f690960a4f9834c4c9feb2
MD5 519f2ef62f1cb8f10541a41520957772
BLAKE2b-256 7da6c53ff9a9d0066d3cd9f3762fd1f042c746bd5b25f55a271e7668338bf9a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for chimera_api-0.1.5.tar.gz:

Publisher: release.yml on inferno-lab/Chimera

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chimera_api-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: chimera_api-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 303.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for chimera_api-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 205becf676817cc9685f513fac0487d906f11f4639f91defa00fba542f16095a
MD5 9ce19510b76eb00c0ac93b836e6b5dc2
BLAKE2b-256 d4f13e59d16eea27d0e407c95f23e4d2fb85a8348538783084a9e70e45e70791

See more details on using hashes here.

Provenance

The following attestation bundles were made for chimera_api-0.1.5-py3-none-any.whl:

Publisher: release.yml on inferno-lab/Chimera

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page