AI & ML

Emerging Python Malware Exploits Microsoft Services for Covert Operations

New malware TWINLOOT cleverly employs Microsoft platforms for command-and-control, evading detection while stealing user credentials.

Aug 18, 2026 3 min read
Sign in to save

Security experts have identified a malicious Python framework dubbed TWINLOOT, which routes its command-and-control (C2) activity through trusted Microsoft services, creating challenges for detection efforts. Discovered by the Ontinue Cyber Defense Center in July during an investigation, TWINLOOT leverages tools like SharePoint Online for file-based dead drops and Microsoft Teams’ TURN infrastructure for real-time communications.

Significantly, TWINLOOT’s primary C2 traffic is managed through Microsoft’s IP addresses instead of traditional attacker-owned domains. This crucial detail raises the stakes for security professionals: because the traffic appears legitimate, it complicates detection by security tools that typically classify Microsoft traffic as safe by default and thus might overlook malicious activities buried within it. Shane Barney, Chief Information Security Officer at Keeper Security, emphasized that the design of this malware takes full advantage of defenders’ reliance on the perceived safety of Microsoft’s domain. This is more significant than it looks; as organizations invest heavily in Microsoft’s ecosystem, they may inadvertently create openings for advanced threats like TWINLOOT.

Imitating Trust Within Microsoft Ecosystems

TWINLOOT's design distinguishes between routine tasks and interactive sessions, a deliberate choice that maximizes its stealth capabilities. The malware utilizes SharePoint to poll for instructions approximately every 15 seconds, facilitating not only command execution but also the exfiltration of stolen credentials and reconnaissance data. This constant polling mechanism allows for real-time undermining of the victim's security without raising immediate suspicion.

Experts noted that this malicious implant authenticates via an attacker-controlled Azure tenant rather than the target's Microsoft 365 environment. This unique approach results in no authentication logs being generated in the victim's Entra ID. The absence of these logs is alarming; if an organization relies solely on logs for threat detection, they might completely miss this sophisticated attack vector. For interactive tasks, the framework establishes a reverse SOCKS5 tunnel through Microsoft Teams. This capability enables attackers to traverse the internal network, accessing services that seem to originate from the compromised machine, which masks their activities even further.

This marks only the second identified instance of Teams’ TURN infrastructure being exploited for such activities, and it's noteworthy that Ontinue identified this as the first time genuine WebRTC DataChannels have been employed for this purpose. The method contrasts sharply with typical Edge transport tactics, where the malware runs Microsoft Edge in headless mode and simulates legitimate Graph API requests, giving the impression of a harmless Edge process. By blending in with expected software behaviors, TWINLOOT decreases the likelihood of detection significantly, and this is the part most people overlook: the attacker's ability to masquerade under the guise of legitimate corporate activities is a game of cat and mouse that security teams struggle to win.

Advanced Credential Theft Techniques

TWINLOOT’s capabilities extend to displaying a simulated Windows 10 or 11 lock screen that shows the victim’s actual account details, capturing all login attempts without validation and sending these credentials back to its SharePoint C2 channel. This technique effectively tricks users into thinking they are entering their credentials into a legitimate system when, in fact, they’re feeding information to the attackers. Victims will typically see a standard incorrect password message, enabling the attacker to authenticate at their discretion. This method exploits not only technology but also human psychology.

The stolen credentials may enable lateral movement through the reverse SOCKS tunnel, granting potential access via protocols like RDP, SMB, or WinRM to additional systems. Such capabilities can turn a single compromised account into a gateway for a broader breach, amplifying the impact of TWINLOOT significantly. Moreover, TWINLOOT incorporates a unique persistence method dubbed “Corrupting the Hive Mind.” This technique builds a Windows “NTUSER.MAN” mandatory-profile hive offline, circumventing the need for administrator rights and generating no detectable registry modifications. This innovation is troubling insofar as it reflects a deep understanding of Windows architecture and security practices, rendering traditional defensive measures less effective.

This innovative persistence strategy marks a significant development in malware tactics. Defenders are urged to monitor for anomalous behaviors within SharePoint, Teams, and Graph engagements rather than solely relying on signature-based detection systems. It’s clear that a more behavioral approach to monitoring could yield better results. Recommendations include disabling Edge’s headless mode, keeping an eye on unusual Python executions, resetting compromised credentials, and employing stronger authentication measures to mitigate phishing risks. Organizations that cling only to traditional defenses may find themselves perpetually on the back foot against such intricate and evolving threats.

Future Implications and Significance

What this means for you, if you're working in this space, is that threats like TWINLOOT are emblematic of a larger trend. Attackers are adapting to the security measures we put in place. They’re exploiting what we perceive as safe to execute harmful activities. This suggests an urgent need for security strategies that extend beyond basic defenses and foster a culture of awareness at all levels of an organization.

As reliance on cloud platforms like Microsoft 365 grows, the potential attack surfaces increase correspondingly. Organizations must reevaluate their approach to cybersecurity, emphasizing not just technological defenses but also user education and response readiness. Such a holistic strategy might not only mitigate the risks presented by TWINLOOT but also prepare teams for emerging threats that similarly exploit trusted environments.

Source: James Davis · www.csoonline.com

Comments

Sign in to join the discussion.