# sqli blind

Blind SQL injection occurs when the application does not display error messages, making it challenging to directly extract data. In such cases, a technique called "blind" exploitation is used, where an attacker sends crafted queries to the application and observes its behavior to infer information about the underlying database.

<figure><img src="https://410895813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlKjYaxo0rpR2Jsapi3%2Fuploads%2F1VTxwiaBHjPMmjHA7Jum%2Fimage.png?alt=media&#x26;token=0e626f98-7f89-4169-86c6-057d70247774" alt=""><figcaption></figcaption></figure>

To successfully log in once again, we will need an overall `true` query. This can be achieved by injecting an `OR` condition into the password field, so it will always return `true`. Let us try `something' or '1'='1` as the password.

<figure><img src="https://410895813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlKjYaxo0rpR2Jsapi3%2Fuploads%2F300XfP7Q0bJANnQHUt0l%2Fimage.png?alt=media&#x26;token=9c30e735-c107-4134-999e-f423826119d7" alt=""><figcaption></figcaption></figure>

The additional `OR` condition resulted in a `true` query overall, as the `WHERE` clause returns everything in the table, and the user present in the first row is logged in. In this case, as both conditions will return `true`, we do not have to provide a test username and password and can directly start with the `'` injection and log in with just `' or '1' = '1`.

<figure><img src="https://410895813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlKjYaxo0rpR2Jsapi3%2Fuploads%2FE4PE4bzQTuOiaZnx3YnT%2Fimage.png?alt=media&#x26;token=40747e0b-7ceb-47d5-bac6-f754fb2787a9" alt=""><figcaption></figcaption></figure>

This works since the query evaluate to `true` irrespective of the username or password.

subverting query logic

{% embed url="<https://academy.hackthebox.com/module/33/section/194>" %}

{% embed url="<https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/SQL%20Injection#authentication-bypass>" %}

\
time based

<figure><img src="https://410895813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlKjYaxo0rpR2Jsapi3%2Fuploads%2FITV5joQfeMSqGIXuaPnB%2Fimage.png?alt=media&#x26;token=2ecbdbac-e173-4246-b98c-11fcd9f1a25f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://410895813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlKjYaxo0rpR2Jsapi3%2Fuploads%2FLAD2sfHtywboB6PLOoBa%2Fimage.png?alt=media&#x26;token=c8a08372-0de1-44ae-97e0-de09324ca425" alt=""><figcaption></figcaption></figure>
