Trustwave SpiderLabs Security Advisory TWSL2017-016: Local kernel heap buffer overflow Vulnerability in ESET DESLock+ client application Published: 08/15/2017 Version: 1.0 Vendor: DESlock (http://www.deslock.com/) Product: DESLock+ client Version affected: <= 4.8.16 Product description: DESlock+ Standard/Pro client applications provide comprehensive encryption of email, file & folder encryption and policy driven removable media encryption protection for USB flash drives and other removable storage. Finding 1: Local kernel heap buffer overflow *****Credit: Neil Kettle of Trustwave CVE: CVE-2017-12840 CWE: CWE-122 A kernel driver, namely DLMFENC.sys, bundled with the DESLock+ client application contains a locally exploitable heap based buffer overflow in the handling of an IOCTL message of type 0x0FA4204. The vulnerability is present due to the kernel driver failing to allocate sufficient memory on the kernel heap to contain a user supplied string as such the string is copied into a buffer of constant size (0x1000-bytes) and thus an overflow condition results. Access to the kernel driver is permitted through an obfuscated interface whereby bytes of user supplied message are ‘authenticated’ via an obfuscation routine employing a linear equation as follows: static void xor_mask_req (struct ioctl_req *req, UCHAR *xor_buf) { DWORD i, pid; PCHAR ptr; pid = GetCurrentProcessId (); for (i = 0, ptr = (PCHAR) req; i < 0x0C; i++, ptr++) *ptr ^= xor_buf[i & 0x0F] ^ pid; } The contents of ‘xor_buf’ are obtained from the kernel driver and are set as the obfuscated output of a call to KeQueryPerformanceCounter. Exploitation of the issue is possible locally and yields arbitrary code code execution with ring 0 privileges. Remediation Steps: Fixes for this vulnerability were released in DESLock+ client 4.8.17. Please note that Trustwave SpiderLabs have not verified this fix. Revision History: 05/30/2017 - Vulnerability disclosed 08/03/2017 - Patch released by vendor 08/15/2017 - Advisory published References 1. https://www.deslock.com/downloads.php About Trustwave: Trustwave is the leading provider of on-demand and subscription-based information security and payment card industry compliance management solutions to businesses and government entities throughout the world. For organizations faced with today's challenging data security and compliance environment, Trustwave provides a unique approach with comprehensive solutions that include its flagship TrustKeeper compliance management software and other proprietary security solutions. Trustwave has helped thousands of organizations--ranging from Fortune 500 businesses and large financial institutions to small and medium-sized retailers--manage compliance and secure their network infrastructure, data communications and critical information assets. Trustwave is headquartered in Chicago with offices throughout North America, South America, Europe, Africa, China and Australia. For more information, visit https://www.trustwave.com About Trustwave SpiderLabs: SpiderLabs(R) is the advanced security team at Trustwave focused on application security, incident response, penetration testing, physical security and security research. The team has performed over a thousand incident investigations, thousands of penetration tests and hundreds of application security tests globally. In addition, the SpiderLabs Research team provides intelligence through bleeding-edge research and proof of concept tool development to enhance Trustwave's products and services. https://www.trustwave.com/spiderlabs Disclaimer: The information provided in this advisory is provided "as is" without warranty of any kind. Trustwave disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Trustwave or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Trustwave or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.