Ransomware
Ransomware Actor Abuses Genshin Impact Anti-Cheat Driver to Kill Antivirus
We investigate mhyprot2.sys, a vulnerable anti-cheat driver for the popular role-playing game Genshin Impact. The driver is currently being abused by a ransomware actor to kill antivirus processes and services for mass-deploying ransomware.
There have already been reports on code-signed rootkits like Netfilter, FiveSys, and Fire Chili. These rootkits are usually signed with stolen certificates or are falsely validated. However, when a legitimate driver is used as a rootkit, that’s a different story. Such is the case of mhyprot2.sys, a vulnerable anti-cheat driver for the popular role-playing game Genshin Impact. The driver is currently being abused by a ransomware actor to kill antivirus processes and services for mass-deploying ransomware. Security teams and defenders should note that mhyprot2.sys can be integrated into any malware.
What we found
During the last week of July 2022, a ransomware infection was triggered in a user environment that had endpoint protection properly configured. Analyzing the sequence, we found that a code-signed driver called “mhyprot2.sys”, which provides the anti-cheat functions for Genshin Impact as a device driver, was being abused to bypass privileges. As a result, commands from kernel mode killed the endpoint protection processes.
As of this writing, the code signing for mhyprot2.sys is still valid. Genshin Impact does not need to be installed on a victim’s device for this to work; the use of this driver is independent of the game.
This ransomware was simply the first instance of malicious activity we noted. The threat actor aimed to deploy ransomware within the victim’s device and then spread the infection. Since mhyprot2.sys can be integrated into any malware, we are continuing investigations to determine the scope of the driver.
Organizations and security teams should be careful because of several factors: the ease of obtaining the mhyprot2.sys module, the versatility of the driver in terms of bypassing privileges, and the existence of well-made proofs of concept (PoCs). All these factors mean that the usage of this driver is likely higher than those of previously discovered rootkits (such as the ones mentioned in the preceding section).
Meanwhile, the timeline and attack sequence of the threat actor’s activities that we present here are noteworthy for security teams. A list of the techniques used in this operation can be found in the MITRE ATT&CK analysis at the end of this article.
Timeline of activities
The earliest evidence of compromise was a secretsdump from an unidentified endpoint of the targeted organization to one of the domain controllers. It was followed by the execution of discovery commands using wmiexec in the context of the built-in domain administrator account. Both secretsdump — which dumps secrets from the remote machine without executing any agent there — and wmiexec — which executes commands remotely through Windows Management Instrumentation (WMI) — are tools from Impacket, a free collection of Python classes for working with network protocols.
Shortly afterward, the threat actor connected to the domain controller via RDP using another compromised administrator account. From there, everything was executed in the context of that user account.
Note: The process rdpclip.exe running under the context of the compromised administrator account was the only destination system artifact supporting the use of RDP toward the domain controller. It facilitates clipboard sharing between RDP sessions.
A malicious file, kill_svc.exe (C:\users\{compromised user}\kill_svc.exe), and mhyprot2.sys (C:\users\{compromised user}\mhyprot2.sys) were transferred to the desktop. This was the first time that the vulnerable driver was seen. The file kill_svc.exe installed the mhyprot2 service and killed antivirus services.
Another malicious file, avg.msi, was transferred to the netlogon share \\{domaincontroller}\NETLOGON\avg.msi. This Windows installer contains avg.exe, a malicious file masquerading as AVG Internet Security, and is responsible for dropping and executing the following:
- logon.bat – A batch file that executes HelpPane.exe, kills antivirus and other services, and executes svchost.exe.
- HelpPane.exe – A malicious file masquerading as Microsoft Help and Support executable; similar to kill_svc.exe, it installs mhyprot2.sys and kills antivirus services.
- mhyprot2.sys – A vulnerable Genshin Impact anti-cheat driver.
- svchost.exe – The ransomware payload.
This also shows that the threat actor intended to mass-deploy the ransomware using the domain controller via startup/logon script.
The Windows installer avg.msi hosted on the netlogon share was deployed to one workstation endpoint via Group Policy Object (GPO). We suspect that this was to test whether deployment via GPO would be successful, but this case resulted in a failure.
Afterward, the threat actor logged in to the workstation from the unidentified endpoint. Both Logon Type 3 (Network Logon) and Logon Type 10 (RemoteInteractive) were observed. The Windows installer avg.msi was manually installed three times, which also resulted in a failure — no encryption. However, it was successful in killing the antivirus services.
Note: The installation of avg.msi might have failed but the product was also no longer working.
The file avg.exe, extracted from avg.msi, was also transferred to the desktop and executed three times. However, in our analysis, we found that this step also did not work even though the antivirus was no longer working. Apparently, using the the .msi or .exe file resulted in the applications’ being stuck.
In an attempt to make things work, the threat actor transferred logon.bat to the desktop and executed it manually. The file logon.bat, supposedly dropped and executed by avg.exe, was used as a standalone.
Surprisingly, executing logon.bat worked and the ransomware svchost.exe began dropping ransom notes and encrypting files. Knowing this, the threat actor hosted three files necessary for mass deployment on a shared folder named “lol”: mhyprot2.sys, kill_svc.exe (for killing antivirus services), and svchost.exe (the ransomware).
A batch file named “b.bat” (C:\Users\{compromised user}\Desktop\b.bat), responsible for copying and executing the files mentioned above, was deployed via PsExec using the credentials of the built-in domain administrator account. It listed target workstations in the file ip.txt.
A closer look at mhyprot2.sys
The driver mhyprot2.sys is loaded by kill_svc.exe/HelpPane.exe using the NtOpenFile function.
After loading mhyprot2.sys, kill_svc.exe/HelpPane.exe checks a list of processes to be terminated.
Afterward, it passes this information to the driver using the DeviceIoControl function.
The control code 0x81034000 is sent to the driver, instructing it to terminate the processes in the list.
The mhyprot2.sys driver that was found in this sequence was the one built in August 2020. Going back to social media streams, we can see that shortly after Genshin Impact was released in September 2020, this module was discussed in the gaming community because it was not removed even after the game was uninstalled and because it allowed bypassing of privileges.
A PoC, provided by user kagurazakasanae, showed that a library terminated 360 Total Security. A more comprehensive PoC, provided by Kento Oki, had the following capabilities:
- Read/Write any kernel memory with privilege of kernel from user mode.
- Read/Write any user memory with privilege of kernel from user mode.
- Enumerate a number of modules by specific process id.
- Get system uptime.
- Enumerate threads in a specific process, allowing reading of the PETHREAD structure in the kernel directly from the command-line interface (CLI).
- Terminate a specific process by process id with ZwTerminateProcess, which calls in the vulnerable driver context (ring-0).
The issue was also reported by Kento Oki to miHoYo, the developer of Genshin Impact, as a vulnerability. Kento Oki’s PoC led to more discussions, but the provider did not acknowledge the issue as a vulnerability and did not provide a fix. Of course, the code-signing certificate is still valid and has not been revoked until now and the digital signature for code signing as a device driver is still valid at this time.
Complications of code signing as a device driver
It is still rare to find a module with code signing as a device driver that can be abused. The point of this case is that a legitimate device driver module with valid code signing has the capability to bypass privileges from user mode to kernel mode. Even if a vendor acknowledges a privilege bypass as a vulnerability and provides a fix, the module cannot be erased once distributed. This file has a code signature for the driver, which allows this module to be loaded in kernel mode. If the signature was signed for a malicious module through private key theft, the certificate can be revoked to invalidate the signature. However, in this case, it is an abuse of a legitimate module. It seems that there is no compromise of the private key, so it is still not known if the certificate will be revoked. It remains valid, at least for now.
As mentioned above, this module is very easy to obtain and will be available to everyone until it is erased from existence. It could remain for a long time as a useful utility for bypassing privileges. Certificate revocation and antivirus detection might help to discourage the abuse, but there are no solutions at this time because it is a legitimate module.
How to counter abuse: monitoring and detection
There are only a limited number of driver files with valid signatures that are expected to have behavior comparable to the privilege bypassing we report here. We recommend that security teams and network defenders monitor the presence of the hash values within their organizations. We have confirmed that privilege bypassing is possible in at least this file:
- mhyprot2.sys (0466e90bf0e83b776ca8716e01d35a8a2e5f96d3)
In addition, we recommend monitoring Windows event logs for the installation of the service corresponding to the driver. If the installation of the service was not intended, compromise is strongly suspected:
- Windows Event Log (System) – 7045: A new service was installed in the system. Service name: mhyprot2.
Recommendations and solutions
Ransomware operators are continuously looking for ways to covertly deploy their malware onto users’ devices. Using popular games or other sources of entertainment is an effective way of baiting victims into downloading dangerous files. It is important for enterprises and organizations to monitor what software is being deployed onto their machines or have the proper solutions in place that can prevent an infection from happening.
Users and organizations can also benefit from security solutions that offer multilayered detection and response such as Trend Micro Vision One™, which has multilayered protection and behavior detection capabilities that help block suspicious behavior and tools before ransomware can do any damage. Trend Micro Apex One™ also provides next-level automated threat detection and response to protect endpoints against advanced issues, like human-operated ransomware.
For more information on the indicators of compromise, download this document.
With additional insights from Nathaniel Gregory Ragasa and Eleazar Valles
MITRE ATT&CK tactics and techniques