How the attack works
GitHub accepts three kinds of SSH credentials for Git. A user can add public keys to their account, a repository can hold deploy keys, and organizations and enterprises on GitHub Enterprise Cloud can register an SSH certificate authority (CA). With a CA in place, members can reach the organization's repositories with certificates that the CA signed, and each certificate names the GitHub user it is for. The certificates work even when SAML single sign-on is enforced, and an issued certificate cannot be revoked other than by removing the CA.
For an attacker with owner access, a CA of their own is the strongest of the three. Whoever holds the private key of a registered CA can issue a certificate for any member, without touching that member's account, password or keys. Owners can also require SSH certificates, which blocks access to the organization's repositories over HTTPS and with unsigned SSH keys. Disabling that requirement reopens those paths for keys and tokens the attacker already holds.
The plainer variant needs no owner. After taking over an account, or with admin access to a repository, an attacker adds an SSH key to the account or a deploy key to the repository. Neither depends on the password, and a deploy key has no expiry date and is not tied to the user who added it. GitHub records the three changes as ssh_certificate_authority.create, ssh_certificate_requirement.disable and public_key.create in the organization and enterprise audit logs.
What an attacker needs
- For a certificate authority or the certificate requirement, control of an account that manages the security settings of the organization or enterprise (an owner) on GitHub Enterprise Cloud.
- For an SSH key, control of the user account it is added to. For a deploy key, admin access to the repository.
Impact
A CA under the attacker's control gives Git access over SSH to the organization's repositories in the name of any member the attacker puts in a certificate, for as long as the CA stays registered. An added SSH key gives the Git access of the account it belongs to, and a deploy key gives read or write access to one repository. None of them depends on the password, the session or the second factor of an account, so they outlast a password reset.
Detection rules
GitHub SSH Certificate Authority Created
Detects an SSH certificate authority being added to an organization or an enterprise. Certificates signed by a registered CA are accepted for Git access to the organization's repositories and name the GitHub user they act for, so whoever holds the private key of the CA can issue access for any member. Issued certificates cannot be revoked other than by removing the CA. Check the acting owner (actor) and whether the CA is one your organization operates.
title: GitHub SSH Certificate Authority Created
id: dc823a79-a6ce-492d-a8a5-931981381493
status: experimental
description: >-
Detects an SSH certificate authority being added to an organization or an
enterprise. Certificates signed by a registered CA are accepted for Git
access to the organization's repositories and name the GitHub user they act
for, so whoever holds the private key of the CA can issue access for any
member. Issued certificates cannot be revoked other than by removing the
CA. Check the acting owner (actor) and whether the CA is one your
organization operates.
references:
- https://attack.mitre.org/techniques/T1098/004/
- https://docs.github.com/en/enterprise-cloud@latest/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/organizations/managing-git-access-to-your-organizations-repositories/about-ssh-certificate-authorities
author: Forestall
date: 2026-11-14
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.004
logsource:
product: github
service: audit
detection:
selection:
action: ssh_certificate_authority.create
condition: selection
falsepositives:
- The platform or security team setting up SSH certificates, or rotating a CA (a new CA is added before the old one is removed). The event is rare; confirm each one with the acting owner and a change record.
level: high
False positives
- The platform or security team setting up SSH certificates, or rotating a CA (a new CA is added before the old one is removed). The event is rare; confirm each one with the acting owner and a change record.
GitHub SSH Certificate Requirement Disabled
Detects the requirement for members to use SSH certificates to access organization resources being disabled. While the requirement is on, the organization's repositories cannot be reached over HTTPS or with unsigned SSH keys. Disabling it lets ordinary SSH keys and HTTPS credentials work again, including ones an attacker added or stole earlier. Enabling the requirement is a different action and does not match.
title: GitHub SSH Certificate Requirement Disabled
id: 40816b6a-f71d-4f79-89fa-61d3a960bee1
status: experimental
description: >-
Detects the requirement for members to use SSH certificates to access
organization resources being disabled. While the requirement is on, the
organization's repositories cannot be reached over HTTPS or with unsigned
SSH keys. Disabling it lets ordinary SSH keys and HTTPS credentials work
again, including ones an attacker added or stole earlier. Enabling the
requirement is a different action and does not match.
references:
- https://attack.mitre.org/techniques/T1098/004/
- https://docs.github.com/en/enterprise-cloud@latest/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/organizations/managing-git-access-to-your-organizations-repositories/managing-your-organizations-ssh-certificate-authorities
author: Forestall
date: 2026-11-14
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.004
logsource:
product: github
service: audit
detection:
selection:
action: ssh_certificate_requirement.disable
condition: selection
falsepositives:
- Owners lifting the requirement because members or tools could not connect, or during a CA rotation. Confirm the change and its planned end date with the acting owner.
level: medium
False positives
- Owners lifting the requirement because members or tools could not connect, or during a CA rotation. Confirm the change and its planned end date with the acting owner.
GitHub SSH Key or Deploy Key Added
Detects the audit log action public_key.create, which GitHub records when an SSH key is added to a user account or a deploy key is added to a repository. Both give Git access that does not depend on the password of an account, and a deploy key has no expiry date. The action is routine for developers and automation, so the rule is a low-level signal: triage by the actor, the title and fingerprint of the key, and for deploy keys the read_only field (false means write access).
title: GitHub SSH Key or Deploy Key Added
id: f5f34c4b-6c0b-49ad-bb00-47bcf83aa85f
status: experimental
description: >-
Detects the audit log action public_key.create, which GitHub records when
an SSH key is added to a user account or a deploy key is added to a
repository. Both give Git access that does not depend on the password of an
account, and a deploy key has no expiry date. The action is routine for
developers and automation, so the rule is a low-level signal: triage by the
actor, the title and fingerprint of the key, and for deploy keys the
read_only field (false means write access).
references:
- https://attack.mitre.org/techniques/T1098/004/
- https://docs.github.com/en/enterprise-cloud@latest/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/authentication/connecting-to-github-with-ssh/managing-deploy-keys
author: Forestall
date: 2026-11-14
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.004
logsource:
product: github
service: audit
detection:
selection:
action: public_key.create
condition: selection
falsepositives:
- Developers adding SSH keys to their accounts, and deployment tooling that adds deploy keys to repositories. Where this is frequent, add the automation accounts to a filter_* selection on actor and alert only for sensitive repositories or for keys added soon after an unusual sign-in.
level: low
False positives
- Developers adding SSH keys to their accounts, and deployment tooling that adds deploy keys to repositories. Where this is frequent, add the automation accounts to a filter_* selection on actor and alert only for sensitive repositories or for keys added soon after an unusual sign-in.
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.
New SSH key followed by Git access over SSH from a location the account has not used
An attacker who adds an SSH key to a taken-over account uses it from their own network, while the owner's keys are used from a few known places. The key event and the Git events are separate, so a rule on either one cannot see the pair. A new key that is followed within hours by Git access over SSH from a country or an address the account has not used is the pattern of a key that does not belong to the account owner.
- A key is added:
public_key.create. Where the organization uses single sign-on a key must be authorized before use, which isorg_credential_authorization.grantwith afingerprint. Keepactor, thefingerprintand the time. - In the following 24 hours, collect
git.clone,git.fetchandgit.pushevents by the sameactorwhosetransport_protocol_nameshows SSH. GitHub delivers Git events through the REST API, audit log streaming and exports only, and keeps them for seven days. - Compare the country (
actor_location) and, where IP disclosure is enabled,actor_ipof those events with the countries and addresses of the account's events over the previous 30 days. Alert on a Git operation from one the account has not used. - GitHub says the SSH key fingerprints of its credential inventory export can be compared with the authentication metadata of audit log events, a public preview for SSH and deploy keys. Where your Git events carry the fingerprint, match on it instead of on the account.
Eventspublic_key.createorg_credential_authorization.grantgit.clonegit.fetchgit.push
LimitsA developer who sets up a laptop on a new network adds a key and fetches from that network on the same day. IP addresses appear only where source IP disclosure is enabled and never for bots, and the country is coarse. A deploy key is not bound to the user who added it, so only the fingerprint match covers it. GitHub does not document the values of transport_protocol_name. The 24 hours and 30 days are starting points.
Triage
- For a new certificate authority, identify the owner who added it (actor) and check the CA in the authentication security settings against the CAs your organization operates. Delete an unknown CA first and investigate second, because removing the CA is the only way to invalidate its certificates.
- For a disabled certificate requirement, confirm the change with the acting owner and review Git access over HTTPS and with ordinary SSH keys after the change.
- For public_key.create, read the title, fingerprint and read_only fields of the event. It covers account SSH keys and deploy keys alike; a deploy key with write access on a sensitive repository, or a key added shortly after an unusual sign-in, deserves a closer look.
- Look for other changes by the same actor around the same time, such as new owners, tokens, app installations or removed branch protections.
- If the change is not explained, delete the CA or the key, reset the credentials and sessions of the actor, and review the Git and audit log activity that used the new credential.
Response
Once the attack is confirmed:
- Delete the unknown certificate authority from the organization or enterprise. This invalidates every certificate it issued at once, and nothing else does.
- Turn the SSH certificate requirement back on if it was disabled, after checking that the remaining certificate authorities are your own.
- Delete the SSH keys and deploy keys that nobody can account for on the affected accounts and repositories. A password reset does not remove them.
- Secure the owner or user account that made the change, including its password, second factor, sessions and personal access tokens.
- Treat the repositories the credential could reach as copied, and rotate secrets stored in them. A certificate from a rogue CA can name any member, so its reach is every repository that any member can access over SSH.
- Review the pushes made over SSH during that period for unreviewed changes, in particular with a deploy key that has write access.
Mitigation
- Keep organization and enterprise owners few, with phishing-resistant two-factor authentication, and compare the registered SSH certificate authorities with the CAs your organization operates.
- Issue short-lived certificates, and upgrade older CAs so that certificates without an expiry date are rejected.
- Stream the audit log to your SIEM and alert on every new certificate authority and every change to the certificate requirement.
- Review account SSH keys and deploy keys regularly. Prefer GitHub Apps to deploy keys for automation, and use the enterprise policy for deploy keys where you do not need them.
- After an account takeover, remove unknown SSH keys and tokens in addition to resetting the password.
Frequently asked questions
Can a single certificate issued by a rogue CA be revoked?
No. An issued certificate cannot be revoked other than by removing the certificate authority that signed it. Deleting the CA invalidates all of its certificates together, which is why an unknown CA should be deleted first and investigated second.
Does SAML single sign-on stop access with a certificate from a registered CA?
No. Certificates signed by a registered CA work even when SAML single sign-on is enforced. Each certificate names the GitHub user it is for, and whoever holds the private key of the CA can issue one for any member without touching that member's account, password or keys.
Does public_key.create tell an account SSH key from a deploy key?
The action is the same for both. Read the fields of the event, where the title and fingerprint identify the key and `read_only` set to false means a deploy key with write access. Because the action is routine for developers and automation, the rule is a low-level signal that needs triage by actor and repository.
Which of these changes needs an owner, and which does not?
A certificate authority and the SSH certificate requirement belong to the security settings of an organization or enterprise on GitHub Enterprise Cloud, so they need an account that manages those settings, in practice an owner. An SSH key needs only control of the user account it is added to, and a deploy key needs admin access to the repository.
References
- MITRE ATT&CK T1098.004: Account Manipulation: SSH Authorized Keys
- About SSH certificate authorities
- Managing your organization's SSH certificate authorities
- Adding a new SSH key to your GitHub account
- Managing deploy keys
- Audit log events for your organization
- Audit log events for your enterprise
- Authorizing an SSH key for use with single sign-on
- Identifying audit log events performed by an access token (SSH keys, deploy keys, credential inventory)
- REST API: Get the audit log for an enterprise (actor_location in the response schema)
- Searching the audit log for your enterprise (GitHub Enterprise Server 3.22, actor_ip)
- Displaying IP addresses in the audit log for your enterprise