T1567.001
Exfiltration to Code Repository
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.
Microsoft Sentinel / Defender
kusto
let CodeRepoDomains = dynamic(["github.com", "api.github.com", "gitlab.com", "api.gitlab.com", "bitbucket.org", "api.bitbucket.org", "dev.azure.com", "raw.githubusercontent.com", "gist.github.com", "codeberg.org"]);
// Signal 1: Large outbound data transfers from scripting/git tools to code repository domains
let NetworkSignal = DeviceNetworkEvents
| where Timestamp > ago(24h)
| where RemoteUrl has_any (CodeRepoDomains)
| where InitiatingProcessFileName has_any ("git", "curl", "wget", "python", "powershell", "pwsh", "node", "ruby", "perl")
| where BytesSent > 524288
| extend Signal = "LargeUploadToCodeRepo"
| extend BytesSentMB = round(toreal(BytesSent) / 1048576, 2)
| project Timestamp, DeviceName, AccountName, Signal, RemoteUrl, RemotePort, BytesSent, BytesSentMB, BytesReceived, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessParentFileName;
// Signal 2: Git push commands explicitly targeting external repository URLs
let GitPushSignal = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "git.exe" or FileName =~ "git"
| where ProcessCommandLine has "push"
| where ProcessCommandLine has_any (CodeRepoDomains)
| extend Signal = "GitPushToExternalRepo"
| extend BytesSentMB = 0.0
| project Timestamp, DeviceName, AccountName, Signal, RemoteUrl="", RemotePort=0, BytesSent=tolong(0), BytesSentMB, BytesReceived=tolong(0), InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessParentFileName=InitiatingProcessParentFileName;
// Signal 3: Direct API calls to repository REST APIs using PUT/POST (file upload without git client)
let ApiUploadSignal = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName has_any ("curl", "wget", "python", "powershell", "pwsh", "node", "ruby")
| where ProcessCommandLine has_any ("api.github.com", "api.gitlab.com", "api.bitbucket.org", "gist.github.com")
| where ProcessCommandLine has_any ("-X PUT", "-X POST", "method='PUT'", "method='POST'", "requests.put", "requests.post", "Invoke-RestMethod", "Invoke-WebRequest", "contents", "gists")
| extend Signal = "CodeRepoAPIUpload"
| extend BytesSentMB = 0.0
| project Timestamp, DeviceName, AccountName, Signal, RemoteUrl="", RemotePort=443, BytesSent=tolong(0), BytesSentMB, BytesReceived=tolong(0), InitiatingProcessFileName=FileName, InitiatingProcessCommandLine=ProcessCommandLine, InitiatingProcessParentFileName;
union NetworkSignal, GitPushSignal, ApiUploadSignal
| sort by Timestamp desc high severity
medium confidence
Data Sources
Network Traffic: Network Connection Creation Network Traffic: Network Traffic Content Process: Process Creation Command: Command Execution Microsoft Defender for Endpoint
Required Tables
DeviceNetworkEvents DeviceProcessEvents
False Positives
- Software developers legitimately pushing code to GitHub or GitLab as part of normal development workflow — especially on developer workstations
- CI/CD pipeline agents (Jenkins build servers, GitHub Actions self-hosted runners, GitLab CI runners) performing automated builds and deployments that push artifacts or release assets
- Developer IDEs with integrated Git (VS Code, IntelliJ, Visual Studio) performing background sync, auto-push on save, or pull request creation via API
- Backup and configuration management scripts that legitimately use GitHub/GitLab as a storage backend for infrastructure-as-code or configuration files
- Security tools such as Dependabot, Renovate, or Snyk that create automated pull requests by pushing fix branches to repositories
Last updated: 2026-04-21 Research depth: deep
References (10)
- https://attack.mitre.org/techniques/T1567/001/
- https://github.com/EmpireProject/Empire
- https://docs.github.com/en/rest/repos/contents
- https://docs.github.com/en/rest/gists/gists
- https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/reviewing-the-audit-log-for-your-organization
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicenetworkevents-table
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-deviceprocessevents-table
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1567.001/T1567.001.md
- https://github.com/SigmaHQ/sigma/tree/master/rules/windows/network_connection
- https://www.cisa.gov/news-events/cybersecurity-advisories/aa23-347a
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