How the attack works
GitHub Actions workflows take credentials from secrets and configuration from variables, which are stored at organization, repository and environment level. Organization owners create organization secrets and variables and decide which repositories may use them. Write access to an organization repository is enough to create repository secrets and variables, and admin access is needed for those of an environment. Where a secret with the same name exists at more than one level, the lowest level takes precedence: an environment secret overrides a repository secret, which overrides an organization secret.
An attacker with such access does not have to read a secret to abuse this. Overwriting a variable that holds a registry address, a deployment target or a cloud role name sends the output of the next workflow run somewhere else. Creating a repository secret with the name of an organization secret replaces the credential that the repository's workflows use, and widening the repository access of an organization secret hands it to workflows in more repositories. GitHub records every creation, update and removal as its own audit log action at org., repo. and environment. level. The events name the entry in the key field and carry no value.
What an attacker needs
- Write access to an organization repository for its repository secrets and variables.
- Admin access to the repository for the secrets and variables of an environment.
- An organization owner, or a custom organization role that can manage organization Actions secrets, for organization secrets and variables.
Impact
Workflows that deploy, publish or sign run with values the attacker chose. Build output can go to a registry or an account the attacker controls, a deployment can use a credential the attacker knows, and an organization secret that was opened to more repositories can be used by a workflow in any of them. The change stays in effect for every later run until someone compares the stored entries with what they should be.
Detection rules
GitHub Actions Secret or Variable Created
Detects a new GitHub Actions secret or variable being created at organization, repository or environment level, and a new Codespaces or Dependabot secret being created for an organization or a repository. A new entry is usually ordinary pipeline work. It matters when the name of a new secret equals that of a secret at a higher level, because GitHub gives the lowest level precedence and the new secret then replaces the shared one for that repository or environment. The events name the entry in the key field. Comparing that name with the entries at higher levels needs your own list, which the detection logic on this page describes.
title: GitHub Actions Secret or Variable Created
id: f43561d9-e8d1-47af-85d3-164d3d3a5416
status: experimental
description: >-
Detects a new GitHub Actions secret or variable being created at
organization, repository or environment level, and a new Codespaces or
Dependabot secret being created for an organization or a repository. A new
entry is usually ordinary pipeline work. It matters when the name of a new
secret equals that of a secret at a higher level, because GitHub gives the
lowest level precedence and the new secret then replaces the shared one
for that repository or environment. The events name the entry in the key
field.
Comparing that name with the entries at higher levels needs your own list,
which the detection logic on this page describes.
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/actions/reference/security/secrets
- https://attack.mitre.org/techniques/T1677/
author: Forestall
date: 2026-11-18
tags:
- attack.execution
- attack.t1677
logsource:
product: github
service: audit
detection:
selection:
action:
- org.create_actions_secret
- repo.create_actions_secret
- environment.create_actions_secret
- org.create_actions_variable
- repo.create_actions_variable
- environment.create_actions_variable
- org.create_integration_secret
- repo.create_integration_secret
condition: selection
falsepositives:
- Teams that set up a new pipeline or a new environment, which is the usual cause. Use the rule as context for other alerts on the same repository, or keep it for the repositories that deploy to production.
level: low
False positives
- Teams that set up a new pipeline or a new environment, which is the usual cause. Use the rule as context for other alerts on the same repository, or keep it for the repositories that deploy to production.
GitHub Actions Secret or Variable Updated
Detects an existing GitHub Actions secret or variable being updated at organization, repository or environment level, and an existing Codespaces or Dependabot secret being updated for an organization or a repository. An update replaces the value that later workflow runs use, and for an organization secret it can also change which repositories may use the secret. The events name the entry in the key field and carry no value, so the rule cannot tell a rotation from a replacement. Look first at organization and environment entries and at updates made with a token.
title: GitHub Actions Secret or Variable Updated
id: 2ac14aba-c18c-4b59-9f6f-ac73fbf416fd
status: experimental
description: >-
Detects an existing GitHub Actions secret or variable being updated at
organization, repository or environment level, and an existing Codespaces
or Dependabot secret being updated for an organization or a repository.
An update replaces the value that later workflow runs use, and for an
organization secret it can also change which repositories may use the
secret. The events name the entry in the key field and carry no value, so
the rule cannot tell a rotation from a replacement. Look first at
organization and environment entries and at updates made with a token.
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/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets
- https://attack.mitre.org/techniques/T1677/
author: Forestall
date: 2026-11-18
tags:
- attack.execution
- attack.t1677
logsource:
product: github
service: audit
detection:
selection:
action:
- org.update_actions_secret
- repo.update_actions_secret
- environment.update_actions_secret
- org.update_actions_variable
- repo.update_actions_variable
- environment.update_actions_variable
- org.update_integration_secret
- repo.update_integration_secret
condition: selection
falsepositives:
- Scheduled credential rotation and infrastructure-as-code tools that write secrets and variables on every run. Exclude the service identity they use by actor, and keep the rule for every other account.
- Engineers who correct a value by hand. Confirm the change with the team that owns the pipeline.
level: medium
False positives
- Scheduled credential rotation and infrastructure-as-code tools that write secrets and variables on every run. Exclude the service identity they use by actor, and keep the rule for every other account.
- Engineers who correct a value by hand. Confirm the change with the team that owns the pipeline.
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.
Repository or environment secret created with the name of an organization secret
GitHub gives the lowest level precedence when a secret name exists at several levels. A new repository or environment secret that carries the name of an existing organization secret therefore replaces that credential for the repository without any change to the organization secret, which is how a user with write access alone can redirect a shared deployment credential.
- Keep a list of the names of your organization secrets, from the organization settings or from the
keyfield of earlierorg.create_actions_secretevents. - A secret is created at a lower level:
repo.create_actions_secretorenvironment.create_actions_secret. Takekey,repoandactor. - Alert when
keyis on the list of organization secret names, and name the repository whose workflows now use the new value.
Eventsorg.create_actions_secretrepo.create_actions_secretenvironment.create_actions_secret
LimitsTeams override an organization secret on purpose, for example to give one repository its own registry token, and those cases have to be confirmed once and excluded. GitHub lists key among the fields of these actions without describing it, so confirm on one event of your own that it holds the name.
Secret or variable changed and a workflow started by the same account soon after
An attacker who has changed a deployment value wants it used before anyone notices, and starts the workflow that reads it. A change to a secret or variable that is followed within minutes by a run in the same repository from the same account, and by a job that was given that secret, links the change to its use.
- A secret or variable is created or updated at
repo.,environment.ororg.level, for examplerepo.update_actions_secret. Keepactor,repo,keyand the time. - Within 30 minutes the same
actorstarts a run in the samerepo:workflows.created_workflow_run, with the trigger ineventand the run inworkflow_run_id. - The jobs of that run are given the changed secret:
workflows.prepared_workflow_jobwith the sameworkflow_run_id, wheresecrets_passedcontains the name fromkey.
Eventsrepo.update_actions_secretrepo.update_actions_variableworkflows.created_workflow_runworkflows.prepared_workflow_job
LimitsAn engineer who rotates a credential and redeploys to test it produces the same sequence, so the result needs the change record. The two workflow events reach only the REST API, audit log streaming and exports. GitHub describes secrets_passed as the list of secrets, so for a variable the logic ends at the second step. The 30 minutes are a starting point.
Triage
- Identify who made the change (
actor), the level (theorg.,repo.orenvironment.prefix of the action), the repository (repo), the environment (environment_name) and the entry (key). - For an organization secret, read
visibilityand check in the organization settings which repositories can use the secret now. - Check whether an entry with the same name exists at a higher level. A new repository or environment secret with the name of an organization secret takes its place for that repository.
- Check whether a token made the change (
programmatic_access_type,hashed_token) and whether the account also changed workflow files or branch protection in the same period. - Ask the team that owns the pipeline whether the change was planned, and look at the workflow runs of the repository that started after it.
Response
Once the attack is confirmed:
- Set the secret or variable back to its correct value, and delete repository or environment entries that shadow an organization secret without a reason.
- Rotate the real credential behind an overwritten secret, and rotate an organization secret whose repository access was widened, because workflows in the added repositories could use it in the meantime.
- Hold the deployments and releases of the affected repositories since the change, and check where the workflow runs of that period published or deployed.
- Revoke the token that made the change, or reset the credentials and sessions of the account when a person's account did it.
- Review every other secret and variable the same actor created or updated, at all three levels.
Mitigation
- Limit each organization secret to selected repositories instead of all repositories, and review that list whenever it changes.
- Keep deployment credentials in environments with required reviewers and a restriction on the branches that may deploy. Environment secrets need admin access to change and are released to a job only after the protection rules pass.
- Keep write and admin access to repositories small, and grant the organization permission to manage Actions secrets to as few people as possible.
- Manage secrets and variables from one pipeline or one service identity, so that a change by any other account stands out.
- Alert on every update of an organization or environment secret or variable.
Frequently asked questions
Can someone with write access to one repository replace an organization secret for that repository?
In effect, yes. Write access to an organization repository is enough to create a repository secret. GitHub states that when a secret with the same name exists at several levels, the lowest level takes precedence, so the workflows of that repository use the repository secret. The organization secret itself is not changed and still serves the other repositories.
Does the audit log show the old or the new value of a secret?
No. The documented fields of these events name the entry in `key` and, for several actions, its `visibility`. They hold no value. Whether a change was a rotation or a replacement therefore has to be confirmed with the team that owns the secret, and when nobody can confirm it the credential behind it should be rotated.
Why does this page cover variables when they hold no credentials?
Variables decide where a workflow sends its work, for example a registry address, a deployment target or the name of a cloud role. Changing one redirects the next run without touching any workflow file or secret, so it passes code review and secret scanning. The update actions for variables are matched together with those for secrets.
How do I tell a planned secret rotation from tampering?
Rotation comes from a known identity, often on a schedule, and one credential changes at a time. Exclude that identity by `actor` and alert on changes by people and by other tokens. Look first at organization and environment entries, at a new entry that shadows an organization secret, and at changes that come with new workflow files or a manual workflow run.