eWPTXv3 - Notes
GitHubPortfolioTwitter/X MediumCont@ctHome
  • 📝eWPTXv3
    • Web Application Penetration Testing Methodology
      • 1.1 Introduction to Web App Security Testing
        • 1.1.1 Web Application
        • 1.1.2 Web App Architecture
        • 1.1.3 HTTP/HTTPS
      • 1.2 Web App Pentesting Methodology
    • Web Application Reconnaissance
      • 2.1 Information Gathering
        • 2.1.1 DNS Recon
          • 2.1.1.1 DNS Zone Transfer
          • 2.1.1.2 Subdomain Enumeration
        • 2.1.2 WAF Recon
      • 2.2 Passive Crawling & Spidering
      • 2.3 Web Server Fingerprinting
        • 2.3.1 File & Directory Brute-Force
      • 2.4 Web Proxies
        • 2.4.1 Burp Suite
        • 2.4.2 OWASP ZAP
    • Authentication Attacks
      • 6.1 HTTP Attacks
        • 6.1.1 HTTP Method Tampering
        • 6.1.2 Attacking HTTP Authentication
      • 6.2 Session Attacks
        • 6.2.1 Session Hijacking
        • 6.2.2 Session Fixation
        • 6.2.3 Session Hijacking via Cookie Tampering
      • 6.3 JWT Attacks
      • 6.4 CSRF
    • Injection Vulnerabilities
      • 4.1 Command Injection
      • 4.2 Cross-Site Scripting (XSS)
        • 4.2.1 XSS Anatomy
        • 4.2.2 Reflected XSS
        • 4.2.3 Stored XSS
        • 4.2.4 DOM-Based XSS
        • 4.2.5 Identifying & Exploiting XSS with XSSer
      • 4.3 ​SQL Injection (SQLi)
        • 4.3.1 DB & SQL Introduction
        • 4.3.2 SQL Injection (SQLi)
        • 4.3.3 In-Band SQLi
        • 4.3.4 Blind SQLi
        • 4.3.5 NoSQL
        • 4.3.6 SQLMap
        • 4.3.7 Mitigation Strategies
    • API Penetration Testing
      • 5.1 API Testing
    • Server-Side Attacks
      • 6.1 Server-side request forgery (SSRF)
      • 6.2 Deserialization
      • 6.3 ​File & Resource Attacks
        • 6.1 File Upload Vulnerability
        • 6.2 Directory Traversal
        • 6.3 File Inclusion (LFI and RFI)
          • 6.3.1 Local File Inclusion (LFI)
          • 6.3.2 Remote File Inclusion (RFI)
        • 6.4 CMS Pentesting
          • 6.4.1 Wordpress, Drupal & Magento
    • Filter Evasion & WAF Bypass
      • 7.1 Obfuscating attacks using encodings
    • 📄Report
      • How to write a PT Report
  • 🛣️RoadMap / Exam Preparation
  • 📔eWPTX Cheat Sheet
Powered by GitBook
On this page
  • Exploiting Blind SQL Injection
  • Boolean-Based
  • Detecting the Current User
  • Scripting Blind SQLi Data Dump
  • Time-Based Blind SQL Injection
  1. eWPTXv3
  2. Injection Vulnerabilities
  3. 4.3 ​SQL Injection (SQLi)

4.3.4 Blind SQLi

Exploiting Blind SQL Injection

Blind SQL injection is an inference methodology used to extract database schemas and data when direct in-band or error-based SQL injections are not possible. This technique relies on transforming a query into a True/False condition and observing the application's response.

Boolean-Based

Exploitation Scenario

  • Identifying Dynamic Query Structure: Assuming the query structure is like: SELECT <fields> FROM <table> WHERE id='<id parameter>';, you can attempt to trigger always true and always false conditions. For example, ' OR 'a'='a and ' OR '1'='11. If the application responds differently for true and false conditions, it indicates a potential blind SQL injection.

Detecting the Current User

  • Using MySQL Functions: By employing MySQL functions like user() and substring(), you can iteratively guess the characters of the current database user's username. For example:

    • ' or substr(user(), 1, 1) = 'a

    • ' or substr(user(), 1, 1) = 'b

    • Continue this process until the full username is identified.

Scripting Blind SQLi Data Dump

  • Automation with SQLMap: SQLMap is a tool that automates the process of detecting and exploiting SQL injection vulnerabilities, including blind SQL injections. It can significantly simplify the process of dumping data from a database.

  • Optimizing Payloads: To speed up the exploitation, it's crucial to narrow down the charset by optimizing payloads. By testing if the conversion to upper or lower case of a character yields a true or false condition, you can determine if the character is uppercase, lowercase, or a number/symbol.

Time-Based Blind SQL Injection

  • Time-Based Technique: Time-based blind SQL injection involves inferring a true condition from a false condition based on the delay in the application's response. For example:

    • IF (SELECT user) = 'sa' WAITFOR DELAY '0:0:5'

  • Example with MySQL:

    • IF EXISTS (SELECT * FROM users WHERE username = 'armando') BENCHMARK(1000000, MD5(1))

    • This query performs the MD5 function 1,000,000 times if the condition is true.

  • Caution with BENCHMARK(): Be cautious with the first argument of BENCHMARK(), as it can significantly affect server load.

Blind SQL injection, whether time-based or boolean-based, requires a systematic approach to iteratively guess and extract information from the database. Automation tools like SQLMap can be invaluable in efficiently exploiting blind SQL injection vulnerabilities. Always exercise caution to avoid unintended consequences, especially when using delay functions like BENCHMARK() in time-based injections.

Previous4.3.3 In-Band SQLiNext4.3.5 NoSQL
📝