MediumCVE-2026-96638

    Pillow: BMP RLE decoder memory-amplification DoS via unbounded delta escape / absolute mode (CVE-2026-96638)

    Published Last modified Sources: CVE.org, Hersteller

    What is affected, what to do

    Update pillow to version 13.0.0.

    Affected
    • Python-pillow Pillow gte 9.1.0, < 13.0.0..*

    Not sure whether and how you are affected? Ask a question about this vulnerability

    Metrics

    6.5

    Priority

    XIEM Effective CVSS: highest available CVSS rating from NVD and vendor data.

    Source: Vendor (CNA), CVSS v3

    6.5

    CVSS v3

    Severity Medium on the scale from 0 to 10.

    Source: CVE.org, Hersteller

    —

    EPSS score

    No value is available for this vulnerability.

    Show all metrics
    Severity
    Medium
    Priority (0–325)

    The priority score is a consolidated metric that condenses several individual signals into a single, action-guiding ranking: technical severity (CVSS), exploitation likelihood (EPSS), known-exploited status (KEV) and the context of the affected asset. The aim is to answer the only truly important question in vulnerability management: what first?

    Read in glossary
    62.50 Methodology
    Exploit maturity

    An exploit is code or a technique that specifically uses a concrete vulnerability to force unintended behaviour — such as executing code or escalating privileges. It is the tool that turns a theoretical flaw into a practical attack.

    Read in glossary
    no public PoC known
    XIEM Effective CVSS

    XIEM® is the tiered managed-security operating model from NEOSEC and a registered trademark of NEOSEC GmbH. It extends classic SIEM — the central collection, normalisation and correlation of security-relevant events — with endpoint forensics, network visibility and deception technology, and consolidates them into three building tiers: Sentry, Orchestrate and Command.

    Read in glossary
    6.5 Methodology
    CVSS v3

    CVSS is the globally established, open standard for assessing the technical severity of a vulnerability on a scale from 0 to 10. It describes how easily a flaw can be exploited and what damage it can cause — but not how likely its actual exploitation is. CVSS and the complementary EPSS deliberately answer different questions.

    Read in glossary
    6.5
    KEV status

    The KEV catalogue is a list maintained by the US authority CISA of vulnerabilities for which active exploitation in the wild has been confirmed. It answers not the question „how severe?“ but „is it already being attacked?“ — thereby sharply prioritising patching.

    Read in glossary
    —
    Published
    CWE

    CWE is a catalogue of typical weakness types in software and hardware — such as flawed input validation, unsafe memory handling or poor authentication. Where a CVE names a concrete vulnerability in a concrete product, a CWE describes the underlying class of defect.

    Read in glossary
    CWE-400, CWE-770

    Detection rules

    No NEOSEC detection rule is available for this vulnerability yet.

    Classification under NIS2 and CRA

    Rule-based classification from exploitation status and severity. It does not replace a case-by-case assessment.

    NIS2

    NIS2 is EU Directive (EU) 2022/2555 to raise the level of cybersecurity across the Union. It substantially broadens obligations compared with the first NIS directive: more sectors, mandatory risk management, staged reporting duties and personal accountability of senior management.

    Read in glossary
    Handle the vulnerability in regular vulnerability handling under Art. 21(2)(e) NIS2.
    CRA

    The CRA is EU Regulation (EU) 2024/2847 setting horizontal cybersecurity requirements for „products with digital elements“ — from industrial controllers and software to connected consumer devices. For the first time manufacturers must ensure security across the entire product lifecycle, handle vulnerabilities and provide security updates.

    Read in glossary
    From 11.12.2027, Annex I Part II CRA requires manufacturers of affected products with digital elements to handle vulnerabilities without delay and provide security updates.
    ISO/IEC 27001

    ISO/IEC 27001 is the internationally leading standard for an information security management system (ISMS). It describes a risk-based, process-oriented framework to systematically plan, implement, review and improve information security.

    Read in glossary
    Control A.8.8, management of technical vulnerabilities: assess relevance to your systems, plan remediation and keep evidence.

    Description

    Summary

    BmpRleDecoder can be forced to allocate gigabytes of memory from a kilobyte-sized crafted BMP file via unbounded growth in the delta escape and absolute mode branches.

    Affected versions

    All versions up to and including current HEAD (v13.0.0.dev0, commit e7a7ea84)

    Root cause

    BmpRleDecoder.decode() (BmpImagePlugin.py:327-395) builds a Python bytearray data with dest_length = xsize*ysize, looping while len(data) < dest_length. The loop condition is only checked at the TOP; individual branches append attacker-controlled amounts UNBOUNDED by dest_length:

    • delta escape (line 370): data += b"\x00" * (right + up * self.state.xsize) with right,up in 0..255 -> up to ~255*xsize bytes in ONE iteration.
    • absolute mode (line 385): data += bytes_read (up to 255).

    Because a single delta can push len(data) to ~256 * (row size), a tiny RLE stream combined with a large-but-legal xsize (xsize*ysize just under MAX_IMAGE_PIXELS, ~89M) yields a multi-GB data bytearray (then copied again by bytes(data) and set_as_raw). No heap OOB (bytearray/set_as_raw are bounds-safe), but a severe memory-amplification DoS: the attacker file stays tiny.

    Reproduction

    Python 3.13, Pillow HEAD e7a7ea84

    Attached: pillow_poc_bmp_rle_dos.py

    A 1084-byte BMP (BI_RLE8, width=3,000,000, height=1 -> 3M px, passes bomb check) with one delta escape (00 02 00 150) produces ~429 MB data; measured peak RSS 911 MB. Scaling width toward the bomb limit and up=255 produces tens of GB from a ~1 KB file.

    Suggested fix

    Cap growth at dest_length in the delta and absolute branches, e.g. clamp the delta fill to (dest_length - len(data)) and stop appending once len(data) >= dest_length; reject deltas that would move the cursor beyond the image, matching the existing per-row clamp at line 341-343.

    Credit: Yazan Balawneh - CyStack Security Team (GitHub: sonicnew)

    pillow_poc_bmp_rle_dos.py

    Source: NVD (NIST), cvelistv5, GitHub Security Advisories

    Affected products

    The following versions are affected. Older releases of the same product line are also vulnerable unless stated otherwise.

    Affected products
    VendorProductAffected versionsFixed in
    python-pillowPillow
    • ≥ 9.1.0, < 13.0.0
    • —
    pippillow
    • >= 9.1.0, < 13.0.0
    • 13.0.0

    Weakness classes (CWE)

    • CWE-400Uncontrolled Resource Consumption

      Class

      The product does not properly control the allocation and maintenance of a limited resource.

      Entry at MITRE CWE-400
    • CWE-770Allocation of Resources Without Limits or Throttling

      Base

      The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.

      Entry at MITRE CWE-770

    References & sources

    • github.compython-pillow/Pillow/security/advisories/GHSA-24rc-8hj2-v98cx_refsource_CONFIRM
    • github.compython-pillow/Pillow/pull/10015x_refsource_MISC
    • github.compython-pillow/Pillow/commit/e7794835e323ff2691d9b3a974cade1a443…x_refsource_MISC
    • github.compython-pillow/Pillow/releases/tag/13.0.0x_refsource_MISC

    Reanalysis & status changes

    Chronological NVD audit events for this CVE — reanalyses, CVSS updates, CPE diffs.

    1. New CVE Receivedsecurity-advisories@github.com

      • Description: after Pillow is a Python imaging library. From 9.1.0 until 13.0.0, BmpRleDecoder.decode() in src/PIL/BmpImagePlugin.py permits crafted RLE BMP delta escapes and absolute-mode runs to append beyond the remaining dest_length without a per-branch cap. A delta can add roughly 255 image rows in one iteration, so a kilobyte-sized file with a large but permitted width can expand the data bytearray to hundreds of megabytes or more, causing memory-exhaustion denial of service. This issue is fixed in version 13.0.0.
      • CVSS V3.1: after AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H
      • CWE: after CWE-400
      • CWE: after CWE-770
    Embed badge

    Show the severity and KEV status of this vulnerability on your site – with a link back here. The image is updated hourly.

    Badge preview for CVE-2026-96638
    <a href="https://intel.neosec.eu/en/cve/CVE-2026-96638"><img src="https://intel.neosec.eu/badge/cve/CVE-2026-96638.svg?lang=en" alt="CVE-2026-96638 – NEOSEC Intel" height="20"></a>