HIGHCVSS v4 7.1Vulnerability

CVE-2026-96642

### Summary `TarIO.__init__` does not check that a tar header's size field is positive. A crafted header with a negative size makes it seek backward onto itself. This causes an infinite loop that uses 100% CPU and never returns. ### Details `TarIO.__init__` reads 512-byte tar headers one at a time, looking for a member with a given name. For each header it reads the size field and skips ahead to the next header: ```python size = int(s[124:135], 8) ... self.fh.seek((size + 511) & (~511), io.SEEK_CUR) ``` There is no check that size is zero or more. A tar header can set this field to a negative octal value. For size = -512, the seek offset comes out to exactly -512, which cancels the 512 bytes the loop had just read. The file position goes right back to where this loop step started. The loop only stops on end of file or when a header name starts with a null byte. Neither happens, since the same header keeps showing up again. The loop never ends on its own. ### Steps to reproduce This uses Tests/images/hopper.tar, a normal file already in the Pillow test suite. It only changes the size field of the first header. ```python from PIL import TarIO with open("Tests/images/hopper.tar", "rb") as f: data = bytearray(f.read()) # Set the size field (bytes 124 to 135) to a negative octal value. # Octal 1000 is 512, so this is size = -512. data[124:135] = b" -00001000" with open("poisoned.tar", "wb") as f: f.write(data) # "does-not-exist" does not match the header name, so TarIO must # keep scanning. This call never returns. TarIO.TarIO("poisoned.tar", "does-not-exist") ``` We confirmed this with ps. The process sits at 98 to 100% CPU and never exits on its own. It only stops if killed from outside. A pytest version of this, using pytest-timeout so the test does not hang forever, is below. On the current code it fails with Failed: Timeout (>3.0s) from pytest-timeout. ```python from __future__ import annotations from pathlib import Path import pytest from P

Properties

Severity
high
Summary
Pillow: TarIO negative size field causes infinite CPU-spin loop
Nvd fetched at
2026-10-22T22:14:18.200859+00:00
Epss score
0.00333
Cvss severity
HIGH
Cvss score
7.1
Retrieved at
2026-10-22T22:17:36+00:00
Ghsa published
2026-10-22T16:01:46Z
Source url
https://github.com/advisories/GHSA-3j72-p6qg-6xp7
Ghsa updated
2026-10-22T16:01:48Z
Ghsa id
GHSA-3j72-p6qg-6xp7
Last source
FIRST EPSS
Score
7.1
Cvss version
4.0
Cve id
CVE-2026-96642
Cvss vector
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/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
First seen by Signal
2026-10-21T22:34:38+00:00
Is ghsa only
false
Vector
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/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
Published at
2026-10-21T21:20:32.650

Related Entities (3)

AFFECTS (1)

→[Software]pip/Pillow

VULNERABLE_TO (1)

←[Software]pip/Pillow

Explore deeper with Ninja Signal's threat intelligence graph

CVE-2026-96642 (CVSS v4 7.1) — Ninja Signal Threat Intelligence | Ninja Signal