CVE-2021-20270 Infinite Loop in Pygments

High 7.5 Published Updated

An infinite loop in Pygments allows attackers to cause denial of service via crafted Standard ML source files during syntax highlighting.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2021-20270?

CVE-2021-20270 is a high-severity denial of service vulnerability in Debian Debian Linux, published on 23 Mar 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

An infinite loop in SMLLexer in Pygments versions 1.5 to 2.7.3 may lead to denial of service when performing syntax highlighting of a Standard ML (SML) source file, as demonstrated by input that only contains the "exception" keyword.

Weakness: CWE-835

Which versions are affected by CVE-2021-20270?

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

PackageAffectedFixed in
pygments PyPIFrom 1.52.7.4
pygments PyPIFrom 1.52.7.4
Pygments PyPIFrom 1.52.7.4
Linux distribution packages (15)
python-Pygments SUSE:Enterprise Storage 6All versions2.6.1-7.7.1
python-Pygments SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOSAll versions2.6.1-7.7.1
python-Pygments SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSSAll versions2.6.1-7.7.1
python-Pygments SUSE:Linux Enterprise High Performance Computing 15-ESPOSAll versions2.2.0-4.6.1
python-Pygments SUSE:Linux Enterprise High Performance Computing 15-LTSSAll versions2.2.0-4.6.1
python-Pygments SUSE:Linux Enterprise Module for Basesystem 15 SP2All versions2.6.1-7.7.1
python-Pygments SUSE:Linux Enterprise Module for Package Hub 15 SP2All versions2.2.0-4.6.1
python-Pygments SUSE:Linux Enterprise Module for Package Hub 15 SP3All versions2.2.0-4.6.1
python-Pygments SUSE:Linux Enterprise Server 15 SP1-BCLAll versions2.6.1-7.7.1
python-Pygments SUSE:Linux Enterprise Server 15 SP1-LTSSAll versions2.6.1-7.7.1
python-Pygments SUSE:Linux Enterprise Server 15-LTSSAll versions2.2.0-4.6.1
python-Pygments SUSE:Linux Enterprise Server for SAP Applications 15All versions2.2.0-4.6.1
python-Pygments SUSE:Linux Enterprise Server for SAP Applications 15 SP1All versions2.6.1-7.7.1
python-Pygments openSUSE:Leap 15.2All versions2.6.1-lp152.5.9.1
python-Pygments openSUSE:TumbleweedAll versions2.21.0-1.1

Products include Debian Debian Linux, Fedoraproject Fedora, Pygments Pygments, Redhat Enterprise Linux, Redhat Openshift Container Platform, Redhat Openstack Platform and 1 more.

How do I fix CVE-2021-20270?

Upgrade pygments to 2.7.4 or later.

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-2021-20270 being exploited?

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

All Debian Debian Linux vulnerabilities

Sources

Also known as ALPINE-CVE-2021-20270, AZL-35137, AZL-6811, DEBIAN-CVE-2021-20270, DLA-2590-1, DSA-4870-1 and 10 more.

Is CVE-2021-20270 in your software?

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

Check your SBOMs for free