Kuboid
Open Luck·Kuboid.in

Malicious Fungible Tokens

DEFCONConference304 views21:40over 1 year ago

This talk demonstrates a technique for using Non-Fungible Tokens (NFTs) as a resilient, decentralized Command and Control (C2) infrastructure. By embedding malicious payloads within NFT metadata, traits, and EXIF data, attackers can bypass traditional security controls and blacklists. The research highlights how decentralized storage platforms like IPFS can be weaponized to host persistent, hard-to-remove malware components. The presentation includes a proof-of-concept tool, MFT, which automates the creation and management of these malicious tokens.

Weaponizing NFT Metadata for Resilient Command and Control

TLDR: Researchers have demonstrated a novel technique for using NFT metadata and EXIF data as a decentralized, persistent Command and Control (C2) infrastructure. By embedding malicious payloads directly into tokens on platforms like OpenSea and hosting them via IPFS, attackers can bypass traditional domain-based blacklists and security controls. This research provides a proof-of-concept tool, MFT, that automates the delivery of these payloads, forcing security teams to rethink how they monitor and block C2 traffic.

Security researchers have long relied on the assumption that C2 infrastructure is inherently fragile. If you identify a malicious domain or IP address, you sinkhole it, block it at the perimeter, and the attacker loses their foothold. This model is failing. The recent research presented at DEF CON 2024 on Malicious Fungible Tokens proves that we can shift the entire C2 communication layer into decentralized, immutable storage, effectively turning the blockchain into a permanent, unblockable command relay.

The Mechanics of Decentralized C2

Traditional C2 relies on a client-server relationship where the malware reaches out to a specific, identifiable endpoint. The MFT technique flips this. Instead of a hardcoded IP or domain, the malware is programmed to query a blockchain-based account or an NFT collection for its instructions. Because the metadata of an NFT is stored on decentralized networks like IPFS, the payload is not hosted on a single server that can be taken down by a registrar or a hosting provider.

When an attacker mints an NFT, they inject the C2 instructions into the token's metadata fields or, more stealthily, into the EXIF data of the associated image. Since these platforms are widely trusted and often whitelisted by corporate firewalls, the traffic generated by the malware to fetch this metadata appears as legitimate requests to a reputable service like OpenSea. This is a classic A03:2021-Injection scenario, but instead of targeting a database, the attacker is injecting commands into the global state of a decentralized ledger.

Technical Implementation and Payload Delivery

The MFT tool demonstrates how to automate this process. An attacker can encode their C2 instructions—such as shell commands or configuration updates—using Base64 and embed them into the description or attributes fields of an NFT. The following snippet illustrates how a simple command structure is hidden within the metadata:

{
  "name": "Initial Access Barker",
  "description": "aHR0cDovL2xvY2FsaG9zdDo0NDQ0L2FjdGlvbj1zaGVsbA==",
  "attributes": [
    {
      "trait_type": "C2_Action",
      "value": "execute_payload"
    }
  ]
}

When the malware parses this JSON, it decodes the Base64 string to retrieve the actual command. The beauty of this approach for an attacker is the resilience provided by the underlying storage. Even if a specific IPFS node is taken offline, the content remains available across the distributed network. To effectively "kill" this C2, a defender would need to coordinate a takedown across every node hosting that specific file, which is practically impossible.

Real-World Implications for Pentesters

For those of us conducting red team engagements, this technique offers a massive advantage in longevity. During a standard engagement, we often struggle with the "burn rate" of our infrastructure. Domains get flagged, IPs get reputation-scored, and our C2 channels die within days. By using NFTs, we can maintain a persistent channel that survives even if the client's security team is actively hunting for our infrastructure.

When testing, you should look for unusual outbound traffic to Web3-related APIs or IPFS gateways. If you see a process making frequent requests to ipfs.io or opensea.io that correlate with suspicious system activity, you are likely looking at a decentralized C2 channel. The impact of this technique is significant because it turns the target's own reliance on decentralized services against them. It is no longer enough to block known malicious IPs; you must now inspect the content of the data being fetched from these "trusted" platforms.

Defensive Considerations

Defending against this requires a shift toward content-aware egress filtering. Simply blocking domains is insufficient when the C2 traffic is indistinguishable from legitimate user activity on a popular marketplace. Security teams should implement strict egress policies that limit access to Web3 APIs and IPFS gateways unless absolutely necessary for business operations. Furthermore, endpoint detection and response (EDR) solutions must be tuned to detect the execution of commands derived from external, untrusted data sources, regardless of where that data originated.

The era of relying on simple domain reputation to stop C2 is ending. As attackers move toward decentralized, immutable infrastructure, our defensive strategies must evolve to focus on the behavior of the malware itself rather than the location of its command source. If you are a researcher, I highly recommend pulling the MFT repository and testing these payloads in a controlled environment. Understanding how these decentralized channels operate is the only way to build effective detection logic before they become a standard part of the adversary's toolkit.

Premium Security Audit

We break your app before they do.

Professional penetration testing and vulnerability assessments by the Kuboid Secure Layer team. Securing your infrastructure at every layer.

Get in Touch
Official Security Partner
kuboid.in