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.exelogs low-level platform settings to a text file.ReWriter_read.execreates a service forRwDrv.sys, records the BIOS control register's protection bits, and dumps the SPI flash to a file.ReWriter_binary.exeadds a DXE driver namedSecDxeto 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 setsBootExecuteto its defaultautocheck autochk *, which the implant expects, and stops and uninstalls theRwDrvservice.
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
- Firmware.
SecDxe, an unsigned DXE driver with GUID682894B5-6B70-4EBA-9E90-A607E5676297, registers a callback for the moment the firmware is about to start the operating system. - 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), writesrpcnetp.exeandautoche.exeto the Windows partition, and edits the SYSTEM hive file directly so thatBootExecutereadsautocheck autoche *. - Session Manager. Windows runs
autoche.exeinstead of the disk checkerautochk.exe. It registersrpcnetp.exeas a service, under the same name as the legitimate Computrace service, and restoresBootExecuteto its previous value. - The agent.
rpcnetp.exeis a copy of a 2008 Computrace small agent with a modified configuration and timers. The Computrace small agent injects itself intosvchost.exeand 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
| Location | What | Source |
|---|---|---|
%WINDIR%\SysWOW64\autoche.exe | Dropper written by SecDxe at boot. Windows ships autochk.exe, not autoche.exe | ESET white paper |
%WINDIR%\SysWOW64\rpcnetp.exe (64-bit Windows), %WINDIR%\System32\rpcnetp.exe (32-bit) | Trojanized LoJack small agent | ESET white paper |
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\BootExecute | autocheck 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's | ESET white paper |
| System event log, Services key history | A kernel driver service for RwDrv.sys, created by the tools and later uninstalled | ESET white paper |
| Tool files | info_efi.exe, ReWriter_read.exe, ReWriter_binary.exe, a dumped flash image (image.bin) | ESET white paper, IOCs |
| SPI flash, DXE firmware volume | DXE driver SecDxe (GUID above) with an embedded NTFS driver; the vendor's AMI NTFS driver possibly missing | ESET white paper |
| Network | Small agent traffic to the servers in ESET's IOC list | ESET 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
BootExecuteunderSession Managerin every control set; anything other thanautocheck autochk *(plus known third-party entries) needs an explanation. List services whoseImagePathpoints torpcnetp.exe. See Boot Execute and Windows services on windowspersistence.com. - Files. Look for
autoche.exeandrpcnetp.exeinSystem32andSysWOW64; compare anyrpcnetp.exewith what the organisation's Absolute deployment, if any, should contain. - Execution traces.
info_efi.exeand the twoReWritertools 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
-
windriversreads driver services,.sysfiles, 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 listsrwdrv.sysas 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.
- "A kernel driver service was installed" for a 7045 event naming
-
rpcnetp.exeruns as an ordinary service, not a driver, andautoche.exeandBootExecuteare outside the checker's modules. Check them with the commands above or the Boot Execute page. -
esp:SecDxeis 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
- Preserve the flash dump, the dropped files and the SYSTEM hive before changing anything.
- 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
SecDxeis gone. - Only then clean Windows. Deleting
autoche.exe,rpcnetp.exeand 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. - Rotate credentials used on the host and investigate the rest of the network for SedUploader, XAgent and Xtunnel, which ESET found alongside LoJax.
- 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.
- 2019-07-02LoJax (S0397)MITRE ATT&CK
- 2018-09-27LoJax: First UEFI rootkit found in the wild, courtesy of the Sednit groupESET
- 2018-09-27LOJAX: First UEFI rootkit found in the wild, courtesy of the Sednit group (white paper)ESET
- 2018-09-26LoJax indicators of compromiseESET
- 2018-05-01Lojack Becomes a Double-AgentArbor Networks ASERT
- 2015-01-05Intel BIOS locking mechanism contains race condition that enables write protection bypass (VU#766164)CERT/CC
See also
Related families
- MoonBounceFirmware implant
- CosmicStrandFirmware implant
- FinSpy UEFI bootkitUEFI bootkit