Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,26 @@ brew bundle
prek install
```

## Lab
## Labs

Requires Docker. The lab lives in `owasp_juiceshop/`: OWASP Juice Shop (target) and a Kali desktop (attacker) run on an internal Docker network with no internet access.
Requires Docker. Each lab pairs a vulnerable target with the shared Kali desktop in `kali/` on an internal Docker network with no internet access. Only one lab runs at a time; starting one stops the other.

| Command | Purpose |
| ----------------------- | ----------------------------------------------- |
| `just juice-shop-up` | Build and start the lab; auto-off after 2 hours |
| `just juice-shop-up 30` | Same, with auto-off after 30 minutes |
| `just juice-shop-down` | Stop the lab |
| Command | Purpose |
| ----------------------- | ---------------------------------------------------------- |
| `just juice-shop-up` | Build and start the Juice Shop lab; auto-off after 2 hours |
| `just dvwa-up` | Build and start the DVWA lab; auto-off after 2 hours |
| `just juice-shop-up 30` | Either `up` command takes an auto-off time in minutes |
| `just juice-shop-down` | Stop the lab (`just dvwa-down` does the same) |

| Lab | Directory | Target URL inside Kali | Notes |
| ---------- | ------------------ | ------------------------ | ------------------------------------------------------------------ |
| Juice Shop | `owasp_juiceshop/` | `http://juice-shop:3000` | |
| DVWA | `dvwa/` | `http://dvwa` | Log in as `admin` / `password`, then click Create / Reset Database |

- Kali desktop: <http://127.0.0.1:6080/vnc.html>, password `kalilab` (override with `VNC_PASSWORD`, max 8 characters).
- Juice Shop is reachable only from inside Kali, at `http://juice-shop:3000`.
- `/home/kali` persists in the `kali-home` volume; everything else resets on `just juice-shop-down`.
- To add or update tools, edit `owasp_juiceshop/kali/Dockerfile` and run `docker compose -f owasp_juiceshop/compose.yaml build --pull --no-cache kali`.
- Targets are reachable only from inside Kali.
- `/home/kali` persists in the `kali-home` volume, shared by both labs; everything else resets when a lab stops.
- To add or update tools, edit `kali/Dockerfile` and run `docker compose -f kali/compose.yaml build --pull --no-cache kali`.

## Security checks

Expand All @@ -37,4 +43,3 @@ Requires Docker. The lab lives in `owasp_juiceshop/`: OWASP Juice Shop (target)
| `prek run -a` | Run the pre-commit hooks manually |

Both checks run on commit via prek and in CI via `.github/workflows/security.yml`.

22 changes: 22 additions & 0 deletions dvwa/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: dvwa

include:
- ../kali/compose.yaml

services:
dvwa:
image: ghcr.io/digininja/dvwa:latest
environment:
DB_SERVER: db
depends_on: [db]
networks: [lab]

# DVWA's stock database credentials; the lab network is isolated.
db:
image: mariadb:10
environment:
MYSQL_ROOT_PASSWORD: dvwa
MYSQL_DATABASE: dvwa
MYSQL_USER: dvwa
MYSQL_PASSWORD: p@ssw0rd
networks: [lab]
33 changes: 21 additions & 12 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
compose := "docker compose -f owasp_juiceshop/compose.yaml"

[private]
list:
@just --list
Expand All @@ -12,16 +10,27 @@ gitleaks *args:
zizmor *args:
zizmor {{ args }} .

# Start the lab; it shuts itself down after `ttl` minutes
juice-shop-up ttl="120": juice-shop-timer-cancel
{{ compose }} up -d --build
nohup sh -c 'sleep $(({{ ttl }} * 60)) && {{ compose }} down' juice-shop-auto-off >/dev/null 2>&1 &
@echo "Kali desktop: http://127.0.0.1:6080/vnc.html (auto-off in {{ ttl }} min)"
# Start the Juice Shop lab; it shuts itself down after `ttl` minutes
juice-shop-up ttl="120": (lab-up "owasp_juiceshop" ttl)

# Stop the Juice Shop lab
juice-shop-down: lab-down

# Start the DVWA lab; it shuts itself down after `ttl` minutes
dvwa-up ttl="120": (lab-up "dvwa" ttl)

# Stop the lab
juice-shop-down: juice-shop-timer-cancel
{{ compose }} down
# Stop the DVWA lab
dvwa-down: lab-down

# Labs share the Kali desktop port, so only one runs at a time.
[private]
lab-up dir ttl: lab-down
docker compose -f {{ dir }}/compose.yaml up -d --build
nohup sh -c 'sleep $(({{ ttl }} * 60)) && docker compose -f {{ dir }}/compose.yaml down' lab-auto-off >/dev/null 2>&1 &
@echo "Kali desktop: http://127.0.0.1:6080/vnc.html (auto-off in {{ ttl }} min)"

[private]
juice-shop-timer-cancel:
-@pkill -f '[j]uice-shop-auto-off'
lab-down:
-@pkill -f '[l]ab-auto-off'
docker compose -f owasp_juiceshop/compose.yaml down
docker compose -f dvwa/compose.yaml down
File renamed without changes.
33 changes: 33 additions & 0 deletions kali/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Shared attacker desktop, included by each lab's compose.yaml.
services:
kali:
build: .
image: lab-kali
environment:
VNC_PASSWORD: ${VNC_PASSWORD:-kalilab}
shm_size: 2gb
volumes:
- kali-home:/home/kali
networks: [lab]

# Only path between the host and the lab: forwards the Kali desktop (noVNC).
gateway:
image: alpine/socat
command: TCP-LISTEN:6080,fork,reuseaddr TCP:kali:6080
ports:
- "127.0.0.1:6080:6080"
read_only: true
cap_drop: [ALL]
depends_on: [kali]
networks: [lab, edge]

networks:
# No route to the host network or the internet.
lab:
internal: true
edge:

volumes:
# Fixed name so every lab shares the same home directory.
kali-home:
name: kali-home
File renamed without changes.
32 changes: 3 additions & 29 deletions owasp_juiceshop/compose.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,9 @@
name: juice-shop

include:
- ../kali/compose.yaml

services:
juice-shop:
image: bkimminich/juice-shop
networks: [lab]

kali:
build: ./kali
environment:
VNC_PASSWORD: ${VNC_PASSWORD:-kalilab}
shm_size: 2gb
volumes:
- kali-home:/home/kali
networks: [lab]

# Only path between the host and the lab: forwards the Kali desktop (noVNC).
gateway:
image: alpine/socat
command: TCP-LISTEN:6080,fork,reuseaddr TCP:kali:6080
ports:
- "127.0.0.1:6080:6080"
read_only: true
cap_drop: [ALL]
depends_on: [kali]
networks: [lab, edge]

networks:
# No route to the host network or the internet.
lab:
internal: true
edge:

volumes:
kali-home:
Loading