# High

Di bawah ini adalah *source-code* dari XSS (Reflected) level medium 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 *source code* di atas terlihat bahwa *pattern* **"\<s\*c\*r\*i\*p\*t"** tidak diizinkan. Tetapi seperti pada level sebelumnya kita tidak menggunakan tag `<script>`. Sehingga kita masih bisa menggunakan *payload* yang sama seperti pada level sebelumnya.

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

Oke langsung saja kita gunakan *payload* sebelumnya.

```markup
<body onload="alert('Hacked')">
```

![](https://gblobscdn.gitbook.com/assets%2F-LzH5Vfe8_AlGL8KPrs2%2F-Lzl0Ol1wWn09EbcKb6X%2F-LzlC5uTUf0qji8Co3TP%2Fimage.png?alt=media\&token=82a9ed68-c752-44ea-9813-d9a8d5131aac)

Yup! Berhasil lagi. Mudah bukan?😁​

Tetap semangat! 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/cross-site-scripting-xss/reflected/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.
