Skip to content
DoS Advisory Intermediate

GHSL-2022-024: Regular Expression Denial of Service (ReDoS) in the Azure SDK for Java.

The Azure SDK for Java used a regular expression with nested repetition to validate tenant IDs, which could cause catastrophic backtracking. An attacker could supply a crafted tenant ID to cause denial of service in applications using the SDK.

ghsecuritylab Follow

Originally disclosed on GitHub Security Lab

The Azure SDK for Java up to version 1.5.0-beta2 is vulnerable to Regular Expression Denial of Service (ReDoS) in the way it validates tenant IDs. Specially crafted IDs may cause catastrophic backtracking, taking exponential time to complete.

ghsecuritylab, on GitHub Security Lab

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

The regular expression used for tenant ID validation contains nested repetition where a dot (.) alternative overlaps with other alternatives, leading to exponential backtracking on non-matching input.

Impact

This issue may lead to denial of service of the application using the Azure SDK if user input reaches validateTenantIdCharacterRange, but only on JDK 8 or earlier because JDK 9 introduced mitigations.

What the attacker needed

Application uses Azure SDK for Java <=1.5.0-beta2; application runs on JDK 8 or earlier; user input reaches tenant ID validation

The fix

The issue was fixed in version 1.5.1 of com.azure.identity.

How it was found

  1. Call ValidationUtil.validateTenantIdCharacterRange with a string of many hyphens followed by a newline.
  2. Observe that the regex engine backtracks exponentially, causing a delay.

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 check text. Some patterns can take a very long time to fail on certain inputs, which can freeze the program. Here, a specially crafted tenant ID could make the validation take exponentially longer, effectively denying service.

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 by ghsecuritylab

View all

132 more disclosed reports, best first.

More from GitHub Security Lab

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.