T1102.002

Bidirectional Communication

Adversaries may use an existing, legitimate external web service as a means for sending commands to and receiving output from a compromised system. Compromised systems may leverage popular websites and cloud storage platforms (Google Drive, OneDrive, Dropbox, GitHub, Pastebin, Twitter, Google Calendar) to host C2 instructions and receive command output. This technique is particularly evasive because traffic blends with legitimate business use of these services, which are commonly accessed prior to compromise and protected with SSL/TLS encryption.

Microsoft Sentinel / Defender
kusto
let WebServiceDomains = dynamic([
  "api.dropboxapi.com", "content.dropboxapi.com", "dropbox.com",
  "onedrive.live.com", "graph.microsoft.com", "sharepoint.com",
  "drive.google.com", "docs.google.com", "googleapis.com", "calendar.google.com",
  "api.github.com", "raw.githubusercontent.com", "gist.github.com",
  "pastebin.com", "paste.ee", "ghostbin.com", "hastebin.com",
  "api.twitter.com", "twitter.com", "t.co",
  "api.telegram.org", "discord.com", "discordapp.com",
  "slack.com", "api.slack.com",
  "technet.microsoft.com", "notion.so", "trello.com",
  "pcloud.com", "box.com", "mediafire.com", "yandex.com",
  "sites.google.com", "blogspot.com", "wordpress.com"
]);
let SuspiciousProcesses = dynamic([
  "powershell.exe", "pwsh.exe", "cmd.exe", "wscript.exe", "cscript.exe",
  "mshta.exe", "rundll32.exe", "regsvr32.exe", "certutil.exe",
  "python.exe", "python3.exe", "pythonw.exe",
  "curl.exe", "wget.exe", "bitsadmin.exe"
]);
DeviceNetworkEvents
| where Timestamp > ago(24h)
| where RemoteUrl has_any (WebServiceDomains) or RemoteIPType == "Public"
| where InitiatingProcessFileName has_any (SuspiciousProcesses)
| extend IsCloudStorage = RemoteUrl has_any ("dropbox.com", "onedrive.live.com", "drive.google.com", "sharepoint.com", "box.com", "pcloud.com")
| extend IsPasteSite = RemoteUrl has_any ("pastebin.com", "paste.ee", "ghostbin.com", "hastebin.com", "gist.github.com")
| extend IsSocialMedia = RemoteUrl has_any ("twitter.com", "api.twitter.com", "t.co", "blogspot.com", "discord.com")
| extend IsDevPlatform = RemoteUrl has_any ("api.github.com", "raw.githubusercontent.com", "gist.github.com")
| extend IsMessaging = RemoteUrl has_any ("api.telegram.org", "slack.com", "api.slack.com")
| join kind=leftouter (
    DeviceProcessEvents
    | where Timestamp > ago(24h)
    | project ProcessTimestamp=Timestamp, DeviceName, InitiatingProcessId=ProcessId,
              ProcessCommandLine, InitiatingProcessCommandLine,
              InitiatingProcessParentFileName
) on DeviceName, $left.InitiatingProcessId == $right.InitiatingProcessId
| extend SuspiciousCmdLine = InitiatingProcessCommandLine has_any (
    "-enc", "-EncodedCommand", "DownloadString", "Invoke-Expression", "IEX",
    "Net.WebClient", "Invoke-WebRequest", "Start-BitsTransfer",
    "[Convert]::FromBase64", "frombase64", "base64"
)
| where IsCloudStorage or IsPasteSite or IsSocialMedia or IsDevPlatform or IsMessaging
| project Timestamp, DeviceName, AccountName,
          InitiatingProcessFileName, InitiatingProcessCommandLine,
          RemoteUrl, RemoteIP, RemotePort,
          IsCloudStorage, IsPasteSite, IsSocialMedia, IsDevPlatform, IsMessaging,
          SuspiciousCmdLine, InitiatingProcessParentFileName
| sort by Timestamp desc
high severity medium confidence

Data Sources

Network Traffic: Network Connection Creation Process: Process Creation Microsoft Defender for Endpoint

Required Tables

DeviceNetworkEvents DeviceProcessEvents

False Positives

  • Legitimate IT automation scripts using PowerShell to interact with OneDrive, SharePoint, or Microsoft Graph API for business purposes
  • Developer workstations using curl, Python, or PowerShell to access GitHub APIs, Pastebin, or other development resources
  • Backup and sync agents or IT tools that legitimately upload/download files from Dropbox, OneDrive, or Google Drive
  • Security tools or monitoring scripts that use Pastebin or GitHub to pull configuration data or threat intelligence feeds
  • Collaboration tools (Slack, Teams, Discord) that spawn browser processes or helper utilities to handle webhooks or integrations

Unlock Pro Content

Get the full detection package for T1102.002 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections