### Security # Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer www.bitdefender.com ----- ## Contents Summary ....................................................................................................................................................3 Key Findings ...............................................................................................................................................3 Technical analysis ......................................................................................................................................3 A primer on packers............................................................................................................................................................3 Initial access ........................................................................................................................................................................6 Execution flow .....................................................................................................................................................................7 Command and Control .....................................................................................................................................................18 Impact .................................................................................................................................................................................18 Campaign distribution .............................................................................................................................19 Conclusion ................................................................................................................................................19 Bibliography .............................................................................................................................................20 MITRE techniques breakdown ................................................................................................................20 Indicators of Compromise .......................................................................................................................21 Hashes ................................................................................................................................................................................21 URLs ....................................................................................................................................................................................21Contents Files/Folders dropped ......................................................................................................................................................21 **��������** ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer #### A primer on packers VMProtect [3] and Themida [4] are packers that use a software virtual machine to emulate parts of code on a virtual CPU that has a different instruction set than a conventional CPU. This makes reverse-engineering ��������������������������������������������������� to understand the virtual CPU’s architecture and instruction set [5] and then replace the opcodes with their native counterparts. Only then can an analyst grasp the meaning of the code [6] and bypass the other obfuscation techniques employed by the packer. ������������������������������������������������� of resource consumption and increased time for ���������������������������������������������������� use VMProtect or Themida virtualize only some critical ��������������������������������������������������� ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer parts unvirtualized, in a packed state. From a reverse-engineering perspective, this means that, if we could bypass the ����������������������������������������������������������������������������������������������������������������� process memory during runtime. Going step by step through the code with a debugger and bypassing every check is tedious work. More so, if the debugger detection code is virtualized, then there is no chance of getting through it in a reasonable time. Therefore, we need to rely on our knowledge of how to detect debuggers. To achieve this, we must patch the information in memory and hook all the functions to bypass debugger detection. However, manually adding hooks every time we ������������������������������������������������������������������������������������������������������������������� various anti-anti-debugger techniques. With some luck, the debugged process will run, then we can save its memory ��������������������������������������������������������������������������������������������������������������� ����������������������������������������������������������������������� ���������������������������������������������������������������������������������������������������������������� ������������������������������������������������������������������������������������������������������int3��������� **���������������������������������������������������������������������������** �������������������������������������������������������������������������������������������������������������������� ����������������������������������������������������������������������������������������������������������������� see a big blob of packed code with high entropy and scrambled strings. ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer **�������������������������������������������������������������������������** There are two very useful plugins or scripts that can unpack some Themida versions. These plugins can be loaded ���������������������������������������������������������������������������������������������������������������������� �������������������������������������������������������������������������������������������������������������������� �������������������������������������������������������������������������������������������������������������������� ������������������������������������������������������������������������������������������������������������������ ���������������������������������������������������� ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer **�����������������������������������������������������������������** #### Initial access We noticed in our telemetry that the initial dropper process (msh.exe�����msn.exe��������������������explorer. _exe���������������������������������������������������������������������������������������������������������_ systems. We could not capture any installer for those cracks, but we suspect they delivered the dropper for the cryptocurrency stealer. This technique is very similar to how Redline stealer delivers its payloads through fake cracked software installers [1]. ----- #### �������������� msh.exe/msn.exe Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer **������������������������������** ��������������������������������������������������������������������������\Windows\System32\������������������������ ��������������������������������������������������������������������������������������������������������������������� ������������������������������������������������������������������������������������������������������������������������ �������������������������������������������������������������������������������������������������������������� ���������������������������������������������������������� **Fig.5. Invalid digital signature from Piriform Ltd.** ������������������������������������������������������������������������������������\AppData\Roaming\mscrlib.exe. #### ������������������� ��������������������������������������������������������������������������������������������������������������������� unpacked .NET assembly. The title and Product Name in its version info is BHUNT, so we named it that too. The ����������������������������mscrlib.exe�������������mscorlib.dll, the core library of the .NET framework. ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer **����������������������������������** We have captured more versions of this assembly. Each one contains all the codebase of the malware and the modules embedded in the resources, the difference being that each version calls a subset of the available methods from their main function. This indicates that the malware can be recompiled according to the attacker’s needs. **�����������������������������������������������������������������** ��������������������������������������������������������������������������that can be used by the methods that implement stealing capabilities. ��������������������������������������������������������������������������������������������������� **Fig.8. drp function** **�����������������������������������������������������������������������������������������������������������������** on the system and sends data about the MachineName and the Username to a C2 server, hxxp://minecraftsquid[.] **hopto[.]org/ifo[.]php����������������������������������������������������������������������������������������������������** can access the clipboard by storing and retrieving a hardcoded string. ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer **Fig.9. log function** ����������������������������������������������������������������������������������������������������� **Fig.10. rdr function** **�������������������������������������������������������������������������������������������������������������** www-form-urlencoded. It sends the message received as parameter to the C2 server. While the function waits for response from the server, the contents are not used in any way. ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer **�����������������������������** ����������������������������������������������������������������������������������������������������������������� achieve functionality. #### blackjack ���������������������������������������������������������������������������������������������������������������������� ��������������������������������������������������������������������������wallet.dat in all the subdirectories of \ _AppData\Roaming\���������������������������������������������������seed.seco���������������������������\AppData\_ _Roamin\Electrum\wallets�������������������������������������������������������������������������������������������������_ from the blackjack function. ----- #### ���������� Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer **Fig.12. blackjack function** **���������������������������** This function writes the resource named �����������into \AppData\Roaming\Outllook.exe. Then it launches this process and registers it to automatically start every time the system boots up using the following command line: “cmd /c REG ADD “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /V “Outllook” /t REG_SZ /F /D %appdata%\Outllook.exe” ��������������������������������������������������������������������������������������������������������������� ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer ������������������������������������������������������������������������������������������������������������ decompile it. The resulting assembly is named Hope2 with CompanyName Microsoft. **���������������������������������** It is a Windows Forms application, so we have to check the InitializeComponent method to arrive at its entry point. InitializeComponent creates two timers, Timer1 and Timer2, with Timer2 enabled from the start and ticking every ������������������������������������������������������������ResumeLayout function. **Fig.15. Entry point of Outllook.exe** �������������������������������Form1_Load �������������������������������������������������������������������������������� �����������������������������������������������������������\AppData\Roaming\Scype\��������������������������������� ����������������������������������������������������������������������������������������������������������������������� ����������������������������������������������Timer1.Start() to notify Timer1 to start handling tick events. **Fig.16. Checking presence of Scype folder** For the helper functions, the assembly has a class called update. These functions can interact with registry (regread, _regset������������������������������������������������������������vidcheck���������������������������������min_udp_ for version checking, datadw, download and ������������������������ ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer **Fig.17. Helper functions contained in update class** ����������������������������������������������������������������������������������������������������. This ������������������������������������������������������������������������������AES_Decrypt with the hardcoded password hoeland!a. Unfortunately, at the time of our analysis, Pastebin had already removed the snippet from their �������������������������������������������������������������������������������������������������������������������� saved under the registry key HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Setup, hardcoded in the regset function. **���������������������������������������������������������������** ���������������������������������������������������������������������������������������������������hxxps:// **���������������������������. The decryption password is letit#fly@. This snippet was also deleted from Pastebin,** ��������������������������������������������������������������������������������������������������������������, which downloads them to the folder \AppData\Roaming\Scype���������������������������������������������������������������� ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer **Fig.19. Obtaining further payloads from Pastebin snippet** The Timer1_Tick method is responsible for launching two processes, svx.exe and svc.exe, residing in \AppData\ _Roaming\Scype. This is achieved by calling the min function that will start the new processes with hidden windows to_ remain stealthy. **�����������������������������������������������** The Timer1_Tick ��������������������������������������������������������������������������������������������������������� always runs the latest version of them. ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer **Fig.21. Timer1_Tick function** _Timer2_Tick ��������������������������������������������������������������������������������������������������_ **Fig.22. Timer2_Tick function** �����������������������������������������������������������������������������������������������������������svc.exe and svx.exe. ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer #### ������� ���������������������������������������������������������������������������������������������������������������������� ���������������������������������������������������� instances with taskkill.exe. **��������������������������������** ������������������������������������������������������������������������������������������������������������������������ passwords, and uploads them to the C2 server as well. It kills all chrome.exe instances with taskkill.exe. **�������������������������������** If any of these two operations succeeded, then the flag variable is set to true, in which case the function writes the resource named ��������to �������������������������������������������������chaos_crew, it starts the process and ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer �������������������������������������������������������������������������������������� ������������������������������������������� �������������������������������������������������������������������������������������������������������������� ����������������������������������������������������������������������������������������������������������������������� passphrases. It achieves this by periodically reading the contents of the clipboard and checking if the obtained string contains 12 or 13 words separated by spaces. Cryptocurrency wallets use these kinds of strong passphrases consisting of multiple words. These passphrases are very hard to brute-force but they are inconvenient to type in, so ��������������������������������������������������������������������������������������������������������� **���������������������������������������������������** #### mrpropper The function mrpropper writes the resource with the same name to \AppData\Roaming\taskui.exe and starts it with ������������������������������������\AppData\Roaming\mscrlib.exe���������������������� **Fig.26. mrpropper function** ����������������������������������������������������������������������������������������������������������������� ������������������������������������������������������������������������������������������� ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer **��������������������������������** #### ������������� This function writes the resource named ��������to ����������������������������� runs it with the command line \ _AppData\Roaming\bonanza.exe /stext \AppData\Roaming\bonanza and uploads the output to the C2 server._ **������������������������������** ������������������������������������������������������������������������������������������������������������������ ���������������������������������������������������������������������������������������������������������������������� ����������������������������������������������������������������������������������Sweet_Bonanza. #### Command and Control �������������������������������hxxp://minecraftsquid[.]hopto[.]org/ifo[.]php������������������������������������������ can point a domain name to changing IP addresses. This way we cannot obtain the IP address of the server to which ������������������������������������������������������������������������������������������������������������������ ����������������������������������������������������������������������������������������������������������������� ����������������������������������������� ��������������������������������������������������������������������������������������������������������������� ���������������������������������������������������������������������������������������������������������� snippets were taken down by Pastebin and we found no version of the malware that would use other locations for ����������� #### Impact The malware can steal cryptocurrency wallet information for the following services: � ������ � Electrum � ������ � Ethereum � Bitcoin � �������� ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer ������������������������������������������������������������������������������������������������������������� ������������������������������������������������������������������������������������������������������� #### Privacy Impact While the malware primarily focuses on stealing information related to cryptocurrency wallets, it can also harvest passwords and cookies stored in browser caches. This might include account passwords for social media, banking, etc. that might even result in an online identity takeover. ## Campaign distribution �������������������������������������������������������������������������������������������������������������������� users who are more likely to have cryptocurrency wallet software installed on their systems. This target group is also more likely to install cracks for operating system software, which we suspect is the main infection source. **Fig.29. Campaign distribution** ## Conclusion ��������������������������������������������������������������������������������������������������������������� ������������������������������������������������������������������������������������������������������������������������� We described how we managed to unpack the components, even if they used Themida. By reverse-engineering �������������������������������������������������������������������������������������������������������������� �������������������������������������������������������������� The most effective way to defend against this threat is to avoid installing software from untrusted sources and to ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer ## ������������ [����https://redcanary.com/blog/kmspico-cryptbot/](https://redcanary.com/blog/kmspico-cryptbot/) [[2] https://unit42.paloaltonetworks.com/westeal/](https://unit42.paloaltonetworks.com/westeal/) [����https://vmpsoft.com/](https://vmpsoft.com/) [����https://www.oreans.com/Themida.php](https://www.oreans.com/Themida.php) [����https://back.engineering/17/05/2021/](https://back.engineering/17/05/2021/) [����https://back.engineering/21/06/2021/](https://back.engineering/21/06/2021/) [����������������������������������������](https://github.com/x64dbg/ScyllaHide) [����https://github.com/NtQuery/Scylla](https://github.com/NtQuery/Scylla) [��������������������������������������������������������������������������������������������������������](https://github.com/inc0d3/malware/blob/master/tools/unpacker/themida-2.x/Themida%20-%20Winlicense%20Ultra%20Unpacker%201.4.txt) [��������������������������](https://github.com/inc0d3/malware/blob/master/tools/unpacker/themida-2.x/Themida%20-%20Winlicense%20Ultra%20Unpacker%201.4.txt) [��������������������������������������������������������������������������](https://github.com/epsylon3/odbgscript/blob/master/doc/ODbgScript.txt) [�����https://github.com/VenTaz/Themidie](https://github.com/VenTaz/Themidie) [[12] �������������������������������������������������������](https://www.nirsoft.net/utils/web_browser_password.html) ## �������������������������� **Credential** **Command** **Execution** **Persistence** **���������������** **���������** **Collection** **�����������** **Access** **and Control** [Masquerading:](https://attack.mitre.org/techniques/T1036/001/) [Invalid Code](https://attack.mitre.org/techniques/T1036/001/) [Signature](https://attack.mitre.org/techniques/T1036/001/) [������������](https://attack.mitre.org/techniques/T1140/) [����������������](https://attack.mitre.org/techniques/T1140/) [Information](https://attack.mitre.org/techniques/T1140/) [����������������](https://attack.mitre.org/techniques/T1564/001/) [Hidden Files and](https://attack.mitre.org/techniques/T1564/001/) [�����������](https://attack.mitre.org/techniques/T1564/001/) [Indicator Removal](https://attack.mitre.org/techniques/T1070/004/) [on Host: File](https://attack.mitre.org/techniques/T1070/004/) [��������](https://attack.mitre.org/techniques/T1070/004/) [���������������������](https://attack.mitre.org/techniques/T1020/) [��������������������](https://attack.mitre.org/techniques/T1041/) [Channel](https://attack.mitre.org/techniques/T1041/) [User](https://attack.mitre.org/techniques/T1204/002/) [�����������](https://attack.mitre.org/techniques/T1204/002/) [Malicious](https://attack.mitre.org/techniques/T1204/002/) [File](https://attack.mitre.org/techniques/T1204/002/) [Boot or](https://attack.mitre.org/techniques/T1547/001/) [������](https://attack.mitre.org/techniques/T1547/001/) [����������](https://attack.mitre.org/techniques/T1547/001/) [�����������](https://attack.mitre.org/techniques/T1547/001/) [Registry](https://attack.mitre.org/techniques/T1547/001/) [Run Keys](https://attack.mitre.org/techniques/T1547/001/) [/ Startup](https://attack.mitre.org/techniques/T1547/001/) [Folder](https://attack.mitre.org/techniques/T1547/001/) [Credentials](https://attack.mitre.org/techniques/T1555/003/) [from](https://attack.mitre.org/techniques/T1555/003/) [Password](https://attack.mitre.org/techniques/T1555/003/) [Stores:](https://attack.mitre.org/techniques/T1555/003/) [Credentials](https://attack.mitre.org/techniques/T1555/003/) [from Web](https://attack.mitre.org/techniques/T1555/003/) [Browsers](https://attack.mitre.org/techniques/T1555/003/) [File and](https://attack.mitre.org/techniques/T1083/) [����������](https://attack.mitre.org/techniques/T1083/) [���������](https://attack.mitre.org/techniques/T1083/) [Clipboard](https://attack.mitre.org/techniques/T1115/) [����](https://attack.mitre.org/techniques/T1115/) [����������](https://attack.mitre.org/techniques/T1005/) [������](https://attack.mitre.org/techniques/T1005/) [System](https://attack.mitre.org/techniques/T1005/) [������������](https://attack.mitre.org/techniques/T1071/001/) [������](https://attack.mitre.org/techniques/T1071/001/) [Protocol:](https://attack.mitre.org/techniques/T1071/001/) [Web](https://attack.mitre.org/techniques/T1071/001/) [Protocols](https://attack.mitre.org/techniques/T1071/001/) ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer ## Indicators of Compromise #### Hashes msh.exe/msn.exe �������������������������������� 4d4a0052d093cc743db0776e04f7e449 �������������������������������� �������������������������������� �������������������������������� �������������������������������� �������������������������������� 4d4a0052d093cc743db0776e04f7e449 �������������������������������� �������������������������������� �������������������������������� �������������������������������� #### mscrlib.exe �������������������������������� �������������������������������� �������������������������������� �������������������������������� #### outllook.exe �������������������������������� #### taskui.exe ��������������������������������������������������������������� the command line, which is not a malicious action on its own. �������������������������������� #### ����������� �������������������������������� #### ���� ��������������������������������������������� ����������������������������������� ����������������������������������� #### Files/Folders dropped _\AppData\Roaming\Outllook.exe_ _�����������������������������_ _\AppData\Roaming\taskui.exe_ _\AppData\Roaming\bonanza.exe_ _\AppData\Roaming\Scype\_ ----- Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer ----- #### Proudly Serving Our Customers �������������������������������������������� Bitdefender provides solutions and services for small business and A channel-exclusive vendor, Bitdefender is proud to share success with tens of medium enterprises, service providers and technology integrators. We take thousands of resellers and distributors worldwide. pride in the trust that enterprises such as ��������������������������� **���������������nce or Safe Systems place in us.** _CRN 5-Star Partner, 4th Year in a Row. Recognized on CRN’s Security 100 List. CRN Cloud_ _Partner, 2nd year in a Row_ _Leader in Forrester’s inaugural Wave™ for Cloud Workload Security_ _More MSP-integrated solutions than any other security vendor_ _NSS Labs “Recommended” Rating in the NSS Labs AEP Group Test_ _3 Bitdefender Partner Programs - to enable all our partners – resellers, service providers_ _SC Media Industry Innovator Award for Hypervisor Introspection, 2nd Year in_ _and hybrid partners – to focus on selling Bitdefender solutions that match their own_ _a Row_ _specializations_ _Gartner® Representative Vendor of Cloud-Workload Protection Platforms_ #### Trusted Security Authority Bitdefender is a proud technology alliance partner to major virtualization vendors, directly contributing to the development of secure ecosystems with **�����������������������������������������������������������������������** Through its leading forensics team, Bitdefender is also actively engaged in countering international cybercrime together with major law enforcement agencies such as FBI and Europol, in initiatives such as NoMoreRansom and TechAccord, as well as the takedown of black markets such as Hansa. Starting in 2019, Bitdefender is also a proudly appointed CVE Numbering Authority in MITRE Partnership. **��������������������������������������������������������������������** **��������������������** **UNDER THE SIGN OF THE WOLF** **Founded 2001, Romania** A trade of brilliance, data security is an industry where only the clearest view, sharpest mind and deepest insight can **Number of employees 1800+** win — a game with zero margin of error. Our job is to win every single time, one thousand times out of one thousand, and one million times out of one million. **Headquarters** Enterprise HQ – Santa Clara, CA, United States And we do. We outsmart the industry not only by having the clearest view, the sharpest mind and the deepest insight, Technology HQ – Bucharest, Romania but by staying one step ahead of everybody else, be they black hats or fellow security experts. The brilliance of our collective mind is like a luminous Dragon-Wolf on your side, powered by engineered intuition, created to guard against all dangers hidden in the arcane intricacies of the digital realm. **WORLDWIDE OFFICES** **USA & Canada: Ft. Lauderdale, FL | Santa Clara, CA | San Antonio, TX |** Toronto, CA This brilliance is our superpower and we put it at the core of all our game-changing products and solutions. **Europe: Copenhagen, DENMARK | Paris, FRANCE | München, GERMANY** | Milan, ITALY | Bucharest, Iasi, Cluj, Timisoara, ROMANIA | Barcelona, SPAIN | Dubai, UAE | London, UK | Hague, NETHERLANDS -----