nachtfeuer/pipeline

Vulnerabilities

24 via 73 paths

Dependencies

60

Source

GitHub

Commit

ee15d98f

Find, fix and prevent vulnerabilities in your code.

Issue type
  • 24
  • 1
Severity
  • 1
  • 8
  • 16
Status
  • 25
  • 0
  • 0

critical severity

Heap-based Buffer Overflow

  • Vulnerable module: pillow
  • Introduced through: pillow@9.5.0 and sphinxcontrib-blockdiag@1.5.5

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 pillow@9.5.0
    Remediation: Upgrade to pillow@10.0.1.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 blockdiag@3.0.0 pillow@9.5.0
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.

Overview

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Heap-based Buffer Overflow when the ReadHuffmanCodes() function is used. An attacker can craft a special WebP lossless file that triggers the ReadHuffmanCodes() function to allocate the HuffmanCode buffer with a size that comes from an array of precomputed sizes: kTableSize. The color_cache_bits value defines which size to use. The kTableSize array only takes into account sizes for 8-bit first-level table lookups but not second-level table lookups. libwebp allows codes that are up to 15-bit (MAX_ALLOWED_CODE_LENGTH). When BuildHuffmanTable() attempts to fill the second-level tables it may write data out-of-bounds. The OOB write to the undersized array happens in ReplicateValue.

Notes:

This is only exploitable if the color_cache_bits value defines which size to use.

This vulnerability was also published on libwebp CVE-2023-5129

Changelog:

2023-09-12: Initial advisory publication

2023-09-27: Advisory details updated, including CVSS, references

2023-09-27: CVE-2023-5129 rejected as a duplicate of CVE-2023-4863

2023-09-28: Research and addition of additional affected libraries

2024-01-28: Additional fix information

Remediation

Upgrade Pillow to version 10.0.1 or higher.

References

high severity

Eval Injection

  • Vulnerable module: pillow
  • Introduced through: pillow@9.5.0 and sphinxcontrib-blockdiag@1.5.5

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 pillow@9.5.0
    Remediation: Upgrade to pillow@10.2.0.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 blockdiag@3.0.0 pillow@9.5.0
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.

Overview

Affected versions of this package are vulnerable to Eval Injection via the PIL.ImageMath.eval function when an attacker has control over the keys passed to the environment argument.

PoC

from PIL import Image, ImageMath

image1 = Image.open('__class__')
image2 = Image.open('__bases__')
image3 = Image.open('__subclasses__')
image4 = Image.open('load_module')
image5 = Image.open('system')

expression = "().__class__.__bases__[0].__subclasses__()[104].load_module('os').system('whoami')"

environment = {
    image1.filename: image1,
    image2.filename: image2,
    image3.filename: image3,
    image4.filename: image4,
    image5.filename: image5
}

ImageMath.eval(expression, **environment)

Remediation

Upgrade pillow to version 10.2.0 or higher.

References

high severity

Denial of Service (DoS)

  • Vulnerable module: pillow
  • Introduced through: pillow@9.5.0 and sphinxcontrib-blockdiag@1.5.5

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 pillow@9.5.0
    Remediation: Upgrade to pillow@10.2.0.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 blockdiag@3.0.0 pillow@9.5.0
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.

Overview

Affected versions of this package are vulnerable to Denial of Service (DoS) when using arbitrary strings as text input and the number of characters passed into PIL.ImageFont.ImageFont.getmask() is over a certain limit. This can lead to a system crash.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.

Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.

One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.

When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.

Two common types of DoS vulnerabilities:

  • High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.

  • Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm ws package

Remediation

Upgrade pillow to version 10.2.0 or higher.

References

high severity

Denial of Service (DoS)

  • Vulnerable module: pillow
  • Introduced through: pillow@9.5.0 and sphinxcontrib-blockdiag@1.5.5

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 pillow@9.5.0
    Remediation: Upgrade to pillow@10.2.0.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 blockdiag@3.0.0 pillow@9.5.0
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.

Overview

Affected versions of this package are vulnerable to Denial of Service (DoS) if the size of individual glyphs extends beyond the bitmap image, when using PIL.ImageFont.ImageFont function. Exploiting this vulnerability could lead to a system crash.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.

Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.

One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.

When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.

Two common types of DoS vulnerabilities:

  • High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.

  • Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm ws package

Remediation

Upgrade pillow to version 10.2.0 or higher.

References

high severity

Uncontrolled Resource Consumption ('Resource Exhaustion')

  • Vulnerable module: pillow
  • Introduced through: pillow@9.5.0 and sphinxcontrib-blockdiag@1.5.5

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 pillow@9.5.0
    Remediation: Upgrade to pillow@10.0.0.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 blockdiag@3.0.0 pillow@9.5.0
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.

Overview

Affected versions of this package are vulnerable to Uncontrolled Resource Consumption ('Resource Exhaustion') when the ImageFont truetype in an ImageDraw instance operates on a long text argument. An attacker can cause the service to crash by processing a task that uncontrollably allocates memory.

Remediation

Upgrade pillow to version 10.0.0 or higher.

References

high severity

Improper Control of Generation of Code ('Code Injection')

  • Vulnerable module: setuptools
  • Introduced through: sphinx@1.6.5, mock@2.0.0 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5 setuptools@40.5.0
    Remediation: Upgrade to sphinx@1.6.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 mock@2.0.0 pbr@6.1.1 setuptools@40.5.0
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5 setuptools@40.5.0
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5 setuptools@40.5.0
    Remediation: Upgrade to sphinxcontrib-inheritance@0.9.0.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 blockdiag@3.0.0 setuptools@40.5.0
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 bandit@1.0.1 stevedore@3.5.2 pbr@6.1.1 setuptools@40.5.0

…and 3 more

Overview

Affected versions of this package are vulnerable to Improper Control of Generation of Code ('Code Injection') through the package_index module's download functions due to the unsafe usage of os.system. An attacker can execute arbitrary commands on the system by providing malicious URLs or manipulating the URLs retrieved from package index servers.

Note

Because easy_install and package_index are deprecated, the exploitation surface is reduced, but it's conceivable through social engineering or minor compromise to a package index could grant remote access.

Remediation

Upgrade setuptools to version 70.0.0 or higher.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: wheel
  • Introduced through: wheel@0.29.0

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 wheel@0.29.0
    Remediation: Upgrade to wheel@0.38.0.

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via attacker-controlled input to Wheel CLI, when parsing a maliciously crafted Wheel file.

Note:Version 0.38.0 has been yanked due to an unrelated non-security issue. Users are advised to upgrade to version 0.38.1.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade wheel to version 0.38.0 or higher.

References

high severity

Buffer Overflow

  • Vulnerable module: pillow
  • Introduced through: pillow@9.5.0 and sphinxcontrib-blockdiag@1.5.5

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 pillow@9.5.0
    Remediation: Upgrade to pillow@10.3.0.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 blockdiag@3.0.0 pillow@9.5.0
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.

Overview

Affected versions of this package are vulnerable to Buffer Overflow via the strcpy function in _imagingcms.c, due to two calls that were able to copy too much data into fixed length strings.

Remediation

Upgrade pillow to version 10.3.0 or higher.

References

high severity

SQL Injection

  • Vulnerable module: bandit
  • Introduced through: bandit@1.0.1

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 bandit@1.0.1
    Remediation: Upgrade to bandit@1.7.7.

Overview

bandit is a Security oriented static analyser for python code.

Affected versions of this package are vulnerable to SQL Injection due to using the str.replace method as a potential risk which, potentially enables the execution of arbitrary SQL code.

Remediation

Upgrade bandit to version 1.7.7 or higher.

References

medium severity

Infinite loop

  • Vulnerable module: zipp
  • Introduced through: bandit@1.0.1

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 bandit@1.0.1 stevedore@3.5.2 importlib-metadata@6.7.0 zipp@3.15.0
    Remediation: Upgrade to bandit@1.5.0.

Overview

Affected versions of this package are vulnerable to Infinite loop where an attacker can cause the application to stop responding by initiating a loop through functions affecting the Path module, such as joinpath, the overloaded division operator, and iterdir.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.

Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.

One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.

When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.

Two common types of DoS vulnerabilities:

  • High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.

  • Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm ws package

Remediation

Upgrade zipp to version 3.19.1 or higher.

References

medium severity

Sandbox Escape

  • Vulnerable module: jinja2
  • Introduced through: jinja2@2.9.6, sphinx@1.6.5 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 jinja2@2.9.6
    Remediation: Upgrade to jinja2@2.10.1.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinx@1.6.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinxcontrib-inheritance@0.9.0.

…and 1 more

Overview

Jinja2 is a template engine written in pure Python. It provides a Django inspired non-XML syntax but supports inline expressions and an optional sandboxed environment.

Affected versions of this package are vulnerable to Sandbox Escape via the str.format_map. This vulnerability requires the attacker to have information about sensitive attributes, and exploiting it could allow the attacker to access sensitive content.

Workaround

Override the is_safe_attribute method on the sandbox and explicitly disallow the format_map method on string objects.

Remediation

Upgrade Jinja2 to version 2.10.1 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: sphinx
  • Introduced through: sphinx@1.6.5, sphinxcontrib-blockdiag@1.5.5 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5
    Remediation: Upgrade to sphinx@3.0.4.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5
    Remediation: Upgrade to sphinxcontrib-inheritance@0.9.0.

Overview

Sphinx is a Python documentation generator.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS). Passing HTML from untrusted sources - even after sanitizing it - to one of jQuery's DOM manipulation methods (i.e. .html(), .append(), and others) may execute untrusted code.

Remediation

Upgrade Sphinx to version 3.0.4 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: sphinx
  • Introduced through: sphinx@1.6.5, sphinxcontrib-blockdiag@1.5.5 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5
    Remediation: Upgrade to sphinx@3.0.4.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5
    Remediation: Upgrade to sphinxcontrib-inheritance@0.9.0.

Overview

Sphinx is a Python documentation generator.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) Passing HTML containing <option> elements from untrusted sources - even after sanitizing it - to one of jQuery's DOM manipulation methods (i.e. .html(), .append(), and others) may execute untrusted code.

NOTE: This vulnerability was also assigned CVE-2020-23064.

Details

Remediation

Upgrade Sphinx to version 3.0.4 or higher.

References

medium severity

Improper Removal of Sensitive Information Before Storage or Transfer

  • Vulnerable module: urllib3
  • Introduced through: sphinx@1.6.5, sphinxcontrib-blockdiag@1.5.5 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5 requests@2.31.0 urllib3@2.0.7
    Remediation: Upgrade to sphinx@1.6.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5 requests@2.31.0 urllib3@2.0.7
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5 requests@2.31.0 urllib3@2.0.7
    Remediation: Upgrade to sphinxcontrib-inheritance@0.9.0.

Overview

urllib3 is a HTTP library with thread-safe connection pooling, file post, and more.

Affected versions of this package are vulnerable to Improper Removal of Sensitive Information Before Storage or Transfer due to the improper handling of the Proxy-Authorization header during cross-origin redirects when ProxyManager is not in use. When the conditions below are met, including non-recommended configurations, the contents of this header can be sent in an automatic HTTP redirect.

Notes:

To be vulnerable, the application must be doing all of the following:

  1. Setting the Proxy-Authorization header without using urllib3's built-in proxy support.

  2. Not disabling HTTP redirects (e.g. with redirects=False)

  3. Either not using an HTTPS origin server, or having a proxy or target origin that redirects to a malicious origin.

Workarounds

  1. Using the Proxy-Authorization header with urllib3's ProxyManager.

  2. Disabling HTTP redirects using redirects=False when sending requests.

  3. Not using the Proxy-Authorization header.

Remediation

Upgrade urllib3 to version 1.26.19, 2.2.2 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: setuptools
  • Introduced through: sphinx@1.6.5, mock@2.0.0 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5 setuptools@40.5.0
    Remediation: Upgrade to sphinx@1.6.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 mock@2.0.0 pbr@6.1.1 setuptools@40.5.0
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5 setuptools@40.5.0
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5 setuptools@40.5.0
    Remediation: Upgrade to sphinxcontrib-inheritance@0.9.0.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 blockdiag@3.0.0 setuptools@40.5.0
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 bandit@1.0.1 stevedore@3.5.2 pbr@6.1.1 setuptools@40.5.0

…and 3 more

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via crafted HTML package or custom PackageIndex page.

Note:

Only a small portion of the user base is impacted by this flaw. Setuptools maintainers pointed out that package_index is deprecated (not formally, but “in spirit”) and the vulnerability isn't reachable through standard, recommended workflows.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade setuptools to version 65.5.1 or higher.

References

medium severity

Always-Incorrect Control Flow Implementation

  • Vulnerable module: requests
  • Introduced through: sphinx@1.6.5, sphinxcontrib-blockdiag@1.5.5 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5 requests@2.31.0
    Remediation: Upgrade to sphinx@1.6.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5 requests@2.31.0
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5 requests@2.31.0
    Remediation: Upgrade to sphinxcontrib-inheritance@0.9.0.

Overview

Affected versions of this package are vulnerable to Always-Incorrect Control Flow Implementation when making requests through a Requests Session. An attacker can bypass certificate verification by making the first request with verify=False, causing all subsequent requests to ignore certificate verification regardless of changes to the verify value.

Notes:

  1. For requests <2.32.0, avoid setting verify=False for the first request to a host while using a Requests Session.

  2. For requests <2.32.0, call close() on Session objects to clear existing connections if verify=False is used.

  3. This vulnerability was initially fixed in version 2.32.0, which was yanked. Therefore, the next available fixed version is 2.32.2.

Remediation

Upgrade requests to version 2.32.2 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: jinja2
  • Introduced through: jinja2@2.9.6, sphinx@1.6.5 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 jinja2@2.9.6
    Remediation: Upgrade to jinja2@3.1.3.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinx@1.6.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinxcontrib-inheritance@0.9.0.

…and 1 more

Overview

Jinja2 is a template engine written in pure Python. It provides a Django inspired non-XML syntax but supports inline expressions and an optional sandboxed environment.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the xmlattr filter, when using keys containing spaces in an application accepts keys as user input. An attacker can inject arbitrary HTML attributes into the rendered HTML template, bypassing the auto-escaping mechanism, which may lead to the execution of untrusted scripts in the context of the user's browser session.

Note Accepting keys as user input is not common or a particularly intended use case of the xmlattr filter, and an application doing so should already be verifying what keys are provided regardless of this fix.

Details

A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.

This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.

Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.

Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.

Types of attacks

There are a few methods by which XSS can be manipulated:

Type Origin Description
Stored Server The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link.
Reflected Server The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser.
DOM-based Client The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data.
Mutated The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters.

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

This section describes the top best practices designed to specifically protect your code:

  • Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
  • Convert special characters such as ?, &, /, <, > and spaces to their respective HTML or URL encoded equivalents.
  • Give users the option to disable client-side scripts.
  • Redirect invalid requests.
  • Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
  • Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
  • Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.

Remediation

Upgrade Jinja2 to version 3.1.3 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: jinja2
  • Introduced through: jinja2@2.9.6, sphinx@1.6.5 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 jinja2@2.9.6
    Remediation: Upgrade to jinja2@3.1.4.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinx@1.6.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinxcontrib-inheritance@0.9.0.

…and 1 more

Overview

Jinja2 is a template engine written in pure Python. It provides a Django inspired non-XML syntax but supports inline expressions and an optional sandboxed environment.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) through the xmlattr filter. An attacker can manipulate the output of web pages by injecting additional attributes into elements, potentially leading to unauthorized actions or information disclosure.

Note: This vulnerability derives from an improper fix of CVE-2024-22195, which only addressed spaces but not other characters.

Details

A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.

This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.

Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.

Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.

Types of attacks

There are a few methods by which XSS can be manipulated:

Type Origin Description
Stored Server The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link.
Reflected Server The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser.
DOM-based Client The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data.
Mutated The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters.

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

This section describes the top best practices designed to specifically protect your code:

  • Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
  • Convert special characters such as ?, &, /, <, > and spaces to their respective HTML or URL encoded equivalents.
  • Give users the option to disable client-side scripts.
  • Redirect invalid requests.
  • Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
  • Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
  • Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.

Remediation

Upgrade Jinja2 to version 3.1.4 or higher.

References

medium severity

Improper Neutralization

  • Vulnerable module: jinja2
  • Introduced through: jinja2@2.9.6, sphinx@1.6.5 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 jinja2@2.9.6
    Remediation: Upgrade to jinja2@3.1.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinx@1.6.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinxcontrib-inheritance@0.9.0.

…and 1 more

Overview

Affected versions of this package are vulnerable to Improper Neutralization when importing a macro in a template whose filename is also a template. This will result in a SyntaxError: f-string: invalid syntax error message because the filename is not properly escaped, indicating that it is being treated as a format string.

Note: This is only exploitable when the attacker controls both the content and filename of a template and the application executes untrusted templates.

Remediation

Upgrade jinja2 to version 3.1.5 or higher.

References

medium severity

Template Injection

  • Vulnerable module: jinja2
  • Introduced through: jinja2@2.9.6, sphinx@1.6.5 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 jinja2@2.9.6
    Remediation: Upgrade to jinja2@3.1.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinx@1.6.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinxcontrib-inheritance@0.9.0.

…and 1 more

Overview

Affected versions of this package are vulnerable to Template Injection when an attacker controls the content of a template. This is due to an oversight in the sandboxed environment's method detection when using a stored reference to a malicious string's format method, which can then be executed through a filter.

Note: This is only exploitable through custom filters in an application.

Remediation

Upgrade jinja2 to version 3.1.5 or higher.

References

medium severity
new

Template Injection

  • Vulnerable module: jinja2
  • Introduced through: jinja2@2.9.6, sphinx@1.6.5 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 jinja2@2.9.6
    Remediation: Upgrade to jinja2@3.1.6.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinx@1.6.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinxcontrib-inheritance@0.9.0.

…and 1 more

Overview

Jinja2 is a template engine written in pure Python. It provides a Django inspired non-XML syntax but supports inline expressions and an optional sandboxed environment.

Affected versions of this package are vulnerable to Template Injection through the |attr filter. An attacker that controls the content of a template can escape the sandbox and execute arbitrary Python code by using the |attr filter to get a reference to a string's plain format method, bypassing the environment's attribute lookup.

Note:

This is only exploitable if the application executes untrusted templates.

Remediation

Upgrade Jinja2 to version 3.1.6 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: jinja2
  • Introduced through: jinja2@2.9.6, sphinx@1.6.5 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 jinja2@2.9.6
    Remediation: Upgrade to jinja2@2.11.3.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinx@1.6.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5 jinja2@2.9.6
    Remediation: Upgrade to sphinxcontrib-inheritance@0.9.0.

…and 1 more

Overview

Jinja2 is a template engine written in pure Python. It provides a Django inspired non-XML syntax but supports inline expressions and an optional sandboxed environment.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). 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 using Markdown to format user content instead of the urlize filter, or by implementing request timeouts or limiting process memory.

PoC by Yeting Li

from jinja2.utils import urlize
from time import perf_counter

for i in range(3):
    text = "abc@" + "." * (i+1)*5000 + "!"
    LEN = len(text)
    BEGIN = perf_counter()
    urlize(text)
    DURATION = perf_counter() - BEGIN
    print(f"{LEN}: took {DURATION} seconds!")

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade Jinja2 to version 2.11.3 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: sphinx
  • Introduced through: sphinx@1.6.5, sphinxcontrib-blockdiag@1.5.5 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5
    Remediation: Upgrade to sphinx@3.3.0.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5
    Remediation: Upgrade to sphinxcontrib-inheritance@0.9.0.

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to the usage of an insecure regular expression in the function load_v2 of inventory.py.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade sphinx to version 3.3.0 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: sphinx
  • Introduced through: sphinx@1.6.5, sphinxcontrib-blockdiag@1.5.5 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5
    Remediation: Upgrade to sphinx@3.3.0.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5
    Remediation: Upgrade to sphinxcontrib-blockdiag@1.5.5.
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5
    Remediation: Upgrade to sphinxcontrib-inheritance@0.9.0.

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in google style docs, due to using an inefficient regex pattern with quantified overlapping adjacency.

PoC

" " * 5000 + "!"

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade sphinx to version 3.3.0 or higher.

References

medium severity
new

MPL-2.0 license

  • Module: certifi
  • Introduced through: sphinx@1.6.5, sphinxcontrib-blockdiag@1.5.5 and others

Detailed paths

  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinx@1.6.5 requests@2.31.0 certifi@2025.1.31
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-blockdiag@1.5.5 sphinx@1.6.5 requests@2.31.0 certifi@2025.1.31
  • Introduced through: nachtfeuer/pipeline@nachtfeuer/pipeline#ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 sphinxcontrib-inheritance@0.9.0 sphinx@1.6.5 requests@2.31.0 certifi@2025.1.31

MPL-2.0 license