A threat group that may have been among the first to exploit the ProxyLogon zero-day vulnerability in Exchange Servers last year is using a pair of dangerous and previously unseen malware tools in a cyber espionage campaign targeting military and government organizations in Europe and Asia.
Researchers at Kaspersky who first detected the group’s activities this week described the tools as malware designed to enable long-term persistence on an organization’s public-facing Web servers and giving attackers the ability to move laterally and penetrate deeply into compromised networks.
The malware tools have features that allow their functionality to be extended at will, but Kaspersky has been unable so far to determine the full range of their capabilities, the vendor noted.
Attacks Targeted ProxyLogon Exchange Server Flaw
Kaspersky is tracking the previously unknown group as “ToddyCat.” In a report this week, the security vendor said the adversary’s victim targeting and certain operational overlaps with at least one known Chinese threat actor suggest that members of ToddyCat are Chinese-speaking as well.
“This group targets high-profile organizations, usually government, diplomatic, military organizations, and military contractors,” says Giampaolo Dedola, security researcher at Kaspersky. It may be possible that the threat actor has compromised victims in the US as well. But currently Kaspersky has no information to suggest this is indeed the case, Dedola says.
Kaspersky’s analysis showed that ToddyCat’s campaign began in December 2020 with attacks targeting selected Exchange Servers belonging to three organizations in Vietnam and Taiwan. The attackers used an unknown exploit to breach the Exchange Servers and deploy the popular China Chopper Web shell on the systems. They then used the Web shell to initiate a multi-stage infection chain involving custom loaders that ended with one of the new malware tools — a backdoor called “Samurai” — being deployed on the compromised system.
Samurai is a passive backdoor designed to give the attackers persistent access on Internet-facing Web servers. The backdoor works on ports 80 and 443 and is designed primarily to execute arbitrary C# code on infected systems.
“Based on our investigation, we were able to detect some of the source codes uploaded by the attacker and we know that it was used to execute arbitrary commands, download files, forward TCP packets to internal hosts,” Dedola says. As one example, he points to the attacker using Samurai to communicate with internal Active Directory servers. “The ability to run arbitrary C# code allows attackers to infinitely extend the malware’s capabilities,” he says.
Kaspersky’s research showed the attackers also used Samurai to launch “Ninja,” the other previously unseen malware tool that ToddyCat is using in its attacks. Ninja is Cobalt Strike-like malware for executing post-exploitation activities on already compromised systems.
“It allows the attackers to control the remote system, manipulate the file system, manipulate processes, inject arbitrary code in other processes, forward TCP packets, and load new modules in its memory,” Dedola says.
Ninja agents can be configured to act like servers. So, the adversary can use the malware to designate specific machines as internal command and control servers (C2s), thereby limiting connections to external servers and reducing the chances of being detected. This feature, combined with the TCP command forwarding functionality, gives the attackers a way to manage even those systems that are not directly connected to the Internet, Dedola says.
Between Dec. 2020 and early Feb. 2021, ToddyCat remained tightly focused on a handful of organizations in Vietnam and Taiwan. But then, for a brief period between late February and early March, the threat actor quickly escalated its attacks by targeting the ProxyLogon vulnerability to compromise organizations in multiple countries. The group’s victims included organizations in Russia, UK, Slovakia, India, Iran, and Malaysia, and belonged to industries and sectors that have traditionally been of interest to China-based groups, Kaspersky said.
A Change in Tactics
Almost all of ToddyCat’s early attacks targeted Exchange Server flaws. But starting Sept. 2021, Kaspersky observed what it described as “waves of attacks” against desktop systems involving the use of malicious loaders sent via the Telegram messaging service. It’s unclear how many organizations ToddyCat has compromised, but the number is likely less than 30, Dedola says.
What makes Samurai and Ninja dangerous is the anti-forensic and anti-analysis technique incorporated into the malware, according to Kaspersky. For example. Samurai is designed to share TCP port 80 and 443 with Microsoft Exchange and cannot be detected by monitoring the ports. The malware also uses a complex loading scheme to avoid detection and maintain persistence. It addition, it uses a technique called “control-code flattening” to avoid detection by static analysis tools, Dedola says.
“The Ninja Trojan is also another modular malware, with capabilities that can be easily extended by the attacker,” he tells Dark Reading, adding that the malware runs only in memory and never appears on file systems, making it harder to detect. “It is usually executed with a loader, which decrypts the payload from a third file. The file with the encrypted payload is immediately deleted by the loader.”
Christopher Prewitt, CTO at Inversion6, says Kaspersky’s research shows that the malware authors have gone to great lengths to hide and obfuscate their methods. While the Samurai backdoor features some relatively common features, ToddyCat’s bespoke Ninja post-exploit tool appears more interesting.
“It is loaded in memory, making it much more difficult to analyze and detect,” Prewitt says. “The threat actor could continue to reuse this part of their toolkit, while only swapping out or updating the initial infection point and backdoor tooling.”