Gootkit: Unveiling the Hidden Link with AZORult

Original Post from Security Affairs
Author: Pierluigi Paganini

Cybaze-Yoroi ZLAB revealed interesting a hidden connection between the AZORult toolkit and specific Gootkit payload.

Introduction

In the last days, a huge attack campaign hit several organizations across the Italian cyberspace, as stated on bulletin N020219 the attack waves tried to impersonate legit communication from a known Express Courier. However, a deeper analysis by Cybaze-Yoroi ZLAB revealed interesting hidden aspects, spotting a connection between the AZORult toolkit and a particular Gootkitpayload.

Technical analysis

Stage 1 – The Attached Javascript

Most of the infection attempts started with a particular email attachment: a compressed archive containing stealthy JavaScript code, most of the times able to avoid antivirus detection during the initial stages of the attack campaigns.

Hash 12791e14ba82d36d434e7c7c0b81c7975ce802a430724f134b7e0cce5a7bb185
Threat malicious js
Desc Obfuscated malicious JS. This download first component and keep communication with C2 server.

Table 1:  Generic information about malicious js file

This JS file is an obfuscated dropper with the purpose to download another component from a “safe” remote location:

Figure 1: Snippet from the JavaScript attachment

It contacts two distinct servers, googodsgld.]com and driverconnectsearch.]info. The behaviour of this sort of JavaScript stager is as essential as interesting: it downloads other executable code able to virtually do anything the attacker wants. This kind of pattern and the simplicity of the code itself remotely resemble the Brushaloader threat, a known dropper/stager written in VBScript and contacting its remote infrastructures in a similar manner. We can hypothesize that the malware writers may have emulated the Brushaloader stager functionalities, creating a sort of custom version exploiting the same mechanism.

Figure 2: Classic Brushaloader sample (left) along with the recent Javascript stager (right)
Figure 3: Encrypted communication with driverconnectsearch[.]info server

After the first contact attempt to googodsgld[.]com, the script communicates with the other destination and retrieves a Cabinet Archive encoded within the chunk of executable javascript code returned by driverconnectsearch[.]info. Then it stores it in “%APPDATA%LocalTemp”.  

As shown in Figure 3,  the first characters of the encoded payload string are “TVNDRg” which translates to “MSCF”: standard header of the Microsoft Cabinet compressed file format.

Figure 4: Javascript downloaded from diverconnectsearch[.]info server.

Stage 2 – The Cabinet

Actually, this .CAB archive is just a shell for a PE32 executable file: 

Hash 2274174ed24425f41362aa207168b491e6fb55cab208116070f91c049946097a
Threat RuntimeBroker5.exe
Desc First component downloaded by malicious js file.

Table 2:  Generic information about RuntimeBroker5.exe (AZORult)

Executing the RuntimeBroker5.exe sample, seems it behaves as another dropper: it downloads two other components from the remote server “hairpd[.]com”.

Figure 5: RuntimeBroker5.exe process execution

The sample file actually does not perform only this downlaod. Here one of the key point of the article: it also establishes a communication channel with the AZORult C2 host “ssl.]admin.]itybuy.]it”.

The network packet exchanged with the server confirms this identification due to the known communication patterns and the dynamic analysis also shows info-stealing behaviours compatible with the identified threat. 

As shown in the following figure, the written files in “%APPDATA%LocalTemp” path closely match AZORult analysis described by Unit42 research group.

Figure 6: Evidence of the similarity of RuntimeBroker5.exe and AZORult malware variant analyzed by UNIT42
Figure 7: C2 Communication comparison

During the dynamic analysis, the RuntimeBroker5.exe sample received a sort of configuration file from the C2 server. We extracted it from the running malware image and decoded it:

  1. firefox.exe
  2. SOFTWAREWow6432NodeMozillaMozilla Firefox
  3. SOFTWAREMozillaMozilla Firefox
  4. SOFTWAREClientsStartMenuInternetFIREFOX.EXEshellopencommand
  5. SOFTWAREMicrosoftWindowsCurrentVersionApp Pathsfirefox.exe
  6. %appdata%MozillaFirefoxProfiles
  7. MozillaFireFox
  8. CurrentVersion
  9. Install_Directory
  10. nss3.dll
  11. thunderbird.exe
  12. SOFTWAREWow6432NodeMozillaMozilla Thunderbird
  13. SOFTWAREMozillaMozilla Thunderbird
  14. SOFTWAREClassesThunderbirdEMLDefaultIcon
  15. %appdata%ThunderbirdProfiles
  16. ThunderBird
  17. SELECT host, path, isSecure, expiry, name, value FROM moz_cookies
  18. SELECT fieldname, value FROM moz_formhistory
  19. NSS_Init
  20. PK11_GetInternalKeySlot
  21. PK11_Authenticate
  22. PK11SDR_Decrypt
  23. NSS_Shutdown
  24. PK11_FreeSlot
  25. logins.json
  26. logins
  27. hostname
  28. timesUsed
  29. encryptedUsername
  30. encryptedPassword
  31. cookies.sqlite
  32. formhistory.sqlite
  33. %LOCALAPPDATA%GoogleChromeUser Data
  34. %LOCALAPPDATA%GoogleChrome SxSUser Data
  35. %LOCALAPPDATA%XpomUser Data
  36. %LOCALAPPDATA%YandexYandexBrowserUser Data
  37. %LOCALAPPDATA%ComodoDragonUser Data
  38. %LOCALAPPDATA%AmigoUser Data
  39. %LOCALAPPDATA%OrbitumUser Data
  40. %LOCALAPPDATA%BromiumUser Data
  41. %LOCALAPPDATA%ChromiumUser Data
  42. %LOCALAPPDATA%NichromeUser Data
  43. %LOCALAPPDATA%RockMeltUser Data
  44. %LOCALAPPDATA%360BrowserBrowserUser Data
  45. %LOCALAPPDATA%VivaldiUser Data
  46. %APPDATA%Opera Software
  47. %LOCALAPPDATA%Go!User Data
  48. %LOCALAPPDATA%SputnikSputnikUser Data
  49. %LOCALAPPDATA%KometaUser Data
  50. %LOCALAPPDATA%uCozMediaUranUser Data
  51. %LOCALAPPDATA%QIP SurfUser Data
  52. %LOCALAPPDATA%Epic Privacy BrowserUser Data
  53. %APPDATA%brave
  54. %LOCALAPPDATA%CocCocBrowserUser Data
  55. %LOCALAPPDATA%CentBrowserUser Data
  56. %LOCALAPPDATA%7Star7StarUser Data
  57. %LOCALAPPDATA%Elements BrowserUser Data
  58. %LOCALAPPDATA%TorBroProfile
  59. %LOCALAPPDATA%SuhbaUser Data
  60. %LOCALAPPDATA%Safer TechnologiesSecure BrowserUser Data
  61. %LOCALAPPDATA%RafotechMustangUser Data
  62. %LOCALAPPDATA%SuperbirdUser Data
  63. %LOCALAPPDATA%ChedotUser Data
  64. %LOCALAPPDATA%TorchUser Data
  65. GoogleChrome
  66. GoogleChrome64
  67. InternetMailRu
  68. YandexBrowser
  69. ComodoDragon
  70. Amigo
  71. Orbitum
  72. Bromium
  73. Chromium
  74. Nichrome
  75. RockMelt
  76. 360Browser
  77. Vivaldi
  78. Opera
  79. GoBrowser
  80. Sputnik
  81. Kometa
  82. Uran
  83. QIPSurf
  84. Epic
  85. Brave
  86. CocCoc
  87. CentBrowser
  88. 7Star
  89. ElementsBrowser
  90. TorBro
  91. Suhba
  92. SaferBrowser
  93. Mustang
  94. Superbird
  95. Chedot
  96. Torch
  97. Login Data
  98. Web Data
  99. SELECT origin_url, username_value, password_value FROM logins
  100. SELECT host_key, name, encrypted_value, value, path, secure, (expires_utc/1000000)-11644473600 FROM cookies
  101. SELECT host_key, name, name, value, path, secure, expires_utc FROM cookies
  102. SELECT name, value FROM autofill
  103. SELECT name_on_card, expiration_month, expiration_year, card_number_encrypted value FROM credit_cards
  104. %APPDATA%MicrosoftWindowsCookies
  105. %APPDATA%MicrosoftWindowsCookiesLow
  106. %LOCALAPPDATA%MicrosoftWindowsINetCache
  107. %LOCALAPPDATA%PackagesMicrosoft.MicrosoftEdge_8wekyb3d8bbweACINetCookies
  108. %LOCALAPPDATA%PackagesMicrosoft.MicrosoftEdge_8wekyb3d8bbweAC#!001MicrosoftEdgeCookies
  109. %LOCALAPPDATA%PackagesMicrosoft.MicrosoftEdge_8wekyb3d8bbweAC#!002MicrosoftEdgeCookies
  110. %LOCALAPPDATA%PackagesMicrosoft.MicrosoftEdge_8wekyb3d8bbweACMicrosoftEdgeCookies
  111. InternetExplorer
  112. InternetExplorerLow
  113. InternetExplorerINetCache
  114. MicrosoftEdge_AC_INetCookies
  115. MicrosoftEdge_AC_001
  116. MicrosoftEdge_AC_002
  117. MicrosoftEdge_AC
  118. SoftwareMicrosoftInternet Explorer
  119. SoftwareMicrosoftInternet ExplorerIntelliFormsStorage2
  120. SoftwareMicrosoftWindows NTCurrentVersionWindows Messaging SubsystemProfilesOutlook
  121. SoftwareMicrosoftOffice15.0OutlookProfilesOutlook
  122. SoftwareMicrosoftOffice16.0OutlookProfilesOutlook
  123. POP3
  124. IMAP
  125. SMTP
  126. HTTP
  127. %appdata%WaterfoxProfiles
  128. Waterfox
  129. %appdata%ComodoIceDragonProfiles
  130. IceDragon
  131. %appdata%8pecxstudiosCyberfoxProfiles
  132. Cyberfox
  133. sqlite3_open
  134. sqlite3_close
  135. sqlite3_prepare_v2
  136. sqlite3_step
  137. sqlite3_column_text
  138. sqlite3_column_bytes
  139. sqlite3_finalize
  140. %APPDATA%filezillarecentservers.xml
  141. FileZilla
  142. ole32.dll
  143. CLSIDFromString
  144. {4BF4C442-9B8A-41A0-B380-DD4A704DDB28}
  145. {3CCD5499-87A8-4B10-A215-608888DD3B55}
  146. vaultcli.dll
  147. VaultOpenVault
  148. VaultEnumerateItems
  149. VaultGetItem
  150. MicrosoftEdge
  151. BrowsersAutoComplete
  152. CookieList.txt
  153. SELECT host_key, name, encrypted_value, value, path, is_secure, (expires_utc/1000000)-11644473600 FROM cookies
  154. %appdata%Moonchild ProductionsPale MoonProfiles
  155. PaleMoon
  156. %appdata%Electrumwallets
  157. Electrum
  158. %appdata%Electrum-LTCwallets
  159. Electrum-LTC
  160. %appdata%ElectrumGwallets
  161. ElectrumG
  162. %appdata%Electrum-btcpwallets
  163. Electrum-btcp
  164. %APPDATA%Ethereumkeystore
  165. Ethereum
  166. %APPDATA%Exodus
  167. Exodus
  168. Exodus Eden
  169. *.json,*.seco
  170. %APPDATA%JaxxLocal Storage
  171. JaxxLocal Storage
  172. %APPDATA%MultiBitHD
  173. MultiBitHD
  174. mbhd.wallet.aes,mbhd.checkpoints,mbhd.spvchain,mbhd.yaml
  175. .wallet
  176. wallets.wallet
  177. wallet.dat
  178. walletswallet.dat
  179. electrum.dat
  180. walletselectrum.dat
  181. Softwaremonero-projectmonero-core
  182. wallet_path
  183. BitcoinBitcoin-Qt
  184. BitcoinGoldBitcoinGold-Qt
  185. BitCoreBitCore-Qt
  186. LitecoinLitecoin-Qt
  187. BitcoinABCBitcoinABC-Qt
  188. %APPDATA%Exodus Eden
  189. %Appdata%Psi+profiles
  190. %Appdata%Psiprofiles

Table 3: AZORult Configuration file

The multiple references to Browser Cookies and CryptoWallets confirms the “RuntimeBroker5.exe” sample, initially hidden into the cabilet archive,  is an AZORult variant.

Stage 3 – The Payload

The other file download from hairpd[.]com by AZORult’s sample is another executable PE32.

Figure 8: GET request to download the payload.
Hash a75b318eb2ae6678fd15f252d6b33919203262eb59e08ac32928f8bad54ca612
Threat sputik.exe
Descrizione Breve Second component downloaded by malware. This component is alive after the infection.

Table 4:  Generic information about sputik.exe (Gootkit)

The “sputik.exe” uses a set of evasion techniques to avoid the monitoring of the process, such as invoking the “UuidCreateSequential” API to detect the usage of typical virtual machine’s MAC addresses, but this technique can be easily bypassed by spoofing a real network card one.

Figure 9: Evasion technique through the check “UuidCreateSequential” API call

Bypassing all the evasion techniques reveals the nature of the payload: a Gootkit malware implant.

Figure 10: Command line of the final sample

By instrumenting the execution of the implant, we were able to extract part of the JavaScript code of the malware. The Gootkit implant counts several modules written on top of NodeJS technology embedded into the PE file, revealing part of the implant code.

Figure 11: Portion of Gootkit code snippet

In the past years, Gootkit source code have been leaked online and part of it is also available on the Github platform. This way we were able to investigate differences between the extracted snippets and the known, previously leaked, malware version.

Figure 12: Comparison between extracted Gootkit version and the leaked one

As general consideration, we noticed a lot of similarities between the codes, they are perfectly compatible, but few differences holds. For instance private keys and certificates have been modified, showing the malware author choose a stronger key.

Table 5:  Certificate comparison 
(New on the left, known/leaked on the right)

Conclusion

These attack waves targeting italian organization and users revealed interesting connections between two threats we was used to monitor and detect across both the InfoSec community and the CERT-Yoroi’s constituency, revealing a hidden link connecting this particular AZORult instance and with the Gootkit implant.

Also, the analysis pointed to an evolution of the dropping techniques used in the initial stages of the attacks by cyber-criminals, showing how the usage of extremely flexible stagers written in high level languages, JavaScript in this case, is becoming more popular and needs to be carefully monitored.

Further details, including Indicators of Compromise (IoCs), are reported in the analysis published on the Yoroi Blog.


Pierluigi Paganini

(SecurityAffairs – AZORult, gootkit)

The post Gootkit: Unveiling the Hidden Link with AZORult appeared first on Security Affairs.


Go to Source
Author: Pierluigi Paganini

WordPress Appliance - Powered by TurnKey Linux