GitHub Actions or Integration Secret Created
editGitHub Actions or Integration Secret Created
editIdentifies the creation of a GitHub Actions, Dependabot, or Codespaces secret at the organization, repository, environment, or user scope. Secrets are injected into CI/CD workflows at runtime, so an actor with write or admin access can create a secret to establish durable access or to stage credentials that workflows will consume, allowing malicious automation to persist even after the initial access path is closed. This technique has been observed in software supply-chain attacks such as Shai-Hulud. Because creating secrets is also routine for platform and deployment teams, this rule works best as a building block correlated with the actor, the token used, and any surrounding workflow changes.
Rule type: esql
Rule indices: None
Severity: low
Risk score: 21
Runs every: 5m
Searches indices from: now-9m (Date Math format, see also Additional look-back time)
Maximum alerts per execution: 100
References:
- https://www.wiz.io/blog/shai-hulud-2-0-ongoing-supply-chain-attack
- https://www.elastic.co/blog/shai-hulud-worm-npm-supply-chain-compromise
- https://github.com/SigmaHQ/sigma/blob/master/rules/application/github/audit/github_new_secret_created.yml
- https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions
Tags:
- Domain: Cloud
- Domain: SaaS
- Platform: GitHub
- Use Case: Threat Detection
- Tactic: Persistence
- Tactic: Credential Access
- Data Source: Github
- Data Source: GitHub Audit Logs
- Service: GitHub Actions
- Rule Type: ES|QL
- Resources: Investigation Guide
Version: 1
Rule authors:
- Elastic
Rule license: Elastic License v2
Investigation guide
editTriage and analysis
Disclaimer: This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
Investigating GitHub Actions or Integration Secret Created
GitHub records secret creation through org.create_actions_secret, repo.create_actions_secret, and environment.create_actions_secret for Actions secrets, and through org.create_integration_secret, repo.create_integration_secret, and user.create_integration_secret for Codespaces and Dependabot secrets. The audit log records the secret name but never its value. Secrets are made available to workflows at runtime, so a secret created by a compromised or unexpected actor can give malicious automation durable access to cloud or service credentials. Review the actor and token (user.name, github.actor_ip, github.hashed_token, github.programmatic_access_type), the scope and name of the secret (event.action, github.org, github.repo, github.name), and whether a workflow that consumes the secret was added or changed around the same time to determine whether the creation was legitimate.
Possible investigation steps
-
Identify the actor and the scope of the secret using
user.name,event.action,github.org,github.repo, and the secret name ingithub.name, and confirm whether the actor normally manages CI secrets. -
Review
github.actor_ip,github.hashed_token, andgithub.programmatic_access_typeto determine whether the secret was created interactively or with a PAT or OAuth token, and whether the source is expected for that actor. -
Check whether a workflow file that references the new secret (via
secrets.<NAME>) was added or modified in the same repository and time window, which can indicate the secret is being wired into attacker-controlled automation. - Review the actor’s recent activity for related persistence actions, such as new PATs, SSH keys, OAuth grants, or outside-collaborator additions.
- Correlate with any surrounding change ticket or rotation schedule to confirm whether the secret creation was planned.
False positive analysis
-
Scheduled credential rotation or first-time environment setup by platform engineering or deployment teams. Confirm the secret name (
github.name) and that a change ticket exists before dismissing. - Automation that provisions secrets as part of onboarding a new service or repository. Validate against deployment records and scope exceptions to the specific actor or repository where appropriate.
Response and remediation
- If the secret was not created by an authorized actor, delete it and rotate any cloud or service credentials it may have referenced.
-
Review the repository’s workflow files for unexpected
secrets.usage and remove any malicious or unauthorized workflows. -
Revoke the token identified by
github.hashed_tokenand the actor’s other tokens if the creation was not approved, and require the user to reauthenticate. - Review the actor’s recent audit activity for additional persistence mechanisms, such as new tokens, SSH keys, or collaborator and permission changes.
- Engage incident response per your organization’s playbooks if a supply-chain or account compromise is suspected.
Rule query
editfrom logs-github.audit-* metadata _id, _index, _version
| where
data_stream.dataset == "github.audit"
and (github.actor_is_bot is not null and github.actor_is_bot == false)
and event.action in (
"org.create_actions_secret",
"repo.create_actions_secret",
"environment.create_actions_secret",
"org.create_integration_secret",
"repo.create_integration_secret",
"user.create_integration_secret"
)
| keep
_id,
_index,
_version,
@timestamp,
event.action,
user.name,
github.org,
github.repo,
github.actor_ip,
github.hashed_token,
github.programmatic_access_type,
github.user_agent,
github.name,
github.actor_is_bot
Framework: MITRE ATT&CKTM
-
Tactic:
- Name: Persistence
- ID: TA0003
- Reference URL: https://attack.mitre.org/tactics/TA0003/
-
Technique:
- Name: Account Manipulation
- ID: T1098
- Reference URL: https://attack.mitre.org/techniques/T1098/
-
Sub-technique:
- Name: Additional Cloud Credentials
- ID: T1098.001
- Reference URL: https://attack.mitre.org/techniques/T1098/001/
-
Tactic:
- Name: Credential Access
- ID: TA0006
- Reference URL: https://attack.mitre.org/tactics/TA0006/
-
Technique:
- Name: Unsecured Credentials
- ID: T1552
- Reference URL: https://attack.mitre.org/techniques/T1552/