Skip to content
iv0ksPublic

About

Intentionally vulnerable Flask app to practice path traversal (CWE-22) — A hands-on AppSec lab with Docker.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Fetchly

CWE-22 Python Docker GHCR

Fetchly is an intentionally vulnerable application built for security education. It contains a deliberate path traversal (CWE-22) flaw so you can practice finding and exploiting it in a safe and controlled environment.


🛡️ Vulnerability 🎯 Difficulty 🛠️ Stack 🚩 Entry point
Path Traversal (CWE-22) ⭐ Level 1 (Direct) Python · Flask GET /docs?name=<name>

Note

The guided, spoiler-free path is GUIDE.md; the full answer waits in SOLUTION.md whenever you want it.


📂 Project layout

The repository is organised so the vulnerable code is easy to find and reason about. Three areas, clearly separated: the application itself in app/ (a small Flask app split into factory, routes and config), the served data in docs/ (the directory the app is meant to expose), and the tooling around it (Docker, CI/CD, linters) that turns the lab into a production-shaped project. The challenge flag is deliberately kept out of both the repo and the served directory — see the note under the tree.

fetchly/
├── app/                    # the application package (the bug lives here)
│   ├── main.py             # Flask app factory (resolves paths, error handlers)
│   ├── routes.py           # routes — the vulnerable document endpoint
│   ├── config.py           # static defaults (dir name, listed docs)
│   ├── static/
│   │   └── style.css       # dashboard + error page styles
│   └── templates/
│       ├── dashboard.html  # UI (kept out of the Python code)
│       └── error.html      # styled error page
├── docs/                   # the served documents (the "allowed" directory)
│   ├── welcome.txt
│   ├── meeting-notes.txt
│   └── q3-report.txt
├── tests/                  # exploit + happy-path tests (pytest)
├── tools/traefik/          # reverse-proxy config (static + dynamic routing)
├── SOLUTION.md             # exploit writeup + the fix (spoilers)
├── SECURITY.md             # security policy (it's a lab — read before reporting)
├── .github/workflows/      # integration · delivery · security · release
├── Dockerfile              # hardened multi-stage image (creates the flag)
├── docker-compose.yml      # fetchly + traefik stack
├── .env.example            # Traefik ACME credentials template (copy to .env)
├── CHANGELOG.md            # generated by release-please
├── pyproject.toml          # ruff + black + pytest config, packaging
└── requirements.txt

The application code lives in app/ and reads its documents from docs/, just like a real service would. The target flag.txt is not in the repo: the Dockerfile writes it to /app/flag.txt at build time.


🚀 The Lab

The lab ships as a Docker Compose stack with two services:

  • fetchly — the app itself, published on port 5000.
  • traefik — a reverse proxy that serves the app over HTTPS on a real hostname. It is optional: you only need it for the domain-based access.

Because the stack attaches to an external Docker network (iv0ks-dev), create it once before the first run:

docker network create iv0ks-dev

Option A — just the app (quickest)

Start only the fetchly service (Compose skips traefik when you name a service explicitly):

docker compose up -d fetchly

The app is now reachable directly at:

That is all you need to start playing with Burp Suite.


Option B — full stack with Traefik (HTTPS + hostname)

Bring up both services to also expose the app through Traefik with TLS:

docker compose up -d

Now the same app is reachable two ways at once:

Traefik routing is defined in tools/traefik/ (static config in traefik.yml, the fetchly router in dynamic.yml). TLS uses the ACME DNS-01 challenge via Namecheap, so Traefik needs those API credentials — copy .env.example to .env and fill them in (the .env file is gitignored). The dashboard is at https://traefik.iv0ks.dev.


Caution

The fetchly.iv0ks.dev hostname must resolve to the host running the stack. For purely local experiments, Option A (localhost) is simpler and needs no DNS or certificates.


Running without cloning (prebuilt image)

The published image on GHCR runs standalone, no Compose needed:

docker run --rm -p 5000:5000 ghcr.io/iv0ks/fetchly:latest

Then open http://localhost:5000.


🎯 The Challenge

The Scenario

Fetchly is a document vault: it serves files from a private docs/ directory, one download at a time. A legitimate user only ever sees the documents listed on the dashboard. You're going to prove that boundary is an illusion.

Your objective

Read a file that lives outside the vault — specifically, capture the flag in flag.txt.

Note

The flag has the format FLAG{...}.

The rules

Everything happens over HTTP against the running app — no need to read the source to win (though you can). The flag is not in the repo: it's baked into the container, outside docs/, so you have to actually reach it.

Tip

For the full method, the Learning Guide walks you through it.

About

Intentionally vulnerable Flask app to practice path traversal (CWE-22) — A hands-on AppSec lab with Docker.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages