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

Defending off the land: Agentless defenses available today

Black Hat1,364 views41:2911 months ago

This talk demonstrates how to repurpose built-in Windows OS functionality to create agentless, low-cost deception mechanisms for detecting malicious activity. By leveraging native features like scheduled tasks, registry keys, and certificate authority information access, defenders can create traps that trigger alerts upon unauthorized access or configuration changes. These techniques provide visibility into environments where traditional EDR solutions cannot be deployed or are bypassed by attackers. The presentation includes several practical examples of using these native primitives to detect lateral movement and credential-based attacks.

Defending Off the Land: Turning Native Windows Features Into Deception Traps

TLDR: This research demonstrates how to repurpose built-in Windows features like Scheduled Tasks, Registry keys, and Certificate Authority Information Access (AIA) to create low-cost, agentless deception traps. By embedding unique identifiers into these native components, defenders can detect lateral movement and credential-based attacks without installing third-party software. This approach provides critical visibility into legacy or restricted environments where traditional EDR solutions are often bypassed or cannot be deployed.

Attackers rarely bring their own tools when they can use yours. The concept of "Living off the Land" (LotL) has become the standard for modern post-exploitation, where adversaries leverage native binaries and scripts to maintain persistence, move laterally, and exfiltrate data. While defenders have spent years trying to block these techniques, the reality is that you cannot simply disable every useful Windows feature without breaking the business. Instead of fighting the environment, we should be using it to our advantage.

The Mechanics of Native Deception

The core idea behind this research is to stop treating the operating system as a passive platform and start treating it as an active participant in your defense. By using native Windows primitives, you can create "canaries" that trigger alerts the moment an attacker attempts to orient themselves or establish persistence.

One of the most effective techniques involves the Windows Registry. Attackers frequently modify specific keys to achieve persistence or disable security features. By monitoring these keys, you can detect unauthorized changes in real-time. A simple PowerShell script can periodically poll these keys and fire an alert if a modification is detected.

# Example of monitoring a sensitive registry key for changes
$key = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
$watcher = New-Object System.IO.FileSystemWatcher
# Logic to trigger alert on change

This is not about blocking the action; it is about knowing exactly when and where it happens. Because this relies on native OS behavior, it is incredibly difficult for an attacker to distinguish between a legitimate system configuration and a trap.

Exploiting the Certificate Authority Information Access (AIA)

A particularly clever primitive involves the AIA field in X.509 certificates. When a Windows system validates a certificate, it often reaches out to a URL defined in the AIA field to fetch intermediate certificates. By creating a TLS certificate that points to a unique, attacker-controlled URL—or in this case, a Canarytoken—you can force the system to "call home" whenever that certificate is validated.

This is a powerful way to track lateral movement. If an attacker steals a certificate and attempts to use it on a different machine, the validation process will trigger a network request to your token URL. You get the attacker's IP address and the context of the request, all without installing a single agent.

Detecting Lateral Movement with RDP and WinRM

Remote Desktop Protocol (RDP) and Windows Remote Management (WinRM) are the bread and butter of lateral movement. Attackers use these services to jump between machines, often using stolen credentials. You can turn these services into traps by configuring them to require a specific, fake certificate that points to a Canarytoken.

When an attacker attempts to connect via RDP, the client will attempt to validate the certificate. The validation process triggers the token, and you receive an alert. Even if the attacker has valid credentials, they will be blocked by the certificate validation failure, and you will have already captured their source IP. This is a classic "fail-closed" security model that provides high-fidelity alerts.

Real-World Applicability for Pentesters

During a red team engagement, you are likely already looking for these common LotL targets. If you are running ShareFinder to find interesting files or Snaffler to hunt for credentials, you are interacting with the very systems that could be instrumented with these traps.

For a pentester, the impact of these traps is significant. They turn a "quiet" lateral movement attempt into a noisy event. If you are testing a client's detection capabilities, these traps are a perfect benchmark. If you can move through the network without triggering a single native trap, you have a high degree of confidence in your stealth. If you trigger them, you have identified a gap in the client's ability to monitor their own infrastructure.

Defensive Considerations

Defenders should focus on enabling the right audit events. Windows tracks thousands of events, but many are disabled by default. Enabling Windows Event ID 4698 (a scheduled task was created) is a low-effort, high-reward move.

The primary challenge is managing the noise. If you instrument every machine, you will generate a massive volume of logs. Use these techniques strategically. Focus on high-value assets, domain controllers, and jump boxes. You do not need to trap everything; you just need to trap the paths that matter.

Stop looking for the "perfect" security product to save you. The most powerful tools are already sitting on your servers, waiting for you to configure them. Empower your sysadmins to think like attackers, and you will find that the best defense is often the one that was there all along.

Talk Type
talk
Difficulty
intermediate
Category
blue team
Has Demo Has Code Tool Released


Black Hat Europe 2024

52 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