# High

## High

Command Injection level High on DVWA

Di bawah ini adalah *source-code* dari *command injection* level high di DVWA.

```php
vulnerabilities/xss_r/source/high.php
<?php
​
header ("X-XSS-Protection: 0");
​
// Is there any input?
if( array_key_exists( "name", $_GET ) && $_GET[ 'name' ] != NULL ) {
    // Get input
    $name = preg_replace( '/<(.*)s(.*)c(.*)r(.*)i(.*)p(.*)t/i', '', $_GET[ 'name' ] );
​
    // Feedback for end user
    echo "<pre>Hello ${name}</pre>";
}
​
?> 
```

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

Pada level ini, *blacklist* yang diberikan menjadi semakin banyak. Tetapi jika kita teliti, di baris ke-11 terdapat celah😁 . `'| ' => ''` terdapat spasi setelah `|` . Ini bisa kita manfaatkan dengan cara menjalankan perintah langsung tanpa spasi setelah `|`.

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

Sekarang kita coba menginputan `8.8.8.8 |whoami` (digabung antara pipeline dan command) seperti berikut:

![](https://gblobscdn.gitbook.com/assets%2F-LzH5Vfe8_AlGL8KPrs2%2F-LzNB8sTkF__Fy92pViR%2F-LzNr7a78vhc-PR1t13X%2Fimage.png?alt=media\&token=38f4f8db-c7c6-4720-a59a-800ef37ee70d)


---

# 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/command-injection/high.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.
