CVE-2026-97229: Remote Code Execution via Integer Overflow in the GitLab CI/CD Regex Parser

On October 12, 2026, GitLab patched CVE-2026-97229 a CVSS 10.0 vulnerability affecting Community (CE) and Enterprise (EE) editions via critical patch releases 19.4.2, 19.3.5, and 19.2.8. The flaw stems from an integer overflow triggered when GitLab compiles CI/CD configuration regular expressions using Ruby’s embedded Onigmo regex engine. Under specific conditions, this allows arbitrary command execution on the GitLab server with git user privileges.

Three key developments escalated this beyond a routine CVE. Security researchers published an end-to-end PoC targeted at both patched and unpatched GitLab images. An attacker targeted an open-source Linux distribution’s self-hosted GitLab instance on October 20–21, resulting in a near-miss exploitation attempt; and CISA added the flaw to its Known Exploited Vulnerabilities (KEV) catalog on October 29. Crucially, the incident revealed that the patch resides within GitLab’s bundled Ruby packages rather than the core application codebase. Consequently, simply upgrading the GitLab version fails to remediate the vulnerability across all deployment configurations.

cve

Key Findings

  • Vulnerability: CVE-2026-97229, CWE-190 (Integer Overflow or Wraparound). Located within GitLab’s CI/CD regex compiler specifically inside Ruby’s underlying Onigmo engine.
  • Severity: CVSS v3.1 10.0 (AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H).
  • Impact: Arbitrary OS command execution as the git user on the GitLab server (within the Puma worker process).
  • Affected Versions: GitLab CE/EE prior to 19.2.8 (19.2 branch), 19.3.5 (19.3 branch), and 19.4.2 (19.4 branch). All deployment types are affected; GitLab.com is patched, and GitLab Dedicated instances require no manual intervention.
  • Root Cause: A quantifier bound within the regex is split using an inline comment ((?#)), evading GitLab’s static validation parser. During string matching against a UTF-8 file path, Ruby triggers a re-compilation of the pattern. The resulting program size calculation overflows a 32-bit signed integer boundary.
  • Real-World Exploitation: One week post-patch, an attacker targeted a self-hosted GitLab instance of an open-source Linux distribution project (October 20–21). The project subsequently rebuilt the server from scratch.
  • KEV Listing: Added to CISA’s Known Exploited Vulnerabilities (KEV) catalog on October 29, 2026.
  • Core Takeaway: For self-compiled deployments or custom container images managing their own Ruby runtime, upgrading GitLab alone is insufficient. Updating Ruby to 3.3.13, 3.4.12, 4.0.9, or higher is mandatory. Ruby 3.2 and earlier versions have reached EOL and will not receive fixes.
  • Prerequisite Assessment: Despite the PR:N CVSS rating, the weaponized chain requires an attacker to commit a malicious .gitlab-ci.yml and a specially crafted file path to a public repository. On instances allowing open user registration and public project creation, this operational requirement is effectively nullified.

Who Is Affected?

Branch

Affected Versions

Fixed Version

Latest Version (as of Oct 21)

19.2

Prior to 19.2.8

19.2.8

19.2.9

19.3

Prior to 19.3.5 (including 19.3.4)

19.3.5

19.3.6

19.4

Prior to 19.4.2

19.4.2

19.4.3

19.5, 19.1, 19.0, 18.11

Not listed as affected for this CVE

—

19.5.1, 19.1.9, 19.0.10, 18.11.13

Note: GitLab’s October 12 advisory initially listed 19.3.4 as the fix for the 19.3 branch. However, 19.3.4 contained a regression that broke merge request pages when Ona integration was active. The release notes were subsequently updated to designate 19.3.5 as the remediated version. Deployments remaining on 19.3.4 must upgrade to 19.3.6.

Risk Matrix by Deployment Type

  1. Omnibus packages or official GitLab container images: GitLab applies the fix as a patch directly to its bundled Ruby runtime. Upgrading to the designated GitLab release is sufficient.
  2. Source builds or images using external Ruby runtimes: Upgrading GitLab alone does not apply the patch. The underlying Ruby installation must be manually updated alongside the application.
  3. Ruby 3.2 and earlier: These releases have reached End-of-Life (EOL); no security fixes will be issued. Migration to a supported Ruby branch is required.

Attack Overview

GitLab consolidates repository management, CI/CD pipelines, container registries, and deployment automation into a single platform. Consequently, compromising the GitLab application server carries a significantly broader blast radius than compromising an isolated runner: private repositories, CI/CD variables, runner registration tokens, personal access tokens, webhooks, and integration credentials all reside within the server’s execution context.

The defining characteristic of this vulnerability is that the attack surface appears to be nothing more than a simple regular expression. Features such as rules:exists:regexp and rules:changes:regexp evaluate user-defined patterns against repository file paths. GitLab passes these expressions directly to the native Onigmo engine via Ruby’s Regexp.new call, effectively compiling user-supplied data within memory-unsafe C code.

Attack Chain

  1. Repository Commit: The attacker commits a malicious .gitlab-ci.yml containing a crafted regex alongside a specialized UTF-8 file path (incorporating 4-byte characters) to a public project.
  2. Unauthenticated Trigger: The CI lint API statically evaluates the CI configuration for the attacker’s chosen commit without requiring authentication.
  3. Validation Bypass: GitLab’s internal regex sanitization checks such as quantifier scanners and size guards mistakenly classify the pattern as benign.
  4. Re-compilation: During pattern matching against the UTF-8 path, Ruby re-compiles the expression, causing the compiled program size calculation to overflow.
  5. Control Flow Hijack: Malformed Onigmo bytecode shifts execution flow toward attacker-controlled data regions.
  6. Execution: A system() call is invoked inside the Puma worker process, executing arbitrary OS commands as the git user. The worker process subsequently crashes, leading Workhorse to return a 502 Bad Gateway response.
gitlab_rce

Key Events

Date (2026)

Event

Oct 12

GitLab releases critical patch versions 19.4.2, 19.3.5, and 19.2.8, addressing 24 vulnerabilities in total. CVE-2026-97229 receives a CVSS 10.0 rating. Reported by researcher joaxcar via HackerOne.

Oct 13

Technical details and a functional PoC are publicly disclosed. An open-source Linux distribution project mistakenly upgrades its instance to version 19.3.4 instead of 19.3.5.

Oct 16

In-depth technical root-cause analysis is published.

Oct 20

A newly registered account initiates reconnaissance against the targeted open-source project’s GitLab server.

Oct 21

Primary attack window: worker process crashes, 502 errors, and failed CI jobs are logged. GitLab issues security patches for 19.5.1 and other branches (addressing CVE-2026-110264).

Oct 22

Target instance upgrades to 19.3.6, but the vulnerability remains open due to the use of a standard Ruby runtime base image. Ruby 4.0.8 is released.

Oct 23

Ruby releases 4.0.9, 3.4.12, and 3.3.13 containing Onigmo security fixes. The attacker’s account is suspended.

Oct 24

Project repositories, packages, and October 21 builds are audited against external registries.

Oct 25–26

Attacker returns; re-entry attempts fail, leading administrators to realize the host environment remains vulnerable.

Oct 27

GitLab server access is restricted exclusively to core maintainers and build hosts; teardown and rebuild begin. An updated container image bundling the patched Ruby engine is deployed.

Oct 28

Post-mortem incident report is published; clean rebuild finishes, all user credentials are reset, and GitLab secrets are rotated.

Oct 29

CVE-2026-97229 is added to the CISA KEV catalog. Server resumes public operations running version 19.3.7.

Technical Details

This section is based on the exploitation chain verified by a security research team on a GitLab CE 19.4.1 (Linux amd64) image. Focusing strictly on defense, payload offsets and specific reproduction vectors have been omitted.

1. Entry Point: CI Rules and Onigmo

GitLab supports regular expression matching against repository file paths via the rules:exists:regexp and rules:changes:regexp fields. One pathway demonstrated by researchers involves using exists: regexp: within a conditional include block. GitLab’s RegexpMatcher component expands the input expression, compiles it using Ruby’s native regex engine, and runs it against every file path in the chosen commit’s working tree. Consequently, each path serves as attacker-controlled data fed directly into native Onigmo.

2. Bypassing Guardrails: Split Quantifiers

GitLab enforces several defensive constraints around CI regular expressions: source length validation, a ban on subroutine calls (\g), a scanner filtering out large quantifier bounds, and controls limiting compiled program size to 1 MB (alongside a 50 ms execution timeout).

The quantifier scanner only inspects contiguous numeric digits. An attacker bypasses this check by splitting the bound using an inline regex comment ({5(?#)7805}). Onigmo strips the (?#) comment and interprets the bound as 57,805, whereas GitLab’s scanner sees no contiguous number exceeding 1,000. The two components interpret the exact same string differently, a classic example of a parser differential vulnerability.

3. Post-Validation Re-compilation

The original regex source code is roughly 986 bytes long and remains well under the 1 MB ceiling when initially compiled as US-ASCII. However, when matching against a file path containing valid 4-byte UTF-8 characters, Ruby detects an encoding mismatch and re-compiles the pattern for UTF-8 on the fly. This re-compilation occurs natively inside Onigmo, bypassing GitLab’s size checks and Ruby’s timeout mechanisms. Six [[:word:]] POSIX character classes within the expression expand into massive Unicode range tables under UTF-8, bringing each repeated copy to approximately 37,151 bytes. GitLab never validates the size of this newly compiled program.

4. The Core Flaw: INT_MAX Overflow

Onigmo’s compile_quantifier_node() function evaluates whether unrolling a repeated quantifier body is safe via multiplication (checking body size × repeat count against a maximum threshold):

37,15157,805=2,147,513,555=0x800074D3

This calculated value exceeds the 32-bit signed integer boundary (INT_MAX / 0x7FFFFFFF) by 29,908 bytes. The resulting integer wraparound produces a negative integer, causing the “sufficiently small to expand” validation check to pass. Onigmo proceeds to allocate all 57,805 iterations, writing over 2 GiB of compiled instructions directly into memory.

A secondary integer overflow occurs during alternation (|) compilation, where the jump instruction offset target is calculated using the already-wrapped program length. This produces a negative displacement value in the jump instruction, diverting control flow outside the expected bytecode execution boundaries into an attacker-controlled memory region.

5. Control Flow Hijacking

The attacker places additional character classes at the end of the repeated target. A class like [abc] compiles into an Onigmo bitmap, which can be crafted to emit specific byte sequences. This embeds attacker-controlled Onigmo VM instructions into each unrolled iteration. The broken jump instruction then diverts execution into this controlled bitmap.

The execution chain subsequently proceeds through the following steps:

  1. Onigmo’s backtracking stack is redirected into the repository file path string.
  2. Restored stack values yield two pointers: one determining instruction continuation, and another pointing to a known address inside libruby.
  3. Because relative offsets within libruby remain constant under ASLR, the attacker derives the entry point for system().
  4. As the matcher terminates, control flow redirects through the overwritten return address directly into system().
97229

6. Triggering via Unauthenticated CI Lint

Once setup is complete, the execution vector is triggered using the GET variant of the CI lint API: /api/v4/projects/<project>/ci/lint?content_ref=<ref>. The endpoint verifies read permissions for the public repository (which requires no credentials for open projects), reads the .gitlab-ci.yml file from the attacker’s specified commit, and runs it through the static validator. No pipeline is spawned, and no runners are engaged. Because the endpoint does not reject requests lacking an API token, execution is entirely unauthenticated.

A successful exploitation attempt typically leaves a distinct footprint: the payload executes synchronously within the worker process, after which the corrupted worker process crashes. Workhorse detects the closed backend connection and returns an HTTP 502 Bad Gateway response to the client. Puma then restarts the worker. Consequently, an HTTP 502 status code represents an expected side effect of successful execution rather than a failed attempt.

Real-World Incident: Attack on a Linux Distribution Project

On October 13, the target project mistakenly upgraded its instance to version 19.3.4 a release that lacked the remediated runtime patch. On October 20, a newly registered account began submitting crafted CI configurations. Over October 20–21, GitLab worker processes crashed eight times. The attacker also pulled the project’s custom GitLab container image.

Although the incident response team found no direct forensic evidence confirming full compromise, they acknowledged that successful exploitation could leave no trace. Treating the instance as fully compromised, the team executed a complete rebuild from scratch.

Ruby Side: Onigmo Fixes

On October 23, Ruby issued security releases for Ruby 4.0.9, 3.4.12, and 3.3.13, resolving the underlying Onigmo defects that GitLab had assessed as Remote Code Execution (RCE) vectors.

GitLab CVE

Flaw in Ruby

Fix / Pull Request

4.0 Branch

3.4 Branch

3.3 Branch

CVE-2026-89078

Double free error when pattern parsing fails following an alternation

#13332

4.0.0

3.4.12

3.3.13

CVE-2026-93577, CVE-2026-97229

Integer overflow in compiled pattern size calculation

#19020

4.0.8

3.4.12

3.3.13

CVE-2026-110264

Internal ID overflow in patterns containing extensive quantifier repetitions

#16801

4.0.9

3.4.12

3.3.13

Detection

GitLab published six threat detection rules in Sigma format for self-hosted instances (available in the gitlab-security-oss/tldr repository):

Detection

Focus

Onigmo native worker crash

Native crashes of Ruby/Onigmo worker processes

GraphQL ciLint hostile regexp

Hostile regex patterns within GraphQL ciLint calls

CI regexp oversized non-ASCII path

Abnormally long non-ASCII repository paths processed during regex evaluation

CI regexp guard rejection

Expressions rejected by GitLab’s internal regex guardrails

CI lint Workhorse worker crash

Backend worker crashes (HTTP 502) captured by Workhorse during CI lint requests

CI lint scripted client error burst

Spikes in server errors originating from automated or scripted clients

Mitigation and Remediation Guide

  1. Identify Your Deployment Model First: Determine whether your environment relies on an Omnibus package/official container image, a source build, or a custom container image managing its own Ruby runtime.
  2. Upgrade GitLab Releases: Transition to the latest version within your active release branch (e.g., 19.4.3, 19.3.6, 19.2.9; note that 19.5.1 patches also address CVE-2026-110264). Plan for maintenance downtime on single-node setups due to included database migrations, or execute zero-downtime upgrade procedures on multi-node architectures.
  3. Update the Ruby Runtime: If you manage a custom or self-compiled Ruby environment, update directly to Ruby 3.3.13, 3.4.12, 4.0.9, or higher. Ruby 3.2 and earlier branches are EOL and will not receive security patches.
  4. Apply Temporary Mitigation Measures (Closes specific vectors but does not fix the underlying compiler defect): Restrict anonymous platform access, disable public project creation or write access for untrusted accounts, and block the CI lint route. Additionally, limit user registration and personal access token creation.
  5. Assume Breach on Suspicious Artifacts: If indicators of compromise are observed, treat the host as fully compromised. Immediately rotate all secrets in gitlab-secrets.json, renew all CI/CD variables, revoke and reissue runner tokens, and rotate all personal access tokens. As demonstrated in the real-world case study, executing a complete rebuild from scratch is a reasonable course of action if forensics cannot conclusively rule out compromise.
  6. Strengthen Logging and Detection: Audit and log all outbound network connections, extend log retention windows, and convert the published Sigma rules into your SIEM platform.
  7. Maintain Rapid Patch Cadence: Apply critical GitLab security releases within 24 hours of availability, and verify during each release whether bundled component fixes (such as Ruby) must be applied to your custom builds.

 

Indicators of Compromise (IoCs) and Behavioral Artifacts

No attacker-specific IP addresses, domain names, or file hashes were published in official sources. Consequently, the following table lists behavioral and environmental indicators.

  1. 1. Log and Network Indicators

    Indicator

    Type

    Description

    GET /api/v4/projects/<project>/ci/lint?content_ref=<ref>

    HTTP Request

    Statistically evaluates the CI configuration at the attacker’s chosen commit; takes several seconds during exploitation.

    badgateway: failed to receive response: EOF / HTTP 502

    Workhorse Log

    Log entry indicating that a worker process crashed.

    Puma worker crash with backtrace containing regexp_matcher.rb

    Puma Log

    Native crash during CI regex processing.

    Ruby [BUG] report referencing match_at or onig_compile

    Puma Stderr

    Native Onigmo engine crash report.

    2. Content and Process Artifacts

    Artifact

    Type

    Description

    Quantifier bounds split using inline comments (e.g., {5(?#)7805})

    Regex Pattern

    Technique bypassing GitLab’s quantifier scanner.

    Repeated [[:word:]] classes and crafted character class bitmaps

    Regex Pattern

    Constructs expanding size under UTF-8 and emitting controlled bytecode.

    Abnormally long file path containing 4-byte UTF-8 characters

    Repository Content

    Secondary component required to trigger pattern re-compilation.

    Shell subprocess spawned under Puma/Sidekiq; ~2 GiB worker memory surge

    Process

    Indirect signature of successful execution.

    Newly registered account pushing crafted CI configs and pulling container images

    Account Behavior

    Reconnaissance and preparation pattern observed in real-world incidents.

    Unpatched GitLab prior to 19.2.8 / 19.3.5 / 19.4.2; Ruby prior to 3.3.13 / 3.4.12 / 4.0.9

    Version

    Vulnerable software and runtime components.

    Custom GitLab container images lacking the remediated Ruby runtime

    Container Image

    Base images running unpatched Ruby versions.

MITRE ATT&CK Mapping

  1. 1. Log and Network Indicators

    Indicator

    Type

    Description

    GET /api/v4/projects/<project>/ci/lint?content_ref=<ref>

    HTTP Request

    Statistically evaluates the CI configuration at the attacker’s chosen commit; takes several seconds during exploitation.

    badgateway: failed to receive response: EOF / HTTP 502

    Workhorse Log

    Log entry indicating that a worker process crashed.

    Puma worker crash with backtrace containing regexp_matcher.rb

    Puma Log

    Native crash during CI regex processing.

    Ruby [BUG] report referencing match_at or onig_compile

    Puma Stderr

    Native Onigmo engine crash report.

    2. Content and Process Artifacts

    Artifact

    Type

    Description

    Quantifier bounds split using inline comments (e.g., {5(?#)7805})

    Regex Pattern

    Technique bypassing GitLab’s quantifier scanner.

    Repeated [[:word:]] classes and crafted character class bitmaps

    Regex Pattern

    Constructs expanding size under UTF-8 and emitting controlled bytecode.

    Abnormally long file path containing 4-byte UTF-8 characters

    Repository Content

    Secondary component required to trigger pattern re-compilation.

    Shell subprocess spawned under Puma/Sidekiq; ~2 GiB worker memory surge

    Process

    Indirect signature of successful execution.

    Newly registered account pushing crafted CI configs and pulling container images

    Account Behavior

    Reconnaissance and preparation pattern observed in real-world incidents.

    Unpatched GitLab prior to 19.2.8 / 19.3.5 / 19.4.2; Ruby prior to 3.3.13 / 3.4.12 / 4.0.9

    Version

    Vulnerable software and runtime components.

    Custom GitLab container images lacking the remediated Ruby runtime

    Container Image

    Base images running unpatched Ruby versions.

MITRE ATT&CK Mapping

The following mapping is based on observations from public sources. Techniques marked as “observed” stem from the real-world incident analysis or researcher verification, while “potential” techniques represent probable downstream effects following successful exploitation.

Reconnaissance

  • T1592.002 – Gather Victim Host Information: Software (Observed): The attacker downloaded the target project’s custom GitLab container image to tailor the exploit payload against the exact target build.

Initial Access

  • T1190 – Exploit Public-Facing Application (Observed): Targeting the vulnerable GitLab instance via the unauthenticated CI lint endpoint.

Execution

  • T1059.004 – Command and Scripting Interpreter: Unix Shell (Observed in PoC): Executing arbitrary OS commands within the Puma worker process via system() calls.

Impact (Side Effect)

  • T1499.004 – Endpoint DoS: Application or System Exploitation (Observed): Exploitation attempts causing worker process crashes, resulting in HTTP 502 Bad Gateway errors and failed CI pipelines.

Credential Access

  • T1110.004 – Brute Force: Credential Stuffing (Observed): The target project reported automated login attempts using credentials leaked from external breaches.
  • T1552 – Unsecured Credentials (Potential): Accessing CI/CD environment variables, runner registration tokens, integration credentials, and secrets stored in gitlab-secrets.json.

Collection and Supply Chain

  • T1213.003 – Data from Information Repositories: Code Repositories (Potential): Accessing private repositories, confidential issues, and restricted merge requests.
  • T1195.002 – Supply Chain Compromise: Compromise Software Supply Chain (Potential): Risk of tampering with repository code or build artifacts via a compromised CI/CD platform (the target project verified no such tampering occurred).
 

Related Vulnerabilities

Vulnerabilities originating from the same Onigmo/regex class patched in rapid succession demonstrate that the attack surface extends beyond a single isolated flaw:

  • CVE-2026-89078: Double-free vulnerability in the regex parser (patched in GitLab 19.4.1).
  • CVE-2026-93577: Integer overflow in the regex compiler (patched in GitLab 19.4.1). GitLab’s internal detection notes explicitly describe CVE-2026-97229 as a bypass technique that circumvents the original remediation for this flaw.
  • CVE-2026-110264: Internal ID overflow in patterns containing extensive quantifier repetitions (patched in the October 21 security releases for GitLab 19.5.1 and backported branches).
 

The same release package also resolved 23 additional vulnerabilities, including notable high-severity issues such as CVE-2026-92883 (XSS, CVSS 8.7), CVE-2026-16301 (unauthorized pipeline execution on protected branches, CVSS 8.5), and CVE-2026-14814 (cache poisoning for raw repository files, CVSS 8.2).

Conclusion

CVE-2026-97229 demonstrates how a single regular expression can evolve into remote code execution on a CI/CD platform’s application server due to a parser differential between two components combined with a validation gap during re-compilation. The verified facts are clear: the vulnerability was successfully reproduced by researchers on an unpatched official GitLab image, a real-world exploitation attempt targeted an open-source Linux distribution project, and CISA added the flaw to its Known Exploited Vulnerabilities (KEV) catalog.

What remains unverified is whether the real-world attempt achieved full compromise and how the original report fulfilled the “unauthenticated” claim without pre-existing conditions. Therefore, risk assessment must be calibrated against each host’s exposure profile (e.g., internet-facing status, open user registration, and public project creation settings).

From a defensive standpoint, three key priorities emerge: rapid patch deployment, ensuring underlying runtime components like Ruby are updated alongside the application, and aggressively rotating secrets or executing a clean server rebuild whenever compromise is suspected.

Table of Contents
advanced divider

More posts

This image is about multiple Nginx vulnerabilities.
This image is about multiple Microsoft IIS vulnerabilities.
This image is about SMTP open mail relay vulnerability.
advanced divider

Share this article

Found it interesting? Don’t hesitate to share it to wow your friends or colleagues

advanced divider

Subscribe to our blog newsletter to follow the latest posts