Demigod: The Art of Emulating Kernel Rootkits

Conference:  BlackHat USA 2020



The presentation discusses the development of Demigod, an emulator designed to analyze kernel rookies in a safe sandbox environment. The emulator is built on top of the open-source emulator, Chilling, and is capable of emulating kernel drivers and APIs. The presentation also covers the mechanism of Demigod for Mac OS.
  • Demigod is an emulator designed to analyze kernel rookies in a safe sandbox environment
  • The emulator is built on top of the open-source emulator, Chilling
  • Demigod is capable of emulating kernel drivers and APIs
  • The mechanism of Demigod for Mac OS is discussed
  • The presentation covers the initialization of the kernel environment, mapping of KPIs, and event management system
The presenter demonstrates how Demigod can be used to analyze a famous rootkit


Kernel rootkit is considered the most dangerous malware that may infect computers. Operating at ring 0, the highest privilege level in the system, this super malware has unrestricted power to control the whole machine, thus can defeat all the defensive and monitoring mechanisms. Unfortunately, dynamic analysis solutions for kernel rootkits are severely lacking; indeed, most existing dynamic tools are just built for userspace code (ring 3), but not for Operating System (OS) level. This limitation forces security researchers to turn to static analysis, which however proved to be very tricky & time consuming.This research proposes a novel approach to deal with kernel rootkits. We introduce Demigod, a framework to emulate OS environments, so kernel rootkits can be run in software emulators, all in ring 3. From this sandbox, we can safely monitor, trace, debug or perform all kinds of dynamic analysis with this advanced malware.Emulating complicated OS such as Windows, MacOS & Linux is a challenging task. We will present all the technical issues we had to deal with, including how we built our own loader and dynamic linker, how to emulate the OS environment, essential kernel components and system APIs to allow rootkits to work.Designed and implemented as a cross-platform-architecture engine, Demigod can emulate Windows/MacOS/Linux/BSD on X86/Arm/Aarch64/Mips. On top of Demigod, we built some advanced tools to analyze kernel rootkits, including some automated solutions, providing the malware analyst new weapons to ease their labor work.This talk includes a series of live demos to show how we employ our superior toolset to dissect several well-known kernel rootkits of Windows, MacOS & Linux. We will also explain how to extend Demigod to handle more sophisticated malware in the future.Demigod will be released after our presentation, with full source code.