Environment
Executive summary — Environment is a Medium Linux box built on Laravel 11.30.0 that chains two 2024 CVEs. First, a misconfigured PHP directive lets a query parameter (CVE-2024-52301) slip in as if it were a command-line flag, forcing the framework to boot in an alternate environment with login effectively disabled. Inside, the file manager bundled with the dashboard carries its own validation flaw (CVE-2024-21546): renaming the payload
shell.php..(an extra trailing dot) and adding GIF magic bytes gets RCE aswww-data. An encrypted GPG backup reveals the real userhish's credentials, and the final escalation abusessudopreservingBASH_ENVfor a binary that internally invokes bash, running arbitrary code as root.
| Platform | Hack The Box |
| Operating system | Linux |
| Difficulty | Medium |
| Status | Retired |
| Target IP | <TARGET_IP> |
Attack map
[1] Recon -- SSH (OpenSSH 9.2p1) + nginx serving Laravel 11.30.0
|
[2] CVE-2024-52301 -- register_argc_argv poisons argv via the query string
+-> POST /login?--env=preprod -> authentication bypass (Burp)
|
[3] CVE-2024-21546 (UniSharp Laravel-Filemanager) -- shell.php.. (double extension)
+ GIF89a magic bytes
+-> backend normalises the name -> executable .php. -> RCE as www-data
|
[4] user.txt in /home/hish (find + cat)
|
[5] keyvault.gpg exfiltrated -- gpg --import + gpg --decrypt ->
ENVIRONMENT.HTB -> marineSPm@ster!! -> ssh hish@environment.htb
|
[6] sudo -l -- hish can run /usr/bin/systeminfo as root with BASH_ENV preserved
(env_keep in sudoers) -- systeminfo internally invokes bash
+-> BASH_ENV=/tmp/root.sh runs BEFORE the target script, as root
+-> sudo /usr/bin/systeminfo -> root.txt
1. Enumeration
nmap -sV -sC <TARGET_IP>
Result: SSH (OpenSSH 9.2p1) and HTTP (nginx serving a Laravel 11.30.0 application). Only two ports open, so the entire attack surface sits in the web app.
The exact framework version matters: Laravel 11.30.0 is vulnerable to a documented authentication bypass (CVE-2024-52301), fixed in 11.31.0 — this instance is exactly one patch release behind the fix.
Laravel resolves routes and configuration per virtual host based on the Host header, so without the right hostname the app may respond with different or incomplete content. We add the hostname to local resolution:
echo "<TARGET_IP> environment.htb" | sudo tee -a /etc/hosts
Root Access unlocks the content you can't see — everything else on the site is already open.
See Root Access plansNo account? Create one free then upgrade from your console.