10.9.9.0/24 -- that has no internet accessNmap Results
tcp/22 is SSH or tcp/80 is HTTP, you'll quickly find things are not as they seem.TCP Port Scan
UDP Port Scan
Ad
Service Enumeration
TCP/111

TCP/8080 — FTP



UDP/69 — TFTP
Download the ZIP File


Recursively Unzipping Files
To summarize the source code (see the comments I've added):
- Start with an initial
unzipcall to unzip125.zip - Then, use
findto search the random output directory for the next.zip - If the next
.zipfound, make sure it is truly a ZIP archive- If so,
cpthe file to the parent directory rm -rfthe previous temp directory- Store the new ZIP filename in
$TARGET_ZIP - Store
$TARGET_ZIPin$REMOVE_ON_NEXTto indicate we remove on next run - Recursively call the
find_and_unzipfunction
- If so,

Port Knocking


tcp/65000 was "filtered" in the initial Nmap scanTCP/65000

Enumerate WordPress

wp-config.php, I'm certain


WPScan Enumeration
wpscan requests through Burp in order to ensure wpscan can follow links.Be sure to grab your WPScan API key before running!
Replace "paste_api_token_here"
wpscan-out.txt require authentication or don't have any public exploits available. So, I'm going to do some directory and file enumeration.Directory and File Enumeration
Filter out comments


Attempt File Upload Bypass
Create "test.php" with simple "phpinfo" call to test RCE


Send the request through Burp for inspection


Exploit
Unauthenticated File Upload -> RCE
How We Got Here
- Anonymous FTP access on
tcp/8080revealed a ZIP file in TFTP server - TFTP, being session-less, allowed us to gather the
125.zipfile, which was just a series of recursively nested ZIP files - The final ZIP file in the chain contained a port knocking sequence, which opened
tcp/65000 - This revealed yet another web server — seemingly WordPress — hosting a non-standard directory —
/projects/ - This directory contained a simple, unauthenticated file upload application that required image files on the surface, but only performed simple file extension validation on the client side
Key Takeaway: Obscurity is not security.
Webshell
Download the webshell
Send the request through Burp for inspection

Reverse Shell
Start a TCP socket to catch the reverse shell
Call back to listener
Post-Exploit Enumeration
Operating Environment
OS & Kernel
Current User
Users and Groups
Local Users
Local Groups
Network Configurations
Network Interfaces
Open Ports
Processes and Services
Interesting Processes
Found using pspy:
Scheduled Tasks
Interesting Scheduled Tasks
Interesting Files
/var/www/html/wordpress/wp-config.php
/home/skinny
/usr/bin/passwordStrengthApp.exe
Privilege Escalation
Lateral to Skinny
Binary Analysis
"strings" is installed on the target

Output a list of password for processing

base64 -d,
you'll find that it fails. You'll find that the data is encoded in
Base32. You'd also notice this because of the smaller character set in
Base32 and that it uses more = padded bytes.
Pipe to xargs and first try to base32 -d and if fails print with echo


Becoming Root
Binary Analysis
Simple Buffer Overflow Check
World-executable with root SUID




Transfer File Locally
Copy the binary locally for analysis

0x08049228
cat shadow_backup_sensitiveFileBrief explanation of the output considering ASLR is disabled:
- Partial RELRO — GOT remains at fixed addresses, so partial RELRO is easier to bypass and GOT overwrite-style attacks are simpler
- No canary found — With fixed addresses and no canary, classic stack overflows can reliably hijack control flow
- NX enabled — NX still helps, but stable addresses make building ROP chains much easier because gadget locations never change
- PIE enabled — Without ASLR, PIE’s main benefit disappears; the binary loads at a predictable base, so all gadget addresses are stable
- No RPATH — No custom runtime library search path embedded
- No RUNPATH — No alternative runtime search path for shared libraries
- 80 symbols — Fixed addresses plus symbols make mapping functions to exact addresses straightforward for exploit development
- Fortify: No — Library calls like
strcpy/sprintfare not automatically replaced with safer, bounds-checked versions - Fortified: 0 — No extra overflow checks inserted around vulnerable libc functions
- Fortifiable: 1 — Indicates missed opportunity to auto-harden at least one buffer-using call
checksec shows multiple protections degraded or missing, we're ready to begin exploit development.Setting up a Quick Test Environment
Configure the VM

We can use the "live boot" Debian images to quickly spin up test environments
VM Hardware Configuration:
- CPU:
kvm64 - Memory:
4096 MiB - Hard Disk:
32 GiB(will mount this as persistent storage) - CD/DVD: Live boot
.isofile - NIC: VLAN 666 (same VLAN as Kali)
Boot Order:

Credentials for Live Boot:
- Username:
user - Password:
live
Increase Available Storage


Then, input "n" > "p" > "Enter" > "Enter" > "Enter" > "w" to create a new primary partition
Format the new primary partition as "ext4" and label with the name "persistence"

Power off the VM




Enable SSH Access
Install the SSH daemon
Start the SSH daemon at boot and also start it right now

10.6.6.0/24 network, with no firewall rules inhibiting access. Plan accordingly for your environment.
Add 32-bit Support

Fuzzing the Application

\x28\x92\x04\x08 is 080409228 in reverse, because we have to factor for Little-endian byte ordering when the program is run.Effectively, we're going to fill the program memory buffer with 35
A characters. The remaining bytes 08049228 will be written to the EIP register, which will cause the program to execute the function at this memory address -- read_sensitive_file
Testing on the Target

Crack Root Hash

Unintended Solve: PATH Injection
cat and shadow_backup_sensitiveFile are referenced in the binary using their relative names. We can inject a false cat binary into our $PATH variable, which will cause it to run as root, as the SUID permissions are not dropped.

/home/skinny and using the full path of the binary: /home/skinny/.reload/overspill.obj. When the program executes, it runs cat, which is actually /tmp/cat -- our copy of bash. And, it looks for shadow_backup_sensitiveFile in the current directory, which is just a shell command --chmod u+s /bin/bash.
