Malware Abuses Windows EFS to Thwart Security Analysis
Getting inside a network is only part of the fight for attackers; the other is avoiding detection for as long as possible. Yet another part is keeping analysts from dissecting and reverse-engineering their malicious wares once they end up in the hands of their opponents.
Recently, researchers at Symantec found a backdoor, known as Tranwos, abusing a Windows feature, known as the Encrypting File System (EFS), to make the lives of security researchers more difficult.
"Not only is it trivial for program code to use EFS, it’s also very effective at preventing forensic analysis from accessing the contents of the file," blogged Symantec security researcher Kazumasa Itabashi.
The malware creates a folder and then calls the EncryptFileW API in order to encrypt it, making it so all files and folders subsequently created in the encrypted folder will be encrypted automatically by Windows, the researcher explained. The malware also copies itself as the file name wow.dll in the folder and modifies the Characteristic attribute of the PE header in order to change to a DLL file.
"In some cases, security researchers may use another operating system, such as a version of Linux bootable from a removable drive, in order to retrieve malicious files from a compromised computer," Itabashi blogged. "This method is useful when retrieving files from a computer compromised by a rootkit. However, it’s impossible to get the file wow.dll by this method because the DLL file is encrypted on the EFS."
"A user account that executes this threat can see the contents of the file and change the status of the encryption," he continued. "As this threat makes it impossible for researchers to use forensic tools, as we normally would, we have to manually execute the threat on a test computer to gather the contents of the file. The purpose of this threat using EFS is only to prevent forensic analysis from retrieving the contents of itself."
It is not unusual for malware to take steps to thwart analysts.
"One of the techniques that isn't necessarily newer, but will always make life difficult is malicious activity within memory with minimal interaction with the file system," said Will Irace, vice president of threat research at General Dynamics Fidelis Cybersecurity Solutions. "When a piece of malware is found on a system, artifacts about the malware and what files the malware created can normally be found."
Some malware, he explained, installs itself as a service, some gains persistence through auto-runs and some produce obfuscated logs.
"When this happens, it is a simple task of finding out what the malware changes and creates on the system to determine if a system is compromised," Irace said. "It becomes more complicated if the malware operates solely out of memory. It is difficult to determine the malware operations when the malicious software runs out of memory because memory is volatile, and if not saved shortly after operation, the activity can be lost."
"Another notable technique found in some malware has been modular design," he continued. "By this we mean that the malicious software is created in a way that allows for the actors to dynamically load and unload functions to the malware –i.e., [the] threat actor sends new functionality from the [command and control] server to allow the malware to start performing keystroke logging. This allows the actors to change the ability of the malware on the fly, and makes research and defense from the malware tricky."
Traditional signatures or heuristics won't always catch this type of malware because of the behavior changes based on the module that is added, he said.
Such evasion techniques are part of the evolution of malware, noted Satnam Narang, security response manager at Symantec.
"Essentially, we will see malware use certain evasion techniques, those techniques are discovered, and the malware authors in turn change their routine or develop new techniques," said Narang. "This is a pattern that gets repeated pretty much across the board."