> 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 Toolbox 默认凭据）Linux 权限提升笔记，包含枚举步骤、利用示例和面向报告的验证。

## 这是什么

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

## 枚举

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

```bash
id
cat /proc/1/cgroup
mount
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="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4c13597f6d389972474e5c331a84314b604470a6%2F%7B3258557B-B4F2-4243-A48E-27558C95013C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4c116a18718773902912edfa5840b85cc0adbfb2%2Fimage%20(1039).png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

```bash
echo ' ' > /dev/tcp/172.17.0.1/22 && echo "[+] SSH Open" || echo "[-] SSH Closed"
```

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

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-fa8c5e81828eec484c93464c56b38630e6afc268%2F%7BEAD9A15E-3058-4E82-9767-81350E98F8C8%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **使用默认的 Docker Toolbox 登录凭据登录**

Docker Toolbox 的默认 ID 是：

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

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

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-784e89bfe8ef2386d00d5d9c5d6b7d66ce77a11e%2Fimage%20(1040).png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/zh/privesc/docker-escape/docker-toolbox-default-credentials-linux-privilege-escalation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
