T1593.003
Code Repositories
Adversaries may search public code repositories for information about victims that can be used during targeting. Victims may store code in repositories on various third-party websites such as GitHub, GitLab, SourceForge, and BitBucket. Adversaries search these repositories for sensitive data including accidentally leaked credentials, API keys, internal hostnames, technology stack details, and employee names. Groups such as LAPSUS$, HAFNIUM, and Contagious Interview have actively exploited public repository leaks to discover valid credentials and identify victims for targeting.
Microsoft Sentinel / Defender
kusto
let RepoReconTools = dynamic([
"trufflehog", "gitleaks", "gitrob", "git-secrets", "repo-supervisor",
"gitguardian", "detect-secrets", "noseyparker", "secretscanner",
"git-hound", "gitallsecrets", "github-dorks", "github-search"
]);
let GitHubAPIEndpoints = dynamic([
"api.github.com", "github.com/search", "raw.githubusercontent.com",
"gitlab.com/api", "api.bitbucket.org"
]);
let LegitBrowsers = dynamic([
"chrome.exe", "firefox.exe", "msedge.exe", "iexplore.exe",
"safari", "opera.exe", "brave.exe"
]);
// Branch 1: OSINT/repo-scraping tools executed on internal endpoints
let ReconToolExecution = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName has_any (RepoReconTools)
or ProcessCommandLine has_any (RepoReconTools)
or ProcessCommandLine has_any ("trufflehog", "gitleaks", "gitrob", "github-dorks", "gitallsecrets")
| extend DetectionBranch = "ReconToolExecution"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine, DetectionBranch;
// Branch 2: Non-browser processes making bulk API calls to code repository APIs
let BulkRepoAPIAccess = DeviceNetworkEvents
| where Timestamp > ago(24h)
| where RemoteUrl has_any (GitHubAPIEndpoints)
or RemoteIPType == "Public" and (RemoteUrl has "github" or RemoteUrl has "gitlab" or RemoteUrl has "bitbucket")
| where not (InitiatingProcessFileName has_any (LegitBrowsers))
| where InitiatingProcessFileName !in~ ("git.exe", "gh.exe", "code.exe", "devenv.exe", "rider64.exe", "idea64.exe")
| summarize RequestCount = count(),
UniqueURLs = dcount(RemoteUrl),
SampleURLs = make_set(RemoteUrl, 5),
Earliest = min(Timestamp),
Latest = max(Timestamp)
by DeviceName, AccountName, InitiatingProcessFileName, InitiatingProcessCommandLine
| where RequestCount > 10 or UniqueURLs > 3
| extend DetectionBranch = "BulkRepoAPIAccess"
| extend Timestamp = Earliest;
// Branch 3: PowerShell or scripting engines querying GitHub search/API
let ScriptRepoQuery = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("powershell.exe", "pwsh.exe", "python.exe", "python3", "curl.exe", "wget.exe")
| where ProcessCommandLine has "github.com" or ProcessCommandLine has "api.github.com"
or ProcessCommandLine has "gitlab.com" or ProcessCommandLine has "bitbucket.org"
| where ProcessCommandLine has_any ("search", "code", "token", "secret", "password", "api_key", "credential", "leak")
| extend DetectionBranch = "ScriptRepoQuery"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine, DetectionBranch;
union ReconToolExecution, ScriptRepoQuery
| sort by Timestamp desc medium severity
low confidence
Data Sources
Process: Process Creation Network Traffic: Network Connection Creation Command: Command Execution Microsoft Defender for Endpoint
Required Tables
DeviceProcessEvents DeviceNetworkEvents
False Positives
- Security teams running authorized secret scanning tools (truffleHog, gitleaks) as part of internal security audits or CI/CD pipeline security checks
- Developers using GitHub CLI (gh.exe) or IDE integrations (VS Code, JetBrains) that make legitimate API calls to GitHub — covered by the exclusion list but new IDE tools may need to be added
- DevSecOps automation pipelines running repository scanning tools on build agents — these would generate bulk API calls from CI runner processes
- Penetration testers with written authorization conducting red team exercises against the organization's own GitHub repositories
- GitHub Actions or GitLab CI runners executing on self-hosted agents that connect to GitHub APIs as part of normal pipeline operations
Last updated: 2026-03-13 Research depth: deep
References (10)
- https://attack.mitre.org/techniques/T1593/003/
- https://www.microsoft.com/security/blog/2022/03/22/dev-0537-criminal-actor-targeting-organizations-for-data-exfiltration-and-destruction/
- https://www.microsoft.com/en-us/security/blog/2025/03/05/silk-typhoon-targeting-it-supply-chain/
- https://unit42.paloaltonetworks.com/contagious-interview-beavertail-invisibleferret/
- https://www.forbes.com/sites/runasandvik/2014/01/14/attackers-scrape-github-for-cloud-service-credentials-hijack-account-to-mine-virtual-currency/
- https://github.com/trufflesecurity/trufflehog
- https://github.com/gitleaks/gitleaks
- https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
- https://docs.github.com/en/rest/search/search#search-code
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicenetworkevents-table
Unlock Pro Content
Get the full detection package for T1593.003 including response playbook, investigation guide, and atomic red team tests.
Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance