Skip to content

Firmware implant

LoJax UEFI Rootkit (Sednit): Traces and Offline Checks

LoJax put a DXE driver in SPI flash that dropped a trojanized LoJack agent into Windows at each boot. Disk traces, BootExecute, firmware checks and recovery.

Kind
Firmware implant · Firmware layer
Platforms
Firmware, Windows
First seen
2017
Status
In the wild
Checked by
Windows drivers

Overview

LoJax is a UEFI firmware rootkit that ESET published on 27 September 2018 and described as, to its knowledge, the first UEFI rootkit found in the wild. The name comes from LoJack, the anti-theft agent of Absolute Software, formerly called Computrace: from at least early 2017, trojanized copies of an old LoJack "small agent", rpcnetp.exe, were found calling attacker servers instead of Absolute's. Arbor Networks' ASERT team described those agents in May 2018. ESET then found the tools used to read and rewrite a machine's SPI flash, and at least one system where a malicious UEFI module had been written into the firmware. Its job was to put the trojanized agent back into Windows at every boot.

ESET attributes LoJax to the Sednit group (also tracked as APT28, Sofacy, Strontium and Fancy Bear) with high confidence: some LoJax servers had served as command-and-control for Sednit's SedUploader backdoor in late 2017, and SedUploader, XAgent and Xtunnel were found on most targeted systems. ESET adds that it performs no geopolitical attribution. The targets were a few organisations, mostly government bodies, in the Balkans and in Central and Eastern Europe. ESET found few samples and judged the firmware module rarely used.

How it loads and hides

Installing it from Windows

The attacker's tools ran on an already compromised Windows host. ESET describes three, all built around RwDrv.sys, the legitimately signed kernel driver of the free RWEverything utility:

  • info_efi.exe logs low-level platform settings to a text file.
  • ReWriter_read.exe creates a service for RwDrv.sys, records the BIOS control register's protection bits, and dumps the SPI flash to a file.
  • ReWriter_binary.exe adds a DXE driver named SecDxe to a firmware volume, removes the vendor's read-only AMI NTFS driver, and writes the image back. It succeeds only where the flash is not write-protected, or on older Intel platforms affected by a known race condition in the BIOS lock (VU#766164). It then sets BootExecute to its default autocheck autochk *, which the implant expects, and stops and uninstalls the RwDrv service.

ESET concludes that the victim's firmware either did not configure its write protections or ran on a chipset older than the Platform Controller Hub.

At every boot

  1. Firmware. SecDxe, an unsigned DXE driver with GUID 682894B5-6B70-4EBA-9E90-A607E5676297, registers a callback for the moment the firmware is about to start the operating system.
  2. Writing to Windows. The callback loads an NTFS driver embedded in SecDxe (ESET found it was built from the NTFS driver in Hacking Team's leaked UEFI project), writes rpcnetp.exe and autoche.exe to the Windows partition, and edits the SYSTEM hive file directly so that BootExecute reads autocheck autoche *.
  3. Session Manager. Windows runs autoche.exe instead of the disk checker autochk.exe. It registers rpcnetp.exe as a service, under the same name as the legitimate Computrace service, and restores BootExecute to its previous value.
  4. The agent. rpcnetp.exe is a copy of a 2008 Computrace small agent with a modified configuration and timers. The Computrace small agent injects itself into svchost.exe and then into an Internet Explorer process to reach its server; in LoJax that server belongs to the attacker, who can have the agent download and run code.

The firmware module survives a Windows reinstall and a disk replacement. ESET corrected its first guidance on 9 October 2018: Secure Boot does not protect against this rootkit, because it does not check modules inside the firmware image. Intel Boot Guard, available from the Haswell generation of processors, would have refused to boot the modified firmware had it been configured.

Traces on disk

LocationWhatSource
%WINDIR%\SysWOW64\autoche.exeDropper written by SecDxe at boot. Windows ships autochk.exe, not autoche.exeESET white paper
%WINDIR%\SysWOW64\rpcnetp.exe (64-bit Windows), %WINDIR%\System32\rpcnetp.exe (32-bit)Trojanized LoJack small agentESET white paper
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\BootExecuteautocheck autoche * between the firmware's edit and autoche.exe restoring it; normally autocheck autochk *ESET white paper
HKLM\SYSTEM\CurrentControlSet\Services\<name>A service for rpcnetp.exe, named like the legitimate Computrace agent'sESET white paper
System event log, Services key historyA kernel driver service for RwDrv.sys, created by the tools and later uninstalledESET white paper
Tool filesinfo_efi.exe, ReWriter_read.exe, ReWriter_binary.exe, a dumped flash image (image.bin)ESET white paper, IOCs
SPI flash, DXE firmware volumeDXE driver SecDxe (GUID above) with an embedded NTFS driver; the vendor's AMI NTFS driver possibly missingESET white paper
NetworkSmall agent traffic to the servers in ESET's IOC listESET IOCs

ESET's IOC file lists SHA-1 hashes for the tools, SecDxe, autoche.exe and ten small agent builds. A file name match on rpcnetp.exe is not enough on its own: machines with Absolute's product installed have a legitimate agent of that name. The LoJax builds all derive from one 2008 agent with the same compilation time stamp, and Absolute stated in May 2018 that its recent agents are not affected by the weaknesses LoJax relied on.

How to check a host

Offline, from a disk image or collection

  • SYSTEM hive. Read BootExecute under Session Manager in every control set; anything other than autocheck autochk * (plus known third-party entries) needs an explanation. List services whose ImagePath points to rpcnetp.exe. See Boot Execute and Windows services on windowspersistence.com.
  • Files. Look for autoche.exe and rpcnetp.exe in System32 and SysWOW64; compare any rpcnetp.exe with what the organisation's Absolute deployment, if any, should contain.
  • Execution traces. info_efi.exe and the two ReWriter tools ran on the host; Prefetch and Amcache may record them.
  • Event logs. In the System log, event 7045 records a new kernel driver service when one is created through the Service Control Manager; look for one pointing to RwDrv.sys. The kernel drivers page lists the other places a driver leaves traces.

The firmware

Dump the SPI flash from a trusted environment (chipsec_util spi dump rom.bin from a clean Linux live medium, or a hardware programmer), then:

chipsec_main -i -n -m tools.uefi.scan_blocked -a rom.bin,blockedlist.json
chipsec_main -i -n -m tools.uefi.scan_image -a check,efilist.json,rom.bin

CHIPSEC's default blocked list has a LoJax entry that matches the SecDxe name and GUID. The scan_image check, against a list generated from the vendor's image for the same board and version, also catches a rebuilt module the blocked list would miss. chipsec_main -m common.bios_wp shows whether the flash was writable from the OS in the first place.

Live

reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager" /v BootExecute
Get-ChildItem C:\Windows\SysWOW64\autoche.exe, C:\Windows\SysWOW64\rpcnetp.exe, C:\Windows\System32\rpcnetp.exe -ErrorAction SilentlyContinue
Get-CimInstance Win32_Service | Where-Object PathName -match 'rpcnetp' | Select-Object Name, PathName, State
Get-WinEvent -FilterHashtable @{LogName='System'; Id=7045} | Where-Object Message -match 'RwDrv'

Because autoche.exe restores BootExecute during startup, a clean value on a running machine proves nothing. Files deleted by hand come back at the next boot if the firmware is infected; that return is itself a strong sign.

What the checker looks for

  • windrivers reads driver services, .sys files, Amcache and the System log. For LoJax it can only see the installation toolchain:

    • "A kernel driver service was installed" for a 7045 event naming RwDrv.sys, if the System log still holds it;
    • a leftover RwDrv.sys, signed by its legitimate publisher. LOLDrivers lists rwdrv.sys as a vulnerable driver, so a file whose hash matches one of its samples raises "A known vulnerable driver (LOLDrivers): rwdrv.sys". A copy in a writable folder that no service names raises "A driver file in a writable folder";
    • an Amcache entry for it in a writable folder: "Amcache lists a driver in a writable folder".

    The tools uninstall the service, so the SYSTEM hive alone will not show it.

  • rpcnetp.exe runs as an ordinary service, not a driver, and autoche.exe and BootExecute are outside the checker's modules. Check them with the commands above or the Boot Execute page.

  • esp: SecDxe is inside the firmware, not on the EFI system partition, so this module sees nothing.

  • measuredboot: PCR 0 records the platform firmware's executable code (Microsoft). The module does not compare PCR 0 measurements between boots, so it raises nothing for a rewritten flash. With a TPM and boot logs saved before and after, decoding them yourself would show different PCR 0 events, without saying whether that was an update or an implant.

  • The SPI flash itself is not in any collection. Only a flash dump checked as above can show SecDxe.

Removal and recovery

  1. Preserve the flash dump, the dropped files and the SYSTEM hive before changing anything.
  2. Reflash the SPI flash with a clean image for that exact motherboard, or replace the board. ESET's guidance: there is no easy cleaning, the flash must be reflashed, a firmware update may remove the rootkit if it rewrites the whole BIOS region, and changing the motherboard is the alternative. Dump the flash again afterwards and confirm SecDxe is gone.
  3. Only then clean Windows. Deleting autoche.exe, rpcnetp.exe and the service while the firmware is still infected is undone at the next boot. After the reflash, reinstall rather than clean: the host also ran Sednit's other tools, according to ESET.
  4. Rotate credentials used on the host and investigate the rest of the network for SedUploader, XAgent and Xtunnel, which ESET found alongside LoJax.
  5. Harden firmware. Keep firmware current, use platforms with BIOS write protection correctly configured and, where available, Intel Boot Guard; keep Measured Boot logs so that a firmware change leaves a record.

Sources

Primary public reports, newest first.

  1. 2019-07-02LoJax (S0397)MITRE ATT&CK
  2. 2018-09-27LoJax: First UEFI rootkit found in the wild, courtesy of the Sednit groupESET
  3. 2018-09-27LOJAX: First UEFI rootkit found in the wild, courtesy of the Sednit group (white paper)ESET
  4. 2018-09-26LoJax indicators of compromiseESET
  5. 2018-05-01Lojack Becomes a Double-AgentArbor Networks ASERT
  6. 2015-01-05Intel BIOS locking mechanism contains race condition that enables write protection bypass (VU#766164)CERT/CC

See also