From OnlyDcRatFans to RemcosRAT

Adversaries don’t work 9-5 and neither do we. At eSentire, our 24/7 SOCs are staffed with Elite Threat Hunters and Cyber Analysts who hunt, investigate, contain and respond to threats within minutes.

We have discovered some of the most dangerous threats and nation state attacks in our space – including the Kaseya MSP breach and the more_eggs malware.

Our Security Operations Centers are supported with Threat Intelligence, Tactical Threat Response and Advanced Threat Analytics driven by our Threat Response Unit – the TRU team.

In TRU Positives, eSentire’s Threat Response Unit (TRU) provides a summary of a recent threat investigation. We outline how we responded to the confirmed threat and what recommendations we have going forward.

Here’s the latest from our TRU Team…

What did we find?

In January 2024, our 24/7 SOC Cyber Analysts identified a suspicious ZIP archive is named “IMG_Mia_khlifa” (MD5: 63ad6131e2563a707353b4a9bdb0aa8b). The ZIP archive contains the AnyDesk executable and VBS file named “winrm.vbs” (MD5: 7a533f45f8b30d8bbdfd589fe06c48c2).

Upon further investigation, our SOC has determined that the ZIP archive was delivered via the Discord CDN link. The “winrm.vbs” file executes another VBS file hosted on paste[.]ee, as shown in Figure 1.

Figure 1: Contents of winrm.vbs

The retrieved VBS file from paste[.]ee contains the binary that is presented in the reversed hexadecimal order and string replacement obfuscations.

The binary was identified as DcRat (MD5: bac8861baa346f0ce06c87c33284d478). It’s worth noting that in June 2023, the eSentire Threat Response Unit (TRU) already reported
on threat actors using adult content to deliver DcRat.

DcRat’s encrypted configuration is shown in Figure 2:

Figure 2: Encrypted configuration

DcRat supports the dynamic loading and execution of plugins, specifically SendFile in our example. The plugin can remotely retrieve and execute the files on the infected machine. The code shown in Figure 3 checks the type of packet received by examining the value associated with the key “Pac_ket” in the deserialized data.

It handles different packet types based on their content. If the packet type is “Po_ng”, it performs no further actions and exits the method. If the packet type is “plu_gin”, it checks if a plugin is already registered in the system’s registry, and if not, it adds this message pack to a list for later processing and sends a request back to the server to send the plugin data.

If the packet type is “save_Plugin”, it appears to save the plugin data to the registry for later use.

If a plugin is already registered (i.e., its value is found in the registry), the ClientSocket.Invoke method is called with the current msgPack as an argument.

The plugin is GZIP-compressed and stored in the registry.

Figure 3: Compressed SendFile plugin in the registry

You can access the configuration extractor script for DcRat here.

Extracted configuration for DcRat:

Ports: b'6262'
Hos_ts: b'141.95.84[.]40'
Ver_sion: b' 1.0.7'
In_stall: b'false'
MTX: b'akASASSAS3'
Certifi_cate: b'MIICMTCCAZqgAwIBAgIVAK0bc2EIdL2NlNruWBB+3sQxDt3nMA0GCSqGSIb3DQEBDQUAMGUxFjAUBgNVBAMMDWFqa3djYWp3a2Fhd2MxEzARBgNVBAsMCnF3cWRhbmNodW4xHDAaBgNVBAoME0RjUmF0IEJ5IHF3cWRhbmNodW4xCzAJBgNVBAcMAlNIMQswCQYDVQQGEwJDTjAeFw0yMTExMTEwODA4MTRaFw0zMjA4MjAwODA4MTRaMBAxDjAMBgNVBAMMBURjUmF0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9Bl780mtAcACd1/CjXmhO8J3GFnuXhOgRMtYnNfF/TJKVHOC4hVGDtnM0hJWNNdOwiomtD7Zf00NNRYdkGiJHe5LTy6yGn3aEM8UwwIzBE91o6GwWHsYh4jydX1gfj8HJ2K3HFWQeiAucIsriHfDQOH5+Pg286+LrjKnRVPoLvQIDAQABozIwMDAdBgNVHQ4EFgQULbEAkxaBNMjQx2vfTniENRaLyp4wDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQ0FAAOBgQAAROaXc2vqwgK4JHOyKqd9UHLDDNMl4xxEr1XrnuIz6ahY0G6QbLJtj0bEI4Xe+L+HzK0qDqT6kELUqUq1/22HiQ9kuU5pYE/GV3WyUrt3OOjamKpuUEgE/r8x5w1nkKnQ4EgMJF46SqoYTj+c/VL/WZF+VGjorLim94vujaq1OQ=='
Server_signa_ture: b'KdFH4/mCegQvdI/Okzt1U9yQ9Mv/DWBp6S9zuNtmtzqUUVtvK7SKafNCik+SHWpAIe+a0OA59w97j2xqBWaXDxlM7FNPhS+Z0FdXZXtwVCQq5Z5fLp3HFGPO+CsLi4Hcu027gLOFCtibKcCB2V7oumiAQqRjD42WLYDzeG/TJYo='
Paste_bin: b'null'
BS_OD: b'false'
Group: b'8=======================================))--'
Anti_Process: b'false'
An_ti: b'false'

The final payload retrieved via the plugin is a VBS file named “aw.vbs” (MD5: cb878d728a452beb1af862903c49bbea). The file contains two binaries:

  • RemcosRAT (MD5: 63a2dcb487d0d875688f4e4d5251a93b)
  • dynwrapx.dll (MD5: e0b8dfd17b8e7de760b273d18e58b142)

The VBS file also allocates and manipulates memory for shellcode within a system’s virtual space, primarily utilizing the dynwrapx.dll library. This library facilitates the invocation of Windows API functions from system DLLs within JavaScript or VBScript code.

The shellcode is responsible for process injection and uses ROT13 for API hashing (Figure 4).

Figure 4: Shellcode using API hashing

Eventually, RemcosRAT gets injected into winhlp32.exe process.

RemcosRAT configuration is shown in Figure 5. You can access the script to extract the configuration for RemcosRAT here.

Figure 5: RemcosRAT configuration

What did we do?

Our team of 24/7 SOC Cyber Analysts isolated the system and performed additional investigation before alerting the customer.

What can you learn from this TRU positive?

  • The use of enticing or misleading file names like “IMG_Mia_khlifa” for delivering malware is a common tactic in cyber threats. This approach exploits human curiosity, especially with names that suggest adult content.
  • The delivery of the ZIP archive via a Discord CDN link indicates how attackers exploit popular platforms and their content delivery networks to distribute malware.
  • The presence of the AnyDesk executable and a VBS file within the ZIP archive demonstrates a multi-component attack strategy, where multiple files work in tandem to execute the attack.
  • Identification of DcRat, a remote access tool that supports dynamic plugin execution, highlights the capabilities of the malware. It can remotely retrieve and execute files, enhancing its capability to control the infected machine.
  • The discovery of RemcosRAT and dynwrapx.dll in the final payload underlines the additional stages of the attack.
  • The injection of RemcosRAT into the winhlp32.exe process demonstrates targeted process injection for maintaining persistence and stealth.

Recommendations from our Threat Response Unit (TRU):

  • Train users to identify and report potentially malicious content using Phishing and Security Awareness Training (PSAT) programs.
  • Restrict click-to-run execution of script files, such as .vbs.
    • Create new “Open With” parameters for script files (.js, .jse, .hta, .vbs) so they open with notepad.exe. This setting is found in the Group Policy Management Console under User Configuration > Preferences > Control Panel Settings > Folder Options.
    • Alternatively, configure Attack Surface Reduction rules to block “Block JavaScript or VBScript from launching downloaded executable content
  • Protect endpoints against malware by:

eSentire TRU is a world-class team of threat researchers who develop new detections enriched by original threat intelligence and leverage new machine learning models that correlate multi-signal data and automate rapid response to advanced threats.  

To learn what it means to have an elite team of Threat Hunters and researchers that works for you, connect with an eSentire Security Specialist now. 

Indicators of Compromise

You can access indicators of compromise here.

References

Source: https://www.esentire.com/blog/from-onlydcratfans-to-remcosrat