Pygments ReDoS Vulnerability in AdlLexer of Archetype.py

Vulnerability

A Regular Expression Denial of Service (ReDoS) vulnerability exists in Pygments versions prior to 2.19.2. The issue is located in the AdlLexer within the file pygments/lexers/archetype.py. The vulnerability arises from a regular expression designed to match GUIDs, which contains nested repeating quantifiers. This flaw allows for catastrophic backtracking, causing significant performance degradation by exhausting CPU resources. The vulnerability can block the application thread indefinitely when processing large, maliciously crafted input.

Impact

Exploitation of this vulnerability leads to a denial-of-service condition, where the application becomes unresponsive due to excessive processing time caused by the inefficient regular expression.

Reproduction

The vulnerability can be reproduced by passing a carefully crafted input string of 10,000 'A' characters followed by a hyphen to the AdlLexer. This input triggers the vulnerable regex, causing the lexer to experience a substantial delay as it struggles to process the nested quantifiers. The issue can be automated with a simple Python script that measures the elapsed time, confirming the denial-of-service impact.

Added: Mar 22, 2026, 6:19 AM
Updated: Mar 22, 2026, 6:19 AM

Vulnerability Rating

Custom Algorithm
spread
6.6
impact
2.5
exploitability
6.0
remediation
0.0
relevance
4.5
threat
6.4
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.