Nim-Based Malware Delivered via Weaponized Word Document


Hackers use weaponized Word documents to deliver malicious payloads through social engineering. 

By embedding malware or exploiting vulnerabilities in these documents, attackers trick users into opening them and leading to the execution of malicious code. 

While leveraging the familiarity and trust associated with such file format, this tactic is effective for several illicit purposes:-

  • Spreading malware
  • Gaining unauthorized access
  • Initiating other cyber attacks

Recently, cybersecurity researchers at Netskope identified a new Nim-based malware, which was delivered via weaponized Word documents by the threat actors.

Nim is a new language that sees a rising malware trend, and experts at Netskope Threat Labs note growing Nim-based threats, anticipating further popularity. 

Among them, the most notable one is “Dark Power” ransomware, which is also a variant of the Nim-based family that surfaced recently.

Nim-Based Malware via Word Document

The malicious Word doc drops the Nim backdoor, which is sent as an email attachment by a fake Nepali official. 

Despite macro security, APT malware, like Menorah, which used a similar tactic months ago, still leverages macros for payload delivery. 

Malicious Word file prior to enabling macro (Source – Netskope)

Besides this, opening the file shows a blank doc, prompts macro to enable, and then the clicking triggers the:-

  • Auto-routine
  • Code execution

VBA project uses passwords and obfuscation to dodge AV solutions. At the same time, the macros employ Chr( ) and string concatenation. 

Apart from this, the code is divided into four subroutines, and here below we have mentioned them:-

  • sch_task
  • hide_cons
  • read_shell
  • vb_chain

Word doc deploys Nim-based ‘conhost.exe’ backdoor on September 20, 2023. Nim is a versatile language that compiles the following languages together with Pythonic syntax:-

Backdoor operates with user’s privileges, mimicking Nepali authority to deceive users. C&C server imitates government domains ([.]govnp[.]org).

Nim Backdoor
Nim Backdoor (Source – Netskope)

Nim backdoor checks for analysis tools and terminates if found. Then, it fetches the hostname and encrypts it with the ‘bakery’ function.

Processes the backdoor avoids
Processes the backdoor avoids (Source – Netskope)

The encrypted hostname double-base64 encoded, which was:-

  • Spliced with C&C server URL
  • Suffixed with ‘.asp’

The C&C server issues the commands via HTTP GET, the response is decrypted by the ‘confectionary’ function, executed with cmd /c, and then the result is sent back to the server. 

Besides this, for encryption and decryption, “NPA” was used as the key, potentially Nepal Agent.

Here below, we have mentioned all the C2 hosts that were contacted:-

  • mail[.]mofa[.]govnp[.]org
  • nitc[.]govnp[.]org
  • mx1[.]nepal[.]govnp[.]org
  • dns[.]govnp[.]org

The VBscript ‘OCu3HBg7gyI9aUaB.vbs‘ in the startup folder ensures access. Confirms internet connection, pings Google. 

On success, it runs ‘8lGghf8kIPIuu3cM.bat,’ and the batch file drops the files and creates tasks for payload. 

Meanwhile, the ‘d.bat’ establishes the persistent execution with the scheduled task ‘ConsoleHostManager.’

Scheduled Task
Scheduled Task (Source – Netskope)

Malware in rare languages challenges security experts, and the cross-compilation in Nim aids hackers in creating obstacles for security analysts.

IOCs

MD5

  • e2a3edc708016316477228de885f0c39
  • 777fcc34fef4a16b2276e420c5fb3a73
  • EF834A7C726294CE8B0416826E659BAA
  • 32C5141B0704609B9404EFF6C18B47BF

SHA-1

  • 3aa803baf5027c57ec65eb9b47daad595ba80bac
  • 5D2E2336BB8F268606C9C8961BED03270150CF65
  • 4CAE7160386782C02A3B68E7A9BA78CC5FFB0236
  • 0599969CA8B35BB258797AEE45FBD9013E57C133

SHA-256

  • b5c001cbcd72b919e9b05e3281cc4e4914fee0748b3d81954772975630233a6e
  • 696f57d0987b2edefcadecd0eca524cca3be9ce64a54994be13eab7bc71b1a83
  • 88FA16EC5420883A9C9E4F952634494D95F06F426E0A600A8114F69A6127347F
  • 1246356D78D47CE73E22CC253C47F739C4F766FF1E7B473D5E658BA1F0FDD662

Network

  • mail[.]mofa[.]govnp[.]org
  • nitc[.]govnp[.]org
  • mx1[.]nepal[.]govnp[.]org
  • dns[.]govnp[.]org



Source link