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
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ brew bundle
prek install
```

## Lab

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.

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

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

## Security checks

| Command | Purpose |
Expand Down
16 changes: 16 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
compose := "docker compose -f owasp_juiceshop/compose.yaml"

[private]
list:
@just --list
Expand All @@ -9,3 +11,17 @@ gitleaks *args:
# Audit GitHub Actions workflows
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)"

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

[private]
juice-shop-timer-cancel:
-@pkill -f '[j]uice-shop-auto-off'
35 changes: 35 additions & 0 deletions owasp_juiceshop/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: juice-shop

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:
31 changes: 31 additions & 0 deletions owasp_juiceshop/kali/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM kalilinux/kali-rolling

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
&& apt-get install -y \
kali-linux-default \
kali-desktop-xfce \
burpsuite \
dbus-x11 \
novnc \
sudo \
tigervnc-standalone-server \
tigervnc-tools \
websockify \
zaproxy \
&& rm -rf /var/lib/apt/lists/*

RUN useradd --create-home --shell /bin/bash --groups sudo kali \
&& echo "kali ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/kali \
&& mkdir -p /tmp/.X11-unix \
&& chmod 1777 /tmp/.X11-unix

COPY --chmod=755 entrypoint.sh /usr/local/bin/entrypoint.sh

USER kali
ENV USER=kali
WORKDIR /home/kali

EXPOSE 6080
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
14 changes: 14 additions & 0 deletions owasp_juiceshop/kali/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
set -eu

mkdir -p "$HOME/.vnc"
printf '%s\n' "$VNC_PASSWORD" | vncpasswd -f > "$HOME/.vnc/passwd"
chmod 600 "$HOME/.vnc/passwd"

# Stale locks survive a container restart and block the display.
rm -f /tmp/.X1-lock /tmp/.X11-unix/X1

tigervncserver :1 -localhost yes -geometry 1600x900 -depth 24 \
-PasswordFile "$HOME/.vnc/passwd"

exec websockify --web=/usr/share/novnc 6080 localhost:5901
Loading