> 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-toolbox-default-credentials-linux-privilege-escalation.md).

# Docker 逃逸（Docker Toolbox 默认凭据）- Linux 权限提升

## 这是什么

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

## 枚举

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

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

## 示例

{% hint style="info" %}
在侦察过程中，我们发现我们的 Windows 机器无法直接访问。不过，我们能够连接到一个 Docker 容器中的 Windows 机器，其 IP 地址为 `172.17.0.2` 和 `172.17.0.1` 网关。现在我们将尝试通过这个容器进行横向移动，并提升我们的权限。
{% endhint %}

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

<figure><img src="/files/13049d62aee5ba629288105f75884e5ea13faa2c" alt=""><figcaption></figcaption></figure>

### **SSH 端口验证**

首先，我们需要检查 Docker 网关（172.17.0.1）上的 SSH（22）端口是否开放。为此使用一个简单的命令：

```bash
echo ' ' > /dev/tcp/172.17.0.1/22 && echo "[+] SSH 已开放" || echo "[-] SSH 已关闭"
```

22 端口是开放的，这意味着我们可以尝试通过 SSH 连接到容器中的机器。

<figure><img src="/files/22b7b24b6101fe9567fb27ca2f1372dcfdddc624" alt=""><figcaption></figcaption></figure>

#### **使用默认的 Docker Toolbox 登录信息登录**

Docker Toolbox 的默认 ID 是：

* **用户**: `docker`
* **密码** : `tcuser`

现在我们尝试使用这些信息通过 SSH 连接到容器。一旦连接到这台机器，我们注意到我们以用户身份拥有对容器 root 的访问权限 `docker`.

<figure><img src="/files/aa63b2198309b8040213b6b87f234a078bbda0e2" 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-toolbox-default-credentials-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.
