CVE-2021-20270: High severity Pygments Pygments vulnerability

Published Dec 10, 2020
·
Updated

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.

Other sources

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.

Microsoft

Infinite loop in SML lexer may lead to DoS. When the SMLLexer gets fed the string "exception" it seems to loop indefinitely.

Upstream Fix:

https://github.com/pygments/pygments/commit/f91804ff4772e3ab41f46e28d370f57898700333

Red Hat

Affected Software

46 affected componentsFixes available
ubuntu/pygments<2.7.1+dfsg-2
2.7.1+dfsg-2
ubuntu/pygments<1.6+dfsg-1ubuntu1.1+
1.6+dfsg-1ubuntu1.1+
ubuntu/pygments<2.2.0+dfsg-1ubuntu0.1
2.2.0+dfsg-1ubuntu0.1
ubuntu/pygments<2.3.1+dfsg-1ubuntu2.1
2.3.1+dfsg-1ubuntu2.1
ubuntu/pygments<2.3.1+dfsg-4ubuntu0.1
2.3.1+dfsg-4ubuntu0.1
ubuntu/pygments<2.7.1+dfsg-2
2.7.1+dfsg-2
ubuntu/pygments<2.7.4
2.7.4
ubuntu/pygments<2.1+dfsg-1ubuntu0.1
2.1+dfsg-1ubuntu0.1
ubuntu/pygments<2.7.1+dfsg-2
2.7.1+dfsg-2
ubuntu/pygments<2.7.1+dfsg-2
2.7.1+dfsg-2
ubuntu/pygments<2.7.1+dfsg-2
2.7.1+dfsg-2
redhat/automation-hub<0:4.2.2-1.el7
0:4.2.2-1.el7
redhat/python3-django<0:2.2.18-1.el7
0:2.2.18-1.el7
redhat/python-bleach<0:3.3.0-1.el7
0:3.3.0-1.el7
redhat/python-bleach-allowlist<0:1.0.3-1.el7
0:1.0.3-1.el7
redhat/python-galaxy-importer<0:0.2.15-1.el7
0:0.2.15-1.el7
redhat/python-galaxy-ng<0:4.2.2-1.el7
0:4.2.2-1.el7
redhat/python-pulp-ansible<1:0.5.6-1.el7
1:0.5.6-1.el7
redhat/automation-hub<0:4.2.2-1.el8
0:4.2.2-1.el8
redhat/python3-django<0:2.2.18-1.el8
0:2.2.18-1.el8
redhat/python-bleach<0:3.3.0-1.el8
0:3.3.0-1.el8
redhat/python-bleach-allowlist<0:1.0.3-1.el8
0:1.0.3-1.el8
redhat/python-galaxy-importer<0:0.2.15-1.el8
0:0.2.15-1.el8
redhat/python-galaxy-ng<0:4.2.2-1.el8
0:4.2.2-1.el8
redhat/python-pulp-ansible<1:0.5.6-1.el8
1:0.5.6-1.el8
redhat/resource-agents<0:4.1.1-98.el8
0:4.1.1-98.el8
redhat/python27-babel<0:0.9.6-10.el7
0:0.9.6-10.el7
redhat/python27-python<0:2.7.18-3.el7
0:2.7.18-3.el7
redhat/python27-python-jinja2<0:2.6-16.el7
0:2.6-16.el7
redhat/python27-python-pygments<0:1.5-5.el7
0:1.5-5.el7
debian/mediawiki
1:1.31.16-1+deb10u21:1.31.16-1+deb10u61:1.35.11-1~deb11u11:1.35.13-1~deb11u11:1.39.4-1~deb12u11:1.39.5-1~deb12u11:1.39.5-1
debian/pygments
2.3.1+dfsg-1+deb10u22.7.1+dfsg-2.12.14.0+dfsg-12.15.1+dfsg-1
redhat/python-pygments<2.7.4
2.7.4
pip/Pygments>=1.5<2.7.4
2.7.4
Pygments Pygments>=1.5<=2.7.3
redhat OpenShift Container Platform=3.11
redhat OpenShift Container Platform=4.0
redhat Openstack Platform=10.0
redhat Software Collections
redhat Enterprise Linux=7.0
redhat Enterprise Linux=8.0
Fedoraproject Fedora=33
Debian Debian Linux=9.0
Debian Debian Linux=10.0
Microsoft azl3 python-pygments 2.5.2-1
Microsoft azl3 python-pygments 2.7.4-1

Event History

Dec 10, 2020
CVE Published
12:00 AM
Mar 23, 2021
CVE Published
via MITRE·04:40 PM
Data Sourced
via MITRE·04:40 PM
DescriptionWeakness
Mar 26, 2021
Data Sourced
via Microsoft·07:00 AM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·07:00 AM
Affected Software
Updated
via Microsoft·07:00 AM
DescriptionSeverityWeakness
Apr 20, 2021
Advisory Published
via GitHub·04:35 PM
Oct 9, 2023
Data Sourced
01:16 PM
Description

Parent advisories

This vulnerability appears in the following advisories.

Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the vulnerability ID for this issue?

The vulnerability ID for this issue is CVE-2021-20270.

2

What is the severity level of CVE-2021-20270?

The severity level of CVE-2021-20270 is high, with a CVSS score of 7.5.

3

Which software versions are affected by CVE-2021-20270?

Pygments versions 1.5 to 2.7.3 are affected by CVE-2021-20270.

4

How can I fix the vulnerability in Pygments?

To fix the vulnerability, update Pygments to version 2.7.4.

5

Where can I find more information about CVE-2021-20270?

More information about CVE-2021-20270 can be found at the following references: [Reference 1](https://bugzilla.redhat.com/show_bug.cgi?id=1922136), [Reference 2](https://www.debian.org/security/2021/dsa-4889), [Reference 3](https://lists.debian.org/debian-lts-announce/2021/05/msg00003.html).

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203