Skip to content
DoS Disclosed report Intermediate

Server-side ReDoS via user-controlled regex in OIDC Access Policy

The OIDC Access Policy compiled user-supplied regular expressions with Ruby's Regexp engine and matched them against JWT claim values without any timeout or complexity check. A crafted pattern with catastrophic backtracking could tie up a Puma worker thread, and a few concurrent requests could exhaust the small thread pool and cause a denial of service.

6b_jjj Follow

Originally disclosed on HackerOne

  • Fixed in 17 days
  • Disclosed after 48 days

The OIDC Access Policy implementation evaluates user-supplied regular expressions against JWT claim values using Ruby’s Regexp engine without any timeout or complexity validation.

The vulnerable code path is:

Regexp.new(value).match?(claim_value)

Where:

  • value is fully user-controlled (defined when creating an OIDC API Key Role using the string_matches operator)
  • claim_value is derived from JWT claims and can be influenced via GitHub Actions metadata (e.g. branch names)

A malicious regular expression with catastrophic backtracking characteristics can be supplied, causing the server to spend an excessive amount of CPU time evaluating a single request.

Example pattern: ^(a+)+$

Example input: refs/heads/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!

This causes Ruby’s regex engine to enter exponential backtracking during evaluation.

Impact

A single crafted request can block a Puma worker thread for an extended period of time due to catastrophic regex backtracking.

Since RubyGems.org runs with a very small thread pool, a small number of concurrent requests can exhaust all available workers, resulting in partial or full denial of service.

This can disrupt gem publishing operations and CI/CD pipelines that rely on RubyGems.org availability.

The original report as published on HackerOne, by 6b_jjj. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the user-controlled regex was compiled and evaluated with Ruby's Regexp engine without a timeout or any check on pattern complexity.

Impact

A small number of concurrent crafted requests could exhaust the small Puma thread pool, causing partial or full denial of service and disrupting gem publishing and CI/CD pipelines.

What the attacker needed

Ability to create an OIDC API Key Role; control over a JWT claim value; a few concurrent requests

How it was found

  1. Create an OIDC API Key Role using the string_matches operator with a pattern that backtracks catastrophically.
  2. Trigger evaluation of the policy against a JWT claim value shaped to cause exponential backtracking.
  3. Send a small number of concurrent requests to exhaust the worker pool.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A regular expression is a pattern used to match text, and some patterns can take an enormous amount of time on certain inputs. Here the site let users supply their own pattern and ran it against values from a login token, so a deliberately slow pattern could keep the server busy. Enough of these requests at once can make the site stop responding to other people.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More from RubyGems

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.