Hackers Exploit Outlook to Conceal Linux Backdoor, Evade Detection with Microsoft Graph API and OAuth Tokens

Hackers Exploit Outlook Mailboxes to Conceal Linux GoGra Backdoor Communications

A sophisticated cyber espionage campaign has emerged, wherein a nation-state-affiliated hacking group, known as Harvester, is leveraging Microsoft Outlook mailboxes to clandestinely manage communications for its Linux-based GoGra backdoor. This innovative tactic significantly complicates detection efforts by traditional security systems.

Background on Harvester APT Group

Active since at least 2021, the Harvester Advanced Persistent Threat (APT) group has been implicated in various cyber espionage activities, primarily targeting entities in South Asia. Their operations are characterized by the deployment of custom malware designed to infiltrate and persist within targeted networks.

Development of the Linux GoGra Backdoor

In a notable evolution of their tactics, Harvester has developed a Linux variant of their previously identified GoGra backdoor. This new iteration utilizes the Microsoft Graph API and authentic Outlook mailboxes as a command-and-control (C2) channel, effectively masking malicious communications within legitimate email traffic.

Technical Details of the Attack

The attack initiates with social engineering techniques, where victims are enticed to open decoy documents bearing names such as TheExternalAffairesMinister.pdf and Details Format.pdf. These files, while appearing innocuous, are in fact malicious Linux ELF binaries. Upon execution, the malware establishes persistence by deploying a Go-based dropper that installs the payload in the ~/.config/systemd/user/userservice directory. To ensure it survives system reboots, the malware sets up a systemd user unit and an XDG autostart entry, masquerading as the legitimate Conky system monitor.

Abuse of Microsoft Infrastructure

A critical aspect of this backdoor is its exploitation of Microsoft’s cloud services. The malware contains hardcoded Azure Active Directory (AD) application credentials, including tenant ID, client ID, and client secret, allowing it to request OAuth2 tokens directly from Microsoft. It then communicates through a legitimate Outlook mailbox folder named Zomato Pizza, polling for new instructions every two seconds.

When the attacker sends a command, the malware retrieves emails with subjects beginning with Input, decrypts the AES-CBC encrypted, base64-encoded message body, and executes the command using /bin/bash. The results are encrypted with the same AES key and sent back to the attacker via an email reply with the subject Output. After transmission, the implant deletes the original command email using an HTTP DELETE request, effectively erasing evidence of the exchange.

Implications and Recommendations

This method of utilizing legitimate Microsoft services for malicious purposes underscores the evolving sophistication of cyber threats. By embedding command-and-control communications within trusted email infrastructure, attackers can evade traditional network defenses that are not configured to scrutinize legitimate email traffic.

Organizations operating Linux systems are advised to conduct thorough audits of autostart entries and systemd user units for any unexpected or unfamiliar services, particularly those imitating legitimate tools like Conky. Additionally, monitoring OAuth2 token requests and Microsoft Graph API activity from endpoints that do not typically engage in such communications can aid in early detection of unauthorized activities.

Implementing robust endpoint detection and response (EDR) solutions capable of identifying anomalous behaviors, such as unauthorized system modifications or unusual network communications, is crucial. Regularly updating security protocols and educating staff on recognizing phishing attempts and other social engineering tactics can further bolster an organization’s defense against such sophisticated threats.