CVE-2022-40896 Pygments vulnerable to ReDoS

Medium 5.5 Published Updated

Attackers can cause denial of service in applications using Pygments via a ReDoS vulnerability in the Smithy lexer.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2022-40896?

CVE-2022-40896 is a medium-severity denial of service vulnerability in n/a, published on 19 Jul 2023. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official description

A ReDoS issue was discovered in pygments/lexers/smithy.py in pygments through 2.15.0 via SmithyLexer.

Weakness: CWE-434

Which versions are affected by CVE-2022-40896?

3 open source packages ship an affected version, including pygments and Pygments. It affects 1 product.

PackageAffectedFixed in
pygments PyPIAll versions2.15.0
pygments PyPIAll versions2.15.1
Pygments PyPIAll versions2.15.0

Products include Pygments Pygments.

How do I fix CVE-2022-40896?

Upgrade pygments to a fixed version for your release line: 2.15.0 or 2.15.1.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2022-40896 being exploited?

There is no known exploitation of CVE-2022-40896 in the wild and no public exploit code.

Sources

Also known as AZL-27502, AZL-35139, DEBIAN-CVE-2022-40896, GHSA-mrwq-x4v8-fh7p, MGASA-2024-0107, MINI-pvx8-36jq-fh6r and 7 more.

Is CVE-2022-40896 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free