Back to Intelligence

Operation ShadowCloud: Detecting and Disrupting GitHub-Based C2 Espionage Infrastructure

SA
Security Arsenal Team
December 6, 2026
11 min read

A newly disclosed intrusion set tracked as Operation ShadowCloud has been using GitHub as command-and-control (C2) infrastructure for a little over two years — and the operation's own opsec failure just handed defenders an extraordinary gift. Analysis of the GitHub commit history associated with the campaign has exposed 80,409 individual espionage commands issued to compromised hosts, revealing a sustained cyber espionage operation attributed to Chinese-speaking threat actors targeting government sectors in Asia and Africa.

This is not a theoretical technique. Living-off-legitimate-services C2 — abusing trusted platforms like GitHub, Slack, Dropbox, or Google Drive for command channels — has been a staple of advanced persistent threat tradecraft for years (MITRE ATT&CK T1102: Web Service). What makes ShadowCloud significant is the scale and longevity: two years of continuous operation, tens of thousands of issued commands, and a victimology focused on government entities in regions where defensive maturity and egress visibility are often limited.

If your SOC treats github.com, api.github.com, or raw.githubusercontent.com as implicitly trusted destinations, you have a blind spot that this threat class exploits by design. This post breaks down the technique from a defender's perspective and delivers concrete detection logic, hunt queries, and hardening steps you can operationalize today.

Technical Analysis

What Happened

Researchers analyzing an intrusion set observed malware communicating with attacker-controlled GitHub infrastructure. Rather than standing up bespoke C2 servers — which can be sinkholed, seized, or attributed — the operators used GitHub repositories and their commit mechanisms as a dead-drop and command-distribution channel. Implants on compromised hosts would authenticate to or anonymously poll GitHub endpoints, retrieve tasking embedded in repository content (commits, files, issues, or gists), and in this case, the operators themselves left a forensic goldmine: the commit history preserved the full operational record.

The analysis of that commit history exposed:

  • 80,409 espionage commands issued over the campaign lifecycle
  • Campaign duration of slightly over two years of continuous operation
  • Victimology centered on government organizations in Asia and Africa
  • Attribution indicators pointing to Chinese-speaking operators

How GitHub-as-C2 Works (Defender's View)

From the endpoint and network perspective, the attack chain typically looks like this:

  1. Initial access is achieved through an unauthorized access mechanism (phishing, exposed service exploitation, or supply-chain vector — the summary does not specify, so defenders should assume multiple ingress paths).
  2. Implant deployment: a lightweight beacon or staging payload is dropped, often with persistence via scheduled tasks, run keys, or service installation.
  3. C2 establishment: the implant makes outbound HTTPS connections to GitHub properties — commonly api.github.com (REST/GraphQL API), raw.githubusercontent.com (raw file retrieval), or gist.github.com. Traffic is TLS-encrypted to a legitimate, high-reputation SaaS domain, defeating reputation-based filtering and blending with developer activity.
  4. Tasking retrieval: the implant reads commands from commit contents, file blobs, or issue/comment bodies. In ShadowCloud's case, commands were committed to repositories — which is precisely why the commit history later exposed the full command corpus.
  5. Execution and exfiltration: tasking executes via cmd.exe, powershell.exe, wscript.exe, or similar interpreters; results are written back through the same channel or exfiltrated over HTTPS.

Why This Defeats Naive Defenses

  • Domain reputation is useless: GitHub is allow-listed in most proxies and is essential in any environment with developers.
  • TLS inspection gaps: many organizations exempt major SaaS properties from SSL decryption due to certificate pinning or privacy policy.
  • Volume camouflage: in engineering-heavy environments, GitHub API traffic is constant. The implant's traffic is indistinguishable at the destination level — differentiation requires process-level context (which binary is talking to GitHub, and why).

Exploitation Status

This is confirmed, active, in-the-wild espionage tradecraft with a documented two-year operational history — not a proof of concept. No CVE is associated with this disclosure; the technique abuses legitimate platform functionality by design. There is no patch for "GitHub works as intended." Defense is entirely a detection-and-egress-control problem.

Detection & Response

The highest-fidelity detection opportunity is the process-to-destination mismatch: GitHub API traffic is legitimate when it originates from git.exe, gh.exe, IDE helpers, or CI runners — and deeply suspicious when it originates from script interpreters, Office applications, unsigned binaries in user profiles, or system processes with no business reason to touch source-control APIs.

Sigma Rules

YAML
---
title: Non-Developer Process Connecting to GitHub API Endpoints
id: 3f8c1a72-6b4d-4e59-9a21-7c0d5e2f8b13
status: experimental
description: Detects network connections to GitHub C2-capable endpoints (api.github.com, raw.githubusercontent.com, gist.github.com) from processes not typically associated with legitimate development activity. Consistent with web service C2 tradecraft such as Operation ShadowCloud.
references:
  - https://thehackernews.com/2026/12/github-commit-history-exposes-80409.html
  - https://attack.mitre.org/techniques/T1102/
  - https://attack.mitre.org/techniques/T1071/001/
author: Security Arsenal
date: 2026/12/15
tags:
  - attack.command_and_control
  - attack.t1102
  - attack.t1071.001
logsource:
  category: network_connection
  product: windows
detection:
  selection_destination:
    DestinationHostname|contains:
      - 'api.github.com'
      - 'raw.githubusercontent.com'
      - 'gist.github.com'
      - 'objects.githubusercontent.com'
  selection_suspicious_process:
    Image|endswith:
      - '\powershell.exe'
      - '\pwsh.exe'
      - '\cmd.exe'
      - '\wscript.exe'
      - '\cscript.exe'
      - '\mshta.exe'
      - '\rundll32.exe'
      - '\regsvr32.exe'
      - '\wmic.exe'
      - '\curl.exe'
      - '\certutil.exe'
      - '\bitsadmin.exe'
  condition: selection_destination and selection_suspicious_process
falsepositives:
  - Developer automation scripts pulling modules or tools from GitHub (inventory and tune per host role)
  - PowerShell module installs from PSGallery-backed GitHub releases
level: high
---
title: Unsigned Executable in User Profile Connecting to GitHub
id: 9d2e6b41-1f7a-4c38-b8e4-5a9d0c3f6e27
status: experimental
description: Detects executables running from user-writable paths (AppData, Temp, Public, Downloads) establishing connections to GitHub domains. Malware using GitHub as a dead-drop resolver or C2 channel frequently stages from user-writable directories.
references:
  - https://thehackernews.com/2026/12/github-commit-history-exposes-80409.html
  - https://attack.mitre.org/techniques/T1102/
author: Security Arsenal
date: 2026/12/15
tags:
  - attack.command_and_control
  - attack.t1102
logsource:
  category: network_connection
  product: windows
detection:
  selection_destination:
    DestinationHostname|contains:
      - 'github.com'
      - 'githubusercontent.com'
  selection_path:
    Image|contains:
      - '\AppData\Local\Temp\'
      - '\AppData\Roaming\'
      - 'C:\Users\Public\'
      - '\Downloads\'
      - 'C:\ProgramData\'
  filter_legit:
    Image|contains:
      - '\AppData\Local\GitHubDesktop\'
      - '\AppData\Local\Programs\Microsoft VS Code\'
      - '\AppData\Local\slack\'
  condition: selection_destination and selection_path and not filter_legit
falsepositives:
  - User-installed development tools and auto-updaters running from AppData
  - Electron-based applications with GitHub integration
level: medium
---
title: GitHub API Interaction via Command-Line Web Request
id: 5b7f3d08-8c2e-4a61-9d74-2e6b1a5c9f40
status: experimental
description: Detects command-line invocations that fetch content from GitHub raw content or API endpoints, a common pattern for retrieving second-stage payloads or C2 tasking in web-service C2 campaigns.
references:
  - https://thehackernews.com/2026/12/github-commit-history-exposes-80409.html
  - https://attack.mitre.org/techniques/T1102/002/
  - https://attack.mitre.org/techniques/T1059/
author: Security Arsenal
date: 2026/12/15
tags:
  - attack.command_and_control
  - attack.t1102.002
  - attack.execution
logsource:
  category: process_creation
  product: windows
detection:
  selection_url:
    CommandLine|contains:
      - 'raw.githubusercontent.com'
      - 'api.github.com'
      - 'gist.githubusercontent.com'
  selection_tool:
    CommandLine|contains:
      - 'Invoke-WebRequest'
      - 'Invoke-RestMethod'
      - 'iwr '
      - 'irm '
      - 'curl.exe'
      - 'wget.exe'
      - 'certutil -urlcache'
      - 'Net.WebClient'
      - 'DownloadString'
  condition: selection_url and selection_tool
falsepositives:
  - Legitimate tooling installation scripts (e.g., package managers, admin bootstrap scripts)
  - DevOps pipeline steps
level: medium

A note on tuning: the first rule is your workhorse, but it will fire in environments with heavy PowerShell-based automation. Baseline by host role — developer workstations and build servers get tuned separately from finance, HR, and executive endpoints, where any process-to-GitHub-API connection outside an approved list should be treated as suspicious by default.

KQL Hunt (Microsoft Sentinel / Defender)

KQL — Microsoft Sentinel / Defender
// Hunt: Non-developer processes communicating with GitHub C2-capable endpoints
// Tunes out common developer tooling; review the 'OtherProcesses' output carefully
let GitHubC2Domains = dynamic(["api.github.com", "raw.githubusercontent.com", "gist.github.com", "gist.githubusercontent.com", "objects.githubusercontent.com"]);
let ApprovedProcs = dynamic(["git.exe", "gh.exe", "githubdesktop.exe", "code.exe", "code-insiders.exe", "devenv.exe", "idea64.exe", "node.exe", "docker.exe", "com.docker.backend.exe", "azuredevops.agent.exe", "runner.worker.exe"]);
DeviceNetworkEvents
| where TimeGenerated > ago(30d)
| where RemoteUrl in~ (GitHubC2Domains)
| extend ProcName = tolower(InitiatingProcessFileName)
| where ProcName !in~ (ApprovedProcs)
| summarize ConnectionCount = count(),
            FirstSeen = min(TimeGenerated),
            LastSeen = max(TimeGenerated),
            DistinctDevices = dcount(DeviceName),
            Devices = make_set(DeviceName, 20),
            CommandLines = make_set(InitiatingProcessCommandLine, 10)
    by ProcName, InitiatingProcessFolderPath, RemoteUrl
| where ConnectionCount > 10  // Beacon-like repetition threshold; tune to environment
| sort by ConnectionCount desc

The ConnectionCount > 10 threshold targets the beaconing pattern inherent to polling-based C2: ShadowCloud-style implants poll their tasking source repeatedly over days and weeks, producing high connection counts from a single process path to a single GitHub endpoint. A developer's one-off Invoke-RestMethod does not produce that cadence. If your environment ingests firewall or proxy logs into Sentinel, extend the same logic against CommonSecurityLog filtered on RequestURL or DestinationHostName.

Velociraptor VQL

VQL — Velociraptor
-- Hunt: Processes holding active connections to GitHub API/raw endpoints
-- deployed as a hunt across the fleet to catch live ShadowCloud-style implants
SELECT Pid,
       Name,
       Exe,
       CommandLine,
       Username,
       netstat().RemoteIP AS RemoteIP,
       netstat().RemotePort AS RemotePort,
       netstat().Status AS ConnStatus
FROM pslist()
WHERE netstat().RemotePort = 443
  AND (
        Name =~ '(?i)(powershell|pwsh|cmd|wscript|cscript|mshta|rundll32|regsvr32|curl|wmic)'
        OR Exe =~ '(?i)(AppData|Users\\\\Public|ProgramData|Temp)'
      )
  AND netstat().RemoteIP IS NOT NULL

Note that VQL's netstat() returns IPs rather than hostnames, so pair this hunt with a DNS-resolution lookup (e.g., resolve() against your DNS or a lookup of GitHub's published IP ranges from https://api.github.com/meta) or correlate the resulting PIDs against your proxy logs. For a dead implant with no live connection, swap the approach to glob() hunting for recently modified executables and scripts in user-writable paths, then triage with yara().

Remediation / Verification Script

PowerShell
#Requires -RunAsAdministrator
# Operation ShadowCloud-style GitHub C2 exposure audit
# 1) Enumerate established connections to GitHub IP space from non-dev processes
# 2) Audit DNS cache for GitHub API resolution from unexpected hosts
# 3) Review persistence surfaces for recently created tasks referencing web requests

$approvedProcs = @('git.exe','gh.exe','githubdesktop.exe','code.exe','devenv.exe','node.exe')

# --- 1. Live connection check against GitHub published ranges ---
Write-Host "[*] Fetching GitHub published IP ranges..." -ForegroundColor Cyan
$ghMeta = Invoke-RestMethod -Uri 'https://api.github.com/meta' -Headers @{ 'User-Agent' = 'soc-audit' }
$ghRanges = $ghMeta.api + $ghMeta.web + $ghMeta.packages

$suspicious = Get-NetTCPConnection -State Established -RemotePort 443 -ErrorAction SilentlyContinue |
  ForEach-Object {
    $proc = Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue
    [PSCustomObject]@{
      Process     = $proc.ProcessName
      Path        = $proc.Path
      RemoteIP    = $_.RemoteAddress
      Pid         = $_.OwningProcess
      ApprovedProc = ($approvedProcs -contains $proc.ProcessName)
    }
  } | Where-Object { -not $_.ApprovedProc }

$suspicious | Format-Table -AutoSize
Write-Host "[!] Cross-reference RemoteIPs against GitHub ranges and proxy logs." -ForegroundColor Yellow

# --- 2. DNS cache check for C2-capable GitHub endpoints ---
Write-Host "[*] DNS cache entries for GitHub C2-capable endpoints:" -ForegroundColor Cyan
Get-DnsClientCache | Where-Object {
  $_.Entry -match 'api\.github\.com|raw\.githubusercontent\.com|gist\.github\.com'
} | Select-Object Entry, Data, TimeToLive | Format-Table -AutoSize

# --- 3. Scheduled tasks referencing GitHub or web-request primitives ---
Write-Host "[*] Scheduled tasks with web-request or GitHub references:" -ForegroundColor Cyan
Get-ScheduledTask | ForEach-Object {
  $task = $_
  $actions = ($task.Actions | Out-String)
  if ($actions -match 'github|Invoke-WebRequest|Invoke-RestMethod|DownloadString|curl\.exe') {
    [PSCustomObject]@{
      TaskName   = $task.TaskName
      TaskPath   = $task.TaskPath
      State      = $task.State
      Actions    = $actions.Trim()
    }
  }
} | Format-List

Write-Host "[*] Audit complete. Escalate any unsigned binaries in user paths talking to GitHub." -ForegroundColor Cyan

Remediation

There is no vendor patch here — the platform is working as designed. Remediation is architectural and operational:

  1. Egress policy by process identity, not just destination. Move beyond domain allow-listing. At the proxy or Secure Web Gateway layer, restrict api.github.com and raw.githubusercontent.com to identified developer subnets and build infrastructure where feasible. At minimum, alert on those destinations from server VLANs and non-engineering user segments — governments and enterprises compromised by ShadowCloud almost certainly had no such segmentation.

  2. Deploy and tune the detections above. Onboard the Sigma rules into your SIEM pipeline (convert via sigma-cli or your platform's native compiler), run the KQL hunt retroactively over 30+ days of data, and push the VQL artifact fleet-wide via Velociraptor. Prioritize: (a) servers with no development function, (b) executive/finance endpoints, (c) anything in a government or diplomatic enclave.

  3. Hunt your own exposure on GitHub. If your organization uses GitHub, audit for: personal access tokens (PATs) committed to repositories, service accounts with excessive scope, and — critically — whether any attacker-planted repositories exist in your org or are being polled by your hosts. GitHub's own audit log and secret scanning should be enabled and reviewed. Revoke and rotate any token found in telemetry associated with anomalous processes.

  4. Enable TLS inspection for SaaS categories where policy permits. The single biggest blind spot enabling this tradecraft is uninspected HTTPS to high-reputation domains. Where legal and policy constraints allow, inspect GitHub API traffic and alert on anomalous patterns (e.g., PAT-authenticated API calls from endpoints, high-frequency polling of a single repository).

  5. Restrict script interpreter egress. Use WDAC/AppLocker or EDR network isolation policies to block powershell.exe, mshta.exe, wscript.exe, rundll32.exe, and curl.exe from initiating outbound 443 on endpoints where they have no legitimate remote-fetch requirement. This is one of the highest-leverage hardening steps against the entire web-service-C2 technique class, not just ShadowCloud.

  6. Threat-hunt persistence. Two years of dwell time means robust persistence. Review scheduled tasks, run keys, services, and WMI subscriptions created within the campaign window, cross-referenced against hosts that show GitHub API connections from non-developer processes. If you find a hit, treat it as an IR event — acquire memory and triage before remediation, because the implant is almost certainly not the only artifact.

  7. Report and coordinate. Espionage campaigns targeting government sectors warrant engagement with national CERTs and, for U.S. entities, CISA and FBI. If your hunt surfaces matching activity, preserve the GitHub artifacts (repository URLs, commit SHAs, account handles) before reporting them to GitHub Trust & Safety — once repos are taken down, the forensic record goes with them, as this story's commit-history windfall demonstrates.

The ShadowCloud disclosure is a reminder that the attacker advantage in abusing legitimate services is entirely dependent on defender passivity. The traffic is visible. The cadence is detectable. The process context gives it away. Close the gap.

Related Resources

Security Arsenal Managed SOC Services AlertMonitor Platform Book a SOC Assessment soc-mdr Intel Hub

Is your security operations ready?

Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.