How the attack works
A group access token or project access token belongs to a bot user that GitLab creates as a member of the group or project, with the role and scopes chosen at creation. A token with the api scope and the Owner or Maintainer role has complete read and write access to the API for its group or project, including every subgroup and project below a group, and it is not tied to anyone's password, second factor or SSO session. Group Owners create group access tokens; project Maintainers and Owners create project access tokens; custom roles can be given the same ability.
This makes access tokens a natural persistence step after an account takeover: the attacker creates a token, copies it out and keeps access when the user's password is reset. GitLab records creation as group_access_token_created and project_access_token_created, and writes the token's scopes and access level into details.custom_message. Personal access tokens are recorded as personal_access_token_created, but that event carries neither scopes nor expiry. A separate low-level rule on this page reads that event, as context for other alerts on the same account. Deploy tokens and deploy keys serve the same purpose for the repository and the registries: a deploy token is a user name and token pair that does not expire by default, and a deploy key is an SSH key that keeps providing access until it is revoked. GitLab records them as deploy_token_created, group_deploy_token_created and deploy_key_added, which a separate rule on this page reads.
What an attacker needs
- The Owner role on the group, the Maintainer or Owner role on the project, or a custom role with the manage group access tokens or manage project access tokens permission. Group access tokens cannot be used to create other group, project or personal access tokens.
- Log collection: audit event streaming (Ultimate) for the top-level group or the instance, to an HTTP destination, received as JSON.
Impact
Durable API and Git access to the group or project that survives password resets, second factor resets and removal of the creating user. With the Owner role the token manages members, CI/CD variables, runners and protected branches for the whole group.
Detection rules
GitLab Group or Project Access Token Created With the Owner Role
Detects a GitLab group or project access token created with the Owner role. The role is not a separate field: the rule matches the text "Owner access level" that GitLab writes into details.custom_message for these events. That wording was checked against the GitLab source and is not part of a documented schema, so validate it on your version.
title: GitLab Group or Project Access Token Created With the Owner Role
id: db2177f9-9e62-4d5f-8630-e7100f7712e8
status: experimental
description: >-
Detects a GitLab group or project access token created with the Owner role.
The role is not a separate field: the rule matches the text "Owner access
level" that GitLab writes into details.custom_message for these events. That
wording was checked against the GitLab source and is not part of a
documented schema, so validate it on your version.
references:
- https://docs.gitlab.com/user/compliance/audit_event_types/
- https://docs.gitlab.com/user/compliance/audit_event_schema/
- https://docs.gitlab.com/user/group/settings/group_access_tokens/
- https://attack.mitre.org/techniques/T1098/001/
author: Forestall
date: 2026-11-11
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.001
logsource:
product: gitlab
service: audit
detection:
selection:
event_type:
- group_access_token_created
- project_access_token_created
details.custom_message|contains: 'Owner access level'
condition: selection
falsepositives:
- Automation that needs the Owner role, which should be rare. Most integrations work with Maintainer or lower.
level: high
False positives
- Automation that needs the Owner role, which should be rare. Most integrations work with Maintainer or lower.
GitLab Deploy Token Created or Deploy Key Added
Detects a project deploy token or a group deploy token being created, and a deploy key being added to a project (audit event types deploy_token_created, group_deploy_token_created and deploy_key_added). Both are credentials that are not tied to a person. A deploy token is a user name and token pair for HTTP access to the repository, the container registry and the package registry, and it does not expire unless an expiry date is set. A deploy key is an SSH key that reads the repository and, as a read-write key, pushes to it. GitLab states that a deploy key keeps providing access until it is revoked, also after the user who added it is removed. The event type reference does not document where the scopes of the token or the write permission of the key appear in the event, so the rule matches on the event type and the credential has to be read on the Repository settings page.
title: GitLab Deploy Token Created or Deploy Key Added
id: 6673eb7a-d1b1-418a-b61a-89fc7fe369a5
status: experimental
description: >-
Detects a project deploy token or a group deploy token being created, and a
deploy key being added to a project (audit event types
deploy_token_created, group_deploy_token_created and deploy_key_added).
Both are credentials that are not tied to a person. A deploy token is a
user name and token pair for HTTP access to the repository, the container
registry and the package registry, and it does not expire unless an expiry
date is set. A deploy key is an SSH key that reads the repository and, as a
read-write key, pushes to it. GitLab states that a deploy key keeps
providing access until it is revoked, also after the user who added it is
removed. The event type reference does not document where the scopes of the
token or the write permission of the key appear in the event, so the rule
matches on the event type and the credential has to be read on the
Repository settings page.
references:
- https://docs.gitlab.com/user/compliance/audit_event_types/
- https://docs.gitlab.com/user/project/deploy_tokens/
- https://docs.gitlab.com/user/project/deploy_keys/
- https://attack.mitre.org/techniques/T1098/001/
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.001
logsource:
product: gitlab
service: audit
detection:
selection:
event_type:
- deploy_token_created
- group_deploy_token_created
- deploy_key_added
condition: selection
falsepositives:
- Deployment and build systems that are given a token or a key by the team that owns the project. Baseline the usual creators, and review a group deploy token and a read-write deploy key more closely than a read-only credential for one project.
level: medium
False positives
- Deployment and build systems that are given a token or a key by the team that owns the project. Baseline the usual creators, and review a group deploy token and a read-write deploy key more closely than a read-only credential for one project.
GitLab Group or Project Access Token Created
Detects the creation of a GitLab group access token or project access token (audit event types group_access_token_created and project_access_token_created). The scopes and access level of the token are written in details.custom_message.
title: GitLab Group or Project Access Token Created
id: ab52a715-19c2-440d-a644-11c9a3b70777
status: experimental
description: >-
Detects the creation of a GitLab group access token or project access token
(audit event types group_access_token_created and
project_access_token_created). The scopes and access level of the token are
written in details.custom_message.
references:
- https://docs.gitlab.com/user/compliance/audit_event_types/
- https://docs.gitlab.com/user/group/settings/group_access_tokens/
- https://attack.mitre.org/techniques/T1098/001/
author: Forestall
date: 2026-11-11
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.001
logsource:
product: gitlab
service: audit
detection:
selection:
event_type:
- group_access_token_created
- project_access_token_created
condition: selection
falsepositives:
- Tokens created for automation by the teams that own the group or project. Baseline the usual creators and review the rest.
level: medium
False positives
- Tokens created for automation by the teams that own the group or project. Baseline the usual creators and review the rest.
GitLab Personal Access Token Created
Detects a user creating a personal access token (audit event type personal_access_token_created). A personal access token is attached to a user and authenticates with the GitLab API and with Git over HTTPS. GitLab requires one for that purpose when two-factor authentication or SAML is enabled. An attacker who is signed in as a user can create one and keep the access after the session ends, until the token expires or is revoked. Developers create tokens all the time, and the event type reference lists the event without fields for the scopes or the expiry date, so this is a low-level signal. It gains weight next to a sign-in from an unusual place or other changes on the same account.
title: GitLab Personal Access Token Created
id: da7a7d01-6534-4691-8045-f752bef23ffb
status: experimental
description: >-
Detects a user creating a personal access token (audit event type
personal_access_token_created). A personal access token is attached to a
user and authenticates with the GitLab API and with Git over HTTPS.
GitLab requires one for that purpose when two-factor authentication or
SAML is enabled. An attacker who is signed in as a user can create one and keep
the access after the session ends, until the token expires or is
revoked. Developers create tokens all the time, and the event type
reference lists the event without fields for the scopes or the expiry
date, so this is a low-level signal. It gains weight next to a sign-in
from an unusual place or other changes on the same account.
references:
- https://docs.gitlab.com/user/compliance/audit_event_types/
- https://docs.gitlab.com/user/profile/personal_access_tokens/
- https://attack.mitre.org/techniques/T1098/001/
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.001
logsource:
product: gitlab
service: audit
detection:
selection:
event_type: personal_access_token_created
condition: selection
falsepositives:
- Developers and automation owners who create tokens for their own work, which is the usual cause. Use the rule as context for other alerts on the same account, or keep it for administrators and group Owners.
level: low
False positives
- Developers and automation owners who create tokens for their own work, which is the usual cause. Use the rule as context for other alerts on the same account, or keep it for administrators and group Owners.
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.
Personal access token created and a token of the same account used from an unseen address soon after
An attacker who creates a token on a taken-over account copies it out and uses it from their own network, while a developer usually starts using a new token from the machine that created it. From GitLab 19.1 GitLab reports a personal access token used from an address it had not seen. Such a report shortly after the same account created a token ties the new credential to use from a new place.
- A token is created:
personal_access_token_created. Keep the account (author_id,entity_path), the address of the creation (ip_address) and the time. - Within 24 hours GitLab reports a token of the same account used from a previously unseen address:
personal_access_token_used_from_unseen_ip(GitLab 19.1 and later, streaming only). - Alert on the pair, and raise the priority when the unseen address differs from the address of the creation and when Git operations or downloads follow from it (
repository_git_operation,repository_download_operation).
Eventspersonal_access_token_createdpersonal_access_token_used_from_unseen_iprepository_git_operationrepository_download_operation
LimitsThe unseen address event does not name the token in a documented field, so the join is by account and time and an older token of the same account matches as well. The personal access tokens page of the user shows the last addresses of each token. A developer who creates a token for a build server sees the same pair. GitLab does not say whether the event is written for the bot users of group and project access tokens. The 24 hours are a starting point.
Triage
- Read
details.custom_messagefor the token ID, scopes and access level, andentity_pathfor the group or project. - Identify the creator (
author_name,ip_address) and confirm the token with them through a separate channel. - Check what else the creator did in the same session, such as new members, deploy keys or CI/CD variable reads.
- If unexplained, revoke the token on the group or project Settings > Access tokens page and review the bot user's audit events.
Response
Once the attack is confirmed:
- Revoke every group and project access token that the same creator made since the account was first misused, not only the token in the alert. Revoking invalidates a token immediately.
- Treat the creator's account as compromised. Reset its password and second factor, and revoke its personal access tokens and any SSH key its owner does not recognise.
- Reverse what the token's bot user did while the token was valid. With the Owner role that can include new members, changed CI/CD variables, new runners and loosened protected branch rules anywhere in the group.
- Rotate the deployment credentials stored in the CI/CD variables of the group or project if the token had the
apiscope with the Maintainer or Owner role, because it had complete read access to the API. - List the access tokens that remain in the group hierarchy, confirm that each one has an owner and a purpose, and watch for new tokens from the same author or address.
Mitigation
- In the top-level group, clear Users can create group access tokens and project access tokens in this group unless teams need them, and create the few required tokens centrally.
- Give tokens the lowest role and the narrowest scopes that work, and avoid
apiwith the Owner role. - Keep the expiry requirement on and set a maximum token lifetime where your tier allows it.
- Inventory group and project access tokens on a schedule and revoke those without an owner or recent use.
- Alert on every new group or project access token and review the ones created with Owner or Maintainer.
Frequently asked questions
Does resetting the creator's password or removing the creator invalidate the token?
No. A group or project access token belongs to a bot user that GitLab creates as a member of the group or project. It is not tied to anyone's password, second factor or SSO session, so it keeps working after the creator's password is reset or the creator leaves. The access ends when the token is revoked or expires.
Do these rules also report personal access tokens?
Only as a low-level signal. The main rules match group and project access tokens (`group_access_token_created`, `project_access_token_created`), deploy tokens and deploy keys. A separate rule reads `personal_access_token_created`, but that event carries neither the scopes nor the expiry of the token, so it says much less about what was created and is meant as context for other alerts on the same account.
Why does the Owner rule read the role from a message text?
The audit event has no separate field for the role. GitLab writes the scopes and the access level into `details.custom_message`, and the rule matches the text "Owner access level" there. That wording was checked against the GitLab source and is not part of a documented schema, so test it on your GitLab version before you rely on the rule.
Is the bot user removed as soon as the token is revoked?
No. Revoking invalidates the token immediately, but by default GitLab deletes the bot user and all of its tokens 30 days after the last of those tokens is revoked or expires. Until then the revoked token stays visible as inactive.