Roadmaps / Cybersecurity / Lab 5

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. 1 Start Juice Shop on your computer

    It runs only on your machine. Open http://localhost:3000 and close the welcome banner.

    Run this
    docker run -d --name juice-shop -p 3000:3000 bkimminich/juice-shop
    You should see:

    The OWASP Juice Shop store page.

  2. 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.

    Run this
    ' OR 1=1--
    You should see:

    You are logged in as the administrator, without knowing any password.

  3. 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.

    Run this
    <iframe src="javascript:alert(`xss`)">
    You should see:

    A pop-up saying xss.

  4. 4 Run an automated baseline scan

    OWASP ZAP checks for common problems such as missing security headers. On Linux, replace host.docker.internal with 172.17.0.1. The report is saved to reports/zap-baseline.html.

    Run this
    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.html
    You should see:

    A summary with WARN-NEW lines and a zap-baseline.html file in reports.

  5. 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.

    File: reports/juice-shop-findings.md
    # 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. 6 Commit, push and stop the app

    Stopping the container removes the vulnerable app from your computer.

    Run this
    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.

Finished? Get your proof page

We check your public GitHub repository and give you a page to share with recruiters, and can add the project to your resume.