> For the complete documentation index, see [llms.txt](https://hacktricks.xsx.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacktricks.xsx.tw/linux-hardening/privilege-escalation/docker-security/weaponizing-distroless.md).

# Weaponizing Distroless

<details>

<summary><strong>从零开始学习AWS黑客技术，成为</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS红队专家)</strong></a><strong>！</strong></summary>

支持HackTricks的其他方式：

* 如果您想在**HackTricks中看到您的公司广告**或**下载HackTricks的PDF**，请查看[**订阅计划**](https://github.com/sponsors/carlospolop)！
* 获取[**官方PEASS & HackTricks商品**](https://peass.creator-spring.com)
* 发现[**PEASS家族**](https://opensea.io/collection/the-peass-family)，我们独家的[**NFTs系列**](https://opensea.io/collection/the-peass-family)
* **加入** 💬 [**Discord群组**](https://discord.gg/hRep4RUj7f) 或 [**telegram群组**](https://t.me/peass) 或在**Twitter** 🐦 上**关注**我 [**@carlospolopm**](https://twitter.com/carlospolopm)**。**
* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。\*\*

</details>

## 什么是Distroless

Distroless容器是一种**只包含运行特定应用程序所需依赖的容器**，不包含任何不必要的软件或工具。这些容器旨在尽可能地**轻量级**和**安全**，并通过移除任何不必要的组件来**最小化攻击面**。

Distroless容器通常用于**安全性和可靠性至关重要的生产环境**。

一些**Distroless容器的例子**包括：

* 由**Google**提供：<https://console.cloud.google.com/gcr/images/distroless/GLOBAL>
* 由**Chainguard**提供：<https://github.com/chainguard-images/images/tree/main/images>

## 武器化Distroless

武器化Distroless容器的目标是能够**执行任意二进制文件和有效载荷，即使存在Distroless的限制**（系统中缺少常见二进制文件）以及通常在容器中发现的保护措施，如`/dev/shm`的**只读**或**不执行**。

### 通过内存

将在2023年的某个时候到来...

### 通过现有二进制文件

#### openssl

[**在这篇文章中，**](https://www.form3.tech/engineering/content/exploiting-distroless-images) **解释了为什么在这些容器中经常发现`openssl`二进制文件，可能是因为它需要**由即将在容器内运行的软件。

滥用\*\*`openssl`**二进制文件可以**执行任意操作\*\*。

<details>

<summary><strong>从零开始学习AWS黑客技术，成为</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS红队专家)</strong></a><strong>！</strong></summary>

支持HackTricks的其他方式：

* 如果您想在**HackTricks中看到您的公司广告**或**下载HackTricks的PDF**，请查看[**订阅计划**](https://github.com/sponsors/carlospolop)！
* 获取[**官方PEASS & HackTricks商品**](https://peass.creator-spring.com)
* 发现[**PEASS家族**](https://opensea.io/collection/the-peass-family)，我们独家的[**NFTs系列**](https://opensea.io/collection/the-peass-family)
* **加入** 💬 [**Discord群组**](https://discord.gg/hRep4RUj7f) 或 [**telegram群组**](https://t.me/peass) 或在**Twitter** 🐦 上**关注**我 [**@carlospolopm**](https://twitter.com/carlospolopm)**。**
* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。\*\*

</details>
