Silverseal is an open-source Linux bootkit research framework written in Rust. It demonstrates how a UEFI bootkit hooks the Linux boot process to load a Rust kernel module. The repository contains:
silverseal-bootkit/: theno_stdUEFI bootkit, with architecture-specific assembly underasm/.silverseal-rootkit/: the Kbuild-managed Rust Linux kernel module.scripts/: environment, deployment, and recovery helpers.
The project explores UEFI bootkit development, Linux boot-chain hooking, kernel-module loading, and pre-OS persistence in a research environment.
grubx64.efiis replaced bysilverseal-bootkit.efi; the original is retained asgrubx64.efi.original.- The bootkit loads the saved GRUB image, hooks its Linux boot-image function, and starts GRUB. When GRUB takes its existing Linux boot path, the hook restores the original function and detours the kernel image's zstd decompressor.
- After the decompressor returns, the bootkit locates a late-initcall entry in the decompressed kernel. It places a stager and worker in
.textcode caves, keeps theirwork_structand arguments in a.datacave, and redirects that initcall entry to the stager. - During kernel initialization, the stager queues the worker with
schedule_work, then jumps to the original initcall so it still runs. - The worker sleeps for 10 seconds, then calls
call_usermodehelperto run/sbin/insmod /silverseal_rootkit.kofrom the real root filesystem.
The x64 kernel hook uses signatures and layout assumptions from a specific Ubuntu kernel image. Matching build artifacts alone does not establish that the hook will work on another kernel; validate the target image and boot behavior in a disposable VM.
ARM64 mirrors the existing x86 deployment model:
grubaa64.efiis replaced bysilverseal-bootkit.efi; the original is retained asgrubaa64.efi.original.- The bootkit chain-loads that original GRUB image and detours its existing Linux boot-image path. It does not add or require a GRUB menu entry.
- The bootkit finds the stock ARM64 zboot PE inside the staged
vmlinuz.linuxsection and observes its successful decompression intovmlinux. - The decompressed kernel is matched against the exact target profile. A late-initcall entry is redirected to a position-independent stager.
- The stager initializes a kernel
work_structand calls the target kernel'sschedule_work.isra.0. Its worker sleeps for 10 seconds, then invokes/sbin/insmod /silverseal_rootkit.kofrom the real root filesystem. - The original initcall still runs.
On Ubuntu, install_dependencies.sh installs build packages, Rust and rust-src, and bindgen-cli. It also checks whether the running kernel advertises CONFIG_RUST=y. Review the script before running it because it installs packages and changes the default Rust toolchain:
./scripts/install_dependencies.shOn WSL2 with Ubuntu, wsl_setup.sh prepares a custom Rust-enabled WSL2 kernel, a modules VHDX, and a build tree for external modules. It can optionally write a Windows .wslconfig entry. Review its options and the changes it makes before running it:
./scripts/wsl_setup.sh --help
./scripts/wsl_setup.shThe pinned ARM64 Ubuntu target has a separate setup flow below. ubuntu_target_setup.sh runs natively in that ARM64 VM and derives the required Rust version from its kernel configuration; it is not a generic WSL cross-build helper.
Use the native ARM64 Ubuntu VM on Apple Silicon. The real module must be built through the target kernel's Kbuild tree, not with Cargo's IDE stub:
cd Silverseal
./scripts/ubuntu_target_setup.sh 7.0.0-31-generic
cd silverseal-rootkit
make clean ARCH=arm64 LLVM= KDIR=/lib/modules/7.0.0-31-generic/build
PATH=/usr/bin:/bin:$PATH \
RUST_LIB_SRC=/path/printed/by/ubuntu_target_setup.sh \
make RUST_MIN_TOOLCHAIN= \
ARCH=arm64 \
LLVM= \
KDIR=/lib/modules/7.0.0-31-generic/build \
RUSTC=rustc-1.93 \
RUSTDOC=rustdoc-1.93Confirm that Kbuild produced the module for the pinned kernel:
file target/arm64/7.0.0-31-generic/silverseal_rootkit.ko
modinfo target/arm64/7.0.0-31-generic/silverseal_rootkit.ko | grep vermagicBefore runtime testing, validate the target kernel's work_struct layout from its BTF or DWARF: size 32 bytes, entry at offset 8, and func at offset 24. A mismatch is a hard stop because those values are encoded by the stager.
Apple Silicon can build the AArch64 UEFI binary directly. Install stable Rust with the aarch64-unknown-uefi target and PowerShell (pwsh) for fixture verification.
The large pinned artifacts are expected in tmp/silverseal-kernel-7.0.0-31-generic/. Generate the v3 profile after verifying their hashes, unique signatures, nested stock-zboot PE, caves, initcall, and linked System.map evidence:
cd Silverseal
pwsh ./scripts/verify_arm64_fixture.ps1 \
-ArtifactDirectory ./tmp/silverseal-kernel-7.0.0-31-generic \
-OutputDirectory ./target/arm64-fixture/7.0.0-31-generic-v3
export SILVERSEAL_ARM64_PROFILE="$PWD/target/arm64-fixture/7.0.0-31-generic-v3/7.0.0-31-generic.ssarm64p"
cargo build-bootkit-arm64 --releaseThe result is:
target/aarch64-unknown-uefi/release/silverseal-bootkit.efi
An ARM64 build with no SILVERSEAL_ARM64_PROFILE deliberately installs no hook. The profile and small signature fixtures live under fixtures/arm64/7.0.0-31-generic/; the large kernel and GRUB artifacts remain ignored.
Host-side contracts can be run with:
cargo test-arm64
cargo test -p silverseal-bootkit --bin silverseal-arm64-tool --features arm64-toolsCopy the bootkit and module into the VM, then put the module on the real root filesystem and replace the existing ARM64 GRUB binary:
sudo install -m 0644 \
silverseal-rootkit/target/arm64/7.0.0-31-generic/silverseal_rootkit.ko \
/silverseal_rootkit.ko
sudo ./scripts/setup_silverseal.sh arm64 \
target/aarch64-unknown-uefi/release/silverseal-bootkit.efi
sudo rebootDo not create a menu entry and do not rebuild initramfs. The VM should boot its normal existing Ubuntu entry. After boot, inspect the module result with:
sudo dmesg -w
lsmod | grep silverseal_rootkitTo restore the saved original GRUB image:
sudo ./scripts/restore_silverseal.sh arm64The restore helper keeps the replaced image as grubaa64.efi.silverseal for recovery.
Add a virtual serial port to the powered-off ARM64 VM and configure its output to a file on macOS. The bootkit discovers the firmware's UEFI Serial I/O protocol; it does not assume QEMU's PL011 MMIO address. If Fusion firmware exposes no Serial I/O protocol, logging is silently disabled and boot continues.
On macOS, watch the configured output file while the VM boots:
touch /path/to/fusion-serial.log
tail -F /path/to/fusion-serial.logThis captures bootkit messages before Linux starts. Once Linux is available, sudo dmesg -w in the VM is the simpler source for the delayed worker and module logs. QEMU is not required by this workflow.
The x86 UEFI build requires nasm on PATH and assembles the x64 loader and stager into the EFI image:
cargo build-bootkit-x64 --releaseThe resulting image is target/x86_64-unknown-uefi/release/silverseal-bootkit.efi. Build the real module through the target kernel's Rust-enabled Kbuild tree, using matching headers and tools:
make -C silverseal-rootkit ARCH=x86_64 KDIR=/path/to/target/kernel/build
modinfo silverseal-rootkit/target/x86_64/<kernel-release>/silverseal_rootkit.ko | grep vermagicThe Makefile stages module artifacts under silverseal-rootkit/target/x86_64/<kernel-release>/. cargo check -p silverseal-rootkit checks only the IDE stub; it does not build a loadable module. For an Ubuntu generic kernel, match the target kernel's Rust version and RUST_LIB_SRC as well as its headers. The pinned ARM64 setup command above is specific to that VM.
From the repository root in a disposable x86_64 VM, deploy the EFI image by passing its path to the setup script:
sudo ./scripts/setup_silverseal.sh x86_64 \
target/x86_64-unknown-uefi/release/silverseal-bootkit.efiThe script saves /boot/efi/EFI/ubuntu/grubx64.efi as grubx64.efi.original and installs the bootkit in its place. To restore the original GRUB image:
sudo ./scripts/restore_silverseal.sh x86_64The restore helper retains the replaced image as grubx64.efi.silverseal for recovery.
With a VM serial port configured, Linux hosts can inspect /dev/ttyS* and monitor the corresponding port at 115200 baud using minicom, screen, or picocom:
ls -la /dev/ttyS*
sudo minicom -D /dev/ttyS0 -b 115200On a Windows host with a VM serial pipe at \\.\pipe\com_1, PuTTY can open a Serial connection at 115200 baud with no flow control. The reconnecting helper uses that fixed pipe path and requires PuTTY at C:\Program Files\PuTTY\putty.exe:
powershell -ExecutionPolicy Bypass -File .\scripts\connect-vm.ps1