From 1d51eb1ce7a9a2468e73a438b6434f57ad46332d Mon Sep 17 00:00:00 2001 From: Aaron <7063649+ahcodedev@users.noreply.github.com> Date: Tue, 10 Nov 2026 22:46:42 -0800 Subject: [PATCH] Add DVGA lab and update docker image pinning --- .github/workflows/security.yml | 13 ++++++ .gitignore | 4 ++ .markdownlint-cli2.jsonc | 3 ++ .pre-commit-config.yaml | 6 +++ README.md | 74 +++++++++++++++++++++++++++++++--- crapi/compose.yaml | 16 ++++---- dvga/README.md | 36 +++++++++++++++++ dvga/compose.yaml | 13 ++++++ dvwa/compose.yaml | 4 +- justfile | 18 +++++++++ kali/Dockerfile | 2 +- kali/README.md | 2 + kali/compose.yaml | 2 +- owasp_juiceshop/compose.yaml | 2 +- 14 files changed, 176 insertions(+), 19 deletions(-) create mode 100644 .markdownlint-cli2.jsonc create mode 100644 dvga/README.md create mode 100644 dvga/compose.yaml diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index e39658c..f99d580 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -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 diff --git a/.gitignore b/.gitignore index 4263813..33d7e2b 100644 --- a/.gitignore +++ b/.gitignore @@ -223,3 +223,7 @@ __marimo__/ .claude CLAUDE.md + +# Local notes + +ROADMAP.md diff --git a/.markdownlint-cli2.jsonc b/.markdownlint-cli2.jsonc new file mode 100644 index 0000000..1edb655 --- /dev/null +++ b/.markdownlint-cli2.jsonc @@ -0,0 +1,3 @@ +{ + "ignores": [".github/pull_request_template.md"] +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index af03abf..b31700c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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.*)$ diff --git a/README.md b/README.md index 71e1078..67e4675 100644 --- a/README.md +++ b/README.md @@ -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 (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. diff --git a/crapi/compose.yaml b/crapi/compose.yaml index 6125bb9..92ba2bf 100644 --- a/crapi/compose.yaml +++ b/crapi/compose.yaml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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' diff --git a/dvga/README.md b/dvga/README.md new file mode 100644 index 0000000..2899275 --- /dev/null +++ b/dvga/README.md @@ -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 . +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. diff --git a/dvga/compose.yaml b/dvga/compose.yaml new file mode 100644 index 0000000..bcefda7 --- /dev/null +++ b/dvga/compose.yaml @@ -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] diff --git a/dvwa/compose.yaml b/dvwa/compose.yaml index fe1409b..307b562 100644 --- a/dvwa/compose.yaml +++ b/dvwa/compose.yaml @@ -5,7 +5,7 @@ include: services: dvwa: - image: ghcr.io/digininja/dvwa:latest + image: ghcr.io/digininja/dvwa:latest@sha256:8029450682bd70e2e8cd1ffe8e46dd1885ff2a913296091cebfa8ba0a7d36498 environment: DB_SERVER: db depends_on: [db] @@ -13,7 +13,7 @@ services: # 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 diff --git a/justfile b/justfile index cc626e8..26103b9 100644 --- a/justfile +++ b/justfile @@ -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) @@ -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 @@ -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 diff --git a/kali/Dockerfile b/kali/Dockerfile index 82324df..5415ae0 100644 --- a/kali/Dockerfile +++ b/kali/Dockerfile @@ -1,4 +1,4 @@ -FROM kalilinux/kali-rolling +FROM kalilinux/kali-rolling:latest@sha256:6ec743d9fc5cd397451eeddeff3869bcfab5de9bd5dec5b1f34cbfbd80313073 ENV DEBIAN_FRONTEND=noninteractive diff --git a/kali/README.md b/kali/README.md index bd89b36..2af8e3c 100644 --- a/kali/README.md +++ b/kali/README.md @@ -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. diff --git a/kali/compose.yaml b/kali/compose.yaml index f9ed4db..dbc64b0 100644 --- a/kali/compose.yaml +++ b/kali/compose.yaml @@ -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" diff --git a/owasp_juiceshop/compose.yaml b/owasp_juiceshop/compose.yaml index 96aecdf..6f89a8a 100644 --- a/owasp_juiceshop/compose.yaml +++ b/owasp_juiceshop/compose.yaml @@ -5,5 +5,5 @@ include: services: juice-shop: - image: bkimminich/juice-shop + image: bkimminich/juice-shop:latest@sha256:877fc77b12d72b42e486eb09b6b1711cc56514306d92006b284e7e7cf076a809 networks: [lab]