Docker2
Docker2
Platform: Web Kids20 | Category: Web | Type: Challenge | Difficulty: Easy | OS: NA | Author: D3v0o0Nu11 | Date: 2019-11-10 | Status: Solved Techniques: docker_env_leakage, lfi_proc_environ
Summary
LFI challenge in a Docker container. The goal is to exploit a Local File Inclusion vulnerability to obtain the flag.
Recon
Port scan
bash read-only • copy allowednmap -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_docker2 - Tags: docker, lfi, proc_filesystem, environment_variables
- Indicators: LFI vulnerability present, Docker container environment, /proc/self/environ readable, secrets in environment variables
- Source:
20191110_web_kids20_websrv1_docker2.md
Foothold
Vulnerability / Misconfiguration
- docker_env_leakage
- lfi_proc_environ
bash read-only • copy allowed<command>
Exploitation
- See original writeup content for detailed exploitation.
Privilege Escalation
Enumeration
bash read-only • copy allowedsudo -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.
bash read-only • copy allowed<command>
Flags
| Flag | Location | Value |
|---|---|---|
| flag | REDACTED |
Key Takeaways / Lessons
- docker_env_leakage
- lfi_proc_environ
- Tags: docker, lfi, proc_filesystem, environment_variables
Original Writeup
<details><summary>Click to expand original content</summary>Description
LFI challenge in a Docker container. The goal is to exploit a Local File Inclusion vulnerability to obtain the flag.
Analysis
An LFI vulnerability was found in the web application, allowing arbitrary file reads on the server. In Docker containers, secrets and configuration are often passed through environment variables. The file /proc/self/environ contains all environment variables of the current process.
Solution
- Discovered an LFI vulnerability in a parameter (e.g.,
?file=or?page=) - Used LFI to read
/proc/self/environ:
https://2019-11-10-docker2.ctf.su/?file=../../../proc/self/environ
or with null-byte (for older PHP versions):
https://2019-11-10-docker2.ctf.su/?file=../../../proc/self/environ%00
- The response contained the process environment variables, including the flag.
Alternative paths for reading env:
/proc/self/environ- environment variables of the current process/proc/1/environ- environment variables of PID 1 (init process in Docker)
signed by XESXOR