Getting Started with WebGoat: A Hands-On Guide to OWASP Web Security Training
This guide provides a step-by-step setup for WebGoat, a valuable tool for hands-on OWASP web security training. We’ll cover the prerequisites, installation process, and walk through key labs to illustrate common vulnerabilities.
Prerequisites
Before you begin, ensure you have the following:
- Java 11+ (OpenJDK)
- Docker Desktop
- A modern browser (Chrome, Edge, or Firefox)
Step-by-Step Setup
- Install Docker Desktop: Install and verify Docker Desktop is running on your operating system.
- Pull the WebGoat Image: Open your terminal and run:
docker pull webgoat/webgoat:latest - Run WebGoat: Execute the following command in your terminal:
docker run -d -p 8080:8080 --name webgoat webgoat/webgoat:latest - Access WebGoat: Open your browser and navigate to
http://localhost:8080/WebGoat/. Click “Sign In” to begin. - Getting Started Lab: Upon first login, complete the “Getting Started” lab to familiarize yourself with the interface and safety guidelines.
Safety Note: Run WebGoat on localhost or an isolated network. Never expose port 8080 to the public internet. Monitor resource usage.
Hands-On Labs
The following labs provide practical-guide-to-secure-web-communication/”>practical experience with common web vulnerabilities:
Lab 1: XSS – Reflected XSS in a Search Field
This lab demonstrates how a simple input field can reflect user data, leading to XSS vulnerabilities.
Steps:
- Navigate to WebGoat → XSS → Reflected XSS lab activity.
- Enter the following payload into the search input and submit:
<script>alert('XSS')</script> - Observation: If the input is not encoded, the script will execute. If encoded, it will not.
- Remediation: Implement HTML entity escaping (e.g.,
<,>) and content security policies.
Lab 2: SQL Injection – Authentication Bypass
This lab showcases how a vulnerable login form can be bypassed without valid credentials if user input isn’t handled securely.
Steps:
- Open the login lab under SQL Injection.
- Enter
' OR '1'='1in the username field (leave the password blank). - Observation: If string concatenation is used instead of parameterized queries, authentication may be bypassed.
- Remediation: Use prepared statements/parameterized queries, input validation, and robust error handling.
Lab 3: CSRF – Unauthenticated Action
This lab explores Cross-Site Request Forgery (CSRF), where a site’s trust in a logged-in browser session is exploited.
Steps:
- Navigate to a state-changing lab action (e.g., purchase or profile update) without re-authentication.
- Attempt to trigger the action via a crafted HTML form from another page/domain without explicit user interaction.
- Observation: If CSRF protections are absent, the action may be triggered by an attacker.
- Remediation: Implement anti-CSRF tokens, same-site cookies, and state validation.
Note: Only perform CSRF testing in a controlled environment. Never test on production systems without explicit authorization.
Lab 4: Insecure Direct Object Reference (IDOR)
IDOR occurs when the server trusts the identifier provided by the client.
Steps:
- Access a resource URL with a direct object parameter (e.g.,
/WebGoat/resource?userId=123). - Modify the parameter (e.g.,
userId=124) to attempt accessing another user’s data. - Observation: Lack of server-side authorization checks can lead to data exposure.
- Remediation: Enforce authorization at each request and validate user context against the target resource.
Takeaway: Proper access control is crucial. Always verify the requester’s identity and access permissions.
Deployment Options: Docker vs. Native WebGoat Setup
| Aspect | Docker-based Deployment | Native/JAR Installation |
|---|---|---|
| Quick Start | Quick and easy setup with minimal configuration. | Requires Java runtime and manual server setup. |
| OS and Environment | Works on Windows, macOS, and Linux via Docker. | Depends on host OS and Java environment. |
| Resource Usage | Generally 1-2 GB RAM and 1 CPU core. Containerization helps manage resource usage. | Depends on host; may consume more resources. |
| Upgrade Path | Regularly pull the latest image. | Manual update of JARs, dependencies, and server configuration. |
Pros and Cons
Pros
- Hands-on practice in a safe environment.
- Reproducible and resettable labs.
- Clear structure for building skills.
Cons
- Some content may reference older OWASP Top 10 editions. Supplement with up-to-date references.
- Focus on exploitation; ensure defensive best practices are included.
- Requires basic Docker familiarity.
Mitigation: Update OWASP Top 10 mappings and add a defense-focused appendix.

Leave a Reply