QA Interview Hub · Knowledge base · Quizzes · Українська

Penetration Testing › Pentest basics

A legal lab: where to practise and how to isolate it

Practise legally on deliberately vulnerable applications built for learning: PortSwigger Web Security Academy, OWASP Juice Shop and DVWA. Juice Shop and DVWA are run by you and isolated: the port is bound to 127.0.0.1 only, never exposed to the network or put on a public server, and the container is stopped after practice. Someone else's public site is not permission to train.

Pentest · Basics

How do you learn to break applications and stay out of jail? Where do you get a "victim"?

A beginner read about SQL injection and decided to "try it on some site". That is exactly the mistake from the earlier lessons: without the owner's permission such a test is illegal. The right answer is simple: learn on deliberately vulnerable applications that were made for this and that you run yourself. This lesson covers three sources of practice and how to set up a lab that harms nobody.

Three legal sources (the whole course uses them):

  • PortSwigger Web Security Academy — free online labs by topic (SQL injection, XSS, CSRF, SSRF, access control and more). Nothing to install: a lab opens in the browser, and some need Burp Suite (the free Community Edition is enough for most);
  • OWASP Juice Shop — a vulnerable online shop that tracks completed challenges. Runs locally;
  • DVWA (Damn Vulnerable Web Application) — a classic training application with difficulty levels (low … impossible). Runs locally.

Isolation mechanism. A deliberately vulnerable application is dangerous if someone else reaches it. So the rules are simple: listen only on 127.0.0.1, do not open the port to the network, do not put it on a public server (the DVWA README forbids this explicitly), and stop the container after practice. A Docker container adds one more layer: your files and keys are not inside it.

A lab on your computer

your computerBrowserBurp / ZAPDocker:Juice Shop127.0.0.1:3000the port is not reachable from the internet
Figure 1. Only 127.0.0.1 listens: you alone can see the vulnerable application.

Example: starting Juice Shop. The command from the project README:

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

The shop opens at http://localhost:3000. The 127.0.0.1: prefix in the port mapping binds the container to your machine only. Without it the port may listen on all interfaces. DVWA is started with docker compose up -d (address http://localhost:4280), the default login is admin / password.

How to practise. Pick a topic in the Academy, read the description, try it yourself and only then look at the hint. Then repeat the same in Juice Shop through Burp: this trains the "request → hypothesis → check" loop.

A real example. When Log4Shell (CVE-2021-44228) appeared in December 2021, researchers published a deliberately vulnerable application (Spring Boot with Log4j 2.14.1) so it could be reproduced safely. Its author directly advises running it in an isolated environment, preferably a virtual machine. This is how a legal lab works: a vulnerability is studied where it harms nobody.

Limits. A lab teaches mechanics, but everything in it is simplified: no WAF, noise, limits or complex business logic. After the training exercises you move on to your own team's applications or test environments, with written permission.

Common mistakes:

  • "practising" on someone else's site because "it is public": that is not permission;
  • running DVWA or Juice Shop on a VPS in an open network: scanners will find it;
  • copying other people's exploits without reading them: they sometimes contain malicious code (run only code you understand);
  • thinking a lab equals a real test: a real one has a scope, permission and a report.

Check yourself

Why does the Juice Shop command say 127.0.0.1:3000:3000 and not just 3000:3000?

Answer

Without the address the port may listen on all interfaces and other devices on the network can see the application. With the prefix only your machine can reach it.

In an interview. Junior: I practise on PortSwigger Academy, Juice Shop and DVWA: deliberately vulnerable applications that I run locally. Middle/Senior: I isolate the lab: the container listens only on 127.0.0.1, nothing is exposed to the internet, and I stop it after the session. Real systems need written permission and a scope.

More articles in this chapter