Lab 5 of 8 · Web application security
Assess OWASP Juice Shop, a practice app built to be hacked
Run the deliberately vulnerable Juice Shop on your computer, find a SQL injection and an XSS by hand, run an automated scan, and write a findings report.
- Time
- 90 minutes
- Cost
- Free.
What you learn
Most breaches start with a web app. Knowing the common weaknesses, and how to prove and explain them, is the base for both defenders and penetration testers.
- The OWASP Top 10 web risks
- SQL injection and cross-site scripting, hands-on
- Automated scanning with OWASP ZAP
- Writing findings with a clear fix
In the AI era: AI-written code repeats common security mistakes. Knowing how injection and XSS work lets you catch them in review, wherever the code came from.
Before you start
Install Docker Desktop.
Only test systems you own or that are built for practice. Scanning or attacking anyone else's system without written permission is illegal in most countries.
Step by step
1 Start Juice Shop on your computer
It runs only on your machine. Open http://localhost:3000 and close the welcome banner.
docker run -d --name juice-shop -p 3000:3000 bkimminich/juice-shopYou should see:The OWASP Juice Shop store page.
2 SQL injection on the login form
Click Account → Login. In the email field type the text below, type anything as the password, and log in. The quote breaks out of the SQL query and
--comments out the password check.' OR 1=1--You should see:You are logged in as the administrator, without knowing any password.
3 Cross-site scripting (XSS) in the search box
Paste this into the search box and press Enter. The page runs code that came from your search text.
<iframe src="javascript:alert(`xss`)">You should see:A pop-up saying
xss.4 Run an automated baseline scan
OWASP ZAP checks for common problems such as missing security headers. On Linux, replace
host.docker.internalwith172.17.0.1. The report is saved toreports/zap-baseline.html.mkdir -p reports docker run --rm -v "$PWD/reports:/zap/wrk" -t ghcr.io/zaproxy/zaproxy:stable zap-baseline.py -t http://host.docker.internal:3000 -r zap-baseline.htmlYou should see:A summary with WARN-NEW lines and a
zap-baseline.htmlfile inreports.5 Write the findings report
A finding is only useful with impact and a fix. Fill this in for both issues, and add two items from the ZAP report.
# Web application assessment: OWASP Juice Shop (local practice app) Scope: http://localhost:3000 on my own computer. Date: ... ## Finding 1: SQL injection in login (Critical) - Where: email field on /#/login - Proof: `' OR 1=1--` logs in as the administrator - Impact: anyone can take over any account, including admin - Fix: parameterised queries; never build SQL from user input ## Finding 2: Reflected XSS in search (High) - Where: search box - Proof: an iframe with a javascript: URL runs in the page - Impact: attackers can run code in a victim's browser - Fix: encode output; add a Content-Security-Policy ## Automated scan highlights (ZAP) - ... - ...6 Commit, push and stop the app
Stopping the container removes the vulnerable app from your computer.
git add reports git commit -m "Add web application assessment of Juice Shop" git push docker rm -f juice-shop
You are done when
You reproduced a SQL injection and an XSS on a practice app.
Your report gives impact and a fix for each finding.
The Juice Shop container is stopped.
We check your public GitHub repository and give you a page to share with recruiters, and can add the project to your resume.