Why Sandbox Environments?
Sandboxing creates a safe, isolated environment to run potentially dangerous code without exposing your system, network, or data to risk. When testing security vulnerabilities, a sandbox:- Isolates malicious code from your host machine and network
- Prevents unintended damage to your operating system
- Enables safe testing of exploits and attack vectors
- Contains security breaches within the test environment
The Normo Unsecure PWA contains vulnerabilities including SQL injection, XSS, CSRF, open redirects, insecure authentication, and more. These require isolated testing environments.
Recommended Sandbox Environments
Secure Architecture Sandbox Testing Environment (Recommended)
SAST Environment
Purpose-built multi-layer isolation environment specifically designed for the Normo Unsecure PWA
- Multi-layer isolation: Containerized architecture with network isolation
- Automated security reports: SAST, DAST, network, and penetration testing
- Pre-installed sample apps: Ready-to-use vulnerable applications
- Custom app upload: Test your own Flask applications
- Ethical penetration testing: Tools designed for educational contexts
- Authentic architecture: Mirrors real-world security testing environments
Follow Setup Instructions
Refer to the repository’s README for detailed setup instructions including Docker configuration and environment initialization.
Deploy the Normo Unsecure PWA
Use the environment’s upload feature or deploy directly within the containerized architecture.
Alternative Sandbox Options
Depending on your resources and requirements, consider these alternatives:GitHub Codespaces
Pros: Cloud-based, no local setup, instant deploymentCons: Requires GitHub account, limited free hoursSetup: Fork the repository and launch Codespaces from GitHub
CodeSandbox.io
Pros: Browser-based, easy to use, collaborativeCons: May require account, limited for advanced testingSetup: Import repository via URL
Docker Containers
Pros: Full isolation, reproducible, portableCons: Requires Docker knowledge, local resourcesSetup: Create Dockerfile and docker-compose.yml
Virtual Machine
Pros: Complete isolation, OS-level separationCons: Resource intensive, requires VM softwareSetup: Install VirtualBox/VMware, create Linux VM
Ubuntu Live USB
Pros: Portable, no installation, hardware isolationCons: Limited persistence, manual setup each bootSetup: Create bootable Ubuntu USB, install Python
Qubes OS
Pros: Security-focused OS, domain isolationCons: Steep learning curve, requires dedicated hardwareSetup: Install Qubes OS in VM, create isolated domain
Deployment Methods
Method 1: Standard Local Deployment
For basic sandbox environments with Python installed:Method 2: GitHub Codespaces Deployment
Fork Repository
Navigate to the Normo Unsecure PWA repository and fork it to your account.
CORS Configuration: The app has
CORS(app) enabled specifically for Codespaces CSRF demonstrations. This allows cross-origin requests needed for certain vulnerability testing.Method 3: Docker Container Deployment
Create aDockerfile in the project root:
Dockerfile
Method 4: Virtual Machine Deployment
Create Ubuntu VM
- Download Ubuntu Server/Desktop ISO
- Create a new VM with at least 2GB RAM
- Install Ubuntu in the VM
Network Access Configuration
Local Testing Only
By default, the application runs onhost="0.0.0.0", making it accessible on all network interfaces. For strict local-only testing:
main.py (line 73)
Network Testing (Teacher-Hosted Scenario)
If a teacher is hosting the app for students to perform black-box testing:-
Find your LAN IP address:
-
Ensure firewall allows port 5000:
Linux
-
Students access via:
http://{teacher-ip}:5000
Updating Student Resources for Remote URLs
Many examples in.student_resources/ assume local testing with http://127.0.0.1:5000. If using a remote server, update HTML/JavaScript examples:
Example Update
Application Configuration
The Flask application is configured inmain.py with these settings:
main.py (lines 70-73)
Configuration Breakdown
| Setting | Value | Purpose |
|---|---|---|
debug | True | Enables debug mode with detailed error pages (vulnerability) |
host | 0.0.0.0 | Listens on all network interfaces |
port | 5000 | Default Flask development port |
TEMPLATES_AUTO_RELOAD | True | Automatically reloads templates on change |
SEND_FILE_MAX_AGE_DEFAULT | 0 | Disables browser caching |
CORS | Enabled | Allows cross-origin requests for CSRF demos |
Debug Mode: Running with
debug=True exposes sensitive information in error messages and enables the Werkzeug debugger. This is intentional for learning about debug mode vulnerabilities.Database Setup
The application uses SQLite with the database located atdatabase_files/database.db. The database is accessed via user_management.py:
user_management.py (example)
Database Schema
users table:username(TEXT)password(TEXT) - stored in plain text (vulnerability)dateOfBirth(TEXT)
id(INTEGER PRIMARY KEY)feedback(TEXT)
Security Testing in Sandboxes
Once deployed in a sandbox, students should:1. White Box Analysis
Review the source code to identify vulnerabilities:- main.py: Open redirects, CORS configuration, debug mode
- user_management.py: SQL injection, plain text passwords, timing attacks
- templates: XSS vulnerabilities in rendered content
2. Grey Box Analysis
Combine code review with active testing:- Test identified vulnerabilities with payloads
- Verify assumptions from code review
- Map application flow and attack surface
3. Black Box Analysis
Test without source code access (if teacher-hosted):- Penetration testing with tools like ZAP Proxy
- Manual vulnerability discovery
- Network traffic analysis
4. Automated Scanning
Use security tools available in the sandbox:- OWASP ZAP: Automated vulnerability scanning
- Bandit: Python security linter
- Safety: Dependency vulnerability checker
OWASP WSTG
Comprehensive web security testing guide
ZAP Proxy
Open source penetration testing tool
Next Steps
Document Findings
Prepare your security assessment report with discovered vulnerabilities and impact analysis.
Troubleshooting
Cannot Access Application on Network
- Verify firewall settings allow port 5000
- Check
host="0.0.0.0"in main.py - Ensure devices are on the same network
- Test with
curl http://server-ip:5000from another machine
Database Errors
- Ensure
database_files/database.dbexists - Check file permissions in the sandbox
- Verify SQLite3 is available in the environment
Import Errors in Sandbox
- Reinstall requirements:
pip install -r requirements.txt - Use virtual environment for dependency isolation
- Check Python version compatibility (3.x required)
