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

# Docker 密码复用 - Linux 权限提升

## 这是什么

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

## 枚举

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

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

## 示例

Docker 逃逸：

我们注意到该 IP 地址不是机器的 IP（机器 IP：10.10.11.130；Docker 容器 IP：172.19.0.2）。

<div data-full-width="true"><figure><img src="/files/88f553290cf48059a7f8c40cc82027592cb8bdcd" alt=""><figcaption></figcaption></figure></div>

我们将手动扫描端口，因为 `nmap` 未安装在网关（172.19.0.1）上：

```bash
for PORT in {0..1000}; do timeout 1 bash -c "</dev/tcp/172.19.0.1/$PORT
&>/dev/null" 2>/dev/null && echo "端口 $PORT 开放"; done
```

我们注意到端口 22 是开放的（内部端口），因此我们可以通过 SSH 连接。

```bash
for PORT in {0..1000}; do timeout 1 bash -c "</dev/tcp/172.19.0.1/$PORT&>/dev/null" 2>/dev/null && echo "端口 $PORT 开放"; done
```

<figure><img src="/files/75ad78ac0d748f2c47c6d12bc03ffacf7989a2be" alt=""><figcaption></figcaption></figure>

如果我们尝试使用以下凭据以 root 账户登录： `superadministrator` 密码，我们无法登录，但使用 `augustus`，我们成功获得一个 shell。

<figure><img src="/files/ae97c5adb5db15249f878085b6cee4e41594da1b" 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/docker-escape/docker-password-reuse-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.
