How sasanlabs/vulnerableapp works
1. What this repo is
- OWASP VulnerableApp is a single Spring Boot application that intentionally exposes many security flaw scenarios. It is not a library; the main architectural unit is a backend app plus its bundled static UI, payload catalogs, and seeded test data.
2. Top-level runtime boundary
- The application is Java 17 + Spring Boot, started from org.sasanlabs.Application.
- It can run as a standalone JAR or as a Docker image. The legacy app is exposed on port 9090 under /VulnerableApp; the README also describes a broader Docker-based stack with an external modern facade UI.
3. Request entry layer
- VulnerableAppRestController is the main HTTP entry point for metadata and scenario navigation.
- ControllerExceptionHandler and custom exceptions provide a single error boundary for the API layer.
- Static content is also served directly from src/main/resources/static, including the legacy UI shell and vulnerability-specific HTML/JS/CSS templates.
4. Scenario discovery and metadata
- EndPointsInformationProvider is the main orchestration service for discovering available attack surfaces.
- Custom annotations in internal/utility/annotations describe each vulnerable endpoint: attack vector, request parameter location, response type, and request mapping.
- Response beans such as AllEndPointsResponseBean, AttackVectorResponseBean, LevelResponseBean, and ScannerResponseBean form the contract between discovery logic and the UI/scanner metadata.
5. Core architectural pattern: one module per vulnerability
- The repo is organized by vulnerability family under service/vulnerability/*.
- Each module encapsulates its own logic, level variants, and often its own model/repository/controller classes.
- This makes the application extensible: new scenarios are added as isolated modules rather than by changing shared core code.
6. Stateful modules and persistence
- Some vulnerabilities are backed by an embedded H2 database and Spring Data repositories, especially:
- Authentication
- IDOR
- SQL injection
- Persistent XSS
- XXE
- Seed data and schema live under src/main/resources/scripts/**/db, so scenario state is reproducible at startup.
- The README also documents browser access to the H2 console, confirming the database is part of the app runtime, not an external dependency.
7. External/system-like dependencies simulated inside the app
- EmbeddedLDAPConfig supports LDAP-injection scenarios with a local embedded LDAP setup.
- JWT scenarios use bundled keys, token generators/validators, and algorithm/key-strength helpers.
- SSRF uses MetaDataServiceMock to simulate metadata endpoints.
- Path traversal and file upload scenarios rely on bundled files/resources and upload handling rather than real external services.
8. UI and asset model
- The frontend assets are co-located with backend code under src/main/resources/static/templates/**.
- Each vulnerability and level has its own HTML/CSS/JS bundle, which means the UI is scenario-driven rather than a single generic app shell.
- Global assets like index.html, vulnerableApp.css/js, images, and vector files support the shared navigation layer.
9. Internationalization and payload catalogs
- src/main/resources/i18n/messages*.properties localize labels and descriptions.
- src/main/resources/attackvectors/*.properties define scenario payloads and scanner-facing content.
- These files are part of the architecture because they separate scenario behavior from human-readable UI/scanner metadata.
10. Extensibility boundary
- src/main/resources/sampleVulnerability contains a template for generating a new vulnerability module.
- That template, plus the custom annotations and metadata provider, is the repository’s primary extension mechanism.
11. Configuration and support code
- VulnerableAppConfiguration, VulnerableAppProperties, and EnvUtils centralize app setup and environment-specific behavior.
- Utility classes cover JSON serialization, password hashing, message bundles, constants, and shared enum-like types.
12. Testing and release pipeline
- The test tree mirrors the vulnerability modules, so each scenario has focused unit/integration coverage.
- GitHub Actions, Gradle, Dockerfiles, and compose files define CI/build/release packaging.
- This matters architecturally because the project is designed for reproducible scanner benchmarking, so build and runtime determinism are first-class concerns.
Main entry points: schema.sql Seed Data · Auth.html Scenario UIs · EndPointsInformationProvider.java Discovery Service · gradle.yml CI Workflows
Components 27
Runtime
Application bootstrap and Spring configuration
- Application · Main startup class for the Java 17 Spring Boot app
src/main/java/org/sasanlabs/Application.java - App Config · Central configuration and runtime properties
src/main/java/org/sasanlabs/configuration/VulnerableAppConfiguration.java - LDAP Config · Embedded LDAP setup used by LDAP injection scenarios
src/main/java/org/sasanlabs/configuration/EmbeddedLDAPConfig.java
API Core
HTTP entrypoints, metadata discovery, and shared contracts
- Rest API · Main HTTP entrypoint for scenario metadata and navigation
src/main/java/org/sasanlabs/controller/VulnerableAppRestController.java - Error Boundary · Controller exception handler and API error mapping
src/main/java/org/sasanlabs/controller/exception/ControllerExceptionHandler.java - Discovery Service · Orchestrates endpoint discovery and scanner metadata
src/main/java/org/sasanlabs/service/impl/EndPointsInformationProvider.java - Annotations · Custom annotations describing attack vectors, parameters, and mappings
src/main/java/org/sasanlabs/internal/utility/annotations/AttackVector.java - API Beans · Response beans exchanged between discovery logic and the UI/scanner
src/main/java/org/sasanlabs/beans/AllEndPointsResponseBean.java
Vulnerability Modules
Isolated scenario implementations grouped by family
- Auth · Authentication scenario with H2-backed user data
src/main/java/org/sasanlabs/service/vulnerability/authentication/AuthenticationVulnerability.java - IDOR · Broken object reference scenarios with login and user records
src/main/java/org/sasanlabs/service/vulnerability/idor/IDORVulnerability.java - SQLi · Error-based, blind, and union-based SQL injection scenarios
src/main/java/org/sasanlabs/service/vulnerability/sqlInjection/ErrorBasedSQLInjectionVulnerability.java - XSS · Reflected and persistent XSS scenarios
src/main/java/org/sasanlabs/service/vulnerability/xss/reflected/XSSWithHtmlTagInjection.java - XXE · XML external entity scenarios with entity and schema handling
src/main/java/org/sasanlabs/service/vulnerability/xxe/XXEVulnerability.java - JWT · JWT generation and validation scenarios using bundled keys and helpers
src/main/java/org/sasanlabs/service/vulnerability/jwt/JWTVulnerability.java - File Upload · Unrestricted upload flow and preflight handling
src/main/java/org/sasanlabs/service/vulnerability/fileupload/UnrestrictedFileUpload.java - SSRF · Server-side request forgery scenarios with metadata mock service
src/main/java/org/sasanlabs/service/vulnerability/ssrf/SSRFVulnerability.java - Redirects · Open redirect and client-side navigation variants
src/main/java/org/sasanlabs/service/vulnerability/openRedirect/Http3xxStatusCodeBasedInjection.java
Resources
Static UI, payload catalogs, seed data, and templates
- Static UI · Bundled legacy shell and global static assets
src/main/resources/static/index.html - Scenario UIs · Per-vulnerability HTML, CSS, and JS templates
src/main/resources/static/templates/AuthenticationVulnerability/LEVEL_1/Auth.html - Payload Catalogs · Attack vector and scanner-facing payload/property files
src/main/resources/attackvectors/GeneralVulnerabilityPayload.properties - I18n Bundles · Localized UI and description strings
src/main/resources/i18n/messages.properties - Seed Data · Database schema/data scripts and bundled fixtures for scenarios
src/main/resources/scripts/Authentication/db/schema.sql - Sample Module · Template for generating a new vulnerability module and UI bundle
src/main/resources/sampleVulnerability/sampleVulnerability/SampleVulnerability.java
Delivery
Build, compose, and release packaging
- Build · Gradle build and wrapper for reproducible builds
build.gradle - Compose · Docker compose definitions for local and stack-based execution
docker-compose.yml - Dockerfile · Container image definition for the application runtime
Dockerfile.base - CI Workflows · GitHub Actions pipelines for build, release, docker, and onboarding
.github/workflows/gradle.yml
Connections 24
- Application → App Config: loads · Bootstraps the application with central configuration
- App Config → LDAP Config: includes · Wires embedded LDAP support into the runtime
- Rest API → Discovery Service: queries · Fetches vulnerability and endpoint metadata
- Rest API → Error Boundary: handled by · API failures flow through the controller exception boundary
- Discovery Service → Annotations: reflects · Reads custom annotations to discover scenarios
- Discovery Service → API Beans: returns · Builds scanner and navigation response contracts
- Auth → Seed Data: uses · Relies on schema and data scripts for startup state
- IDOR → Seed Data: uses · Relies on schema and data scripts for startup state
- SQLi → Seed Data: uses · Relies on schema and data scripts for startup state
- XSS → Seed Data: uses · Persistent XSS uses stored records and schema fixtures
- XXE → Seed Data: uses · Uses XML/schema fixtures bundled with the app
- JWT → Payload Catalogs: uses · Consumes bundled key and algorithm material
- SSRF → Payload Catalogs: uses · Uses mock metadata and scanner payload content
- File Upload → Static UI: serves · Upload scenario is exposed through the bundled UI shell
- Redirects → Scenario UIs: renders · Scenario-specific frontend bundle for redirect variants
- Static UI → Scenario UIs: links · Global shell routes users into scenario templates
- Scenario UIs → Payload Catalogs: guided by · UI behavior and scanner prompts are aligned with payload catalogs
- I18n Bundles → API Beans: labels · Localizes metadata shown by the discovery API and UI
- Sample Module → Annotations: demonstrates · Template shows the extension pattern for new modules
- Sample Module → Scenario UIs: pairs with · Template includes a matching frontend bundle
- Build → CI Workflows: validated by · CI runs Gradle-based build and test pipelines
- Compose → Dockerfile: builds · Compose stack uses container images defined by the Dockerfile
- CI Workflows → Dockerfile: packages · Automation produces containerized releases
- CI Workflows → Compose: deploys · Workflows support the docker-based local and release stacks