1. Resources
  2. Detection rules
  3. Personal Access Token Granted Access to a GitHub Organization

Personal Access Token Granted Access to a GitHub Organization detection rules

An attacker gets a personal access token approved for organization resources, or loosens the organization's token policy, to keep API and Git access that outlives password resets and is never challenged by 2FA.

Platform
GitHub
Severity
Medium
Log source
GitHub audit log
Last updated
Rule formats
Sigmaand queries for: SplunkMicrosoft SentinelIBM QRadar
What an attacker needs
Control of a member account to create a token and request access, or of an owner account to approve requests or change the token policy.
Impact
Durable, password-independent access to the private repositories, issues, packages and Actions settings the token covers, usable from anywhere.
Response
Revoke the token's access to the organization in the personal access token settings, and restore the token policy if it was weakened.
Mitigation
Require administrator approval for fine-grained personal access tokens, and restrict classic personal access tokens from accessing the organization.
Audit actions
org_credential_authorization.grantpersonal_access_token.access_grantedpersonal_access_token.auto_approve_grant_requests_enabledpersonal_access_token.auto_approve_grant_requests_disabledpersonal_access_token.auto_approve_grant_requests_resetpersonal_access_token.access_restriction_resetpersonal_access_token.access_restriction_disabledauto_approve_personal_access_token_requests.enablepersonal_access_token.expiration_limit_unset
Threat groups
Storm-0501

How the attack works

Personal access tokens (PATs) let a user call the GitHub API and use Git over HTTPS without a password or a second factor. Organizations control them with three settings: owner approval for each fine-grained token that requests access to private resources, a restriction that blocks fine-grained or classic tokens altogether, and a maximum token lifetime. Classic tokens are never subject to approval; unless the organization restricts them, they reach everything their owner can.

After taking over a member account, an attacker creates a token so access continues after the password is reset or the session is revoked. With owner access they can approve a pending token request, switch approval off, lift the token restriction or remove the lifetime limit, which turns a one-off foothold into durable programmatic access. Each approval and policy change is recorded in the organization (or enterprise) audit log. GitHub also records the approval setting under the newer action names personal_access_token.auto_approve_grant_requests_enabled and personal_access_token.auto_approve_grant_requests_disabled, and an enterprise handing its approval or restriction policy back to the organizations as personal_access_token.auto_approve_grant_requests_reset and personal_access_token.access_restriction_reset. A separate rule on this page reads those four actions. Where an organization enforces SAML or OIDC single sign-on, a classic token has to be authorized for single sign-on before it can reach the organization, and GitHub records that step as org_credential_authorization.grant, which a further rule on this page reads.

What an attacker needs

  • Control of a member account, to create a token and request access to the organization.
  • Control of an owner account, to approve requests or change the token policy.

Impact

Durable, password-independent access to the private repositories, issues, packages and Actions settings the token covers, usable from anywhere. A policy change extends the same exposure to every member's tokens, including tokens that were blocked or awaiting approval.

Detection rules

GitHub Credential Authorized for Single Sign-On

Detects a member authorizing a credential for use with SAML or OIDC single sign-on (org_credential_authorization.grant). In an organization that enforces single sign-on, a personal access token (classic) has to be authorized once before it can reach the organization. After that the token works without a browser session until the authorization is revoked, the token expires or is regenerated, or its owner leaves the organization. Fine-grained tokens are authorized when they are created and are covered by the other rules on this page. The documented fields of the event include oauth_credential_type and managed_token_scopes. GitHub does not document their values, so the rule matches on the action name alone.

LevelLowStatusExperimentalLog sourceGitHub audit log
title: GitHub Credential Authorized for Single Sign-On
id: 6c000e99-693f-4dbc-80be-bfa71c6c0949
status: experimental
description: >-
  Detects a member authorizing a credential for use with SAML or OIDC single
  sign-on (org_credential_authorization.grant). In an organization that
  enforces single sign-on, a personal access token (classic) has to be
  authorized once before it can reach the organization. After that the token
  works without a browser session until the authorization is revoked, the
  token expires or is regenerated, or its owner leaves the organization.
  Fine-grained tokens are authorized when they are created and are covered by
  the other rules on this page. The documented fields of the event include
  oauth_credential_type and managed_token_scopes. GitHub does not document
  their values, so the rule matches on the action name alone.
references:
  - 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://docs.github.com/en/enterprise-cloud@latest/authentication/authenticating-with-single-sign-on/authorizing-a-personal-access-token-for-use-with-single-sign-on
  - https://attack.mitre.org/techniques/T1098/001/
author: Forestall
date: 2026-11-18
tags:
  - attack.persistence
  - attack.privilege-escalation
  - attack.t1098.001
logsource:
  product: github
  service: audit
detection:
  selection:
    action: org_credential_authorization.grant
  condition: selection
falsepositives:
  - Developers who authorize a new credential for ordinary work, which is the usual cause. Review the authorizations of accounts that signed in from a new device or location shortly before, and of accounts that had no authorized credential until now.
level: low

False positives

  • Developers who authorize a new credential for ordinary work, which is the usual cause. Review the authorizations of accounts that signed in from a new device or location shortly before, and of accounts that had no authorized credential until now.

GitHub Fine-Grained Personal Access Token Granted Organization Access

Detects a fine-grained personal access token being granted access to organization resources, for example when an owner approves a pending token request. Each grant gives a person-bound credential that does not use 2FA access to the listed repositories.

LevelMediumStatusExperimentalLog sourceGitHub audit log
title: GitHub Fine-Grained Personal Access Token Granted Organization Access
id: a0ef2fe8-9499-436b-8f3b-d4b6a634d575
status: experimental
description: >-
  Detects a fine-grained personal access token being granted access to
  organization resources, for example when an owner approves a pending token
  request. Each grant gives a person-bound credential that does not use 2FA
  access to the listed repositories.
references:
  - https://attack.mitre.org/techniques/T1098/001/
  - https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/audit-log-events-for-your-organization
  - https://docs.github.com/en/organizations/managing-programmatic-access-to-your-organization/managing-requests-for-personal-access-tokens-in-your-organization
author: Forestall
date: 2026-11-10
tags:
  - attack.persistence
  - attack.privilege-escalation
  - attack.t1098.001
logsource:
  product: github
  service: audit
detection:
  selection:
    action: personal_access_token.access_granted
  condition: selection
falsepositives:
  - Owners approving tokens for routine developer work. Where approvals are frequent, alert only for sensitive repositories or for tokens whose owner was recently added to the organization.
level: medium

False positives

  • Owners approving tokens for routine developer work. Where approvals are frequent, alert only for sensitive repositories or for tokens whose owner was recently added to the organization.

GitHub Personal Access Token Approval Policy Changed or Handed to Organizations

Detects a change to the approval requirement for fine-grained personal access tokens under the action names personal_access_token.auto_approve_grant_requests_enabled and personal_access_token.auto_approve_grant_requests_disabled, and an enterprise resetting its approval policy or its token access restriction so that each organization decides for itself. The rule fires on both directions of the approval change: GitHub's descriptions of the two actions do not agree with the cross-references from the older auto_approve_personal_access_token_requests actions, so the action name alone does not prove whether approval was switched on or off. Read the resulting setting. A reset ends an enterprise-wide setting: where the enterprise had required approval or restricted token access, each organization owner can now drop it.

LevelMediumStatusExperimentalLog sourceGitHub audit log
title: GitHub Personal Access Token Approval Policy Changed or Handed to Organizations
id: b4fb917f-b51b-4518-9d6d-7379e60374f1
status: experimental
description: >-
  Detects a change to the approval requirement for fine-grained personal
  access tokens under the action names
  personal_access_token.auto_approve_grant_requests_enabled and
  personal_access_token.auto_approve_grant_requests_disabled, and an
  enterprise resetting its approval policy or its token access restriction so
  that each organization decides for itself. The rule fires on both
  directions of the approval change: GitHub's descriptions of the two actions
  do not agree with the cross-references from the older
  auto_approve_personal_access_token_requests actions, so the action name
  alone does not prove whether approval was switched on or off. Read the
  resulting setting. A reset ends an enterprise-wide setting: where the
  enterprise had required approval or restricted token access, each
  organization owner can now drop it.
references:
  - https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/audit-log-events-for-your-organization
  - 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://docs.github.com/en/enterprise-cloud@latest/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-personal-access-tokens-in-your-enterprise
  - https://attack.mitre.org/techniques/T1098/001/
author: Forestall
date: 2026-11-16
tags:
  - attack.persistence
  - attack.privilege-escalation
  - attack.t1098.001
logsource:
  product: github
  service: audit
detection:
  selection:
    action:
      - personal_access_token.auto_approve_grant_requests_enabled
      - personal_access_token.auto_approve_grant_requests_disabled
      - personal_access_token.auto_approve_grant_requests_reset
      - personal_access_token.access_restriction_reset
  condition: selection
falsepositives:
  - A change that turns the approval requirement on matches as well. Check the personal access token settings of the organization or enterprise to see what is in force now.
  - A deliberate, reviewed policy change by the security owners of the organization or enterprise. Confirm it against a change record.
level: medium

False positives

  • A change that turns the approval requirement on matches as well. Check the personal access token settings of the organization or enterprise to see what is in force now.
  • A deliberate, reviewed policy change by the security owners of the organization or enterprise. Confirm it against a change record.

GitHub Personal Access Token Policy Weakened

Detects an owner weakening the organization's personal access token policy: disabling the restriction on token access to organization resources, letting fine-grained tokens through without approval, or removing the token lifetime limit.

LevelHighStatusExperimentalLog sourceGitHub audit log
title: GitHub Personal Access Token Policy Weakened
id: 136d2787-e659-4c3d-849d-7284d7cf28d9
status: experimental
description: >-
  Detects an owner weakening the organization's personal access token policy:
  disabling the restriction on token access to organization resources,
  letting fine-grained tokens through without approval, or removing the token
  lifetime limit.
references:
  - https://attack.mitre.org/techniques/T1098/001/
  - https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/audit-log-events-for-your-organization
  - https://docs.github.com/en/organizations/managing-programmatic-access-to-your-organization/setting-a-personal-access-token-policy-for-your-organization
author: Forestall
date: 2026-11-10
tags:
  - attack.persistence
  - attack.privilege-escalation
  - attack.t1098.001
logsource:
  product: github
  service: audit
detection:
  selection:
    action:
      - personal_access_token.access_restriction_disabled
      - auto_approve_personal_access_token_requests.enable
      - personal_access_token.expiration_limit_unset
  condition: selection
falsepositives:
  - A deliberate, reviewed policy change by the organization's security owners; confirm it against a change record.
level: high

False positives

  • A deliberate, reviewed policy change by the organization's security owners; confirm it against a change record.

Detection logic

Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.

Token granted access and many private repositories cloned soon after

Detection hypothesisSequence of eventsNeeds a baseline

An attacker who has taken over a member account creates a token, gets it approved or authorizes it for single sign-on, and uses it at once to copy everything the account can read. A new grant that is followed within hours by clones of many repositories by the same account, authenticated with a token, sets this apart from a developer who prepares a token for one project.

  1. A token gains access: personal_access_token.access_granted for a fine-grained token, or org_credential_authorization.grant where single sign-on is enforced. Note the time and the account that owns the token.
  2. In the following 24 hours, collect the git.clone events whose actor is that account and whose programmatic_access_type shows that a token authenticated the request. GitHub delivers Git events through the REST API, audit log streaming and exports only.
  3. Count the different values of repo among the clones where repository_public says the repository is not public, and compare the count with what the same account cloned in an ordinary week.

Eventspersonal_access_token.access_grantedorg_credential_authorization.grantgit.clone

LimitsA new team member who sets up a workstation authorizes a token and clones many repositories on the same day. GitHub does not document the values of programmatic_access_type or of repository_public, so read them from your own events first. The REST API returns Git events for seven days only, and the 24 hours are a starting point.

New token first used from a country or address the account has not used

Detection hypothesisNeeds a baselineJoins two logs

A token that an attacker created or stole is used from the attacker's network, while its owner works from a few known places. GitHub records the hash of the token on actions taken with it outside the web interface, so the first use of a token can be compared with where the same account normally acts. A first use from a country or address the account never used, soon after the token gained access, is the pattern of a credential that has left its owner.

  1. Collect the events that carry hashed_token, which GitHub writes for actions taken with a token outside the web interface. Keep hashed_token, programmatic_access_type, actor, the time, the country (actor_location) and, where IP disclosure is enabled, actor_ip.
  2. For each hashed_token value seen for the first time, compare its country and address with those of all events of the same actor over the previous 30 days.
  3. Alert when the first use comes from a country or an address the account has not used before.
  4. Raise the priority when the hash equals the managed_hashed_token of an org_credential_authorization.grant in the preceding 24 hours, or when a personal_access_token.access_granted for the same account came shortly before.

Eventsorg_credential_authorization.grantpersonal_access_token.access_granted

LimitsGitHub shows IP addresses only where source IP disclosure is enabled and never for actions by bots and automated systems, and the country is coarse. GitHub lists managed_hashed_token without describing it or saying that it uses the same hash as hashed_token, so compare the two for one of your own tokens first. Travel, VPNs and build systems that move between clouds look the same. The 30 days and 24 hours are starting points.

Triage

  • Identify the approving owner (actor) and the token owner; check the token owner's recent sign-ins and security log for new devices or locations.
  • Review the repositories and permissions the token received (repositories, repository_selection) against the owner's role.
  • For a policy change, confirm it with the acting owner; if unexplained, restore the policy and revoke tokens that gained access since the change.

Response

Once the attack is confirmed:

  1. Revoke the token's access to the organization in the organization's personal access token settings. SSH keys that were created with the token keep working after the revocation, so look for those and remove them as well.
  2. Restore the token policy if it was weakened. That means owner approval for fine-grained tokens, the restriction on classic tokens and the maximum token lifetime.
  3. Secure the account that owns the token and, after a policy change or an approval nobody requested, the owner account that acted. Reset the password and second factor, end sessions and remove tokens and SSH keys the account holder does not recognise.
  4. Review the audit log activity of the token owner since the grant for the repositories and permissions the token covered. Treat private repositories it could read as copied, and rotate secrets stored in them.
  5. After a policy change, review every token that gained access while the policy was weakened. Owners can view and revoke only fine-grained tokens. Classic tokens that reached the organization in that period are stopped by switching the restriction back on.

Mitigation

  • Require administrator approval for fine-grained personal access tokens, and restrict personal access tokens (classic) from accessing the organization.
  • Set a maximum lifetime for both token types and review active tokens and pending requests regularly.
  • Use GitHub Apps for automation instead of tokens tied to a person.
  • Alert on token policy changes and review the repositories and permissions of every approved token.

Frequently asked questions

Does the access granted rule see classic personal access tokens?

No. Classic tokens are never subject to approval, so no `personal_access_token.access_granted` event is written for them. Unless the organization restricts them, a classic token reaches everything its owner can. For classic tokens the signals are the policy rule, which fires when the restriction on token access is disabled, and, where the organization enforces single sign-on, the rule on `org_credential_authorization.grant`.

Does resetting the member's password or ending their session stop the token?

No. A personal access token works without the password or a second factor, which is why attackers create one after taking over an account. It keeps working after a password reset or a revoked session until it expires, is deleted by its owner or has its access to the organization revoked by an owner.

Why is a token policy change rated higher than a single approved token?

An approval gives one token access to the repositories listed in the request. A policy change, such as switching approval off, lifting the token restriction or removing the lifetime limit, extends the same exposure to every member's tokens, including tokens that were blocked or waiting for approval.

How can I tell a routine token approval from a suspicious one?

Owners approve tokens for ordinary developer work, so volume alone says little. Look at the token owner, for example an account recently added to the organization or one with sign-ins from a new device or location, and at whether the repositories and permissions fit that person's role. Where approvals are frequent, alert only for sensitive repositories.

References

We respect your privacy

We use cookies to keep this site secure and working properly. With your permission, we also use optional cookies to understand usage and improve the experience. Cookie Policy

You can change your choice at any time.