DoNex is a LockBit-inspired ransomware group that emerged after Darkrace, adopting leaked LockBit tooling and a similar deployment flow. The post analyzes the DoNex binary, detailing its steps from initial checks and token-based admin verification to local and network share encryption, ransom note deployment, and cleanup. #DoNex #Darkrace
Keypoints
- DoNex appears as a LockBit-derived clone that follows Darkrace’s lineage and leverages the leaked LockBit builder.
- The sample is 32-bit, not packed, and compiled with Microsoft Visual C/C++; DIE and Binary Ninja are used to analyze it.
- It hides its console window, uses a mutex to ensure a single instance, and retrieves the process token to inspect user identity and admin rights.
- It disables WOW64 file system redirection to access system files and prepares cryptographic context for encryption.
- Icon dropping and registry modification are used to mark encrypted files with a custom icon, and recycle bins are wiped.
- The malware encrypts local drives and reachable network shares, drops a ransom note, clears logs, and initiates a hard restart.
MITRE Techniques
- [T1564.001] Hide Artifacts – The binary hides the attached console window by getting a handle to the window with FindWindowA and setting visibility to hidden via ShowWindow(…SW_HIDE…). – “the main function starts by getting a handle to the attached console window with ‘FindWindowA’, and setting the visibility to hidden by calling ‘ShowWindow’ and passing ‘SW_HIDE’ as a parameter.”
- [T1112] Modify Registry – Drops an icon and sets it as the default icon via RegCreateKeyExA/RegSetValueExA to associate icons with encrypted files. – “create keys in the device registry through use of ‘RegCreateKeyExA’, and ‘RegSetValueExA’, to set it as the default file icon for newly encrypted files.”
- [T1083] File and Directory Discovery – Enumerates files on targeted drives with FindFirstFileW/FindNextFileW and applies a blacklist during iteration. – “Files are then iterated through using ‘FindFirstFileW’ and ‘FindNextFileW’, and checked against a file blacklist (‘checkFileBlacklist’) to avoid encrypting critical system files.”
- [T1033] Account Discovery – Uses GetTokenInformation to identify user account information tied to the token, notably the SID. – “Using the access token handle, ‘GetTokenInformation’ is called to identify the user account information tied to the token, most notably the SID.”
- [T1069.001] Permission Groups Discovery – Allocates an administrator SID and compares it against the current token to determine admin rights. – “the SID for the administrators group is allocated and initialized… EqualSid is called to compare the SID from derived from the token information against the newly initialized SID for the administrators group.”
- [T1135] Network Share Discovery – Enumerates accessible network shares via Windows Networking API and attempts connections to shares. – “Network shares are enumerated through use of the Windows Networking API (‘WNetOpenEnumW’), and connections are made to shares that are accessible by the current acting user account (‘WNetEnumResourceW’ and ‘WNetAddConnection2W’).”
- [T1486] Data Encrypted for Impact – After preparation, the malware encrypts files on disk and on network shares as part of the encryption flow. – “The encryption setup function (renamed to ‘mainEncryptSetup’) which handles … encryption is called.”
- [T1070.001] Clear Windows Event Logs – Cleans up application, system, and security event logs as part of cleanup. – “the application, system, and security event logs are erased (‘OpenEventLogA’ and ‘ClearEventLogA’).”
- [T1059] Command and Scripting Interpreter – Drops and executes a batch file (1.bat) via WinExec to perform actions like pinging localhost and killing processes. – “This function (renamed to ‘batRun’) drops a looping batch file (‘1.bat’), and executes it with ‘WinExec’, which pings the localhost address, and uses ‘taskkill’ to kill processes…”
- [T1569.002] Service Execution / Service Stop – The sample creates a connection to the service control manager and can stop services via OpenSCManagerA/OpenServiceA/ControlService. – “creates a connection to the service control manager … OpenSCManagerA, OpenServiceA, … ControlService.”
Indicators of Compromise
- [SHA-256 Hash] context – 6d6134adfdf16c8ed9513aba40845b15bd314e085ef1d6bd20040afd42e36e40, 2b15e09b98bc2835a4430c4560d3f5b25011141c9efa4331f66e9a707e2a23c0, and 1 more hash
- [SHA-256 Hash] context – d3997576cb911671279f9723b1c9505a572e1c931d39fe6e579b47ed58582731
- [File] context – C:UsersuserDesktopReadMe.f58A66B51.txt, C:UsersuserDownloadsReadMe.f58A66B51.txt
- [Registry] context – HKEY_CLASSES_ROOT.f58A66B51, HKEY_CLASSES_ROOTf58A66B51fileDefaultIcon, HKEY_LOCAL_MACHINESOFTWAREClassesf58A66B51fileDefaultIcon
Read more: https://isc.sans.edu/diary/Slicing+up+DoNex+with+Binary+Ninja/30812/