> For the complete documentation index, see [llms.txt](https://notes.anggipradana.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.anggipradana.com/tutorial/dvwa/local-file-inclusion/high.md).

# High

Di bawah ini adalah *source-code* dari *file inclusion* level High di DVWA.

```php
vulnerabilities/fi/source/high.php
<?php
​
// The page we wish to display
$file = $_GET[ 'page' ];
​
// Input validation
if( !fnmatch( "file*", $file ) && $file != "include.php" ) {
    // This isn't the page we want!
    echo "ERROR: File not found!";
    exit;
}
​
?> 
```

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

Perhatikan pada *source code* di atas, parameter page hanya diizinkan ketika file tersebut diakses dengan diawali kata *"file"* atau bernama **include.php**. Jika salah, maka akan muncul tampilan seperti berikut:

![](https://gblobscdn.gitbook.com/assets%2F-LzH5Vfe8_AlGL8KPrs2%2F-M-uT15NZNobc-fi-ZAV%2F-M-uUMR1l-Z-tLLm8mxU%2Fimage.png?alt=media\&token=ce65e06d-f99f-4486-92b4-6c471dd26d7f)

Validasi ini memiliki celah, yaitu kita bisa menggunakan protokol `file://` untuk melihat file yang ada di server lokal target. Server akan mengizinkannya, karena memang diawali dengan kata *"file"*.

Karena protokol ini hanya untuk melihat file yang ada di dalam server target, maka kita hanya bisa melakukan *Local File Inclusion*.

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

Langsung saja kita jalankan *payload* seperti berikut:

```http
?page=file:///etc/passwd
```

![](https://gblobscdn.gitbook.com/assets%2F-LzH5Vfe8_AlGL8KPrs2%2F-M-uT15NZNobc-fi-ZAV%2F-M-uUWlOL8CeCatRSQFo%2Fimage.png?alt=media\&token=b2ac58d6-5a79-4944-b199-bd60cf676789)

Yup! berhasil!😁

Kali ini saya hanya bisa melakukan *local file inclusion*. Tetapi tetap saja kita bisa melakukan RCE. Untuk mengetahui caranya anda bisa melihat pembahasan celah *file upload*.

Happy Hacking! 🍻


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://notes.anggipradana.com/tutorial/dvwa/local-file-inclusion/high.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
