Skip to content

Commit dabfe5a

Browse files
authored
Update av-bypass.md
1 parent 54f93d5 commit dabfe5a

1 file changed

Lines changed: 1 addition & 58 deletions

File tree

src/windows-hardening/av-bypass.md

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -715,64 +715,7 @@ Detection / Mitigation
715715
• Monitor creations of new *kernel* services and alert when a driver is loaded from a world-writable directory or not present on the allow-list.
716716
• Watch for user-mode handles to custom device objects followed by suspicious `DeviceIoControl` calls.
717717
718-
### Silver Fox BYOVD: WatchDog amsdk.sys/wamsdk.sys (Zemana SDK) on Win10/11
719-
720-
A real-world APT campaign (“Silver Fox”) abused a signed but vulnerable antimalware driver to reliably kill EDR/AV (including PP/PPL) and sometimes elevate privileges on fully patched Windows 10/11.
721-
722-
Key points
723-
- Driver: WatchDog Anti‑Malware amsdk.sys v1.0.600 (Microsoft-signed). Internals show Zemana SDK reuse (PDB path: zam64.pdb). Loadable on modern Windows where blocklists didn’t yet include it.
724-
- Legacy path: Older variants used ZAM.exe (legacy Zemana) on Win7-era systems.
725-
- Post-patch: Vendor released wamsdk.sys v1.1.100. It fixed LPE by tightening device security but still allowed arbitrary termination of processes, including PP/PPL.
726-
727-
Root cause (amsdk.sys v1.0.600)
728-
- The device object is created via IoCreateDeviceSecure with a strong SDDL: D:P(A;;GA;;;SY)(A;;GA;;;BA) but DeviceCharacteristics omits FILE_DEVICE_SECURE_OPEN.
729-
- Without FILE_DEVICE_SECURE_OPEN, the secure DACL does not protect opens via the device namespace. Any user can open a handle by using a path with an extra component such as \\ .\\amsdk\\anyfile. Windows resolves it to the device object and returns a handle, bypassing the intended ACL.
730-
731-
Powerful IOCTLs exposed
732-
- 0x80002010 – IOCTL_REGISTER_PROCESS: Register the caller.
733-
- 0x80002048 – IOCTL_TERMINATE_PROCESS: Terminates arbitrary PIDs, including PP/PPL (the driver only avoids critical system PIDs to prevent bugchecks).
734-
- 0x8000204C – IOCTL_OPEN_PROCESS: Returns full-access handles to target processes (LPE/token‑theft pivot).
735-
- 0x80002014 / 0x80002018 – Raw disk read/write (stealth tampering possible).
736-
737-
Minimal PoC to terminate PP/PPL via user mode
738-
```c
739-
#define IOCTL_REGISTER_PROCESS 0x80002010
740-
#define IOCTL_TERMINATE_PROCESS 0x80002048
741-
742-
int main() {
743-
DWORD pidRegister = GetCurrentProcessId();
744-
DWORD pidTerminate = /* target PID */;
745-
HANDLE h = CreateFileA("\\\\.\\amsdk\\anyfile", GENERIC_READ|GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
746-
DeviceIoControl(h, IOCTL_REGISTER_PROCESS, &pidRegister, sizeof(pidRegister), 0, 0, 0, 0);
747-
DeviceIoControl(h, IOCTL_TERMINATE_PROCESS, &pidTerminate, sizeof(pidTerminate), 0, 0, 0, 0);
748-
return 0;
749-
}
750-
```
751-
752-
Local privilege escalation pivot
753-
- Because any user can open the device, IOCTL_OPEN_PROCESS can hand out full-access handles to privileged processes. From there you can DuplicateTokenEx/CreateProcessAsUser to jump to SYSTEM. Raw disk I/O IOCTLs can also be abused for stealthy boot/config tampering.
754-
755-
Patch and adversary response
756-
- Fix guidance: set FILE_DEVICE_SECURE_OPEN at device creation and add PP/PPL checks to block protected process termination.
757-
- Vendor patch (wamsdk.sys v1.1.100): Enforced secure opens (closing the LPE) but still allowed arbitrary termination (no PP/PPL level checks).
758-
- Signature evasion: Actors flipped a single byte in the unauthenticated RFC 3161 countersignature inside the WIN_CERTIFICATE. Result: the Microsoft Authenticode chain remains valid, but the file’s SHA‑256 changes, defeating hash‑based driver blocklists.
759-
760-
Operational tradecraft observed (loader)
761-
- Single EXE bundles the vulnerable driver(s) and a downloader module. On modern OS, amsdk.sys loads; on legacy OS, ZAM.exe path is used. The loader persists via services (e.g., Amsdk_Service kernel driver; a misspelled Termaintor service) and drops under C:\\Program Files\\RunTime.
762-
- EDR killer logic: open amsdk device; for each process name in a Base64 list (~192 entries), issue IOCTL_REGISTER_PROCESS → IOCTL_TERMINATE_PROCESS.
763-
764-
Detection ideas
765-
- Monitor creation/start of kernel driver services backed by unusual paths and registry-driven NtLoadDriver flows creating Amsdk_Service; look for user-mode opens of \\.\\amsdk* followed by DeviceIoControl 0x80002010 → 0x80002048.
766-
- Hunt for the suspicious service name "Termaintor" and drops under C:\\Program Files\\RunTime.
767-
- Keep Microsoft’s vulnerable-driver blocklist current and augment with allow/deny lists (WDAC/HVCI/Smart App Control). Track use of new hashes on known signed binaries to catch countersignature tampering.
768-
769-
References and tooling
770-
- LOLDrivers: https://github.com/magicsword-io/LOLDrivers
771-
- Microsoft Vulnerable Driver Blocklist: https://learn.microsoft.com/en-us/windows/security/application-security/application-control/app-control-for-business/design/microsoft-recommended-driver-block-rules
772-
- Terminator (Zemana BYOVD PoC): https://github.com/ZeroMemoryEx/Terminator
773-
- CPR writeup with IOCTLs/PoCs/IOCs: https://research.checkpoint.com/2025/silver-fox-apt-vulnerable-drivers/
774-
775-
718+
### Bypassing Zscaler Client Connector Posture Checks via On-Disk Binary Patching
776719
777720
Zscaler’s **Client Connector** applies device-posture rules locally and relies on Windows RPC to communicate the results to other components. Two weak design choices make a full bypass possible:
778721

0 commit comments

Comments
 (0)