T1567.001 Splunk · SPL

Detect Exfiltration to Code Repository in Splunk

Adversaries may exfiltrate data to a code repository rather than over their primary command and control channel. Code repositories are often accessible via an API (ex: https://api.github.com). Access to these APIs are often over HTTPS, which gives the adversary an additional level of protection. Exfiltration to a code repository can also provide a significant amount of cover to the adversary if it is a popular service already used by hosts within the network. Tools such as Empire have been observed using GitHub for data exfiltration, leveraging the GitHub API to stage and retrieve data as part of a C2 channel.

MITRE ATT&CK

Tactic
Exfiltration
Technique
T1567 Exfiltration Over Web Service
Sub-technique
T1567.001 Exfiltration to Code Repository
Canonical reference
https://attack.mitre.org/techniques/T1567/001/

SPL Detection Query

Splunk (SPL)
spl
index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational"
  ((EventCode="3"
    (DestinationHostname="github.com" OR DestinationHostname="api.github.com" OR DestinationHostname="gitlab.com" OR DestinationHostname="api.gitlab.com" OR DestinationHostname="bitbucket.org" OR DestinationHostname="api.bitbucket.org" OR DestinationHostname="dev.azure.com" OR DestinationHostname="gist.github.com" OR DestinationHostname="codeberg.org")
    (Image="*\\git.exe" OR Image="*\\curl.exe" OR Image="*\\wget.exe" OR Image="*\\python.exe" OR Image="*\\python3.exe" OR Image="*\\powershell.exe" OR Image="*\\pwsh.exe" OR Image="*\\node.exe" OR Image="*\\ruby.exe"))
  OR
  (EventCode="1"
    (Image="*\\git.exe")
    (CommandLine="*push*")
    (CommandLine="*github.com*" OR CommandLine="*gitlab.com*" OR CommandLine="*bitbucket.org*" OR CommandLine="*dev.azure.com*"))
  OR
  (EventCode="1"
    (Image="*\\curl.exe" OR Image="*\\wget.exe" OR Image="*\\python.exe" OR Image="*\\python3.exe" OR Image="*\\powershell.exe" OR Image="*\\pwsh.exe")
    (CommandLine="*api.github.com*" OR CommandLine="*api.gitlab.com*" OR CommandLine="*gist.github.com*")
    (CommandLine="*PUT*" OR CommandLine="*POST*" OR CommandLine="*contents*" OR CommandLine="*gists*" OR CommandLine="*upload*" OR CommandLine="*Invoke-RestMethod*" OR CommandLine="*requests.put*" OR CommandLine="*requests.post*")))
| eval Signal=case(
    EventCode="3", "NetworkConnectionToCodeRepo",
    EventCode="1" AND match(CommandLine, "push") AND match(CommandLine, "(github\.com|gitlab\.com|bitbucket\.org)"), "GitPushExternal",
    EventCode="1" AND match(CommandLine, "(api\.github\.com|api\.gitlab\.com|gist\.github\.com)"), "CodeRepoAPIUpload",
    1==1, "Unknown")
| eval IsCISystem=if(match(host, "(?i)(jenkins|gitlab-runner|ci[-_]|build[-_]|deploy|devops|runner|bamboo|teamcity)"), 1, 0)
| eval IsKnownIDE=if(match(ParentImage, "(?i)(code\.exe|idea64\.exe|pycharm|devenv\.exe|sourcetree|gitkraken|fork\.exe|tower\.exe)"), 1, 0)
| eval SuspicionScore=case(
    Signal="GitPushExternal" AND IsCISystem=0, 3,
    Signal="CodeRepoAPIUpload" AND IsCISystem=0, 3,
    Signal="NetworkConnectionToCodeRepo" AND IsCISystem=0 AND IsKnownIDE=0, 2,
    Signal="NetworkConnectionToCodeRepo" AND IsCISystem=0 AND IsKnownIDE=1, 1,
    1==1, 0)
| where SuspicionScore >= 2
| table _time, host, User, Image, CommandLine, ParentImage, ParentCommandLine, DestinationHostname, Signal, IsCISystem, IsKnownIDE, SuspicionScore
| sort - SuspicionScore - _time
high severity medium confidence

Detects code repository exfiltration using Sysmon Event ID 3 (Network Connection) and Event ID 1 (Process Creation). Three signal types are scored: network connections from scripting tools to repository domains (Event ID 3), git push commands targeting external repository URLs in the command line (Event ID 1), and direct REST API calls to GitHub/GitLab APIs using PUT/POST methods from scripting tools (Event ID 1). Results are scored based on whether the source host matches CI/CD naming patterns (reducing false positives) and whether the process was launched from a known IDE (lowering suspicion for developer machines). Alerts fire at SuspicionScore >= 2.

Data Sources

Network Traffic: Network Connection CreationProcess: Process CreationSysmon Event ID 1Sysmon Event ID 3

Required Sourcetypes

XmlWinEventLog:Microsoft-Windows-Sysmon/Operational

False Positives & Tuning

  • Software developers legitimately pushing code to GitHub or GitLab — especially when parent process is a known IDE (VS Code, IntelliJ, PyCharm)
  • CI/CD pipeline agents with hostnames not matching the IsCISystem regex pattern (e.g., numeric hostnames) — tune the regex to match your CI infrastructure naming
  • Developer IDEs with Git integration performing background repository sync operations that spawn git.exe
  • Automated dependency update tools (Dependabot, Renovate) running on developer machines or build servers
  • Security scanning tools that push scan results or automated fix branches to repositories
Download portable Sigma rule (.yml)

Other platforms for T1567.001


Testing Methodology

Validate this detection against 4 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 1Exfiltrate Data via GitHub Contents API Using PowerShell

    Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe and CommandLine containing 'api.github.com', 'Invoke-RestMethod', 'PUT', and 'token'. Sysmon Event ID 3: Network Connection from powershell.exe to api.github.com:443. PowerShell ScriptBlock Log Event ID 4104 with full API request including the encoded content. Network proxy logs show HTTPS PUT to api.github.com with outbound payload.

  2. Test 2Git Push Sensitive Files to External Repository from Command Shell

    Expected signal: Sysmon Event ID 1: Multiple process creates — cmd.exe, git.exe (init), git.exe (add), git.exe (commit), git.exe (push) with CommandLine containing 'github.com' and '--force'. Sysmon Event ID 3: Network Connection from git.exe to github.com:443. Sysmon Event ID 11: File Create for stolen_creds.txt in %TEMP%\df00tech-exfil. Security Event ID 4688 if command line auditing enabled.

  3. Test 3Exfiltrate Data via GitHub Gist API Using curl

    Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe spawning curl.exe, CommandLine containing 'api.github.com/gists', '-X POST', and the Authorization header with PAT. Sysmon Event ID 3: Network Connection from curl.exe to api.github.com:443. Proxy logs show HTTPS POST to api.github.com/gists with outbound JSON payload.

  4. Test 4Automated Data Exfiltration via Python GitHub API Script

    Expected signal: Sysmon Event ID 1: Process Create with Image=python.exe and CommandLine containing 'api.github.com', 'PUT', 'urllib.request', and the Authorization token. Sysmon Event ID 3: Network Connection from python.exe to api.github.com:443. No PowerShell ScriptBlock logging (Python process); look for Python audit hooks or endpoint DLP alerts on the data access pattern (reading hosts file).

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections