Maze Ransomware that contains a maze of code
SonicWall Capture Labs Threats Research team detected a variant of Maze ransomware that uses an anti-debugging technique though the technique is well documented.
The sample is distributed as a DLL file. Data is decrypted over and over to get the original data and code. It also makes up interesting strings like “dllisaweapon123”, “justanonce12345” in memory
A thread is created which parses PEB, hashing mechanism is used to retrieve APIs. Now the interesting part begins, address of the “ntdll_DbgUiRemoteBreakin” API is retrieved, and prologue is patched with a RET instruction.
As per documentation available in public domain:
“Debugger attaches to a process with DebugActiveProcess api which creates a thread in debuggee, then DbgUiRemoteBreakin() API is called to debug the process.”
By patching DbgUiRemoteBreakin API, the malware has ensured that the process couldn’t be attached for debugging.
It also has other anti-analysis code to verify if it’s being executed inside controlled environment.
It enumerates processes, computes a hash from the process name and compares the hash value against a list of hash belonging to monitoring tools like “procmon” etc. If the comparison is successful, the process is terminated.
Then it begins to encrypt files. Unlike, most of the ransomware where a specific string is appended to the file name, Maze ransomware adds random string to the file name. The folders where files have already been encrypted, a file named “DECRYPT-FILES.txt” is dropped for the victims which contains ransom note in addition to the instructions to be followed to recover the original files.
SonicWall Capture Labs provides protection against this threat via the following signature:
- GAV: Maze.RSM_7 (Trojan)
This threat is also detected by SonicWall Capture ATP.