APT41 has primarily used malicious ViewStates to trigger code execution against targeted web applications. Within the ASP.NET framework, ViewState is a method for storing the application’s page and control values in HTTP requests to and from the server.
The ViewState is sent to the server with each HTTP request as a Base64 encoded string in a hidden form field.
The web server decodes the string and applies additional transformations to the string so that it can be unpacked into data structures the server can use.
This process is known as deserialization.
Insecure deserialization of user-supplied input can result in code execution. ASP.NET has several insecure deserialization providers, including the one used for ViewStates: ObjectStateFormatter.
To prevent a threat actor from manipulating the ViewState and taking advantage of the insecure deserialization provider, the ViewState is protected by a Message Authentication Code (MAC).
This MAC is a cryptographically signed hash value that the server uses to ensure that the ViewState has not been tampered with, possibly to trigger code execution.
The integrity of the ViewState depends on the application’s machineKey remaining confidential.
The machineKey is stored on the application server in a configuration file named web.config.
A threat actor with knowledge of the machineKey can construct a malicious ViewState and then generate a new and valid MAC that the server accepts.
With a valid MAC, the server will then deserialize the malicious ViewState, resulting in the execution of code on the server.
Publicly available tools such as YSoSerial.NET exist to construct these malicious ViewStates.
The updated tradecraft and new malware continue to show APT41 is a highly adaptable and resourceful actor.
After gaining initial access to an internet-facing server, APT41 performed extensive reconnaissance and credential harvesting.
A common tactic seen is the deployment of a ConfuserEx obfuscated BADPOTATO binary to abuse named pipe impersonation for local NT AUTHORITYSYSTEM privilege escalation.
Once APT41 escalated to NT AUTHORITYSYSTEM privileges, they copied the local SAM and SYSTEM registry hives to a staging directory for credential harvesting and exfiltration.
APT41 has additionally used Mimikatz to execute the lsadump::sam command on the dumped registry hives to obtain locally stored credentials and NTLM hashes.
APT41 also conducted Active Directory reconnaissance by uploading the Windows command-line tool dsquery.exe
APT41 continues to leverage advanced malware in their existing toolkit, such as the DEADEYE launcher and LOWKEY backdoor, with added capabilities and anti-analysis techniques to hinder investigations. During a recent intrusion Mandiant identified a new malware variant, DEADEYE.EMBED, contained in an Alternate Data Stream of a local file.
DEADEYE.EMBED variants embed the payload inside of the compiled binary rather than appended to the overlay at the end of the file, as seen in DEADEYE.APPEND.
APT41 commonly packages their malware with VMProtect to slow reverse engineering efforts.
During multiple U.S. state government intrusions, APT41 incorporated another anti-analysis technique by chunking a VMProtect packaged DEADEYE binary into multiple sections on disk. Breaking the binary into multiple files reduces the chance that all samples can be successfully acquired during a forensic investigation.
APT41 continues to leverage advanced tradecraft to remain persistent and undetected.
In multiple instances, the Windows version of the KEYPLUG backdoor leveraged dead drop resolvers on two separate tech community forums.
The malware fetches its true C2 address from encoded data on a specific forum post.
Notably, APT41 continues to update the community forum posts frequently with new dead drop resolvers during the campaign. APT41 has historically used this unique tradecraft during other intrusions to help keep their C2 infrastructure hidden.
To persist execution of DEADEYE, APT41 has leveraged the schtasks /change command to modify existing scheduled tasks that run under the context of SYSTEM.
APT41 commonly uses the living off the land binary (lolbin) shell32.dll!ShellExec_RunDLLA in scheduled tasks for binary execution.
APT41 has substantially increased their usage of Cloudflare services for C2 communications and data exfiltration.
Specifically, APT41 leveraged Cloudflare Workers to deploy serverless code accessible through the Cloudflare CDN which helps proxy C2 traffic to APT41 operated infrastructure.