CVE-2021-31728 Overview
CVE-2021-31728 is a privilege escalation vulnerability affecting MalwareFox AntiMalware version 2.74.0.150. The vulnerability stems from incorrect access control in the zam64.sys and zam32.sys kernel drivers, allowing a non-privileged process to open a handle to \\.\ZemanaAntiMalware and ultimately execute arbitrary code at ring 0 (kernel level). This grants attackers the ability to escalate privileges from a standard user to SYSTEM-level access.
Critical Impact
Non-privileged users can achieve kernel-level code execution through a series of IOCTL calls, enabling complete system compromise and privilege escalation to SYSTEM.
Affected Products
- MalwareFox AntiMalware version 2.74.0.150
- Driver components: zam64.sys (64-bit) and zam32.sys (32-bit)
- Windows systems running the affected MalwareFox AntiMalware software
Discovery Timeline
- 2021-05-17 - CVE-2021-31728 published to NVD
- 2024-11-21 - Last updated in NVD database
Technical Details for CVE-2021-31728
Vulnerability Analysis
This vulnerability represents a critical flaw in how the MalwareFox AntiMalware kernel drivers handle access control and memory management. The attack chain involves multiple stages that exploit different weaknesses in the driver's IOCTL interface. A non-privileged process can communicate directly with the kernel driver through the exposed device object \\.\ZemanaAntiMalware, which lacks proper access control restrictions.
The exploitation flow leverages four specific IOCTL codes in sequence: first registering with the driver using IOCTL 0x80002010, then allocating executable memory through a flaw in IOCTL 0x80002040, installing a hook via IOCTL 0x80002044, and finally triggering code execution using IOCTL 0x80002014 or 0x80002018. This chain allows arbitrary code to run in ring 0 context within the driver's execution space.
Root Cause
The root cause is improper access control implementation in the Zemana-based kernel drivers (zam64.sys/zam32.sys) used by MalwareFox AntiMalware. The drivers fail to validate the privilege level of processes attempting to interact with the device object and do not properly restrict which IOCTL operations can be performed by unprivileged callers. Additionally, the driver contains a memory allocation flaw that allows executable memory to be created and controlled by usermode processes, violating fundamental kernel security principles.
Attack Vector
The attack vector is local, requiring the attacker to have code execution on the target system as a non-privileged user. The exploitation sequence proceeds as follows:
- Device Handle Acquisition: The attacker opens a handle to \\.\ZemanaAntiMalware without requiring elevated privileges
- Driver Registration: Send IOCTL 0x80002010 to register the attacking process with the driver
- Memory Allocation: Exploit the flaw in IOCTL 0x80002040 to allocate executable memory in kernel space
- Hook Installation: Use IOCTL 0x80002044 to install a malicious hook pointing to the allocated executable memory
- Code Execution: Trigger the hook via IOCTL 0x80002014 or 0x80002018, executing shellcode at ring 0
The vulnerability is particularly dangerous because it converts any local code execution capability into full kernel-level access, bypassing all operating system security controls. Technical details and proof-of-concept information can be found in the GitHub PoC for CVE-2021-31728.
Detection Methods for CVE-2021-31728
Indicators of Compromise
- Unusual processes opening handles to \\.\ZemanaAntiMalware device object
- Non-privileged processes sending IOCTL requests to zam64.sys or zam32.sys drivers
- Suspicious memory allocation patterns originating from Zemana driver context
- Kernel-mode code execution from unexpected memory regions
Detection Strategies
- Monitor for processes attempting to communicate with the \\.\ZemanaAntiMalware device object using Windows kernel callback mechanisms
- Implement driver load monitoring to detect vulnerable versions of zam64.sys and zam32.sys
- Deploy endpoint detection rules that flag DeviceIoControl calls targeting Zemana drivers from non-security processes
- Use behavioral analysis to detect privilege escalation patterns following interaction with security software drivers
Monitoring Recommendations
- Enable Windows Security Event logging for kernel driver interactions and privilege changes
- Configure SentinelOne's Singularity Platform to monitor for suspicious IOCTL activity and driver exploitation attempts
- Audit installed security software versions and driver components for vulnerable releases
- Monitor for unexpected SYSTEM-level process creation following execution of low-privileged applications
How to Mitigate CVE-2021-31728
Immediate Actions Required
- Update MalwareFox AntiMalware to the latest version that addresses the access control vulnerabilities
- Consider temporarily removing or disabling MalwareFox AntiMalware 2.74.0.150 if no patch is immediately available
- Restrict local access to systems running the vulnerable software to trusted users only
- Monitor systems for signs of exploitation while awaiting patch deployment
Patch Information
Users should contact MalwareFox for updated software that addresses the access control issues in the zam64.sys and zam32.sys drivers. The GitHub PoC repository provides technical details about the vulnerability. Organizations should verify that updated driver versions properly implement privilege checking before allowing IOCTL operations.
Workarounds
- Restrict user account privileges to limit the pool of potential attackers who could exploit this vulnerability
- Implement application control policies to prevent unauthorized executables from running on systems with the vulnerable driver
- Consider deploying additional endpoint protection solutions alongside MalwareFox until the vulnerability is patched
- Use Windows Defender Credential Guard and other virtualization-based security features to limit the impact of kernel-mode exploits
# Verify installed MalwareFox driver versions
driverquery /v | findstr /i "zam"
# Check for vulnerable driver files
dir /s C:\Windows\System32\drivers\zam*.sys
# Review driver version information
sigcheck -nobanner C:\Windows\System32\drivers\zam64.sys
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


