Red Team

China-linked spies left 80,000 commands readable on GitHub

Apiiro decoded 80,000 deleted GitDoor commands from public GitHub history, exposing a two-year Chinese espionage campaign across 23 countries.

Network graphic with the headline Spies left their orders on GitHub, about the GitDoor espionage campaign

A Chinese-speaking espionage crew ran its implants from public GitHub repositories for two years and forgot that Git never really forgets. Researchers have now rebuilt more than 80,000 of the operators’ own orders from commit history, giving defenders a rare view of tasking, not just tooling.

What happened

Application security firm Apiiro has published research into Operation ShadowCloud, a long-running espionage campaign that Kaspersky first documented in November and that Sophos tracks as Bronze Sandcastle. SecurityWeek reported the findings on 3 December. According to Apiiro, as reported by SecurityWeek, the group’s GitDoor backdoor collected its instructions from public GitHub repositories. The operators deleted each command a few hours after posting it, but the deletion was itself a commit. Every earlier version of the file stayed in the repository history, readable by anyone.

Apiiro says it decoded over 80,000 commands spread across 104 repositories, 92 of them tied to individual victim machines. It describes the setup as one operation divided into regional teams, each with its own GitHub accounts, relay servers and implant builds, with separate teams for Taiwan, the Philippines, Zambia and Uganda, Southeast Asia, South and Central Asia, and a group spanning Latin America and Italy. Victims appear in 23 countries. Named targets include Taiwan’s three main political parties, the Philippine Coast Guard and the Philippine Department of Justice’s cybercrime office, Argentina’s foreign ministry, Mexico’s economy ministry, Eswatini’s national data centre, India’s electronic toll collection system and a foreign-policy think tank in Italy. US targets included a web design company whose clients include Trump-branded resorts, a major industrial union’s central IT function, and a federal contractor’s accounting system and software vendor.

Two details stand out. First, the activity did not stop when Kaspersky went public on 17 November. Apiiro says the operators carried on against Taiwan’s KMT party afterwards, and that minutes before that report appeared they had pushed a Windows kernel exploit to one of their repositories. Second, the timestamps fit Beijing working hours and the mainland Chinese holiday calendar, including the Saturdays China declares as working days. Apiiro is careful to say that a command in the log does not prove it ran, because results went to private repositories it did not examine.

The technical picture

Kaspersky’s two-part analysis fills in how the toolkit works. In the case it investigated, at a Taiwanese organisation, the attackers used a MeshCentral agent, a legitimate remote management tool, apparently left behind by an earlier intrusion. Through it they dropped a trusted executable, a malicious DLL for it to side-load, and an encrypted payload. Kaspersky saw a Sandboxie binary and a Python application binary abused in this way. Apiiro, according to SecurityWeek, found 170 different side-loaded DLLs and 87 or more GitDoor builds.

GitDoor carries an embedded GitHub personal access token. It registers each new victim by opening an issue, uploads encrypted host details disguised as a JavaScript source map file, and polls one repository for commands while posting results to a second. It also copies data to Ably, a commercial real-time messaging service, as a backup channel. Plug-ins for keylogging, screenshots and proxying arrive on demand, often running only in memory.

Its sibling, GraphDoor, takes the same idea into Microsoft 365. Kaspersky found it authenticating as an application, not a user, against Entra ID and then reading and writing SharePoint lists through the Microsoft Graph API on tenants controlled by the attackers. From the victim’s network, that traffic goes to login.microsoftonline.com and graph.microsoft.com, the same destinations as every Teams and Outlook client in the building. Kaspersky links the toolset to Chinese-speaking groups, citing overlaps with FamousSparrow and CopperTurtle in shared staging directories.

Flow diagram of the Operation ShadowCloud attack chain, from an inherited remote management agent and DLL side-loading to cloud C2 on GitHub and SharePoint, and the commit history that exposed 80,000 commands

Why it matters for UK organisations

None of the published victims is British, and I would not suggest UK networks are known to be affected. The relevance is the tradecraft. Most UK organisations I assess allow unrestricted outbound HTTPS to GitHub and Microsoft 365, and few can tell the difference between their own tenant and somebody else’s. Command and control that rides on those services gets past domain reputation filtering, category blocking and most proxy policies by design.

The target list should also register with UK sectors. Government departments, defence suppliers, think tanks, political parties and contractors working on national infrastructure are exactly the kinds of organisation named here, and an Italian policy institute shows the group is willing to work in Europe. UK bodies with operations in Taiwan or Southeast Asia have a more direct interest.

Several victims were also reached through suppliers, from a web agency to infrastructure contractors, a pattern any UK firm in a government or defence supply chain should take seriously.

Expert view

When we run red team engagements, a GitHub or SharePoint-based C2 channel is one of the most dependable ways to stay hidden, because blue teams rarely have the context to call it suspicious. What makes ShadowCloud unusual is not the technique, which has been around for years, but the operational security failure. The operators chose a public repository as a dead drop and treated deletion as erasure.

For defenders, this is a reminder that attacker infrastructure built on public platforms leaves public evidence. The same history that exposed these operators is available to threat hunters, and the GitHub accounts, repository names and SharePoint domains Kaspersky published are directly usable indicators. It also confirms a trend I see in incident work: initial access is often inherited. The MeshCentral agent that let this group in came from an earlier compromise nobody had cleaned up.

I would not over-read the scale, given that commands are not confirmed outcomes. The value is the view of priorities and persistence.

What to do now

  1. Restrict Microsoft 365 to your own tenants. Use Entra tenant restrictions so corporate devices cannot authenticate to or exchange data with unknown tenants. This is the most direct control against GraphDoor-style C2.
  2. Baseline who talks to the GitHub API. Calls to api.github.com from processes that are not developer tools, browsers or known agents deserve investigation, especially from servers. Look for traffic to rest.ably.io where there is no business reason for it.
  3. Hunt for unexpected remote management tools. Inventory MeshCentral, and any other RMM agent, across the estate and remove anything that is not sanctioned. This maps to the Cyber Essentials secure configuration and user access control themes.
  4. Stop side-loading from writable locations. Application allow-listing that considers DLL load paths, together with alerting on signed binaries running from System32 subfolders they do not normally live in, addresses the loader stage. This supports the Cyber Essentials malware protection control.
  5. Load the published indicators. Import Kaspersky’s GitHub account, repository, SharePoint domain and hash indicators into your SIEM and EDR, and search back through retained logs.
  6. Clean up after old incidents. Review previous compromises for leftover access, particularly where remediation was declared complete without a full rebuild.

Bottom line

Operation ShadowCloud shows how far state-aligned operators will go to hide inside trusted cloud services, and how one careless assumption can expose two years of their work. UK defenders cannot block GitHub or Microsoft 365, but they can control which tenants, accounts and processes are allowed to use them, and that is where this kind of C2 is most likely to be caught.

Sources