Kuboid
Open Luck·Kuboid.in
Black Hat2024
Open in YouTube ↗

The Dark Side of EDR: Repurpose EDR as an Offensive Tool

Black Hat4,315 views42:45over 1 year ago

This talk demonstrates how to repurpose EDR software as an offensive tool by exploiting its own configuration files and drivers to achieve persistence, stealth, and privilege escalation. The researcher targets Palo Alto Cortex XDR, showing how to bypass its protection mechanisms by modifying Lua-based policy files and using hard links to bypass file tampering protections. The presentation highlights the risks of relying on process names for security and demonstrates how to load a vulnerable driver to gain kernel-level access. The researcher also releases a tool called CortexVortex to facilitate testing these vulnerabilities.

How to Turn EDR Against Itself: Exploiting Cortex XDR Configuration Files

TLDR: This research demonstrates how to weaponize EDR software by manipulating its own configuration files and drivers to achieve persistence and privilege escalation. By modifying Lua-based policy files and using hard links to bypass file tampering protections, an attacker can effectively disable security controls or execute arbitrary code. Security teams must move beyond simple process-based allowlisting and treat EDR configuration files as high-value targets for integrity monitoring.

Endpoint Detection and Response (EDR) agents are the ultimate arbiters of truth on a modern host. We trust them to catch the malicious activity we miss, to block the shellcode, and to alert us when an adversary touches lsass.exe. But what happens when the guardian is the one being manipulated? This research into Palo Alto Cortex XDR proves that EDR agents are not just security tools; they are complex software suites with their own attack surfaces, configuration files, and kernel-level drivers that can be turned against the host.

The Vulnerability: Trusting the Configuration

Most EDR agents rely on policy files to define what is "normal" and what is "malicious." In the case of Cortex XDR, these policies are stored in clear-text Lua and Python files within the ProgramData directory. Because these files are accessible to the system, they become a prime target for anyone with administrative privileges looking to blind the EDR.

The research highlights a critical design flaw: the EDR relies heavily on process names to enforce its rules. If you can modify the policy files to include your own malicious binary in an allowlist, or if you can rename your malware to match a trusted process already present in those files, the EDR will effectively ignore your activity. This is not a bug in the traditional sense; it is a failure to protect the integrity of the security logic itself.

Bypassing File Tampering Protections

Cortex XDR attempts to prevent this by using a mini-filter driver to block unauthorized modifications to its content files. When you try to edit a policy file, the driver intercepts the I/O request and returns an "Access Denied" error. However, this protection is often based on path comparison.

An effective way to bypass this is by using hard links. As documented in CVE-2015-4481, hard links allow you to create a new directory entry that points to the same data on the disk as the original file. By creating a hard link from an unprotected location to a protected policy file, you can modify the content of the file through the link. Because the link itself is not on the EDR's "protected" list, the mini-filter driver does not trigger.

You can use the native Windows mklink utility to facilitate this. Once the link is established, any write operation to the link propagates to the original file, allowing you to inject your own rules into the EDR's policy engine.

Weaponizing the EDR: The "Bring Your Own Driver" Attack

The most dangerous aspect of this research is the ability to load vulnerable drivers. By modifying the policy files to allow the loading of a known vulnerable driver—such as an older version of a legitimate driver with a documented exploit—you can gain kernel-level execution.

Once you have kernel access, you are no longer playing by the rules of the user-mode EDR. You can disable the EDR's services, clear its logs, or hook its functions to prevent it from reporting your activity to the management server. The CortexVortex tool released by the researchers automates this process, demonstrating how to patch the administrator password verification function. By forcing the EDR to accept any password, you gain full control over the agent's management interface, allowing you to stop the cyerver.exe process or disable protections entirely.

Real-World Implications for Pentesters

For a red teamer, this changes the game. Instead of spending hours finding a zero-day in the OS, you can focus on the EDR agent. If you land on a box with administrative rights, your first step should be to map the EDR's policy directory. If you find clear-text configuration files, you have a path to persistence that is invisible to the EDR itself.

During an engagement, this technique allows you to maintain a foothold that survives reboots and remains undetected by standard behavioral analysis. The impact is total: you own the host, and the security tool meant to stop you is now your primary mechanism for maintaining that ownership.

Defensive Recommendations

Defenders need to stop treating EDR agents as "set and forget" black boxes. If your EDR stores its policy files in a location that is readable or writable by the system, you have a vulnerability.

  1. Monitor File Integrity: Implement strict File Integrity Monitoring (FIM) on the EDR's own installation and configuration directories. Any write operation to these files should trigger an immediate, high-priority alert.
  2. Harden Access Controls: Ensure that the service account running the EDR agent is the only entity with write access to its configuration files.
  3. Move Beyond Names: If you are a vendor, stop relying on process names for allowlisting. Use code signing certificates, file hashes, or path-based validation that cannot be easily spoofed or bypassed via hard links.
  4. Audit Drivers: Regularly audit the drivers loaded on your endpoints. Use tools like Autoruns to identify and block known vulnerable drivers that could be used in a "Bring Your Own Driver" attack.

Security is a race, and the EDR is currently carrying a heavy backpack of legacy design choices. Until vendors prioritize the integrity of their own configuration logic, the EDR will remain a high-value target for any adversary who knows where to look.

Talk Type
exploit demo
Difficulty
advanced
Category
red team
Has Demo Has Code Tool Released


Black Hat Asia 2024

44 talks · 2024
Browse conference →
Premium Security Audit

We break your app before they do.

Professional penetration testing and vulnerability assessments by the Kuboid Secure Layer team. Securing your infrastructure at every layer.

Get in Touch
Official Security Partner
kuboid.in