Dangerous 3rd-party drivers on your system or LOLDrivers







Did you know that a completely legitimate driver can give an attacker the opportunity to register in your system for a long time, remaining inside even after reinstalling it? Or turn your computer into a brick? For example, some seemingly harmless trusted (signed) drivers are incidentally tools for overwriting the BIOS. After such an attack, only the programmer will save.







In Windows, there are trusted applications / scripts / libraries with additional interesting dangerous functionality like executing arbitrary code, downloading files, bypassing UAC, etc. If such additional functionality is found in a kernel component, it becomes even more interesting.







Starting with Windows Vista x64, the Driver Signature Enforcement (DSE) policy applies - all kernel-level drivers must be signed. If an attacker (with user / administrator rights) after penetrating the system wants to get the maximum level of access (install kernel rootkit / bootkit / SMM-rootkit / BIOS-rootkit), he will have to somehow bypass the signature requirement for the driver. The ability to call some functions or instructions from kernel mode in kernel mode can give an attacker a tool to elevate privileges, disclose information or cause a denial of service. We call this functionality a dual-purpose functionality (in some cases, this may be called vulnerabilities or backdoors, however, the discussion on the correct definition is beyond the scope of this article).







DSE workarounds



Let's look at what options an attacker generally has to bypass DSE (you must somehow penetrate ring0). The table below summarizes the ways to bypass DSE with their advantages and disadvantages (for the attacker, and security guards take note). It is worth noting that this information applies to Windows x64, starting with Vista.







Way Benefits disadvantages
Setting Boot Configuration Data (Test Mode) Simplicity
  • It doesn’t work for all applications.
  • A watermark appears on the desktop
  • Reboot required
Using a compromised private key Ability to install any driver
  • If a leak is detected, the certificate is added to the Certificate Revocation List (CRL)
Using Vulnerability in Implementing DSE Control Not detected by Windows antivirus and security systems
  • Difficulty finding such vulnerabilities
  • OS version dependent
Modification of driver checking mechanisms (bootmgr, winload.exe, winresume.exe, ci.dll) Ability to install any driver without OC checks
  • Modification complexity
  • Requires a way to bypass Secure Boot (if enabled)
  • Reboot required
  • OS version dependent
  • Other file controls
Using a signed driver with vulnerability Attack detection difficulty
  • Difficulty finding such vulnerabilities
  • Detection Security Lock
Using a signed driver with dual-purpose functionality Not detected by Windows antivirus and security systems
  • The complexity of the search (for an attacker) of a driver with the required dual-purpose functionality


As you can see from the table, a signed driver with dual-purpose functionality is the most attractive way to bypass DSE for an attacker.







Dangerous or dual purpose functionality



Let's look at examples of malicious capabilities that an attacker appears in the presence of a driver with dangerous dual-purpose functions.











If we analyze various articles and notes about CVE, we can distinguish some classification of potentially dangerous functions when accessing from ring3 functions in drivers. The table below lists the hazardous functions and sources of information about them.







Identified Hazardous Functions Sources of information on security practices
Read / write MSR registers CVE-2018-10711, CVE-2018-18535, CVE-2018-19323, CVE-2007-5633, CVE-2007-5761
Read / Write I / O Ports CVE-2018-10712, CVE-2018-18536, CVE-2018-19322
Read / Write Physical Memory CVE-2018-16712, CVE-2018-10710, CVE-2017-15302, CVE-2017-15303, CVE-2018-19321
Read / write control registers CVE-2018-10709, Eset - Windows exploitation in 2016
Access Performance / Clock Counters Leif Uhsadel, Andy Georges, Ingrid Verbauwhed - Exploiting Hardware Performance Counters
Read / write flag register Wojtczuk R., Rutkowska J. Following the White Rabbit: Software attacks against Intel VT-d technolog
Cache access instructions Cache-Based Side-Channel Attacks Detection through Intel Cache Monitoring Technology and Hardware Performance Counters


And this is not the whole list of possible dangerous functions. You can also talk about reading / writing kernel virtual memory, reading / writing MMIO, access to PCI devices, etc.







The first three functions are of the greatest interest, as well as the greatest danger (and the most likely to detect a driver with such functions): read / write MSR registers, read / write I / O ports, read / write physical memory. Using control registers, you can bypass some protection mechanisms, writing to the flag register allows you to enable read / write input / output ports in ring3 (by the way, it is mentioned in this article on Habré), the success of attacks on third-party channels (by accessing the cache, monitoring counters performance / cycles) is most likely unlikely.







In the process of creating this material at the DEFCON 27 conference in Las Vegas, researchers Jesse Michael and Mickey Shkatov presented the work “Get off the kernel if you cant drive” , which also discusses this problem, and we recommend that you study this material to complete the picture. The scenarios for using such drivers are very simple and clear, and examples of code sections responsible for the most critical functionality are presented. And also provides code for working and finding similar drivers.







In general, it is worth noting that this topic has long been concerned about security researchers. Back in 2018, researcher Alexander Matrosov in his article "What makes OS drivers dangerous for BIOS?" raised this question and demonstrated how simple it is to exploit BIOS.







Dual-Function Drivers



Below are the most famous representatives of drivers with dual-purpose functions.









Usually, the described dangerous functions are recognized as vulnerabilities if the driver is accessible to the user without administrator rights (incorrect ACL) or when it allows executing arbitrary code directly (as in bandainamcoonline.sys). In other cases, this is just functionality, and since the user has administrator rights, he can use all the driver functions and this is the norm.







If you think that there are no more than a dozen such drivers, then you are greatly mistaken. You can see this selection of interesting drivers. This list contains drivers from ASUS, AVAST, Razer, LG, American Megatrends and other well-known companies. So there are a lot of them, you just need to search. So, they pose a real threat.







This threat is also understood by Microsoft employees. And they will be grateful for information about such drivers;)

image







Recommendations



For users:









Manufacturers are better off not signing such drivers. If the user needs to update the BIOS, check the system for vulnerabilities (hi, chipsec), measure the performance or perform some other manipulations that require the installation of such drivers, then he may well go into Test Mode, do all this, and then exit. Usability will then fall, but security will increase.







findings



If something is signed, then you can’t trust this anyway. Firstly, you can sign something like that, and secondly, an attacker can take advantage of this signed one (even if it is from a trusted manufacturer).







Information security specialists should not exclude from the threat model situations where an attacker requires a driver with dangerous functionality to perform an attack. There are enough drivers like that, it's quite simple to do. If the attack is not carried out with such a pop driver as RwEverything, but with some less widely known one, then it will be even more difficult to detect. So you need to be on the alert, monitor such things and not allow each driver to boot into the system.







Author: Elizaveta Khomenko








All Articles