How anpk1011/webgoat works
Purpose and Runtime
WebGoat is an OWASP deliberately insecure, educational web application for practicing server-side web-security attacks. It is a Java 25, Maven, Spring Boot system packaged for standalone execution or Docker. It runs two local web applications: WebGoat (default :8080/WebGoat) and WebWolf (default :9090/WebWolf), the auxiliary attacker-support service. Primary launch wiring is in src/main/java/org/owasp/webgoat/server/StartWebGoat.java and src/main/java/org/owasp/webgoat/server/ParentConfig.java; container packaging is Dockerfile.
Two Application Boundaries
WebGoat and WebWolf have separate Spring MVC/security configurations, properties, templates, static assets, and user/data models. WebGoat is the lesson portal; WebWolf provides capabilities exercises can target or use, including mailbox, file server, request tracing, and JWT tools. Their principal application roots are src/main/java/org/owasp/webgoat/container/WebGoat.java and src/main/java/org/owasp/webgoat/webwolf/WebWolf.java; configuration is split between src/main/resources/application-webgoat.properties and src/main/resources/application-webwolf.properties.
WebGoat Request, Identity, and Progress Flow
Browser requests enter Spring MVC and Spring Security, then route through current-user/session and lesson-tracking infrastructure. Registration and authenticated users are persisted through repositories/services; user progress records completion per lesson/assignment. Key boundary components are src/main/java/org/owasp/webgoat/container/WebSecurityConfig.java, src/main/java/org/owasp/webgoat/container/users/UserService.java, and src/main/java/org/owasp/webgoat/container/service/LessonProgressService.java. The database is initialized via src/main/resources/db/container/V1__init.sql, with lesson-specific migrations under resource lesson directories.
Lesson Discovery and Content Assembly
Lessons are modular Java classes implementing shared lesson/assignment metadata, dynamically discovered alongside their resource bundles. Course/menu services turn discovered lessons into navigable categories and render each lesson’s HTML, AsciiDoc documentation, localized labels, and assets. The core abstractions and loading path are src/main/java/org/owasp/webgoat/container/lessons/Lesson.java, src/main/java/org/owasp/webgoat/container/LessonResourceScanner.java, and src/main/java/org/owasp/webgoat/container/LessonTemplateResolver.java. A representative complete lesson bundle spans src/main/java/org/owasp/webgoat/lessons/sqlinjection/ and src/main/resources/lessons/sqlinjection/.
Exercise Execution and Validation
Lesson-specific HTTP endpoints intentionally expose vulnerable or mitigated behavior. Assignments submit attack attempts to a common endpoint/result model; validation produces an AttackResult, hints are available separately, and tracking persists successful work. This creates a controlled framework boundary between generic progression logic and intentionally unsafe lesson code. Central classes: src/main/java/org/owasp/webgoat/container/assignments/AssignmentEndpoint.java, src/main/java/org/owasp/webgoat/container/assignments/AttackResult.java, and src/main/java/org/owasp/webgoat/container/assignments/LessonTrackerInterceptor.java.
Client UI and WebWolf Services
WebGoat serves a server-hosted shell with a legacy JavaScript application (Backbone/jQuery) that loads menus, lesson content, hints, assignment status, and report cards from backend endpoints. Main client routing/content pieces are src/main/resources/webgoat/static/js/goatApp/view/GoatRouter.js, src/main/resources/webgoat/static/js/goatApp/controller/LessonController.js, and src/main/resources/webgoat/templates/main_new.html. WebWolf independently exposes mailbox, uploaded files, and captured requests through src/main/java/org/owasp/webgoat/webwolf/mailbox/MailboxController.java, src/main/java/org/owasp/webgoat/webwolf/FileServer.java, and src/main/java/org/owasp/webgoat/webwolf/requests/Requests.java.
Deployment and Exposure Constraints
The application is intentionally vulnerable and designed to bind locally; Docker maps both application ports explicitly. Runtime host names can be configured for proxy-based lessons, and category/lesson exclusions alter the generated menu/course. Material external interaction is browser/proxy tooling (ZAP or Burp) and Docker; WebWolf is an internal companion service rather than a remote dependency.
Main entry points: WebWolf.java WebWolf application · WebGoat.java WebGoat application · StartWebGoat.java Dual-app launcher · LessonResourceScanner.java Lesson discovery
Components 20
Runtime
Standalone or Docker launches both local applications.
- Docker packaging · Maps the WebGoat and WebWolf ports.
Dockerfile - Dual-app launcher · Starts the two local application contexts.
src/main/java/org/owasp/webgoat/server/StartWebGoat.java - Parent configuration · Provides shared launch wiring.
src/main/java/org/owasp/webgoat/server/ParentConfig.java
WebGoat portal
Lesson portal, identity, progress, and exercise framework.
- WebGoat application · Serves the lesson portal at /WebGoat.
src/main/java/org/owasp/webgoat/container/WebGoat.java - Security and sessions · Protects portal requests and establishes current-user context.
src/main/java/org/owasp/webgoat/container/WebSecurityConfig.java - Users and identity · Persists registration and authenticated users.
src/main/java/org/owasp/webgoat/container/users/UserService.java - Lesson progress · Records completion by lesson and assignment.
src/main/java/org/owasp/webgoat/container/service/LessonProgressService.java - Application database · Initialized with core and lesson-specific migrations.
src/main/resources/db/container/V1__init.sql - Portal UI shell · Loads menus, lesson content, hints, status, and reports.
src/main/resources/webgoat/templates/main_new.html
Lesson system
Modular educational content and intentionally vulnerable exercises.
- Lesson abstraction · Shared lesson and assignment contract.
src/main/java/org/owasp/webgoat/container/lessons/Lesson.java - Lesson discovery · Discovers modular lessons and resource bundles.
src/main/java/org/owasp/webgoat/container/LessonResourceScanner.java - Lesson content renderer · Assembles HTML, AsciiDoc, labels, and assets.
src/main/java/org/owasp/webgoat/container/LessonTemplateResolver.java - SQL injection lesson · Representative intentionally vulnerable lesson implementation.
src/main/java/org/owasp/webgoat/lessons/sqlinjection/introduction/SqlInjection.java - Assignment execution · Accepts attack attempts and returns AttackResult validation.
src/main/java/org/owasp/webgoat/container/assignments/AssignmentEndpoint.java - Completion interceptor · Persists successful assignment work.
src/main/java/org/owasp/webgoat/container/assignments/LessonTrackerInterceptor.java
WebWolf companion
Local attacker-support application.
- WebWolf application · Local auxiliary service at /WebWolf.
src/main/java/org/owasp/webgoat/webwolf/WebWolf.java - Mailbox service · Provides exercise-targetable mailbox capabilities.
src/main/java/org/owasp/webgoat/webwolf/mailbox/MailboxController.java - File service · Exposes uploaded files for exercises.
src/main/java/org/owasp/webgoat/webwolf/FileServer.java - Request capture · Makes captured requests available to exercises.
src/main/java/org/owasp/webgoat/webwolf/requests/Requests.java
Other components
- Browser / proxy tools · Users interact directly or through security proxy tooling.
Connections 23
- Docker packaging → Dual-app launcher: packages and runs
- Parent configuration → Dual-app launcher: shared wiring
- Dual-app launcher → WebGoat application: starts :8080
- Dual-app launcher → WebWolf application: starts :9090
- Browser / proxy tools → WebGoat application: portal requests
- Browser / proxy tools → WebWolf application: companion requests
- WebGoat application → Security and sessions: secures requests
- Security and sessions → Users and identity: resolves user
- Users and identity → Application database: persists users
- WebGoat application → Portal UI shell: serves shell
- WebGoat application → Lesson discovery: discovers lessons
- Lesson discovery → Lesson abstraction: loads metadata
- Lesson discovery → SQL injection lesson: finds lesson
- Lesson abstraction → Lesson content renderer: renders content
- Portal UI shell → Assignment execution: submits attempts
- SQL injection lesson → Assignment execution: vulnerable endpoints
- Assignment execution → Completion interceptor: successful result
- Completion interceptor → Lesson progress: records completion
- Lesson progress → Application database: persists progress
- WebWolf application → Mailbox service: exposes
- WebWolf application → File service: exposes
- WebWolf application → Request capture: exposes
- SQL injection lesson → WebWolf application: uses companion capabilities