When a vendor says “suspicious activity” and the insiders say “stolen GitHub tokens,” the useful question for a defender is not what happened at SAP. It’s whether you would notice the same thing in your own GitHub organisation. In my analysis of the SAP incident I separated what SAP confirmed from what an insider told Der Spiegel and what company sources told Handelsblatt. This post is the practical half.
You get four Sigma rules for the GitHub audit log: one correlation for bulk cloning by a single token, two rules for attempts to get code past branch protection, and one hunting rule to find the classic personal access tokens that make this kind of theft worthwhile. None of them uses an indicator from the SAP case, because none has been published.
At a glance
- Rules: 4 (one is a Sigma v2 correlation with its base rule in the same file).
- Domain: Cloud-SaaS (GitHub).
- Log source:
product: github,service: audit, streamed from your organisation or enterprise to the SIEM, with Git events and token metadata. - ATT&CK: T1213.003 Code Repositories, T1550.001 Application Access Token, T1562.001 Disable or Modify Tools, T1565.001 Stored Data Manipulation.
- Status: all
experimental. The logic is inferred from reported behaviour, not from published IOCs. - GitHub: Detection Rules/Cloud/SaaS.
The case in brief
SAP confirmed on November 26, 2026 that it had identified suspicious activity and found no evidence of unauthorized access to customer business data. An insider cited by Der Spiegel said attackers had obtained SAP employees’ GitHub authentication tokens, which let them copy and alter source code. Handelsblatt reported a response called “Project Granite”; SecurityWeek, CyberInsider and the CSA, citing Handelsblatt, add that SAP limited GitHub access, paused automated development and replaced signing keys. SAP has confirmed none of those details, and nobody has said how the tokens were stolen. The analysis has the full picture.
For detection, that reported story breaks into four steps with different footprints. Nobody has said how the tokens were stolen; wherever that happened, it was outside GitHub, so the audit log won’t show it. Copying code shows up as git.clone and repo.download_zip events. Altering code shows up as git.push, and if branch protection is in the way, as overrides, rejected pushes or changes to the protection itself. GitHub attaches a hashed_token (a SHA-256 of the token) and a programmatic_access_type to many audit events, which is what ties those steps back to one credential.
Detection map

Everything here depends on one telemetry source, and that is both the strength and the weakness of the set. If you stream the GitHub audit log with Git events, all four rules have their data, with one caveat: token metadata on Git events is still in public preview, and rules 1, 3 and 4 lean on token fields. If you don’t, none of them do, and you can’t fix it after the fact: Git events never show up in the web interface, and on Enterprise Cloud the REST API keeps them for seven days. The dashed box on the right is the honest gap: the theft of the token itself is outside GitHub’s view.
Rule overview
| Rule | Domain | Log source | ATT&CK (tactic / technique) | Level | Status |
|---|---|---|---|---|---|
| Single token clones many repositories within one hour | Cloud-SaaS | github / audit | Collection / T1213.003; Defense Evasion / T1550.001 | Medium | Experimental |
| Branch protection removed or signing and force-push rules changed | Cloud-SaaS | github / audit | Defense Evasion / T1562.001 | Medium | Experimental |
| Protected-branch override or rejected push using a token | Cloud-SaaS | github / audit | Impact / T1565.001; Defense Evasion / T1550.001 | Medium | Experimental |
| Git activity with a classic personal access token | Cloud-SaaS | github / audit | Defense Evasion / T1550.001 | Low (hunting) | Experimental |
The rules
Single GitHub access token clones many distinct repositories within one hour
Context: “copy source code” is the reported step with the clearest log trail. A developer’s token usually touches a handful of repositories a day. An attacker with that token and a list of everything it can read tends to pull as much as possible, quickly, before someone revokes it.
Condition: a base rule keeps git.clone and repo.download_zip events that carry a hashed_token. The correlation counts distinct repo values (a common field on GitHub audit events; check your pipeline keeps the name) per hashed_token and fires at 25 or more within one hour.
ATT&CK: Collection (TA0009) – T1213.003 Data from Information Repositories: Code Repositories; Defense Evasion (TA0005) – T1550.001 Use Alternate Authentication Material: Application Access Token.
title: GitHub Git Clone or Source Archive Download Using an Access Token
id: 73613233-1c56-4b42-81ea-1750b63b4979
name: github_audit_git_clone_or_archive_download_by_token
status: experimental
description: |
Base rule for the correlation below. Matches GitHub audit log git.clone and repo.download_zip events
that carry a hashed token, meaning they were authenticated with a token or key rather than a browser session.
references:
- https://www.securityweek.com/sap-confirms-cyberattack-source-code-reportedly-compromised/
- https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/identifying-audit-log-events-performed-by-an-access-token
- https://netsec101.com/?p=632
author: netsec101.com
date: 2026-12-01
tags:
- attack.collection
- attack.t1213.003
logsource:
product: github
service: audit
definition: 'Requirement: GitHub enterprise or organisation audit log streamed to the SIEM with Git events included. Git events are not shown in the web UI and the Enterprise Cloud REST API keeps them for 7 days. Token metadata on Git events is in public preview. The correlation counts the repo field (a common GitHub audit field); check your pipeline does not rename it.'
detection:
selection:
action:
- 'git.clone'
- 'repo.download_zip'
filter_main_no_token:
hashed_token: null
condition: selection and not filter_main_no_token
falsepositives:
- CI runners, mirroring jobs, backup tools and code-scanning services that clone many repositories with one token
level: low
---
title: Single GitHub Access Token Clones Many Distinct Repositories Within One Hour
id: 1550313d-5018-4c24-8e89-72ca663dd413
status: experimental
description: |
Detects one GitHub access token (grouped by hashed_token) cloning or downloading archives of 25 or more
distinct repositories within one hour. In the SAP incident, an insider reported that stolen employee GitHub
tokens let attackers copy source code; bulk cloning with a developer's token is how that would look in the audit log.
Threshold and logic are inferred, not taken from a published indicator.
references:
- https://www.securityweek.com/sap-confirms-cyberattack-source-code-reportedly-compromised/
- https://labs.cloudsecurityalliance.org/research/csa-research-note-sap-source-code-token-compromise-20261129/
- https://netsec101.com/?p=632
author: netsec101.com
date: 2026-12-01
tags:
- attack.collection
- attack.t1213.003
- attack.defense-evasion
- attack.t1550.001
correlation:
type: value_count
rules:
- github_audit_git_clone_or_archive_download_by_token
group-by:
- hashed_token
timespan: 1h
condition:
gte: 25
field: repo
falsepositives:
- Automation tokens used by CI, backup, mirroring or code-scanning tools; allowlist their hashed_token values after review
- Developers bootstrapping a new machine with a script that clones every team repository
level: medium
False positives and tuning: CI runners, repository mirrors, backup tools and code-scanning services do exactly this every night. Run the base rule alone for a week, list the tokens that cross 25, and allowlist the ones you can explain by hashed_token, not by user name (a stolen token keeps its owner’s name). Then think about lowering the threshold for human accounts. If your SIEM can’t do Sigma correlations, convert the base rule and do the distinct count in the SIEM’s own query language.
How to test: in a lab organisation, create a test token and clone 25 or more small test repositories in a loop within an hour. Confirm that git.clone events with a hashed_token reach the SIEM first; if they don’t, fix the streaming setup before touching the rule.
GitHub branch protection removed or signing and force-push rules changed
Context: altering code that ships means getting past the controls on release branches: required reviews, required signed commits, no force pushes, rules that also bind administrators. An attacker with an admin’s token can simply switch those off. So can a tired admin at 11 p.m., which is why this rule is medium and not high.
Condition: alert on any of protected_branch.destroy, protected_branch.update_signature_requirement_enforcement_level, protected_branch.update_allow_force_pushes_enforcement_level, protected_branch.update_admin_enforced or repository_ruleset.destroy.
ATT&CK: Defense Evasion (TA0005) – T1562.001 Impair Defenses: Disable or Modify Tools.
title: GitHub Branch Protection Removed or Signing and Force-Push Rules Changed
id: 343e1a93-36da-430b-b720-970323305025
status: experimental
description: |
Detects GitHub audit log events where branch protection is deleted, a repository ruleset is deleted, or the
required-signature, force-push or admin-enforcement settings of a protected branch are changed. An attacker
who wants to alter source code, as an insider reported in the SAP incident, has to get past these controls first.
Inferred logic; no published indicator.
references:
- https://www.securityweek.com/sap-confirms-cyberattack-source-code-reportedly-compromised/
- https://docs.github.com/en/enterprise-cloud@latest/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise
- https://netsec101.com/?p=632
author: netsec101.com
date: 2026-12-01
tags:
- attack.defense-evasion
- attack.t1562.001
logsource:
product: github
service: audit
definition: 'Requirement: GitHub enterprise or organisation audit log streamed to the SIEM.'
detection:
selection:
action:
- 'protected_branch.destroy'
- 'protected_branch.update_signature_requirement_enforcement_level'
- 'protected_branch.update_allow_force_pushes_enforcement_level'
- 'protected_branch.update_admin_enforced'
- 'repository_ruleset.destroy'
condition: selection
falsepositives:
- Repository administrators reorganising branch rules or migrating from branch protection to rulesets
- The update events may also fire when a setting is tightened, not only loosened; check the new value in the event
level: medium
False positives and tuning: the “update” events may also fire when a setting is tightened, so look at the new value in the event before escalating, or add a filter once you know how your SIEM parses it. Scope the rule to repositories that feed builds or releases if your organisation has thousands of scratch repos. Expect a burst of noise during a migration from branch protection to rulesets; suppress by change ticket, not forever.
How to test: in a test repository with a protected branch, turn “Require signed commits” off and back on, then delete the protection rule.
GitHub protected-branch override or rejected push using an access token
Context: this is the integrity signal. A token, not a person in the browser, either forcing a change past a protected-branch requirement or trying to push to a protected branch and being refused. The refused attempt matters as much as the successful one: it tells you someone with a token is probing your release branches.
Condition: alert on protected_branch.policy_override or protected_branch.rejected_ref_update when the event carries a hashed_token.
ATT&CK: Impact (TA0040) – T1565.001 Data Manipulation: Stored Data Manipulation; Defense Evasion (TA0005) – T1550.001 Application Access Token.
title: GitHub Protected Branch Override or Rejected Push Using an Access Token
id: aa421b51-1377-46e7-a151-ba9b3f319167
status: experimental
description: |
Detects a protected-branch requirement being overridden, or a push to a protected branch being rejected,
when the event was authenticated with a token or key (hashed_token present). An insider reported that stolen
SAP employee GitHub tokens let attackers alter source code; a token pushing straight at protected branches,
successfully or not, is the integrity signal to chase. Inferred logic; no published indicator.
references:
- https://www.securityweek.com/sap-confirms-cyberattack-source-code-reportedly-compromised/
- https://docs.github.com/en/enterprise-cloud@latest/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise
- https://netsec101.com/?p=632
author: netsec101.com
date: 2026-12-01
tags:
- attack.impact
- attack.t1565.001
- attack.defense-evasion
- attack.t1550.001
logsource:
product: github
service: audit
definition: 'Requirement: GitHub enterprise or organisation audit log streamed to the SIEM; token metadata (hashed_token, programmatic_access_type) present on events.'
detection:
selection:
action:
- 'protected_branch.policy_override'
- 'protected_branch.rejected_ref_update'
filter_main_no_token:
hashed_token: null
condition: selection and not filter_main_no_token
falsepositives:
- Release automation or bots that hold bypass rights on protected branches; allowlist their actor or hashed_token
- Developers whose local Git client pushes to a protected branch by mistake (rejected_ref_update)
level: medium
False positives and tuning: release bots and merge automation that hold bypass rights will trigger overrides; allowlist them by actor and hashed_token. Rejected pushes from developers who forgot which branch they were on are common and harmless; if they swamp you, require two rejected pushes from one token within ten minutes, or drop rejected pushes to low and keep overrides at medium.
How to test: with a personal access token in a lab repository, push a commit directly to a protected branch that requires pull requests. You should see a rejected ref update tied to the token’s hash.
GitHub Git activity authenticated with a classic personal access token
Context: this one is a hunt, not an alert. GitHub’s docs say a classic personal access token can access every repository its owner can, and GitHub recommends fine-grained tokens instead. That breadth makes classic tokens the most valuable thing to steal. You can’t protect tokens you don’t know exist.
Condition: list git.clone, git.fetch, git.push and repo.download_zip events where programmatic_access_type contains “classic”. I could not confirm GitHub’s exact string for this field from the docs, so check a real event and adjust the match.
ATT&CK: Defense Evasion (TA0005) – T1550.001 Application Access Token.
title: GitHub Git Activity Authenticated With a Classic Personal Access Token
id: 20a118bf-0c33-4456-a141-331a7a3230e4
status: experimental
description: |
Hunting rule. Lists Git clone, fetch and push events and source archive downloads authenticated with a classic
personal access token. A classic token can access every repository its owner can, which makes it the most useful kind
to steal. Use the result to build a token inventory and to spot tokens used from unusual places or times.
references:
- https://labs.cloudsecurityalliance.org/research/csa-research-note-sap-source-code-token-compromise-20261129/
- https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/identifying-audit-log-events-performed-by-an-access-token
- https://netsec101.com/?p=632
author: netsec101.com
date: 2026-12-01
tags:
- attack.defense-evasion
- attack.t1550.001
- detection.threat-hunting
logsource:
product: github
service: audit
definition: 'Requirement: GitHub audit log streamed to the SIEM with Git events and token metadata (public preview for Git events). Check the exact programmatic_access_type value in your own events and adjust the match.'
detection:
selection_action:
action:
- 'git.clone'
- 'git.fetch'
- 'git.push'
- 'repo.download_zip'
selection_token:
programmatic_access_type|contains: 'classic'
condition: all of selection_*
falsepositives:
- Legitimate scripts and integrations still using classic tokens; that is the point of the hunt, review and migrate them
level: low
False positives and tuning: every hit is a legitimate use until proven otherwise, and that’s fine. Group the results by hashed_token and actor, and turn the list into a migration plan to fine-grained, expiring tokens. Once a team has migrated, any new classic-token activity from that team becomes worth an alert.
How to test: clone any repository in a lab organisation with a classic token and look for the event.
Coverage and gaps
| Step in case | Tactic | Technique | Rule | Covered? |
|---|---|---|---|---|
| Employee token stolen | Credential Access (TA0006) | Unknown method | – | Gap: outside GitHub |
| Stolen token used | Defense Evasion (TA0005) | T1550.001 | Hunting, correlation, override rules | Partial |
| Source code copied | Collection (TA0009) | T1213.003 | Bulk clone correlation | Yes, for bulk; not for slow, targeted cloning |
| Protections weakened | Defense Evasion (TA0005) | T1562.001 | Protection or signing changed | Partial: ruleset edits and review-setting changes not covered |
| Source code altered | Impact (TA0040) | T1565.001 | Override or rejected push | Partial: pushes to unprotected branches are invisible |
| Altered code built and shipped | Initial Access, downstream (TA0001) | T1195.002 | – | Gap: needs build provenance and signature checks |
Three gaps matter. First, the token theft happened outside GitHub, by a method nobody has disclosed, so catching it needs endpoint, CI or browser-side telemetry, not GitHub logs. Second, Sigma can’t express “first time this token has been seen from this network”; do that in the SIEM with a lookup of hashed_token against past source addresses. Third, a quiet attacker pushes to a feature branch and waits for a reviewer to merge it. No log rule catches that. Required reviews, required signed commits and build provenance (SLSA attestations, Sigstore signatures) do, which is why the second rule protects those settings.
Deploying the rules
Grab the YAML from the GitHub folder and convert it with sigma-cli for your SIEM. GitHub audit logs have no standard field mapping in most backends, so check that action, hashed_token, programmatic_access_type and repo match what your ingest pipeline produces, and add a small custom pipeline if they don’t. For example:
sigma convert -t splunk --without-pipeline github_audit_branch_protection_or_signing_requirement_changed.yml
sigma convert -t lucene --without-pipeline github_audit_protected_branch_override_or_rejected_push_by_token.yml
sigma convert -t kusto --without-pipeline github_audit_classic_pat_git_activity.yml
Correlation rules need a backend that supports Sigma correlations; check yours before relying on the bulk-clone rule, or rebuild the count in the SIEM. Run everything in alert-only mode for a week before paging anyone, and make sure the audit log stream actually includes Git events before you trust a quiet dashboard.
My take
Stolen-token activity is detectable in GitHub, but only if you decided to collect the right log before you needed it. My guess is that plenty of organisations have the audit log but not Git events in it, and certainly not more than a week of them. If I could turn on only one thing after reading the SAP story, it would be audit log streaming with Git events. The rule I’d enable first is the protection-change rule, because it is quiet in a well-run organisation and catches the attacker who switches off release controls instead of working around them. It won’t see a push to a feature branch that a reviewer later merges.
I’d also like GitHub to make two things default: Git events visible in the regular audit log search, and a warning when a classic token with no expiration is used against a repository with protected branches. Detection should not depend on setting up streaming in advance to find out that a token was used to clone everything you own.
Sources
- SecurityWeek: SAP Confirms Cyberattack, Source Code Reportedly Compromised (November 27, 2026)
- Handelsblatt: SAP IT-Sicherheitsvorfall (German, November 27, 2026)
- Cloud Security Alliance: Project Granite research note (November 29, 2026)
- GitHub Docs: Identifying audit log events performed by an access token
- GitHub Docs: Audit log events for your enterprise
- GitHub Docs: Managing your personal access tokens

One thought on “Detecting stolen GitHub tokens after SAP’s incident: 4 Sigma rules for the audit log”