# CVE-2020-28493: Regular Expression Denial of Service (ReDoS)

> Attackers can cause denial of service in applications using Jinja2 by exploiting a regular expression vulnerability in the urlize filter.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L/E:P`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 1 Feb 2021
- **Updated:** 16 Sep 2024
- **Also known as:** ALPINE-CVE-2020-28493, ALSA-2021:4161, AZL-40857, AZL-75813, DEBIAN-CVE-2020-28493, GHSA-g3rq-g295-4j3m, MGASA-2021-0178, OESA-2021-1190, PYSEC-2021-66, RHSA-2021:4161, RLSA-2021:4161, SNYK-PYTHON-JINJA2-1012994, SUSE-SU-2021:0601-1, SUSE-SU-2021:0602-1, SUSE-SU-2021:0603-1, SUSE-SU-2021:0607-1, SUSE-SU-2021:0654-1, SUSE-SU-2021:14644-1, UBUNTU-CVE-2020-28493, USN-5701-1

## What is CVE-2020-28493?

CVE-2020-28493 is a medium-severity denial of service vulnerability in Fedoraproject Fedora, published on 1 Feb 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

This affects the package jinja2 from 0.0.0 and before 2.11.3. The ReDoS vulnerability is mainly due to the `_punctuation_re regex` operator and its use of multiple wildcards. The last wildcard is the most exploitable as it searches for trailing punctuation. This issue can be mitigated by Markdown to format user content instead of the urlize filter, or by implementing request timeouts and limiting process memory.

Weakness: CWE-400 (Uncontrolled Resource Consumption)

## Which versions are affected by CVE-2020-28493?

3 open source packages ship an affected version, including jinja2 and Jinja2. It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `jinja2` | PyPI | All versions | 2.11.3 |
| `jinja2` | PyPI | All versions | 2.11.3 |
| `Jinja2` | PyPI | All versions | 2.11.3 |
| `python3-jinja2` | AlmaLinux:8 | All versions | 2.10.1-3.el8 |
| `python-jinja2` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.10.1-3.el8 |
| `python3-jinja2` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.10.1-3.el8 |
| `python-jinja2` | Rocky Linux:8 | All versions | 0:2.10.1-3.el8 |
| `python-Jinja2` | SUSE:Enterprise Storage 6 | All versions | 2.10.1-3.10.2 |
| `python-Jinja2` | SUSE:HPE Helion OpenStack 8 | All versions | 2.9.6-3.6.1 |
| `python-Jinja2` | SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOS | All versions | 2.10.1-3.10.2 |
| `python-Jinja2` | SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | All versions | 2.10.1-3.10.2 |
| `python-Jinja2` | SUSE:Linux Enterprise High Performance Computing 15-ESPOS | All versions | 2.10.1-3.10.2 |
| `python-Jinja2` | SUSE:Linux Enterprise High Performance Computing 15-LTSS | All versions | 2.10.1-3.10.2 |
| `python-Jinja2` | SUSE:Linux Enterprise Module for Advanced Systems Management 12 | All versions | 2.8-19.23.1 |
| `python-Jinja2` | SUSE:Linux Enterprise Module for Basesystem 15 SP2 | All versions | 2.10.1-3.10.2 |
| `python-Jinja2` | SUSE:Linux Enterprise Module for Public Cloud 12 | All versions | 2.8-19.23.1 |
| `python-Jinja2` | SUSE:Linux Enterprise Module for Python 2 15 SP2 | All versions | 2.10.1-3.10.2 |
| `python-Jinja2` | SUSE:Linux Enterprise Point of Sale 12 SP2 | All versions | 2.8-22.11.1 |
| `python-Jinja2` | SUSE:Linux Enterprise Server 11 SP3-CLIENT-TOOLS | All versions | 2.6-2.19.5.1 |
| `python-Jinja2` | SUSE:Linux Enterprise Server 11 SP4-CLIENT-TOOLS | All versions | 2.6-2.19.5.1 |
| `python-Jinja2` | SUSE:Linux Enterprise Server 11-PUBCLOUD | All versions | 2.6-2.19.5.1 |
| `python-Jinja2` | SUSE:Linux Enterprise Server 15 SP1-BCL | All versions | 2.10.1-3.10.2 |
| `python-Jinja2` | SUSE:Linux Enterprise Server 15 SP1-LTSS | All versions | 2.10.1-3.10.2 |
| `python-Jinja2` | SUSE:Linux Enterprise Server 15-LTSS | All versions | 2.10.1-3.10.2 |
| `python-Jinja2` | SUSE:Linux Enterprise Server for SAP Applications 15 | All versions | 2.10.1-3.10.2 |
| `python-Jinja2` | SUSE:Linux Enterprise Server for SAP Applications 15 SP1 | All versions | 2.10.1-3.10.2 |
| `python-Jinja2` | SUSE:Manager Client Tools 12 | All versions | 2.8-19.23.1 |
| `python-Jinja2` | SUSE:Manager Proxy 4.0 | All versions | 2.10.1-3.10.2 |
| `python-Jinja2` | SUSE:Manager Retail Branch Server 4.0 | All versions | 2.10.1-3.10.2 |
| `python-Jinja2` | SUSE:Manager Server 4.0 | All versions | 2.10.1-3.10.2 |
| `python-Jinja2` | SUSE:OpenStack Cloud 7 | All versions | 2.8-22.11.1 |
| `python-Jinja2` | SUSE:OpenStack Cloud 8 | All versions | 2.9.6-3.6.1 |
| `python-Jinja2` | SUSE:OpenStack Cloud 9 | All versions | 2.10.1-3.6.1 |
| `python-Jinja2` | SUSE:OpenStack Cloud Crowbar 8 | All versions | 2.9.6-3.6.1 |
| `python-Jinja2` | SUSE:OpenStack Cloud Crowbar 9 | All versions | 2.10.1-3.6.1 |

Products: Fedoraproject Fedora, Palletsprojects Jinja.

## How do I fix CVE-2020-28493?

Upgrade jinja2 to 2.11.3 or later.

## Is CVE-2020-28493 being exploited?

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

## Other vulnerabilities in Fedoraproject Fedora

- [CVE-2024-4577](https://insights.sbomify.com/CVE-2024-4577/): PHP-CGI OS Command Injection (critical 9.8, exploited in the wild)
- [CVE-2021-39226](https://insights.sbomify.com/CVE-2021-39226/): Grafana Authentication Bypass (critical 9.8, exploited in the wild)
- [CVE-2019-5544](https://insights.sbomify.com/CVE-2019-5544/): VMware ESXi and Horizon DaaS OpenSLP Heap-Based Buffer Overflow (critical 9.8, exploited in the wild)
- [CVE-2024-4947](https://insights.sbomify.com/CVE-2024-4947/): Google Chromium V8 Type Confusion (critical 9.6, exploited in the wild)
- [CVE-2024-4671](https://insights.sbomify.com/CVE-2024-4671/): Google Chromium Visuals Use-After-Free (critical 9.6, exploited in the wild)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2020-28493 and fix it if it is affected.

What it is: CVE-2020-28493 is a medium-severity denial of service vulnerability in Fedoraproject Fedora, published on 1 Feb 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2020-28493 in the wild and no public exploit code.

Affected packages and fixed versions:
- jinja2 (PyPI): affected all versions; fixed in 2.11.3
- jinja2 (PyPI): affected all versions; fixed in 2.11.3
- Jinja2 (PyPI): affected all versions; fixed in 2.11.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2020-28493/ (Markdown: https://insights.sbomify.com/CVE-2020-28493/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2020-28493
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2020-28493
- OSV: https://osv.dev/vulnerability/CVE-2020-28493

---
From sbomify Insights: https://insights.sbomify.com/CVE-2020-28493/
Summaries are generated and may contain mistakes; the official description above is the record.
