A suspected China-linked hacking campaign has been found targeting SonicWall SMA 100 series appliances since at least 2021. The threat actor behind, tracked as UNC4540, drops malware and establishes long-term persistence on the appliances to steal data.

How the attack unfurls

The initial attack vector is unknown, however, the malware was possibly deployed on the unpatched SonicWall SMA devices by taking advantage of known security flaws.
  • The malware consists of a series of bash scripts and a single ELF binary identified as a TinyShell backdoor.
  • The main module firewalld executes SQL commands against the appliance's database to siphon cryptographically hashed credentials from all logged-in users. 
  • It copies the stolen credentials to the attacker-created text file and later retrieves them by cracking hashes offline.
  • The malware then executes TinyShell to establish a reverse shell on the compromised device for easy remote access.
  • Finally, it adds a small patch to the legitimate SonicWall binary firebased for the malware's stability when the device is shut down.

Attaining persistence

According to Mandiant researchers, the adversary achieves persistence and resilience through multiple subsequent firmware updates and maintains a foothold on the network.
  • The malware contains a second copy of firewalld named iptabled. Both scripts are configured to provide backup to each other and ensure stability and persistence with long-term attacker access. 
  • The bash script geoBotnetd checks for new firmware updates every 10 seconds, if one is found, it unzips the package, copies the malware into the upgrade package, and puts the zip back in the original place to maintain access and survive firmware upgrades.
  • Additionally, it adds a backdoor user named acme on the upgrade file to escalate and maintain persistent access on an already compromised web application.

Patch soon

SonicWall has released updates for SMA100 that incorporate new security enhancements such as File Integrity Monitoring (FIM) and anomalous process identification. Organizations are suggested to upgrade to version 10.2.1.7 or higher and additionally maintain proper patch management and monitor edge devices frequently to prevent such threats.
Cyware Publisher

Publisher

Cyware