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
13 changes: 13 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,16 @@ jobs:
with:
advanced-security: false
annotations: true

check-digests:
name: Check image digests
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install just
run: sudo apt-get update && sudo apt-get install -y just
- run: just check-digests
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,7 @@ __marimo__/

.claude
CLAUDE.md

# Local notes

ROADMAP.md
3 changes: 3 additions & 0 deletions .markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignores": [".github/pull_request_template.md"]
}
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ repos:
language: system
pass_filenames: false
files: ^\.github/
- id: check-digests
name: check-digests
entry: just check-digests
language: system
pass_filenames: false
files: (compose.*\.ya?ml|Dockerfile.*)$
74 changes: 68 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,77 @@ Requires Docker. Each lab pairs a deliberately vulnerable target with a shared [
| [Juice Shop](owasp_juiceshop/README.md) | Insecure online shop (web app) | `just juice-shop-up` | `just juice-shop-down` |
| [DVWA](dvwa/README.md) | One page per vulnerability class (PHP) | `just dvwa-up` | `just dvwa-down` |
| [crAPI](crapi/README.md) | Vulnerable API application (microservices) | `just crapi-up` | `just crapi-down` |
| [DVGA](dvga/README.md) | Vulnerable GraphQL API (Python) | `just dvga-up` | `just dvga-down` |

After starting a lab, open the Kali desktop at <http://127.0.0.1:6080/vnc.html> (password `kalilab`). Each lab's README covers its usage.

## Security checks

| Command | Purpose |
| --------------- | --------------------------------- |
| `just gitleaks` | Scan git history for secrets |
| `just zizmor` | Audit GitHub Actions workflows |
| `prek run -a` | Run the pre-commit hooks manually |
| Command | Purpose |
| -------------------- | -------------------------------------------- |
| `just gitleaks` | Scan git history for secrets |
| `just zizmor` | Audit GitHub Actions workflows |
| `just check-digests` | Check every container image is digest-pinned |
| `prek run -a` | Run the pre-commit hooks manually |

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

## Ready-made online platforms

Hosted alternatives that need no local setup.

### Offensive and bug bounty

- [PortSwigger Web Security Academy](https://portswigger.net/web-security): free, browser-based labs. The best place to start for bug bounty.
- [TryHackMe](https://tryhackme.com): the most beginner-friendly, with guided rooms and a browser-based attack machine.
- [Hack The Box](https://www.hackthebox.com): harder standalone machines, plus HTB Academy (structured courses) and Pro Labs (full corporate networks with AD).
- [OffSec Proving Grounds](https://www.offsec.com/products/proving-grounds/): good practice if you're aiming for the OSCP.
- [PentesterLab](https://pentesterlab.com): web-focused, with good write-ups of real vulnerability classes.

### CTF and wargames

- [picoCTF](https://picoctf.org): free, beginner CTF from Carnegie Mellon, open all year.
- [OverTheWire](https://overthewire.org/wargames/): wargames played over SSH. Bandit is the classic way to learn the Linux command line.
- [pwn.college](https://pwn.college): free courses from Arizona State on binary exploitation and systems security.
- [Hacker101 CTF](https://ctf.hacker101.com): HackerOne's free CTF. Solving challenges can earn private bug bounty invites.
- [Root Me](https://www.root-me.org): a large catalogue of challenges across web, crypto, forensics and networking.
- [CTFtime](https://ctftime.org): calendar and rankings for live CTF events.
- [Google CTF](https://capturetheflag.withgoogle.com): includes a yearly Beginner's Quest track.

### Web and bug bounty challenges

- [Intigriti monthly challenges](https://challenge.intigriti.io) and [YesWeHack Dojo](https://dojo-yeswehack.com): free XSS and web puzzles from bug bounty platforms.
- [BugBountyHunter.com](https://www.bugbountyhunter.com): realistic web apps built around real bug bounty findings.
- [HackingHub](https://www.hackinghub.io): short labs tied to specific vulnerability classes and tools.

### Binary exploitation and reversing

- [ROP Emporium](https://ropemporium.com): a progression of return-oriented programming challenges.
- [Exploit Education](https://exploit.education) (Phoenix, Nebula): downloadable VMs for memory corruption and Linux privilege escalation.
- [pwnable.kr](https://pwnable.kr) and [pwnable.tw](https://pwnable.tw): classic pwn challenges, from easy to very hard.
- [Microcorruption](https://microcorruption.com): embedded exploitation in a browser-based debugger.
- [crackmes.one](https://crackmes.one): community reverse-engineering challenges.

### Crypto

- [CryptoHack](https://cryptohack.org): interactive crypto challenges.
- [Cryptopals](https://cryptopals.com): the classic set of crypto-breaking exercises.

### Boot-to-root and Active Directory

- [VulnHub](https://www.vulnhub.com): vulnerable VMs you download and run yourself.
- [HackMyVM](https://hackmyvm.eu): free downloadable vulnerable VMs, similar to VulnHub.
- [Vulnlab](https://www.vulnlab.com): AD and multi-machine chains.

### Cloud

- [flAWS](http://flaws.cloud) and [flAWS2](http://flaws2.cloud): free AWS misconfiguration challenges.
- [Pwned Labs](https://pwnedlabs.io): cloud pentesting labs for AWS, Azure and GCP.

### Defensive and detection

- [LetsDefend](https://letsdefend.io) and [CyberDefenders](https://cyberdefenders.org): simulated SOC alerts and investigation challenges.
- [Blue Team Labs Online](https://blueteamlabs.online): incident response and forensics challenges.
- [Splunk Boss of the SOC (BOTS) datasets](https://github.com/splunk/botsv3): real-world-style log data you can search.
- [TryHackMe SOC Level 1](https://tryhackme.com/path/outline/soclevel1): guided path for SOC analyst skills.
- [malware-traffic-analysis.net](https://www.malware-traffic-analysis.net): packet captures with exercises, good for Wireshark practice.
16 changes: 8 additions & 8 deletions crapi/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ x-databases: &databases

services:
crapi-web:
image: crapi/crapi-web:latest
image: crapi/crapi-web:latest@sha256:b27d246c646bd33898e7d1d2095b6e7576c0993a7b81a73aa7386929493d7151
environment:
COMMUNITY_SERVICE: crapi-community:8087
IDENTITY_SERVICE: crapi-identity:8080
Expand All @@ -47,7 +47,7 @@ services:
aliases: [crapi-chatbot]

crapi-identity:
image: crapi/crapi-identity:latest
image: crapi/crapi-identity:latest@sha256:5d1db5b3ba8e02bc68711ec6fc4e35ed7cd8b87e63785ece9e7ff5b5e36c5260
environment:
<<: *databases
LOG_LEVEL: INFO
Expand Down Expand Up @@ -78,7 +78,7 @@ services:
networks: [lab]

crapi-community:
image: crapi/crapi-community:latest
image: crapi/crapi-community:latest@sha256:8ba0c7eda86ae065a673f1fa554d0109a24f25c5a8d65097ae024e5ee715c54e
environment:
<<: *databases
LOG_LEVEL: INFO
Expand All @@ -95,7 +95,7 @@ services:
networks: [lab]

crapi-workshop:
image: crapi/crapi-workshop:latest
image: crapi/crapi-workshop:latest@sha256:d4d2d94d35a31e211b04d5a771881f5ae13e358e8fa0804463ae3bace05dd815
environment:
<<: *databases
LOG_LEVEL: INFO
Expand All @@ -116,7 +116,7 @@ services:
networks: [lab]

postgresdb:
image: postgres:14
image: postgres:14@sha256:834a046089d76edd1d2e81c4741f3ad5d1853646ededc86c2708936aad31c1ed
command: ["postgres", "-c", "max_connections=500"]
environment:
POSTGRES_USER: admin
Expand All @@ -128,7 +128,7 @@ services:
networks: [lab]

mongodb:
image: mongo:4.4
image: mongo:4.4@sha256:4be76f674fc4b27859816811b8baa3c51830eb1dbf4ca81a51e26b79edd662ef
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: crapisecretpassword
Expand All @@ -140,7 +140,7 @@ services:

# Catches the emails crAPI sends (sign-up, OTP, vehicle details).
mailhog:
image: crapi/mailhog:latest
image: crapi/mailhog:latest@sha256:015c23f79d40c9dc1800cd0a458503b89aeda3b585a12c37d53829d6c7d61fdd
user: root
environment:
MH_MONGO_URI: admin:crapisecretpassword@mongodb:27017
Expand All @@ -151,7 +151,7 @@ services:
networks: [lab]

api.mypremiumdealership.com:
image: crapi/gateway-service:latest
image: crapi/gateway-service:latest@sha256:97dade9daf0e758547b1686e2d3303c8c9b79838167f728a9211f0ee1f4622b0
healthcheck:
<<: *healthcheck
test: bash -c 'echo -n "GET / HTTP/1.1\n\n" > /dev/tcp/127.0.0.1/443'
Expand Down
36 changes: 36 additions & 0 deletions dvga/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# DVGA lab

[Damn Vulnerable GraphQL Application](https://github.com/dolevf/Damn-Vulnerable-GraphQL-Application) (DVGA) is a deliberately vulnerable pastebin-style app with a GraphQL API. It covers GraphQL-specific flaws such as introspection, batching and deep-query denial of service, as well as injection, broken authorization and SSRF. It has a Beginner and an Expert difficulty.

## Usage

```sh
just dvga-up # build and start
just dvga-down # stop
```

1. Run `just dvga-up`.
2. Open the [Kali desktop](../kali/README.md) at <http://127.0.0.1:6080/vnc.html>.
3. In the Kali browser, go to `http://dvga:5013`. No setup is needed.
4. The API is at `http://dvga:5013/graphql`, with GraphiQL at `http://dvga:5013/graphiql`. The app's users are `admin` / `changeme` and `operator` / `password123`.

## Services

| Service | Image | Purpose |
| --------- | -------------- | ---------------------------------------------- |
| `dvga` | `dolevf/dvga` | The target application, on port 5013 |
| `kali` | `lab-kali` | Attacker desktop |
| `gateway` | `alpine/socat` | Publishes the Kali desktop on `127.0.0.1:6080` |

## How the lab behaves

- **Isolated**: the target and Kali sit on an internal Docker network with no internet access. The target is not published to the host, so it is reachable only from inside Kali.
- **Auto-off**: the lab shuts itself down after 2 hours. Pass minutes to change it, for example `just dvga-up 30`. The timer only applies when the lab is started through `just`.
- **One lab at a time**: starting this lab stops any other lab that is running.
- **Resets on stop**: DVGA rebuilds its database on every start, so pastes and changes are lost when the lab stops. Files under `/home/kali` are kept; see the [Kali desktop](../kali/README.md).

## Notes

- The image name `dolevf/dvga` comes from the official repo README. It is pinned by digest in `compose.yaml` and is amd64 only, so it runs under emulation on Apple Silicon.
- Burp Suite is installed in Kali. GraphQL tools such as InQL, graphw00f and clairvoyance are not.
- The paste import feature fetches from outside websites by default, which fails without internet. Point it at a lab host instead, for example for SSRF.
13 changes: 13 additions & 0 deletions dvga/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: dvga

include:
- ../kali/compose.yaml

services:
dvga:
image: dolevf/dvga:latest@sha256:040aa33c199d99f3380c9ff9a1ee5d725e9abca7b189c63a35a2a73bda79c957
# Upstream publishes amd64 only; runs under emulation on Apple Silicon.
platform: linux/amd64
environment:
WEB_HOST: 0.0.0.0
networks: [lab]
4 changes: 2 additions & 2 deletions dvwa/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ include:

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

# DVWA's stock database credentials; the lab network is isolated.
db:
image: mariadb:10
image: mariadb:10@sha256:d769e37960821dfdcf096954f6e7ac89f747e116c1bba98e48edd265dfc7deae
environment:
MYSQL_ROOT_PASSWORD: dvwa
MYSQL_DATABASE: dvwa
Expand Down
18 changes: 18 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ gitleaks *args:
zizmor *args:
zizmor {{ args }} .

# Check every container image is pinned by digest (locally built `lab-*` images are exempt)
check-digests:
#!/usr/bin/env sh
unpinned=$(grep -rnE --exclude-dir=.git --include='*compose*.yaml' --include='*compose*.yml' --include='Dockerfile*' \
'^[[:space:]]*(image:|FROM[[:space:]])' . | grep -v '@sha256:' | grep -vE 'image:[[:space:]]*lab-|FROM[[:space:]]+scratch')
if [ -n "$unpinned" ]; then
echo "Images not pinned by digest:"
echo "$unpinned"
exit 1
fi

# Start the Juice Shop lab; it shuts itself down after `ttl` minutes
juice-shop-up ttl="120": (lab-up "owasp_juiceshop" ttl)

Expand All @@ -28,6 +39,12 @@ crapi-up ttl="120": (lab-up "crapi" ttl)
# Stop the crAPI lab
crapi-down: lab-down

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

# Stop the DVGA lab
dvga-down: lab-down

# Labs share the Kali desktop port, so only one runs at a time.
[private]
lab-up dir ttl: lab-down
Expand All @@ -42,3 +59,4 @@ lab-down:
docker compose -f owasp_juiceshop/compose.yaml down
docker compose -f dvwa/compose.yaml down
docker compose -f crapi/compose.yaml down
docker compose -f dvga/compose.yaml down
2 changes: 1 addition & 1 deletion kali/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM kalilinux/kali-rolling
FROM kalilinux/kali-rolling:latest@sha256:6ec743d9fc5cd397451eeddeff3869bcfab5de9bd5dec5b1f34cbfbd80313073

ENV DEBIAN_FRONTEND=noninteractive

Expand Down
2 changes: 2 additions & 0 deletions kali/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ docker compose -f kali/compose.yaml build --pull --no-cache kali
```

The image is about 18 GB and a full rebuild takes a long time.

The base image is pinned by digest in `Dockerfile`, so `--pull` does not move it. To update it, replace the digest with the `Digest:` line from `docker buildx imagetools inspect kalilinux/kali-rolling:latest`. Packages still come from the live Kali mirrors at build time.
2 changes: 1 addition & 1 deletion kali/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:

# Only path between the host and the lab: forwards the Kali desktop (noVNC).
gateway:
image: alpine/socat
image: alpine/socat:latest@sha256:e8a6e8868a8e6e01d9c2c321a8f8d4474d2d741d962462e5c5a124a8e66a0055
command: TCP-LISTEN:6080,fork,reuseaddr TCP:kali:6080
ports:
- "127.0.0.1:6080:6080"
Expand Down
2 changes: 1 addition & 1 deletion owasp_juiceshop/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ include:

services:
juice-shop:
image: bkimminich/juice-shop
image: bkimminich/juice-shop:latest@sha256:877fc77b12d72b42e486eb09b6b1711cc56514306d92006b284e7e7cf076a809
networks: [lab]
Loading