Protego field desk

Methodology and Your Practice Lab · Planning and setup

L5. Build a Safe, Legal Practice Lab

Build an isolated practice lab with OWASP Juice Shop and DVWA bound to your own machine, and connect safely to online practice platforms.

Lesson 5 of 21 · About 40 minutes including the lab

By the end of this lesson you can

  • Choose a virtual machine setup with snapshots and safe networking.
  • Run Juice Shop and DVWA with Docker, listening on 127.0.0.1 only.
  • Verify that a lab service is not exposed to your network.
  • Connect to TryHackMe, Hack The Box and PortSwigger labs within their rules.
Video transcript

You want to practice attacks. Where is that legal? A practice lab is a system you own, or one a platform has explicitly made available for testing. Deliberately vulnerable apps can run on your own machine. Run OWASP Juice Shop or DVWA in a container on your own machine. Publish the port on localhost only, so nobody else on the network can reach the vulnerable app. TryHackMe, Hack The Box and PortSwigger give you targets you are allowed to attack. Snapshots and local ports keep the mess contained. A public website is never a practice target without written permission. Bind every lab port to localhost. Take a snapshot before you break things. Follow each platform’s rules on what you may attack. Every lab in this course stays inside these limits. Check your setup in the knowledge check.

Course outlineLesson 5 of 21

Lesson notes

A lab is where you can make mistakes safely. A common setup is a virtual machine (VirtualBox, VMware or Hyper-V) running a testing distribution such as Kali Linux, which ships most of the tools in this course. Take a snapshot before each exercise so you can roll back in seconds.

Deliberately vulnerable applications must never be reachable from the internet or your home network. DVWA’s own README warns not to put it on any internet-facing server. Bind every lab service to 127.0.0.1 (localhost), and use NAT or host-only networking for your VM.

OWASP Juice Shop is a modern, intentionally insecure web shop with a built-in score board of challenges mapped to the OWASP Top 10. DVWA (Damn Vulnerable Web Application) is a simpler PHP application with adjustable security levels (low, medium, high, impossible) so you can compare vulnerable and fixed code.

Online platforms give you legal targets without any setup. TryHackMe offers guided rooms and an in-browser attack machine. Hack The Box offers Starting Point machines for beginners over a VPN. The PortSwigger Web Security Academy offers free, hosted labs for every major web vulnerability class. Each platform authorizes you to attack its own lab machines only, and only while they are assigned to you. Attacking the platform itself, or other users, is out of scope.

When you connect a platform VPN, your VM joins a network with other learners’ machines. Keep your attack VM patched, do not run services you do not need, and disconnect the VPN when you finish.

Commands and expected output

Run OWASP Juice Shop on localhost only (from the Juice Shop README)

docker run --rm -p 127.0.0.1:3000:3000 bkimminich/juice-shop

The -p 127.0.0.1:3000:3000 mapping publishes the container port only on your loopback interface. Browse to http://localhost:3000. Stop it with Ctrl+C; --rm deletes the container so you start fresh next time.

Run DVWA with the project’s Docker Compose file

git clone https://github.com/digininja/DVWA.git
cd DVWA
docker compose up -d

The official compose.yml publishes DVWA as 127.0.0.1:4280. Browse to http://localhost:4280, open Setup, click Create / Reset Database, then log in with the documented default credentials admin / password. Set DVWA Security to low for the first exercises.

Check that a lab service listens on localhost only

ss -tln

Output

State  Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0      5          127.0.0.1:8000      0.0.0.0:*

Real output from a test web server. Local Address 127.0.0.1 means only your own machine can connect. If you see 0.0.0.0 or your LAN address next to a lab port, anyone on your network could reach it: stop it and fix the port mapping.

Hands-on labs

Practice only on these legal targets: your own local lab or machines a platform assigns to you. Never use these techniques on systems you do not have written permission to test.

  • OWASP Juice Shop

    Find the score board

    With Juice Shop running on localhost, find the hidden Score Board page. It lists every challenge and its difficulty, and becomes your progress tracker.

  • DVWA

    Initialize DVWA

    Create the database, log in, and read the source of one module at low and at impossible security using the View Source button. Note the difference.

  • Hack The Box

    Starting Point, Tier 0

    Connect with the platform VPN or browser-based Pwnbox and complete the first Tier 0 machine.

Practice task

Write a one-page lab card: your VM snapshot name, the URLs of Juice Shop and DVWA, the output of ss -tln proving they listen on 127.0.0.1, and the rules of each online platform you joined.

Key takeaways

  • Deliberately vulnerable apps must listen on 127.0.0.1 only, never on the internet.
  • Snapshots let you undo mistakes; take one before every exercise.
  • Platforms authorize you to attack their lab machines, not the platform or other users.
  • Verify exposure with ss -tln rather than assuming.
Knowledge Check

1. Which Docker port mapping keeps Juice Shop reachable only from your own machine?

2. ss -tln shows 0.0.0.0:4280 for DVWA. What does that mean?

3. On TryHackMe or Hack The Box, what are you authorized to attack?

4. Why take a VM snapshot before each exercise?