Detect Web Service in Google Chronicle
Adversaries may use an existing, legitimate external web service as a means for relaying data to/from a compromised system. Popular websites and cloud services such as Google Drive, OneDrive, Dropbox, Pastebin, GitHub, and Discord may act as C2 channels due to the high likelihood that hosts within a network already communicate with them. This provides cover in expected noise and takes advantage of SSL/TLS encryption offered by these providers. Use of web services also protects back-end C2 infrastructure from discovery through malware binary analysis while enabling operational resiliency through dynamic infrastructure changes.
MITRE ATT&CK
- Tactic
- Command and Control
- Technique
- T1102 Web Service
- Canonical reference
- https://attack.mitre.org/techniques/T1102/
YARA-L Detection Query
rule t1102_web_service_c2_network_connection {
meta:
author = "detection-engineering"
description = "Detects non-browser processes initiating outbound network connections to web service domains known to be abused as C2 channels (MITRE T1102)"
severity = "HIGH"
priority = "HIGH"
mitre_attack_tactic = "Command-And-Control"
mitre_attack_technique = "T1102"
mitre_attack_subtechnique = "T1102.002"
platforms = "Windows"
tags = "c2, web-service, t1102, network"
events:
$net.metadata.event_type = "NETWORK_CONNECTION"
$net.target.hostname = /(?i)(pastebin\.com|paste\.ee|ghostbin\.co|api\.github\.com|raw\.githubusercontent\.com|gist\.github\.com|graph\.microsoft\.com|onedrive\.live\.com|api\.onedrive\.com|www\.googleapis\.com|drive\.google\.com|storage\.googleapis\.com|api\.dropboxapi\.com|content\.dropboxapi\.com|discord\.com|discordapp\.com|cdn\.discordapp\.com|api\.telegram\.org|slack\.com|api\.slack\.com|firebaseio\.com|firebase\.googleapis\.com|api\.notion\.so|gitee\.com|top4top\.io)/
not $net.principal.process.file.full_path = /(?i)(chrome\.exe|firefox\.exe|msedge\.exe|iexplore\.exe|safari\.exe|opera\.exe|brave\.exe|OneDriveSetup\.exe|OneDrive\.exe|googledrivesync\.exe|dropbox\.exe|slack\.exe|teams\.exe|discord\.exe)/
(
$net.principal.process.file.full_path = /(?i)(powershell\.exe|pwsh\.exe|cmd\.exe|wscript\.exe|cscript\.exe|mshta\.exe|rundll32\.exe|regsvr32\.exe|certutil\.exe|bitsadmin\.exe|curl\.exe|wget\.exe|python\.exe|python3\.exe|ruby\.exe|perl\.exe|node\.exe)/
or
$net.principal.process.parent_process.file.full_path = /(?i)(winword\.exe|excel\.exe|powerpnt\.exe|outlook\.exe|acrobat\.exe|acrord32\.exe)/
)
condition:
$net
} Chronicle YARA-L 2.0 rule detecting NETWORK_CONNECTION UDM events where a non-browser process connects to known web service domains abused as C2 channels (T1102). Targets suspicious system utilities and scripting interpreters (PowerShell, cmd, wscript, cscript, mshta, certutil, curl, wget, Python, Ruby, Perl, Node.js) and processes spawned by Microsoft Office or Adobe Acrobat making outbound connections to abuse-prone cloud service domains.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate curl.exe or wget.exe usage in scheduled tasks or administrative scripts that download configuration or software updates from GitHub raw content or cloud storage providers.
- Python or Node.js development toolchains on developer machines that routinely contact Firebase, Google APIs, Slack webhooks, or npm registries for dependency resolution or build processes.
- IT automation using PowerShell to interact with Microsoft Graph API, OneDrive, or SharePoint Online for user provisioning, license reporting, or file management workflows.
Other platforms for T1102
Testing Methodology
Validate this detection against 5 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1PowerShell Dead Drop Resolver via Pastebin
Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe, CommandLine containing 'Net.WebClient' and 'pastebin.com'. Sysmon Event ID 3: Network Connection to pastebin.com on port 443. Sysmon Event ID 22: DNS query for pastebin.com. PowerShell ScriptBlock Log Event ID 4104 with the full command.
- Test 2Simulated OneDrive C2 Channel via Microsoft Graph API
Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe, CommandLine containing 'Invoke-RestMethod' and 'graph.microsoft.com'. Sysmon Event ID 3: Network Connection to graph.microsoft.com on port 443. Sysmon Event ID 22: DNS query for graph.microsoft.com.
- Test 3Curl-based GitHub Raw Content Retrieval (Linux/macOS)
Expected signal: Syslog/auditd: execve syscall for curl with arguments containing raw.githubusercontent.com. Network connection to 185.199.x.x (GitHub CDN) on port 443. Linux audit log: SYSCALL record with comm=curl, SOCKADDR with dest IP. File creation at /tmp/df00tech-test-payload.txt.
- Test 4Discord Webhook C2 Simulation
Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe, CommandLine containing 'discord.com' and 'Invoke-RestMethod'. Sysmon Event ID 3: Network Connection to discord.com port 443. Sysmon Event ID 22: DNS query for discord.com. The request will fail with HTTP 401/404 but the network telemetry will still be generated.
- Test 5Python-based Telegram Bot API C2 Simulation
Expected signal: Sysmon Event ID 1: Process Create with Image=python.exe, CommandLine containing 'api.telegram.org'. Sysmon Event ID 3: Network Connection to api.telegram.org port 443. Sysmon Event ID 22: DNS query for api.telegram.org. The request will return HTTP 401 (invalid token) but network telemetry is generated.
References (10)
- https://attack.mitre.org/techniques/T1102/
- https://www.broadcom.com/support/security-center/protection-bulletin/birdyclient-malware-leverages-microsoft-graph-api-for-c-c-communication
- https://www.welivesecurity.com/en/eset-research/evasivepanda-apt-group-uses-update-channels-of-legitimate-applications-for-cyberespionage/
- https://symantec-enterprise-blogs.security.com/threat-intelligence/daggerfly-apt-actor-macos
- https://unit42.paloaltonetworks.com/latrodectus-cybercrime-affiliate-activity/
- https://www.microsoft.com/en-us/security/blog/2021/05/28/breaking-down-nobelium-latest-early-stage-toolset/
- https://www.cybereason.com/blog/molerats-in-the-cloud-new-malware-arsenal-abuses-cloud-platforms-in-middle-east-espionage-campaign
- https://blog.talosintelligence.com/2018/08/rocke-champion-of-monero-miners.html
- https://hp.com/h20195/v2/getpdf.aspx/a00127091enw.pdf
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1102/T1102.md
Unlock Pro Content
Get the full detection package for T1102 including response playbook, investigation guide, and atomic red team tests.