| name | reverser-rootkit-analysis |
| description | Rootkit detection and analysis — UEFI rootkits, kernel-level rootkits, bootkits, DKOM techniques, SSDT/IDT/IRP hooking, hypervisor rootkits, and firmware implant detection using GMER, Volatility, chipsec, and UEFITool. |
| allowed-tools | Bash Read Write |
| metadata | {"when_to_use":"rootkit bootkit uefi firmware kernel driver ssdt hook dkom hidden process hypervisor mbr vbr implant bios spi flash ring0 ring-1","subdomain":"reverser","tags":"rootkit, UEFI, bootkit, kernel, firmware, Volatility, chipsec","mitre_attack":"T1542.001, T1542.003, T1014"} |
Rootkit Analysis
Detect and analyze rootkits operating at kernel, boot, and firmware levels — from user-mode hiding techniques through UEFI implants and hypervisor-based rootkits.
Quick Reference
gmer.exe /scan
volatility3 -f memory.raw windows.pslist vs windows.psscan
chipsec_util.py spi dump firmware.bin
UEFIExtract firmware.bin
sigcheck -u -e C:\Windows\System32\drivers\*.sys
volatility3 -f memory.raw windows.ssdt
MITRE ATT&CK Mapping
| Technique | ID | How It Appears |
|---|
| System Firmware | T1542.001 | UEFI rootkit implanted in SPI flash (LoJax, MosaicRegressor, CosmicStrand) |
| Bootkit | T1542.003 | MBR/VBR modification to load malicious code before OS (TDL4, Rovnix, ESPecter) |
| Rootkit | T1014 | Kernel object manipulation to hide processes, files, registry keys |
| Boot or Logon Autostart: Kernel Modules | T1547.006 | Malicious kernel driver loaded at boot via service registry key |
| Exploitation for Defense Evasion | T1211 | Vulnerable driver exploit (BYOVD) to load unsigned kernel code |
| Virtualization/Sandbox Evasion | T1497 | Hypervisor rootkit detecting/evading analysis environment |
1. User-Mode Rootkit Detection
Detect rootkits that hook user-mode APIs to hide artifacts.
vol3 -f memory.raw windows.iat --pid <PID>
cat /proc/<PID>/maps | grep -v "$(ls /lib/ /usr/lib/ 2>/dev/null | tr '\n' '|')"
echo $LD_PRELOAD
cat /etc/ld.so.preload
vol3 -f memory.raw windows.dlllist --pid <PID>
python3 << 'EOF'
import os, subprocess
user_files = set(os.listdir("C:\\Windows\\System32\\drivers"))
raw = subprocess.check_output(["rawcopy", "/listdir", "C:\\Windows\\System32\\drivers"])
raw_files = set(raw.decode().strip().split('\n'))
hidden = raw_files - user_files
if hidden:
print(f"[!] Hidden files detected: {hidden}")
EOF
2. Kernel Rootkit Detection
Detect DKOM, SSDT hooks, and malicious drivers.
vol3 -f memory.raw windows.pslist > pslist.txt
vol3 -f memory.raw windows.psscan > psscan.txt
comm -23 <(sort psscan.txt) <(sort pslist.txt)
vol3 -f memory.raw windows.ssdt
vol3 -f memory.raw windows.drvscan
vol3 -f memory.raw windows.modules
vol3 -f memory.raw windows.driverirp
lsmod
cat /proc/modules
modinfo <MODULE_NAME> | grep sig
cat /proc/kallsyms | grep sys_call_table
chkrootkit
rkhunter --check --skip-keypress
3. BYOVD (Bring Your Own Vulnerable Driver) Analysis
python3 << 'EOF'
import hashlib, os, json
vuln_hashes = set()
drivers_dir = r"C:\Windows\System32\drivers"
for f in os.listdir(drivers_dir):
path = os.path.join(drivers_dir, f)
if os.path.isfile(path) and f.endswith('.sys'):
h = hashlib.sha256(open(path, 'rb').read()).hexdigest()
if h in vuln_hashes:
print(f"[!] VULNERABLE DRIVER: {f} — {h}")
EOF
sigcheck.exe -u -e C:\Windows\System32\drivers\*.sys
vol3 -f memory.raw windows.drvscan | sort -k3 -t'|'
4. Bootkit Analysis
Detect and analyze MBR/VBR/ESP modifications.
dd if=/dev/sda bs=512 count=1 of=mbr.bin 2>/dev/null
python3 << 'EOF'
data = open("mbr.bin", "rb").read()
if data[510:512] != b'\x55\xAA':
print("[!] Invalid MBR signature — corrupted or wiped")
else:
print("[+] MBR signature valid")
known_sigs = {
b'\xEB\x5A\x90': "Standard Windows MBR",
b'\xEB\x63\x90': "GRUB MBR",
}
sig = data[:3]
print(f"Boot code signature: {sig.hex()}")
print(f"Identified: {known_sigs.get(sig, 'UNKNOWN — possible bootkit')}")
import struct
for i in range(4):
entry = data[446 + i*16 : 446 + (i+1)*16]
status, ptype = entry[0], entry[4]
lba = struct.unpack('<I', entry[8:12])[0]
size = struct.unpack('<I', entry[12:16])[0]
if ptype != 0:
print(f" Partition {i}: type=0x{ptype:02x} status=0x{status:02x} LBA={lba} sectors={size}")
EOF
dd if=/dev/sda1 bs=512 count=1 of=vbr.bin 2>/dev/null
mountvol S: /s
dir S:\EFI\
sigcheck.exe S:\EFI\Microsoft\Boot\bootmgfw.efi
sigcheck.exe S:\EFI\Boot\bootx64.efi
S:\EFI\Microsoft\Boot\bootmgfw.efi
5. UEFI Firmware Analysis
Detect firmware-level implants that survive OS reinstallation.
python chipsec_util.py spi dump firmware.bin
python chipsec_main.py -m common.bios_wp
python chipsec_main.py -m common.spi_lock
python chipsec_main.py -m common.secureboot.variables
UEFIExtract firmware.bin
python3 << 'EOF'
import os
extracted_dir = "firmware.bin.dump"
suspicious = []
for root, dirs, files in os.walk(extracted_dir):
for f in files:
path = os.path.join(root, f)
try:
data = open(path, 'rb').read()
if b'LoJax' in data or b'SedUploader' in data:
suspicious.append((path, "LoJax indicator"))
if b'MosaicRegressor' in data or b'IntelUpdate' in data:
suspicious.append((path, "MosaicRegressor indicator"))
if b'CosmicStrand' in data:
suspicious.append((path, "CosmicStrand indicator"))
import re
urls = re.findall(rb, data)
urls:
suspicious.append((path, f"URLs found: {urls[:]}"))
except: pass
path, reason suspicious:
(f)
EOF
python3 -c
6. Hypervisor / Ring -1 Rootkit Detection
python3 << 'EOF'
import struct, ctypes
import subprocess
result = subprocess.check_output(
["powershell", "-c",
"Get-WmiObject -Class Win32_ComputerSystem | Select-Object HypervisorPresent,Model"],
text=True
)
print(result)
EOF
vol3 -f memory.raw windows.modules | grep -iE "vbox\|vmware\|hv\|hyperv"
python chipsec_main.py -m common.cpu.cpu_info
7. Linux Kernel Rootkit Analysis
lsmod | sort
cat /proc/modules | sort
cat /proc/kallsyms | grep -E "sys_(read|write|open|getdents|kill)"
ls -la /dev/ | grep -vE "^[bcdlps]"
debugfs -R "ls -l /" /dev/sda1 2>/dev/null
ls /proc/ | grep -E "^[0-9]+$" | sort -n > proc_pids.txt
ps -eo pid --no-headers | sort -n > ps_pids.txt
comm -23 proc_pids.txt ps_pids.txt
comm -13 proc_pids.txt ps_pids.txt
ss -tulnp > ss_output.txt
cat /proc/net/tcp /proc/net/tcp6 > proc_net.txt
vol3 -f memory.lime linux.bash
vol3 -f memory.lime linux.check_modules
vol3 -f memory.lime linux.hidden_modules
vol3 -f memory.lime linux.check_syscall
Tools & Resources
| Tool | Purpose | Install |
|---|
| GMER | Windows kernel rootkit scanner (GUI) | gmer.net |
| Volatility 3 | Memory forensics framework | github.com/volatilityfoundation/volatility3 |
| chipsec | UEFI/firmware security assessment | github.com/chipsec/chipsec |
| UEFITool | UEFI firmware image parser/editor | github.com/LongSoft/UEFITool |
| UEFIExtract | CLI firmware volume extractor | github.com/LongSoft/UEFITool |
| Sigcheck | Authenticode signature verification | Sysinternals |
| rkhunter | Linux rootkit scanner | rkhunter.sourceforge.net |
| chkrootkit | Linux rootkit checker | chkrootkit.org |
| LOLDrivers | Vulnerable driver database | loldrivers.io |
| ESET UEFI scanner | UEFI module whitelist checker | eset.com |
Detection Signatures
| Indicator | Description | Detection |
|---|
| SSDT entry pointing outside ntoskrnl | Kernel function hook | Volatility windows.ssdt |
| Process in psscan but not pslist | DKOM process hiding | Volatility cross-view comparison |
| Driver loaded from \Temp or \AppData | Suspicious kernel driver | Volatility windows.drvscan + path check |
| BIOSWE bit unlocked | Firmware writable from OS | chipsec common.bios_wp |
| SPI region not locked | Flash can be modified | chipsec common.spi_lock |
| ESP bootloader hash mismatch | Modified bootloader (bootkit) | Hash comparison with vendor baseline |
| Unsigned .sys file in drivers directory | Potentially malicious driver | Sigcheck -u scan |
| Known BYOVD driver hash | Vulnerable driver exploitation | LOLDrivers hash comparison |
Error Handling & Edge Cases
| Issue | Resolution |
|---|
| GMER crashes or hangs | Rootkit actively fighting scanner; try from WinPE/safe mode boot |
| chipsec requires kernel driver | Run on Linux live USB; Windows needs admin + test signing |
| Firmware dump size mismatch | SPI flash layout varies; use chipsec_util spi info for correct regions |
| Hypervisor rootkit undetectable | Physical hardware analysis required; use JTAG/SPI programmer for firmware dump |
| UEFI Secure Boot prevents chipsec | Boot Linux with Secure Boot disabled or MOK-signed chipsec driver |
| Memory image too large | Use targeted Volatility plugins; filter by PID or address range |
| Rootkit patches Volatility output | Use multiple analysis tools; cross-reference with raw memory search |
| Anti-forensics: cleared event logs | Carve deleted entries from raw disk; check alternate log locations |
Decision Gate
IF suspicious hidden processes/files/network connections:
→ Capture full memory dump
→ Run Volatility cross-view detection (pslist vs psscan)
→ Check SSDT/IDT/IRP hooks
→ Scan for known vulnerable drivers (BYOVD)
IF boot-level persistence suspected:
→ Dump and verify MBR/VBR integrity
→ Mount ESP and hash-verify bootloaders
→ Check Secure Boot configuration
IF firmware implant suspected:
→ Dump SPI flash with chipsec
→ Extract and analyze UEFI volumes
→ Compare against vendor baseline firmware
→ Check BIOS write protect and SPI lock status
IF Linux system:
→ Run chkrootkit + rkhunter
→ Compare /proc PIDs vs ps output
→ Verify syscall table addresses
→ Check for hidden kernel modules
ELSE:
→ Start with GMER quick scan (Windows) or rkhunter (Linux)
→ Escalate to memory forensics if scanner detects anomalies