Preparing for OSCP | Sharing Practical Labs & Real-World Attack Analysis

Step 1: Reconnaissance

Nmap Scan

nmap -sCV -A โ€” min-rate 1000 192.168.166.68

None

Port 80 revealed Docassemble v1.4.96 โ€” vulnerable to CVE-2024โ€“27292 (Path Traversal + SSTI = RCE).

None
None

Step 2: Vulnerability Analysis โ€” CVE-2024โ€“27292

About the Vulnerability

CVE-2024โ€“27292 is a path traversal vulnerability in Docassemble versions 1.4.53 to 1.4.96. The ?i= parameter in the /interview endpoint does not sanitize directory traversal sequences, allowing unauthenticated attackers to read arbitrary files on the server.

Combined with file upload functionality and Jinja2 template rendering, this path traversal becomes a full Remote Code Execution vulnerability. Files starting with '# use jinja' are treated as Jinja2 templates and executed server-side.

Step 2.1 โ€” Path Traversal Confirmation

curl -s "http://192.168.166.68/interview?i=/etc/passwd"

None

Step 2.2 โ€” Config File Read (Credentials)

curl -s "http://192.168.166.68/interview?i=/usr/share/docassemble/config/config.yml" | grep -i "password\|secret\|key\|user"

None

Step 3: Exploitation โ€” File Upload + SSTI = RCE

Step 3.1 โ€” Create Jinja2 Payload

cat > RCE.payload << 'EOF'

None

The '# use jinja' header tells Docassemble to render the file as a Jinja2 template. The SSTI payload uses Python's os.popen() to execute our reverse shell command.

Step 3.2 โ€” Start Listener & Upload File

nc -lvnp 4444

None

Navigate to http://192.168.166.68/interview?i=docassemble.playground1:test.yml in browser, upload RCE.payload and click Continue. Note the uploaded file URL โ€” File ID = 2 (/uploadedfile/2/RCE.payload).

None

Step 3.3 โ€” Trigger SSTI via Path Traversal

curl -s "http://192.168.166.68/interview?i=/usr/share/docassemble/files/000/000/000/002/file.payload"

None

File ID maps to hex path: ID 2 = 0x002 = /usr/share/docassemble/files/000/000/000/002/file.payload. When accessed via path traversal, Docassemble renders it as Jinja2 template, triggering our reverse shell.

Step 4: Shell

None

Step 5: Capture Flags

None

Key Learnings

โ€ข CVE-2024โ€“27292 Path Traversal โ€” The ?i= parameter in Docassemble's /interview endpoint passes user input directly to the file system without sanitizing ../ sequences, enabling unauthenticated arbitrary file read.

โ€ข SSTI Escalation โ€” Files starting with '# use jinja' are rendered as Jinja2 templates. Combining file upload with path traversal allows SSTI execution, escalating file read to full RCE.

โ€ข Sensitive Config Exposure โ€” The config file at /usr/share/docassemble/config/config.yml contained plaintext database passwords and secret keys, readable via path traversal without authentication.

โ€ข exim4 SUID Privesc โ€” The exim4 mail transfer agent had the SUID bit set, allowing www-data to execute commands as root via GTFOBins techniques.

โ€ข File ID to Path Mapping โ€” File upload ID maps directly to a hex path on the filesystem. ID 2 = 0x002 = /usr/share/docassemble/files/000/000/000/002/file.payload.