TExcelTAD
Home › Security Foundations: Concepts, Law, Ethics & Your Lab › Lab Machines and Vulnerable Apps

Lab Machines and Vulnerable Apps

With an isolated network in place (Hypervisors, VM Networks and Snapshots), the next question is what to put on it. Beginners often download every security distribution and vulnerable image they can find and end up with a slow host and no plan. A useful lab is small and has roles: one machine you attack from, a few machines that play realistic servers you defend and inspect, and deliberately vulnerable applications that give you something safe to break. Everything in it is yours, which is what makes it legal to test (see Authorization, Scope and Rules of Engagement).

The roles

Role Typical choice What you do with it Resources
attack / tools workstation Kali Linux (or Parrot OS) run scanners, proxies, password and web tools against lab targets 2 CPUs, 2–4 GB RAM
Linux server Ubuntu Server LTS a realistic target and a defender's view: services, logs, firewall, hardening 1–2 CPUs, 1–2 GB
Windows server Windows Server (Microsoft's free evaluation, 180 days) Active Directory domain controller, Group Policy, Windows logs 2 CPUs, 4 GB+
Windows client Windows 11 Enterprise evaluation (90 days) a domain member, user behaviour, Sysmon 2 CPUs, 4 GB
vulnerable apps OWASP Juice Shop, DVWA, WebGoat in Docker; Metasploitable as a VM practise web and network attacks with the detection and the fix small each
monitoring (later) Wazuh, Security Onion, or an ELK stack collect the lab's logs: the blue-team half of every exercise 4 GB+

You don't need all of it on day one. Kali, one Ubuntu Server and Juice Shop are enough for the first months; add Windows Server for Windows & Active Directory Security and a monitoring VM for Defensive Security.

Kali Linux is a Debian-based distribution packed with security tools. It is a toolbox, not a daily desktop: its default account is the unprivileged kali (the default password is kali; change it), and it should live only on the lab network. Ubuntu Server plays the production Linux server you would run at work. Windows Server is what most companies' identity runs on: one domain controller with a handful of users, groups and policies is enough to learn Active Directory.

Vulnerable applications

App What it is How to run it
OWASP Juice Shop a modern single-page web shop (Node.js, Angular) with many vulnerabilities as scored challenges, covering the OWASP Top 10 and more Docker image bkimminich/juice-shop, port 3000
DVWA (Damn Vulnerable Web Application) a classic PHP/MariaDB app with low, medium, high and impossible security levels per vulnerability Docker (the project ships a Compose file), or on a LAMP VM
OWASP WebGoat a Java teaching app: lessons that explain a flaw, then let you exploit and fix it Docker image webgoat/webgoat
Metasploitable 2 an old, intentionally insecure Ubuntu VM from Rapid7 with dozens of vulnerable network services a VM image only; internal network only, never anything else
Metasploitable 3 Rapid7's newer version, built yourself with Vagrant/Packer; Windows and Linux variants build scripts, more effort

These targets are vulnerable on purpose, and that cuts both ways: the moment one can be reached from outside your lab, it is a gift to anyone who finds it. Metasploitable's own documentation says to never expose it to an untrusted network.

Planning addresses and names

Write the lab down before you build it: addresses, names, roles. The script below allocates addresses in the lab network 10.10.0.0/24 with Python's ipaddress module, checks that each one is inside the network, and prints a hosts file for the lab.test domain (.test is reserved for testing by RFC 6761, so the names can never collide with a real site).

python · try it yourself
import ipaddress

LAB = ipaddress.ip_network("10.10.0.0/24")
plan = [  # (name, last octet, role)
    ("kali", 5, "attack workstation"),
    ("srv01", 10, "Ubuntu Server: web + ssh"),
    ("dc01", 20, "Windows Server: AD domain controller"),
    ("ws01", 21, "Windows client, domain member"),
    ("apps", 30, "Docker host: Juice Shop, DVWA, WebGoat"),
    ("msf2", 40, "Metasploitable 2"),
    ("siem", 50, "Wazuh (later)"),
]
used = set()
for name, last, role in plan:
    ip = LAB.network_address + last
    assert ip in LAB and ip not in (LAB.network_address, LAB.broadcast_address), name
    assert ip not in used, f"duplicate {ip}"
    used.add(ip)
    print(f"{str(ip):12} {name}.lab.test {name:6} # {role}")
print(f"{len(used)} of {LAB.num_addresses - 2} usable addresses in {LAB} assigned")
10.10.0.5    kali.lab.test kali   # attack workstation
10.10.0.10   srv01.lab.test srv01  # Ubuntu Server: web + ssh
10.10.0.20   dc01.lab.test dc01   # Windows Server: AD domain controller
10.10.0.21   ws01.lab.test ws01   # Windows client, domain member
10.10.0.30   apps.lab.test apps   # Docker host: Juice Shop, DVWA, WebGoat
10.10.0.40   msf2.lab.test msf2   # Metasploitable 2
10.10.0.50   siem.lab.test siem   # Wazuh (later)
7 of 254 usable addresses in 10.10.0.0/24 assigned

The printed lines are ready for each machine's /etc/hosts (or C:\Windows\System32\drivers\etc\hosts), and the table becomes part of your lab design in the mini project.

Vulnerable apps in Docker, safely

Docker makes the web targets one command each, but its defaults are not lab-safe: -p 3000:3000 publishes the port on all interfaces of your host, so anyone on your home network can reach the vulnerable shop, and containers on the default bridge network can reach the Internet. A Compose file can do better. Below, Juice Shop and a Kali toolbox container share a network marked internal: true: Docker gives it no gateway, so neither container can reach the outside, and with no published ports nothing outside can reach them. You work from inside the Kali container (docker compose exec kali bash). The example only checks the file with docker compose config, as all Compose examples on this site do; nothing is pulled or started.

compose · try it yourself
name: lab
services:
  juice-shop:
    image: bkimminich/juice-shop
    networks: [labnet]
    read_only: true
    tmpfs: [/tmp]
  kali:
    image: kalilinux/kali-rolling
    command: sleep infinity
    networks: [labnet]
networks:
  labnet:
    internal: true
    ipam:
      config:
        - subnet: 10.10.0.0/24
name: lab
services:
  juice-shop:
    image: bkimminich/juice-shop
    networks:
      labnet: null
    read_only: true
    tmpfs:
      - /tmp
  kali:
    command:
      - sleep
      - infinity
    image: kalilinux/kali-rolling
    networks:
      labnet: null
networks:
  labnet:
    name: lab_labnet
    ipam:
      config:
        - subnet: 10.10.0.0/24
    internal: true

Compose prints the file in its normalised form: the network gets the project prefix (lab_labnet), keeps internal: true and the lab subnet, and neither service has a ports: entry. That absence is the point.

When you want to use your browser on the host instead, publish the port on the loopback address only, ports: ["127.0.0.1:3000:3000"], on a normal network. Then only your own machine reaches the shop, but the container can make outbound connections again; for a web app you play with that's usually acceptable, for anything you suspect is malicious it is not.

How mistakes are detected

  • From another device on your home network, try the lab ports (http://<host-ip>:3000): they must not answer.
  • On the host, list what listens where: ss -tlnp on Linux, Get-NetTCPConnection -State Listen on Windows. A vulnerable app on 0.0.0.0 or [::] is a finding.
  • In Docker, docker ps --format '{{.Names}} {{.Ports}}' shows 0.0.0.0:3000->3000/tcp for an unsafe publish and 127.0.0.1:3000->3000/tcp for a safe one.

How it is fixed or prevented

  • Vulnerable VMs on internal networks only; vulnerable containers on internal: true networks or bound to 127.0.0.1.
  • Lab machines get lab-only passwords and accounts (Lab Safety Rules); never reuse a real password, never sign in to real services from a target.
  • Pin and record image versions you practise on (bkimminich/juice-shop:<version>), so a write-up can be reproduced.
  • Shut targets down when you are not using them.

Pitfalls

  • Too much at once. Five VMs on a laptop with 16 GB RAM leaves nothing for the host. Start small.
  • Treating Kali as a daily OS. It is a tool collection; browse, mail and bank elsewhere.
  • Port-publishing defaults in Docker, and firewall rules that Docker bypasses: on Linux, Docker inserts its own iptables rules, so ufw may not block a published port.
  • Outdated images forever. The targets are meant to be vulnerable; your host, hypervisor and Kali are not.

Practice

  1. Which roles would you start with if your laptop has 16 GB of RAM, and roughly how much memory would they use?
  2. Rewrite the juice-shop service so you can use it from the host's browser without exposing it to your LAN.
  3. Add dvwa at 10.10.0.31 to the address plan. How many usable addresses are left?
Answers
  1. Kali (about 3 GB), one Ubuntu Server (1–2 GB) and Juice Shop in Docker (a few hundred MB): about 5 GB, leaving the rest for the host. Add Windows Server (4 GB+) when you reach Active Directory.
  2. Remove it from the internal network (or add a second, normal network) and publish ports: ["127.0.0.1:3000:3000"].
  3. Eight addresses assigned, so 254 − 8 = 246 usable addresses remain.

Test yourself

What does docker run -p 3000:3000 bkimminich/juice-shop expose?

  1. Only localhost
  2. Port 3000 on all of the host's interfaces, so the home network can reach it
  3. Nothing until you open a firewall port
  4. Only other containers

What does internal: true on a Compose network do?

  1. Makes the network faster
  2. Gives it no external gateway: containers on it can't reach outside networks
  3. Encrypts traffic
  4. Publishes every port

Why use names under lab.test?

  1. .test is reserved for testing (RFC 6761) and can't collide with a real domain
  2. It is required by Kali
  3. It makes DNS faster
  4. Windows refuses other domains

Which of these must only ever run on an isolated internal network?

  1. Ubuntu Server after hardening
  2. Metasploitable 2
  3. Your host's web browser
  4. The hypervisor's update service