Docker1
Docker1
Platform: Web Kids20 | Category: Web | Type: Challenge | Difficulty: Easy | OS: NA | Author: D3v0o0Nu11 | Date: 2019-11-10 | Status: Solved Techniques: dockerfile_disclosure, lfi_path_traversal
Summary
LFI challenge in a Docker container. The web application serves static files through a parameter vulnerable to path traversal.
Recon
Port scan
nmap -p- -sV -sC <TARGET> --min-rate 1000 -Pn
| Port | Service | Version | Notes |
|---|---|---|---|
| <PORT> | <SVC> | <VER> | <notes> |
Enumeration highlights
- Event:
web-kids20| ID:20191110_web_kids20_websrv1_docker1 - Tags: docker, lfi, dockerfile, path_traversal, static_files
- Indicators: static file serving with file parameter, Docker container environment, path traversal in file parameter, Dockerfile in application root
- Source:
20191110_web_kids20_websrv1_docker1.md
Foothold
Vulnerability / Misconfiguration
- Dockerfile_disclosure
- Lfi_path_traversal
<command>
Exploitation
- See original writeup content for detailed exploitation.
Privilege Escalation
Enumeration
sudo -l find / -perm -4000 2>/dev/null getcap -r / 2>/dev/null cat /etc/crontab ps aux
Exploitation
- N/A for challenge-type writeup; see exploitation above.
- Flag obtained via challenge solve.
<command>
Flags
| Flag | Location | Value |
|---|---|---|
| flag | REDACTED |
Key Takeaways / Lessons
- dockerfile_disclosure
- lfi_path_traversal
- Tags: docker, lfi, dockerfile, path_traversal, static_files
Original Writeup
<details><summary>Click to expand original content</summary>Description
LFI challenge in a Docker container. The web application serves static files through a parameter vulnerable to path traversal.
Analysis
The application has a /static/ endpoint with a file parameter used to serve static files. The parameter does not filter ../ sequences, allowing to escape the static files directory and read arbitrary files.
In Docker containers, the Dockerfile often contains:
- Environment variables with secrets (ENV)
- Comments with flags or passwords
- ARG directives with sensitive data
The Dockerfile is usually located in the application root or one level above the static directory.
Solution
- Discovered the static files endpoint:
https://2019-11-10-docker1.ctf.su/static/?file=style.css
- Verified path traversal vulnerability:
https://2019-11-10-docker1.ctf.su/static/?file=../
- Read the Dockerfile via path traversal:
https://2019-11-10-docker1.ctf.su/static/?file=../Dockerfile
- Found the flag in the Dockerfile (in an ENV variable or comment).
Typical flag locations in Dockerfile:
# Flag can be in a comment
# FLAG: spbctf{...}
# Or in an environment variable
ENV FLAG=spbctf{...}
# Or in ARG
ARG SECRET=spbctf{...}
</details>Auto-tracked: saved to WriteUps; run
/xesor-reviseto fold lessons into XESXor_Methodology.md.
signed by XESXOR