> 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/deserialization-attack/php-deserialization-rce-pentesting-web.md).

# PHP 反序列化 RCE

## 反序列化（PHP）

我们找到了一个网站，在那里你可以 **发送 ping**:

<figure><img src="/files/324e3df0e91b280fd72cc74b874486fdf7277d49" alt="" width="563"><figcaption></figcaption></figure>

我们尝试了 **测试不同的输入**，但都没有效果：

<figure><img src="/files/8a10c2073beb66f99a0f148b78883c31ad1f0d56" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/ede334b9594c206942f9a4bcab82202a3d223df7" alt="" width="530"><figcaption></figcaption></figure>

我们向我们的 **攻击者自己的 IP 地址** 并使用……拦截请求 [Burp](/zh/hacking-tools/web/burpsuite.md):

<figure><img src="/files/ac5430ea31b07b8ca83dbb04e9c648a99bf68c82" alt="" width="563"><figcaption></figcaption></figure>

我们看到它是 **已序列化的**:

<figure><img src="/files/b8eb50fc560e8844773fec69b4afd5a2a8c2dca4" alt="" width="563"><figcaption></figcaption></figure>

该 **PHP** 我们遇到的代码类似于以下内容：

<figure><img src="/files/9b8c42b48b978090245f0cec56db22f24faa81de" alt="" width="563"><figcaption></figcaption></figure>

在分析代码后，我们发现更改 **$isValid** 更改为 `true` 并将反向 shell 注入到 **ipAddress** 在一个 **;** 应触发命令执行：

<figure><img src="/files/a2010d640a7abd2518253aa378eaddf5e668c7b1" alt="" width="563"><figcaption></figcaption></figure>

然后，我们 **序列化** 再次使用 Netcat 对文件进行 **PHP**:

<figure><img src="/files/68c0c4ab903b22d6afb7f8dbe0bcaa29e777a419" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/1d05e3b7ab4a5440a09fd2c698a197508dbfa485" alt="" width="563"><figcaption></figcaption></figure>

使用 **Netcat**，我们在端口上监听 **443** 并接收 shell：

<figure><img src="/files/91561e78a753cec7da86f7b6d07a0bbe0c664196" 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/deserialization-attack/php-deserialization-rce-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.
