Graphalgo Malware Targets Go Modules and Terraform Providers

Summary
Researchers found Graphalgo-related Go malware in two Terraform providers and two Go modules. The malware uses conditional execution and Slack and blockchain C2; the article details its operation, indicators, and response guidance.
Key points
- The malware was found in Terraform providers gocommunity-io/dockerd and kreuzwenker/docker, and Go modules gocommunity[.]io/orderedbtree and gogets[.]dev/btreex.
- The Terraform providers activate only when specified input values produce a particular SHA256 hash; Go module variants also use conditional activation.
- The providers decrypt an embedded archive and execute its contents as Go code; one Go module conceals its payload in a ZIP archive disguised as a SQL file.
- The second-stage Go RAT uses Slack and an Ethereum smart contract on Arbitrum Sepolia for C2, with encrypted, client-specific communications.
- Researchers linked the malware to the Graphalgo NPM campaign through shared infrastructure and a public key. The actor also created fake Go package ecosystems to promote malicious packages.
- The article recommends isolating affected machines, rotating credentials, reviewing activity, and reimaging systems where the packages ran.
Article Details
- Attack Vectors
- Malicious Go Modules and Terraform providers distributed Go malware; one provider was a typosquat of a popular Terraform provider.
- The provider payload activates only when specified Terraform variable values produce a particular SHA256 hash; the Go Module variant also required specially crafted input.
- The malware decrypts files concealed in ZIP archives and executes the resulting Go code. Its second stage can execute additional Go or JavaScript code.
- The second-stage agent uses Slack and an Ethereum smart contract on the Arbitrum Sepolia testnet for command and control.
- Defensive Notes
- Alert on HTTP-based blockchain service communications where there is no business need for blockchain access.
- If an affected package or provider ran on a developer machine or CI/CD runner, isolate the environment, rotate credentials that accessed it, review activity during the exposure window, remove the package, and reimage the machine.
- For Terraform-provider exposure, prioritize cloud and infrastructure credentials; also review commits, package publishes, Terraform applies, and GitHub Actions runs made from the affected machine or with its credentials.
Indicators of compromise
| Type | Indicator | Context |
|---|---|---|
| DOMAIN | gocommunity[.]io | Fake Go package ecosystem website associated with a threat actor-controlled organization and reportedly used to lend legitimacy to malicious packages. |
| DOMAIN | gogets[.]dev | Fake Go package ecosystem website associated with a threat actor-controlled organization and reportedly used to lend legitimacy to malicious packages. |
| SHA256 | 5f892a5424e88a21a3eb3d7f82ebf04d8ac31cdb19ada25153be4165df977d0f | SHA256 of the malicious archive distributed in both Terraform providers. |
| SHA256 | ab01686d87565250fc4989faddb877d793667b07ec217a61cbd798f5695d62f5 | SHA256 of the ZIP archive masquerading as a SQL file in the malicious gogets.dev/btreex Go Module. |
| URL | hxxps[:]//portfolio-devs[.]slack[.]com | Slack workspace used by the malware for C2 check-ins; the article notes the malware communicates with api.slack.com rather than directly contacting this workspace subdomain. |
| URL | hxxps[:]//portfolio-testers[.]slack[.]com | Slack workspace used for subsequent C2 communications; the malware communicates through the Slack API rather than directly contacting this workspace subdomain. |
MITRE ATT&CK
T1027 · Obfuscated Files or InformationThe provider payload was hidden in a compressed archive, and its files were AES-encrypted.T1036.005 · Match Legitimate Resource Name or Locationkreuzwenker/docker was identified as a typosquat of the popular kreuzwerker/docker Terraform provider.T1036.008 · Masquerade File TypeMalicious ZIP archives were disguised with the filenames import-resource.sqlite3 and btreex.sql.T1041 · Exfiltration Over C2 ChannelThe malware sends collected system information to a Slack C2 channel.T1059 · Command and Scripting InterpreterThe malware executes decrypted Go code with a detached go run command and accepts C2 instructions to execute additional Go code.T1059.007 · JavaScriptC2 instructions can direct the malware to execute JavaScript using node.T1070.004 · File DeletionC2 messages can instruct the malware to self-delete.T1082 · System Information DiscoveryThe malware collects system attributes including hardware, OS, hostname, architecture, and node availability.T1102.001 · Dead Drop ResolverThe malware retrieves encrypted instructions and key material from an Ethereum smart contract used as a blockchain dead drop.T1102.002 · Bidirectional CommunicationThe malware uses Slack workspaces and the Slack API for bidirectional C2 communications.T1140 · Deobfuscate/Decode Files or InformationThe malware AES-decrypts the archive contents before executing them as Go code.T1195.001 · Compromise Software Dependencies and Development ToolsMalicious Terraform providers and Go Modules distributed the Go malware through software dependencies.T1573.001 · Symmetric CryptographyThe malware encrypts C2 communications using a shared key derived from ephemeral key material and threat actor public keys.
Malware
Products
EthereumFor blockchain-based C2, the malware retrieves data from an Ethereum smart contract on the Arbitrum Sepolia testnet using the hardcoded contract address 0xAD02b5cDE693529d3bdA0266299501ad0193036C, then:SlackCheckMarx, and JFrog. The malware is a Go port of the Graphalgo malware that shares blockchain and Slack infrastructure and a public key with recent JavaScript samples distributed via NPM. The threat actor hasTerraformWe’ve identified Go malware distributed via at least two Terraform providers and at least two Go Modules. This is the first time we’ve observed malware distributed via Terraform providers. The following packages contain
