An Introduction to Bypassing User Mode EDR Hooks

While cross-referencing notes against old blog posts, I realized that I never actually published the majority of my work on system calls and user mode hooking.
System calls are the standard way to transition from user mode to kernel mode.
On Windows, the kernel has a table of functions that are allowed to be called from user mode.
To call a system service from user mode a system call must be performed, which is done via the syscall instruction.
The System Service ID, is the index of the function's entry within the SSDT. So, setting eax to 0 will call the first function in the SSDT, 1 will call the second, 2 will call the third, and so on.
The ntdll versions of these functions simply perform syscalls to call their kernel mode counterparts, which is why they're often referred to as system call stubs.
This is due to the fact that Nt functions are designed to be called from user mode, therefore do more extensive validation of function parameters.
Previously, security products monitored user mode calls from inside the kernel by hooking the SSDT. Since all Nt/Zw functions are implemented in the kernel, all user mode calls must go through the SSDT, and are therefore subject to SSDT hooks.
Once the EDR is done, it can resume the ntdll call by executing the overwritten instructions, then jumping to the location in ntdll right after the hook.
Whenever the EDR wants to call the real NtWriteFile, it executes the 3 overwritten instructions, then jumps to the 4th instruction of the hooked function to complete the syscall.
If the SSN for the function we want to call is 0x18, then the one directly before it will likely be 0x17 and the one directly after, 0x19. Since the EDR doesn't hook every Nt function, we can simply grab the SSN from the nearest non-hooked function, then calculate the one we want by adding or subtracting how many functions are between it and our target function.
The function before it is system call number 0x17, and the function after it is 0x19. We can easily assume that the SSN we want is 0x18. This method does have one flaw though: we can't 100% guarantee system call numbers will remain sequential forever, or the DLL won't skip a few.
If we perform a manual syscall, and somewhere along the way the kernel function we call hits any of the above, the EDR could take the opportunity to inspect the callstack of our thread. By unwinding the call stack and inspecting return addresses, the EDR can see the entire chain of function calls that led to this syscall.
This tells us that the executable called VirtualAlloc(), which called NtAllocateVirtualMemory(), which then performed a system call to transition into kernel mode.
Because direct system calls are such a strong indicator of malicious activity, more sophisticated EDRs will log detections for system call that originated outside ntdll.
One issue we could run into is if the EDR hooks or overwrites the syscall instruction part of the Nt call.
Not just where the syscall came from, but who called the function that executed the syscall.
Since the function is hooked by the EDR, the EDR's hook would be expected to appear in the call stack.
As you can see here it's clear from the call stack that we bypassed the EDR hook.
The EDR's hook is visible in the call stack from a regular call but not from an indirect syscall.


This Cyber News was published on malwaretech.com. Publication date: Mon, 25 Dec 2023 08:13:05 +0000


Cyber News related to An Introduction to Bypassing User Mode EDR Hooks

Silly EDR Bypasses and Where To Find Them - One of the drawbacks of direct & indirect syscalls is that it's clear from the callstack that you bypassed the EDR's user mode hook. As you can see from the last image, when a call is done through a hooked function the return address for the EDR's ...
10 months ago Malwaretech.com
An Introduction to Bypassing User Mode EDR Hooks - While cross-referencing notes against old blog posts, I realized that I never actually published the majority of my work on system calls and user mode hooking. System calls are the standard way to transition from user mode to kernel mode. On Windows, ...
10 months ago Malwaretech.com
Windows Incident Response: EDRSilencer - Going unnoticed on an endpoint when we believe or feel that EDR is prevalent can be a challenge, and this could be the reason why these discussions have taken hold. If you look at other aspects of EDR and SOC operations, there are plenty of ...
9 months ago Windowsir.blogspot.com
WordPress Request Architecture and Hooks - Before diving into the security features of WordPress, it's critical to understand the underlying request architecture. WordPress is a dynamic system that processes and responds to user requests in various ways, depending on the nature of the request ...
4 months ago Wordfence.com
Windows Incident Response: Round Up - MSSQL is still a thingTheDFIRReport recently posted an article regarding BlueSky ransomware being deployed following MSSQL being brute forced. I'm always interested in things like this because it's possible that the author will provide clear ...
10 months ago Windowsir.blogspot.com
Kaspersky Unveils New Flagship Product Line for Business, Kaspersky Next - PRESS RELEASE. Woburn, MA - April 16, 2024 - Today Kaspersky introduced its new flagship product line, Kaspersky Next, combining robust endpoint protection with the transparency and speed of EDR, alongside the visibility and powerful tools of XDR. ...
6 months ago Darkreading.com
Secure email gateways struggle to keep pace with sophisticated phishing campaigns - In 2023, malicious email threats bypassing secure email gateways increased by more than 100%, according to Cofense. In just two years, Cofense identified over 1.5 million malicious emails bypassing their customers' SEGs, signaling a 37% increase in ...
8 months ago Helpnetsecurity.com
CVE-2022-25837 - Bluetooth® Pairing in Bluetooth Core Specification v1.0B through v5.3 may permit an unauthenticated MITM to acquire credentials with two pairing devices via adjacent access when at least one device supports BR/EDR Secure Connections pairing and the ...
1 year ago
ThreatDown EDR update: Streamlined Suspicious Activity investigation - Navigating the complex world of alerts just got easier, thanks to our latest enhancements to the ThreatDown Endpoint Detection and Response platform. The detailed technical information in EDR alerts-replete with complicated diagrams and references to ...
8 months ago Malwarebytes.com
SentinelOne vs Palo Alto Cortex XDR: Which Tool is Best? - SentinelOne and Palo Alto are two of the top brands in this space, and this comparison will help you decide if either one of the company's tools is right for you. SentinelOne's Singularity platform offers four subscription tiers that include their ...
5 months ago Techrepublic.com
Google paid $10 million in bug bounty rewards last year - Google awarded $10 million to 632 researchers from 68 countries in 2023 for finding and responsibly reporting security flaws in the company's products and services. Though this is lower than the $12 million Google's Vulnerability Reward Program paid ...
7 months ago Bleepingcomputer.com
Apple 'Lockdown Mode' Bypass Subverts Key iPhone Security Feature - The new feature was designed to protect particularly vulnerable users - for example, activists and journalists in the crosshairs of dictatorships - by shutting off or otherwise significantly reducing features of the device that hackers love best. In ...
11 months ago Darkreading.com
New iPhone Hack Convinces Users With Fake Lockdown Mode - A post-exploitation tampering technique has been discovered that allows the malware to visually trick the user into thinking their iPhone is in Lockdown Mode. While iOS devices with Lockdown Mode have a smaller attack surface, it's crucial to keep in ...
10 months ago Cybersecuritynews.com
New 'Pool Party' Process Injection Techniques Undetected by EDR Solutions - Breach and attack simulation firm SafeBreach has discovered eight new process injection techniques that leverage Windows thread pools to trigger malicious code execution as the result of legitimate actions. Dubbed Pool Party, the injection variants ...
11 months ago Securityweek.com
CVE-2021-47182 - In the Linux kernel, the following vulnerability has been resolved: scsi: core: Fix scsi_mode_sense() buffer length handling Several problems exist with scsi_mode_sense() buffer length handling: 1) The allocation length field of the MODE SENSE(10) ...
6 months ago Tenable.com
CVE-2023-40195 - Deserialization of Untrusted Data, Inclusion of Functionality from Untrusted Control Sphere vulnerability in Apache Software Foundation Apache Airflow Spark Provider. ...
1 year ago
CVE-2018-5739 - An extension to hooks capabilities which debuted in Kea 1.4.0 introduced a memory leak for operators who are using certain hooks library facilities. In order to support multiple requests simultaneously, Kea 1.4 added a callout handle store but ...
5 years ago
Unraveling the Wonders of Bluetooth - Continuing its evolution, Bluetooth 3.0 + HS arrived in 2009, introducing the concept of Bluetooth High Speed, leveraging Wi-Fi technology for faster data transfer over short distances. Bluetooth 4.0, introduced in 2010, marked a significant ...
9 months ago Feeds.dzone.com
Windows Incident Response: Human Behavior In Digital Forensics, pt II - Targeted Threat ActorI was working a targeted threat actor response, and while we were continuing to collect information for scoping, so we could move to containment, we found that on one day, from one endpoint, the threat actor pushed their RAT ...
10 months ago Windowsir.blogspot.com
Navigating the Uncertainties of CMMC 2.0: An Urgent Call for Clarity - With the introduction of CMMC 2.0, a cloud of uncertainties looms, especially concerning the Level 3 requirements. These uncertainties breed discord within the industry, posing significant threats to prime contracts and the overall integrity of the ...
11 months ago Cyberdefensemagazine.com
CVE-2020-28144 - Certain Moxa Inc products are affected by an improper restriction of operations in EDR-G903 Series Firmware Version 5.5 or lower, EDR-G902 Series Firmware Version 5.5 or lower, and EDR-810 Series Firmware Version 5.6 or lower. Crafted requests sent ...
3 years ago
CVE-2021-31838 - A command injection vulnerability in MVISION EDR (MVEDR) prior to 3.4.0 allows an authenticated MVEDR administrator to trigger the EDR client to execute arbitrary commands through PowerShell using the EDR functionality 'execute reaction'. ...
1 year ago
CVE-2023-4452 - A vulnerability has been identified in the EDR-810, EDR-G902, and EDR-G903 Series, making them vulnerable to the denial-of-service vulnerability. This vulnerability stems from insufficient input validation in the URI, potentially enabling malicious ...
1 year ago
Vectra AI Launches Global, 24x7 Open MXDR Service Built to Defend Against Hybrid Attacks - PRESS RELEASE. San Jose, Calif. - February 15, 2024 - Vectra AI, Inc., the leader in hybrid attack detection, investigation and response, today announced the launch of Vectra MXDR services, the industry's first global, 24x7 open MXDR service built to ...
8 months ago Darkreading.com
Future-Proofing Cybersecurity: A Deep Dive into WithSecure's Innovative Mid-Market Security Solutions - Catering to over 100,000 corporate customers through a network of more than 7,000 partners, WithSecure has honed its focus on corporate security, a strategic shift from its previous broader scope that included consumer security under the F-Secure ...
10 months ago Cybersecurity-insiders.com

Latest Cyber News


Cyber Trends (last 7 days)


Trending Cyber News (last 7 days)