Response playbooks, investigation guides, and Atomic Red Team tests are Pro-only. Upgrade to unlock the full detection package for THREAT-CodeRepo-GistExfil.

Upgrade to Pro
THREAT-CodeRepo-GistExfil Elastic Security · Elastic

Detect Data Exfiltration via GitHub Gists and Private Code Repositories in Elastic Security

Adversaries and malicious insiders increasingly use code-hosting platforms (GitHub, GitLab, Bitbucket) as covert exfiltration channels because traffic to these domains is rarely blocked by web proxies and blends with routine developer activity. Two distinct abuse patterns are observed: (1) anonymous or throwaway-account Gist/paste creation used as a low-friction dead drop for small stolen artifacts (credentials, config files, session tokens) — documented in Turla dead-drop resolver infrastructure and multiple commodity loader families that stage stolen data via the GitHub Gist API before onward retrieval; and (2) bulk exfiltration via `git push` or GitHub API PUT/POST calls to a personal or attacker-controlled repository, seen in APT41 intrusions abusing developer tooling and in Lazarus Group operations staging stolen source code and credentials on GitHub/GitLab ahead of retrieval. The same channel is a leading insider-threat vector: departing employees push proprietary source code or customer data to a personal GitHub account under the cover of routine commits. Detection must distinguish these from the overwhelming volume of legitimate CI/CD and developer git traffic, so the strongest signals are (a) git remotes that do not match the organisation's registered GitHub/GitLab organisation, (b) anonymous Gist creation (no owning account, effectively unlisted/unattributable), and (c) API calls using PUT/POST verbs against content endpoints from processes other than the organisation's recognised CI/CD runners.

MITRE ATT&CK

Tactic
Exfiltration

Elastic Detection Query

Elastic Security (Elastic)
eql
process where event.type == "start" and
(
  (process.name : "git" and process.command_line : "*push*" and
   process.command_line : ("*github.com*", "*gitlab.com*", "*bitbucket.org*") and
   not process.command_line : "*<YOUR_GITHUB_ORG>*")
  or (
    process.name : ("curl", "powershell.exe", "pwsh.exe", "python.exe", "python") and
    process.command_line : "*api.github.com/gists*" and
    process.command_line : ("*POST*", "*PUT*", "*Invoke-RestMethod*", "*Invoke-WebRequest*")
  )
  or (
    process.name : ("curl", "powershell.exe", "pwsh.exe", "python.exe", "python") and
    process.command_line : ("*api.github.com*", "*api.gitlab.com*", "*api.bitbucket.org*") and
    process.command_line : ("*/contents/*", "*/repos/*") and
    process.command_line : ("*PUT*", "*POST*")
  )
)
high severity medium confidence

Detects exfiltration to code repositories using ECS process events: git push commands targeting a remote outside the configured corporate org placeholder, scripting-engine calls to the GitHub Gist API with PUT/POST verbs (anonymous dead-drop pattern), and direct Contents/Repos API uploads. Maps to MITRE T1567.001.

Data Sources

Elastic Endpoint SecurityElastic Agent (Endpoint Integration)Winlogbeat with Sysmon

Required Tables

logs-endpoint.events.process-*winlogbeat-*

False Positives & Tuning

  • Open-source contribution workflows: engineers pushing to personal forks of external projects as an approved part of their role — maintain an allowlist of approved external project namespaces in a detection exception list keyed on process.command_line substrings
  • DevRel or security research Gist publishing: staff authorised to publish public code snippets — exclude by process.user.name against a role-based reference list rather than suppressing the rule globally
  • Partner/contractor repositories: legitimate cross-organisation collaboration repos that structurally sit outside the primary corporate namespace — add their specific org/group names to the allowlist alongside the primary corporate org

Other platforms for THREAT-CodeRepo-GistExfil


Testing Methodology

Validate this detection against 2 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.

  1. Test 1Simulate Exfiltration via Anonymous GitHub Gist

    Expected signal: Sysmon Event ID 1: curl.exe process creation with command line referencing api.github.com/gists and a POST body.

  2. Test 2Simulate Exfiltration via Git Push to Non-Corporate Remote

    Expected signal: Process creation events for git with 'push' in the command line and a remote URL not matching the corporate org.

Unlock playbooks & atomic tests with Pro

Get the full detection package for THREAT-CodeRepo-GistExfil — response playbook and atomic red team tests, plus investigation guidance and hunting queries.

df00tech Pro — £29/user/month

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections