The cybersecurity field is too occupied with Gen AI and its potential misuse in launching cyberattacks. However, there is another quiet threat that most organizations are unaware of or underestimate, the living off-the-land cyberattack.
A short explanation on Living off the Land Cyberattack
It's a technique in which adversaries exploit an organization's tools, which they use to carry out their daily work and weaponize them to launch a cyberattack.
What tools do they exploit?
Adversaries exploit legitimate Windows tools like PowerShell, WMI, WMIC, Bitsadmin, Certutil, Rundll32, Regex, Reg.exe, Regedit, Mshta.exe, Cscript, Wscript, Schtasks, Netsh, Net.exe, Net1.exe, Cmd.exe, Mavinject.exe, InstallUtil.exe, Dllhost.exe, PresentationHost.exe, MSBuild.exe, Conhost.exe, and Pcalua.exe.
With the help of these Windows tools, the adversary quietly escalates their privileges, moves laterally within the systems, exfiltrates data, and maintains a long-term persistence.
What makes this lethal?
EDR, antivirus, and firewalls often fail to detect malicious activities because adversaries are not using any malware; instead, they are using the tools already in the system, which everyone trusts.
During the SolarWinds supply chain attack in 2020, adversaries used PowerShell and WMI to move laterally within the systems and blend with legitimate admin activities.
Let’s take PowerShell, one of the most exploited tools in living-off-the-land attacks, to explain how these Windows tools are exploited in real-time.
First, a quick note on how System Administrators use PowerShell within an organization to give you a context of its dependency:
PowerShell is used for:
What makes PowerShell so dangerous when it is in the hands of an adversary?
Firstly, PowerShell is present in all Windows systems. It’s scriptable and can be easily automated with complex logic. PowerShell can run code without writing to disk and blends well with administrative activity. It also integrates with AD, WMI, .NET, and WinRM.
Now, let’s look into how an adversary will exploit this tool.
Step 1: To Gain Initial Access to the system
This phishing email is for educational purposes only.
The unsuspecting employee opens it, which triggers the macro to run the PowerShell command.
Here is an example:
PowerShell allows downloading and executing malicious code in-memory (fileless). It also avoids disk-based antivirus detection.
Step 2: Mapping All the Assets
Since PowerShell provides integration with the operating system and activity directory—it’s ideal for mapping assets.
In the next stage, the adversary gathers information about the system and network without raising any suspicion. They pass the following commands in PowerShell to map all the assets.
Step 3: Dumping Credentials
Once all the information is gathered, the adversary steals user credentials, allowing him to move laterally within the organization’s systems and networks. They use tools like Invoke—Mimikatz, which the adversary downloaded via PowerShell.
Step 4: Establishing Presence
To maintain a long-term presence within the systems if it's rebooted or logged out—the adversary schedules PowerShell to run at login with the following command automatically.
Step 5: Moving Laterally Within the Systems
To laterally move within other systems in the network—they use PowerShell remoting and pass the following command, since it provides native support for remote execution via WinRM.
Step 6: Gaining Control
As PowerShell runs periodically to fetch new instructions—the adversary exploits by passing the following command to maintain constant communication with their server.
,Step 7: Stealing Data and Disrupting the Entire Operation
Finally, as PowerShell handles archiving, encryption, and HTTP communication, the adversary passes the following command to steal the data and disrupt the entire operation.
But what about other tools? How can adversaries exploit them? While going over each of them will make this blog too long, the table below will give examples of how these tools are exploited.
So, what can organizations do in such cases? To remedy this problem, they will need to identify how their Windows Native tools can be exploited by adversaries.
Also, they will need an EDR that comes with behavioral analysis, heuristics, telemetry correlation, and threat intelligence to detect suspicious activities even if the payload is fileless or obfuscated.
In short, to deal with Living off the Land (LOTL) Attacks, organizations will need a mixture of both offensive and defensive security.
Invinsense XDR has consolidated all the defensive cybersecurity solutions. These include SIEM, SOAR, EDR, Case Management, Threat Intelligence, and Threat Exchange. The AI/ML-enabled security lake allows these tools to coordinate with each other and share intelligence.
Whereas, Invinsense OXDR has consolidated all the offensive security tools. These include Breach and Attack Simulation, Vulnerability Management, RedOps, and Attacker’s Lens View.
Together, they will secure your organization from Living off the Land (LOTL) Attacks.
How?
As an example, let’s look into how Invinsense XDR detects and prevents PowerShell-based living off the land (LOTL) attack. Then, we will go through how Invinsense OXDR will strengthen your organization against such attacks.
Macro spawning PowerShell is a highly suspicious parent-child process chain. The EDR component of Invinsense XDR will detect any PowerShell flag execution that has:
To deal with this threat, our platform will respond by:
Invinsense XDR will flag enumeration commands like Get-WmiObject, Get-ADUser, and Get-NETIPADDRESS when run by unauthorized users or if it's outside of the IT automation context.
It will also detect abnormal PowerShell usage patterns by comparing against behavioral baselines.
Invinsense XDR continuously monitors for behaviors commonly associated with Mimikatz. It detects suspicious access to LSASS memory, the use of known credential dumping functions (e.g., Invoke-Mimikatz), and DLL injection patterns.
When such activity is identified, Invinsense XDR immediately blocks the credential theft attempt, generates a high-priority alert for the SOC team, and automatically isolates the affected host to prevent further compromise.
Invinsense XDR will detect any attempts to register modification under HCKU\...\Run with a suspicious value (PowerShell + Hidden). It will also constantly monitor persistence mechanisms like startup entries, scheduled tasks, and WMI subscriptions.
To stop this, Invinsense XDR will immediately send an alert to our SOC team, plus it will also roll back any registry changes and contain the threat.
Invinsense XDR will detect any invoke command or WinRM usage from the compromised host. It will proceed to flag cross-system PowerShell remoting and unusual lateral behavior.
To remediate this issue, our platform will send an alert to our SOC team while blocking the entire process. It will also provide an attack graph showing lateral spread attempts.
Any beacon-like PowerShell activity, in which HTTP GETs to the same remote host, or there is use of loops (while ($true)) and dynamic command execution(Invoke-Expression) gets flagged by Invinsense XDR. It will also flag any behavioral anomaly based on the frequency and content of web requests.
Invinsense XDR will proceed by killing the beacon process, blocking outbound communication, and alerting our SOC team on a potential C2 channel.
Invinsense XDR detects compression of large directories and exfiltration attempts via HTTP Post using PowerShell. The file movement + compression + external upload sequence is highly anomalous.
Invinsense XDR will send an alert to our SOC team, while also blocking web upload. It will correlate with prior command history to surface a full kill chain.
Alongside EDR, what organizations need to do for securing themselves against Living off the Land (LOTL) attacks is identify all the exposures within the Windows tools. That’s where offensive security comes into play.
The following section will show you how Invinsense OXDR works to identify exposures within your organization’s native Windows Tools.
Through Invinsense OXDR’s vulnerability management, organizations will gain insights into which Windows tools are used in all their endpoints and how accessible they are to users. This will shed light on the execution policy of these tools, their system configuration, monitoring and logging gaps, historical and behavior baselines, and privilege and misuse opportunities.
“Can these tools be executed? From where? By whom?”
“What prevents or allows the use of this tool?”
“If the tool is used maliciously, would it be visible?”
“Has this tool been abused before? Is its use normal on this system?”
“Can a low-privileged user use this tool to escalate or pivot?”
Based on the insights gained from Invinsense OXDR’s vulnerability management, this table shows the exposed attack surface of Windows-native tools that adversaries can exploit in Living off the Land (LOTL)attacks.
Now, Gartner in 2022 came up with CTEM, which stands for continuous threat exposure management. It’s a cybersecurity framework that advocates that instead of trying to remediate all exposures at the same time, organizations should focus on prioritizing the ones that are highly exploitable and frequently targeted by adversaries.
Invinsense OXDR follows the CTEM approach. It will focus on those Windows Tools first that have a higher risk of misuse. Based on the above table, PowerShell is currently very high on the risk scale. So, in the next stage, it will run simulations through BAS and RedOps on PowerShell first.
The table below shows the realistic, controlled PowerShell-based simulations performed by BAS/RedOps, which are part of adversarial exposure validation. These simulations align with adversary behavior and MITRE ATT&CK techniques.
Once the BAS and RedOps simulations are done, Invinsense OXDR will present a list of exposures present in the PowerShell.
Our Purple and Security Engineering Remediation team will proceed to remediate these exposures by:
CTEM is a cyclical process and should be performed continuously. Once your organization has remediated all its exposures in the PowerShell, it should proceed with performing CTEM through Invinsense OXDR on other Windows Tools and remediate exposures within them. In the long run, this will make your organization more resilient to Living off the Land (LOTL) Attacks.