GitLab Email Token Lets Attackers Push Code to Main and Execute CI/CD Jobs
GitLab incoming email tokens can push code, open merge requests, and run CI/CD while bypassing IP allowlists.
Aikido Security researcher Joe Leon reported that GitLab incoming-email addresses for the Email work item feature embed a long-lived glimt token. The token does not expire, is reused across projects the account can access, and authenticates as the owner. An attacker who obtains it can email a Git patch to create branches or merge requests and, with enough permission, commit to main and change .gitlab-ci.yml so GitLab runs attacker-controlled CI/CD jobs that may expose variables or CI_JOB_TOKEN. Aikido showed this path bypasses IP allowlists; GitLab updated its documentation, but the non-expiring token remains, and no in-the-wild exploitation or CVE was reported.
- Non-expiring glimt tokens are reused across all of an owner's projects.
- Emailed Git patches can create branches, merge requests, or commits on main.
- A malicious .gitlab-ci.yml can run CI jobs and expose secrets or CI_JOB_TOKEN.
- Incoming email is excluded from GitLab IP allowlists.
- Reset leaked tokens and search repos for published incoming-email addresses.
Full article788 words · extracted from gbhackers.com · click to collapse
A long-lived GitLab incoming email token embedded in project email addresses for the “Email work item” feature can be exploited to push attacker-controlled code, create merge requests, and trigger CI/CD pipelines using the permissions of the token owner.
This issue can also bypass GitLab’s IP restrictions, as incoming email is explicitly excluded from those controls.
Security researcher Joe Leon from Aikido Security reported that GitLab’s private email addresses, which are intended to allow users to create issues by email, contain a credential that functions more like an account-wide, fine-grained access token than a project-scoped mail address.
The token does not expire and is reused across all projects accessible to the account, including private repositories.
GitLab Email Token Flaw
GitLab exposes a private email address through the “Email work item to this project” option. The address typically follows this format:
`incoming+project-id-glimt-<token>[email protected]`
While the interface historically described the address as a means to create project work items, the embedded glimt-incoming email token authenticates requests as the account owner.
GitLab’s documentation confirms that this incoming email token does not expire and that anyone who obtains it can create issues and merge requests as the associated user.

Aikido found that the token portion remains identical when a user retrieves project email addresses from multiple repositories. This means a token leaked from a public project’s README, support page, documentation, or issue template could potentially be used against other projects accessible to the same account.
The reported attack chain relies on GitLab’s merge-request-by-email workflow. An attacker who knows the target email address can modify the `-issue` suffix to `-merge-request`, submit a specially crafted email, and attach a Git patch file.
The email’s subject can specify a target source branch. GitLab will apply the supplied patch to that branch or create the branch if it does not already exist, using the victim’s permissions. If the compromised account has permission to push to protected branches, the attacker may be able to make commits directly to the main branch.
The risk increases significantly if the patch modifies the `.gitlab-ci.yml` file. If the victim’s role and pipeline settings allow it, GitLab can execute an attacker-defined CI/CD job in the target project.
This job might be utilized to access repository contents, retrieve CI/CD variables, extract secrets, or leverage the CI_JOB_TOKEN for additional access within the GitLab environment.
Aikido tested this behavior against a private project configured with an IP allowlist that excluded their address. GitLab blocked browser access and denied Git clone attempts; however, it accepted the merge request email, allowing the resulting commit to land on the main branch.

GitLab’s documentation now states that users can create issues and merge requests via email because incoming email does not fall under IP restrictions. Therefore, organizations should not consider GitLab IP allowlists as a comprehensive solution for repository modification workflows.
The attack does have limitations. The email token inherits the affected user’s existing permissions so that a low-privilege account would have less impact than a Maintainer or Owner account.
Additionally, attackers must know the intended project’s routing details, including its project path and ID. While these details are easy to obtain for public projects, private ones may require additional information leaks.
Organizations should treat GitLab incoming email addresses as sensitive information, not regular contact addresses.
- Immediately reset incoming email tokens if an address has been exposed, published, or suspected to have leaked. GitLab allows token resets under user profile settings and personal access tokens; resetting invalidates the associated incoming email addresses.
- Search through source repositories, documentation, wiki pages, issue templates, and public websites for glimt tokens and GitLab incoming email address patterns.
- Review users with Maintainer, Owner, and protected-branch push permissions, as their leaked tokens could lead to significant exposure.
- Audit CI/CD configurations for overly broad secret access, unrestricted pipelines, and excessive CI_JOB_TOKEN permissions.
- Treat IP allowlists as a layered control and not as sufficient protection against incoming email workflows.
- Monitor GitLab audit events, merge requests, branch creation, pipeline execution, and changes to `.gitlab-ci.yml` for unusual email-originated activity.
GitLab has updated its user interface and documentation following this disclosure to clarify that incoming email addresses can create both issues and merge requests.
GitLab also removed language suggesting the token could not access other data. However, the underlying mechanism remains unchanged, and GitLab’s documentation still states that the token does not expire and must be kept confidential.
Cut every SOC alert investigation by 21 min. Power your SOC with instant IOC context for immediate response: Integrate TI Lookup in your SOC
Divya is a Senior Journalist at GBhackers covering Cyber Attacks, Threats, Breaches, Vulnerabilities and other happenings in the cyber world.