Bypass O365 Email Security

Delivered malware implant through O365 security controls

Delivering malware files as attachment to Teams channel chat

If you are reading this somewhere other than c2.opsec.zone and the content appears to be a word-for-word copy, be aware that the original was written by Youssef Ennaciri.

Executive Summary

I was encouraged to learn that Microsoft does not perform file‑content scanning within Teams, OneDrive, or SharePoint. While targeting Microsoft Teams may appear unconventional, this blog will demonstrate how the platform can, in practice, offer one of the most accessible pathways for obtaining initial access to a target organization.

Microsoft says that they don't actively scan files in SharePoint, OneDrive and Teams

We may be able to leverage this permissive behavior by delivering a malicious attachment directly to a Teams channel inbox as a new chat message. By default, Teams accepts inbound emails from external senders, and these messages are not subjected to any meaningful content‑scanning or malware inspection. This creates a potential pathway for introducing malicious files into an organization through what appears to be a legitimate communication channel.

It’s true that Microsoft Teams channel email addresses follow a predictable, machine‑generated structure, and that predictability has implications worth understanding from a defensive and research perspective.

Teams channel email addresses typically include:

  • A unique identifier (often a long numeric or alphanumeric string)

  • The tenant’s domain

  • A regional routing domain such as emea.teams.ms, nam.teams.ms, etc.

An example pattern might look like:

[email protected] This format is standardized because Teams automatically generates these addresses to route messages into specific channels.

Delivery Vector: Microsoft Teams Chat Message

Initial attempts to deliver the payload through traditional phishing emails were blocked by the organization’s layered security controls. Microsoft Defender for Office 365 identified the payload and placed it in quarantine.

To circumvent these protections, the delivery method was shifted to Microsoft Teams, which currently receives less scrutiny within collaboration platforms. The payload consisted of a basic command‑and‑control agent packaged in a password‑less ZIP archive containing executable files responsible for loading shellcode. The file was sent as an attachment to the Teams channel inbox address.

After the message was delivered through Teams, the target user received the payload without any security intervention. The file was automatically stored in the user’s OneDrive (SharePoint) directory associated with Teams. No alerts were generated by the mail gateway or the endpoint detection and response solution during this process.

Mitigation

Based on the successful demonstration of the risks associated with delivering malicious files through Microsoft Teams channel mailboxes, the following security improvements are recommended.

Microsoft Defender for Office 365 should be configured to apply anti‑malware scanning to all emails sent to Teams channel mailboxes. External access to these mailbox addresses should be restricted, and any unused or unnecessary channel email addresses should be identified and disabled. The organization should also monitor for the exposure of Teams channel email addresses through intelligence platforms such as Recorded Future. Finally, permissions for external senders should be limited to reduce the likelihood of unauthorized or malicious content being delivered through this channel.

Last updated