Creuto is now an OpenAI Select Partner Read More

Software Architecture & Technical

GitHub token theft after SAP: four PAT settings to change

GitHub token theft is reportedly behind SAP's incident. The four org PAT policy settings GitHub leaves permissive by default, and what changing each breaks.

GitHub token theft after SAP: four PAT settings to change

If the insider account of SAP's incident is accurate, the way in was not an exploit but stolen employee authentication tokens. GitHub token theft is only as damaging as your organisation's token policy allows, and GitHub ships that policy permissive: classic tokens allowed, no expiry required. By the end of this post you will know which four settings to change first, and what each one will break.

  • What happened: Der Spiegel reported on 26 November 2026 an attack SAP tracks internally as "Project Granite"; SAP's confirmation of suspicious activity was published on 27 November.
  • What is alleged, not confirmed: stolen employee authentication tokens, used to copy and alter source code on GitHub.
  • Who should act: any engineering org whose GitHub organisation still accepts long-lived personal access tokens (PATs) from developers, contractors and CI bots.

What SAP has confirmed, and what is only alleged

SAP has confirmed very little. Its statement to BleepingComputer says it "has identified suspicious activity and promptly implemented the necessary measures to protect its customers," and that "based on our investigation to date, we have found no evidence of unauthorized access to customer business data." Everything about tokens comes from insiders quoted by Der Spiegel.

ClaimStatusSource
Suspicious activity detected, measures takenConfirmed by SAPSecurityWeek
No evidence of access to customer business dataSAP statementSecurityWeek, BleepingComputer
Employee tokens stolen, code copied and altered on GitHubAlleged by an insiderDer Spiegel, via SecurityWeek
Agentic AI used in the attackAlleged; not confirmedheise
GitHub access restricted, automated development halted, signing keys replacedReportedHandelsblatt, via heise

SecurityWeek notes that "none of the reports indicate that tampered code was incorporated into software delivered to SAP customers," and that it is unclear whether proprietary code was accessed at all. We treat the token account as a plausible scenario, not a finding. The controls below are worth having either way.

GitHub token theft: what happens if your token is stolen

A stolen GitHub token grants whatever its owner could reach, for as long as the token lives. For a classic token that reach is wide: GitHub's own documentation says a personal access token (classic) "can access every repository that you can access", across every organisation you belong to.

Fine-grained personal access tokens narrow that. Each one is limited to a single user or organisation, can be restricted to specific repositories, and carries specific permissions rather than broad scopes. The blast radius of GitHub token theft is therefore set before the theft, by which token types your organisation accepts and how long they may live.

The GitHub PAT policy defaults most orgs never change

GitHub's organisation PAT policy page states that by default both classic and fine-grained personal access tokens are enabled. As of November 2026, the defaults and the changes we would make look like this.

SettingGitHub defaultWhat to change
Classic PAT access to org resourcesAllowedRestrict
Classic PAT maximum lifetimeNo expiration requirementSet a maximum
Fine-grained PAT maximum lifetime366 daysShorten to match your rotation cycle
Fine-grained PAT approvalRequire administrator approvalKeep it; owner tokens are exempt

Restrict classic personal access tokens organisation-wide

Restricting classic personal access tokens is the single setting with the largest effect. Under "Restrict personal access tokens (classic) from accessing your organizations," choosing the restrict option means classic tokens cannot access resources the organisation owns. They can still read its public resources, so this is not a confidentiality control for open-source repositories.

Set a GitHub personal access token maximum lifetime

A maximum lifetime caps how long any stolen token stays useful. The detail most teams miss: GitHub says tokens with non-compliant lifetimes "will be blocked from accessing your organization," and that the policy "does not revoke or disable these tokens." A blocked token is not dead: it can still be used anywhere else that accepts it.

Require approval for fine-grained personal access tokens

"Require administrator approval" is already the default, which means an owner approves each fine-grained token that can reach the organisation. Two gaps remain. Fine-grained tokens created by organisation owners need no approval, and only fine-grained tokens are subject to approval at all, which is another reason to restrict classic ones.

Should we ban classic personal access tokens? The case against

The strongest objection is that classic tokens still do things fine-grained tokens cannot. GitHub lists the gaps: a fine-grained token cannot span multiple organisations, access Packages, call the Checks API, or reach user-owned Projects, and "a few REST API endpoints are only available with a personal access tokens (classic)." Flip the switch on a Friday and a release job that publishes packages with a classic token will fail.

The answer is that most of those jobs should not use a personal token at all. GitHub's own guidance is that "to access resources on behalf of an organization, or for long-lived integrations, you should use a GitHub App." An installation access token expires after 1 hour and can be narrowed to listed repositories and permissions. The GITHUB_TOKEN in GitHub Actions is created per job and expires when the job finishes. For cloud deployments, OpenID Connect lets workflows exchange short-lived tokens with AWS, Azure or GCP, so you "won't need to duplicate your cloud credentials as long-lived GitHub secrets."

This is the wrong order of work if you have no inventory. Restricting classic tokens before you know which pipelines depend on them is how an outage gets blamed on security. Inventory first, migrate the bots, then restrict. It is also the order we would follow in any DevOps and cloud engineering engagement that touches CI credentials.

How to revoke a leaked GitHub token and find what it did

Revoking a leaked GitHub token takes minutes; establishing what it touched takes longer. The order matters.

  1. Revoke it. GitHub's credential revocation API accepts up to 1,000 credentials per request, unauthenticated, with prefixes ghp_, github_pat_, gho_, ghu_ and ghr_. It is limited to 60 requests an hour, and the owner is notified.
  2. Check what the token created. When an owner revokes a fine-grained token from the organisation, GitHub warns that "SSH keys created by the token will continue to work." An attacker who added a key could keep access after the token dies.
  3. Search the audit log by token. Hash the token with echo -n TOKEN | openssl dgst -sha256 -binary | base64 and search hashed_token:"VALUE", per GitHub's audit log guide. Git events are not returned by search; you need an audit log export.
  4. Rotate what sat downstream. SAP reportedly replaced signing keys. If a stolen token could read secrets or trigger releases, rotate those too.

Note what owners cannot do: the organisation UI only lets owners view and revoke fine-grained tokens. A classic token keeps reaching organisation resources until it expires, unless the organisation restricts classic access. GitHub does revoke some tokens automatically, including any personal access token pushed to a public repository or gist and any token unused for one year, according to its token expiration and revocation page. Tokens sitting in private repositories, on laptops or in CI logs are not covered by that automatic revocation; we traced one way passwords reached GitHub in an earlier post.

Rotating GitHub tokens in a CI pipeline without breaking it

A token rotation plan that works starts by listing every credential your pipelines hold, with its owner, type and expiry. Fine-grained tokens surface in the organisation settings with filters by owner, repository and permission; classic tokens do not, so start with repository and organisation secrets. Replace each bot PAT with a GitHub App installation token or OIDC, set a maximum lifetime, then restrict classic access. Pair it with step-up controls such as GitHub proof of presence for the actions a stolen session could abuse.

Where to start on your organisation's tokens

If the SAP allegations hold, the lesson is not that GitHub failed. It is that defaults chosen for compatibility decided how far stolen credentials could travel. If you are weighing whether to restrict classic tokens this quarter and need the bots migrated first, our CI/CD implementation team can inventory your pipeline credentials, move them to GitHub Apps and OIDC, and switch the policy on once nothing depends on classic tokens.

Frequently asked questions

A stolen GitHub token gives the thief whatever its owner could reach until it expires or is revoked. A classic personal access token can access every repository its owner can, across all their organisations, while a fine-grained token is limited to one owner, chosen repositories and specific permissions.

A leaked GitHub token can be revoked by submitting it to GitHub's credential revocation API, which accepts up to 1,000 credentials per unauthenticated request and notifies the owner. Afterwards, check for SSH keys the token created, because those keep working after the token is revoked, and search the audit log by hashed token.

Restricting classic personal access tokens is worth doing, but only after an inventory. Classic tokens still cover cases fine-grained tokens cannot, such as Packages and the Checks API, so migrate CI bots to GitHub App installation tokens or OIDC first, then restrict classic access for the organisation.

GitHub tokens should last no longer than your rotation process can support. GitHub's organisation policy defaults fine-grained tokens to a 366-day maximum and sets no expiration requirement for classic tokens, while GitHub App installation tokens expire after one hour and the Actions GITHUB_TOKEN expires when the job finishes.

A GitHub maximum lifetime policy does not revoke existing tokens. According to GitHub's documentation, tokens with non-compliant lifetimes are blocked from accessing the organisation, but the policy does not revoke or disable them, so they can still be used anywhere else that accepts them.

Written by

Akash Mohapatra

Akash Mohapatra

Co Founder & Director

29 Nov 2026

·

7 min read

Share

LET'S CONNECT

Connect with Creuto!

Ready to take the first step towards unlocking opportunities, realizing goals, and embracing innovation? We're here and eager to connect.