Command and Control (C2) via File Transfers: The Hidden Communication Channel

Cybercriminals use file transfers to establish a covert C2 channel, allowing them to control compromised systems remotely and execute malicious commands.

Command and Control (C2) via File Transfers

After successfully compromising a system through a malicious file, attackers need a way to maintain access, issue commands, and extract valuable data. This is where command and control (C2) infrastructure comes into play. While many C2 channels rely on direct network connections, file transfer-based C2 mechanisms have emerged as a particularly stealthy alternative that can bypass traditional security controls. According to FireEye’s M-Trends report, file-based C2 techniques were used in 37% of advanced persistent threat (APT) campaigns in 2023, representing a 24% increase from the previous year.

Traditional C2 channels often establish direct network connections to attacker-controlled servers, creating patterns that network monitoring tools can detect. File-based C2 channels, however, leverage legitimate file transfer mechanisms already present in the environment, making them significantly harder to identify as malicious.

A SANS Institute study found that file-based C2 traffic remained undetected in target networks for an average of 83 days, compared to 24 days for traditional network-based C2 channels. This extended dwell time gives attackers a critical advantage, allowing them to operate undetected for longer periods.

How File-Based C2 Works

File-based command and control functions by disguising command instructions and exfiltrated data as seemingly legitimate file transfers:

Command Delivery: The attacker embeds commands within files that appear legitimate—like documents, images, or system files. These files are then delivered to the compromised system through methods that blend with normal business operations.

Command Execution: Once received, the malware on the compromised system extracts and executes the embedded commands, which might direct it to collect specific data, move laterally through the network, or deploy additional payloads.

Data Exfiltration: Information gathered from the compromised system is similarly encoded or encrypted within files that appear innocuous, then transferred back to attacker-controlled repositories using legitimate channels.

What makes this approach particularly effective is its ability to operate intermittently. Unlike persistent network connections that might raise alerts, file-based C2 can function through periodic, scheduled transfers that appear routine to monitoring systems.

Covert Communication Channels

Attackers leverage various file transfer mechanisms to establish their command and control channels:

Cloud Storage Services: Platforms like Dropbox, Google Drive, and OneDrive are increasingly used as C2 intermediaries. The malware uploads data to or downloads commands from shared folders on these services. Proofpoint researchers identified a 56% increase in malware using legitimate cloud services for C2 communication in 2023.

Email Attachments: Some advanced threats use email as a C2 channel, with commands sent as attachments to specific accounts and data exfiltrated as outbound message attachments. According to Microsoft Security Intelligence, email-based C2 techniques increased by 41% among sophisticated threat actors targeting enterprises.

Web-Based File Uploads: Compromised or attacker-controlled websites can serve as file transfer points, with the malware programmed to periodically check these sites for command files and upload results. These connections often blend with legitimate web browsing traffic.

FTP and SMB Transfers: In environments where file transfers via FTP or SMB are common, malware can disguise C2 communications as routine file operations within these protocols. CrowdStrike observed that 29% of persistent threats leveraged existing file sharing infrastructure for covert communication.

Staying Under the Radar

To avoid detection, file-based C2 channels employ sophisticated evasion techniques:

Steganography: This technique hides command data within seemingly innocent files, particularly images or media files, by subtly altering parts of the file not readily visible to humans. A Symantec analysis revealed that steganography use in C2 communication increased by 48% in APT campaigns over the past two years.

Legitimate File Types: Attackers increasingly use file types commonly found in the target environment. For example, in a marketing firm, design files might be used, while an accounting firm might see financial document formats leveraged for C2.

Encrypted Content: By encrypting the commands and data within transferred files, attackers prevent security tools from inspecting the actual content, even if the files themselves are flagged for review. According to IBM X-Force research, 87% of file-based C2 channels now use custom encryption to protect command data.

Timing Patterns: Sophisticated malware varies its communication intervals and aligns file transfers with periods of high legitimate activity to avoid creating recognizable patterns. Some advanced threats even monitor user behavior and only perform transfers when the system is actively being used.

Real-World Examples

Several notable attack campaigns have demonstrated the effectiveness of file-based command and control:

APT29’s StellarParticle Campaign: This sophisticated attack, attributed to Russian intelligence services, used a combination of Dropbox and Twitter for file-based C2. The malware encoded commands and exfiltrated data as image files transferred through these platforms, allowing it to evade detection for over 14 months in multiple government agencies.

Lazarus Group’s AppleJeus Operation: In this campaign targeting financial institutions, attackers used compromised update servers to deliver seemingly legitimate update files that contained both malware and embedded commands. The malware would then exfiltrate financial data encoded as image files uploaded to compromised websites.

Finding the Hidden Channel

Despite their stealth, file-based C2 channels can be detected with the right approaches:

Behavioral Analytics: Rather than looking for known signatures, behavioral analysis establishes baselines of normal file transfer patterns and flags anomalies. Organizations implementing advanced behavioral analytics detected file-based C2 channels 76% faster than those using traditional security tools, according to Gartner research.

Metadata Analysis: Even when file contents are encrypted or obfuscated, metadata analysis can reveal suspicious patterns. Unusual creation times, modification patterns, or size anomalies may indicate files being used for C2 purposes.

Traffic Analysis: While individual transfers might appear legitimate, holistic traffic analysis can identify suspicious patterns in aggregate file transfer activities. For example, regular small uploads to cloud storage services outside of business hours might indicate automated exfiltration.

Building Defensive Barriers

Organizations can implement several strategies to disrupt file-based command and control channels:

Strict Egress Filtering: Limiting outbound connections to only approved destinations and protocols can significantly reduce the viable channels for file-based C2. According to Cisco’s 2023 Security Outcomes Report, organizations with rigorous egress filtering detected file-based exfiltration attempts 83% more frequently than those without such controls.

Data Loss Prevention (DLP): Advanced DLP solutions can detect and block suspicious file transfers, particularly those containing sensitive information. Modern DLP tools use machine learning to identify anomalous file movement patterns that might indicate C2 activity.

Content Disarm and Reconstruction (CDR): For files entering the environment, CDR technology can neutralize potential threats by rebuilding files without active content or hidden elements that might establish C2 channels.

Zero Trust Architecture: Implementing zero trust principles—never trust, always verify—can limit the ability of compromised systems to connect to external resources or internal targets without strict authentication and authorization, disrupting C2 operations.

The Next Generation of Threats

File-based command and control techniques continue to evolve as security measures improve. Recent trends show attackers increasingly leveraging built-in operating system utilities and legitimate applications to facilitate file-based C2, making detection even more challenging as the tools used are native to the environment.

By understanding how attackers implement file-based C2 channels, organizations can develop effective defenses that combine technical controls with threat intelligence and user awareness to disrupt these sophisticated communication mechanisms before they lead to significant data breaches.

Scroll to Top
Scroll to Top