Search

Find a vulnerability

Search criteria

    Related vulnerabilities

    BREW-AIDER-CVE-2026-112405 (GHSA-CP9V-662Q-VVX9)

    Vulnerability from osv_homebrew – Published: 2026-10-22 09:13 – Updated: 2026-10-29 21:58 – Source website
    VLAI
    Summary
    Pillow: NULL pointer dereference in Image.merge via an unvalidated band 0
    Details

    Summary

    Image.merge() checks the mode of every input band except band 0. If band 0 is a single-band I or F image, the native merge routine reads a pixel pointer that is NULL for those modes and the process crashes. The IPTC plugin reaches this from a plain Image.open() followed by a load, and IPTC has no magic-byte prefilter, so a crafted file with no recognizable header can drive it.

    Details

    The validation loop skips band 0:

    • src/PIL/Image.py:3795 iterates for band in bands[1:] and checks mode and size only for those.

    For an I or F image the 8-bit plane image8 is NULL (only image32 is set). ImagingMerge dereferences bands[0]->image8[y] for the multi-band output modes:

    • src/libImaging/Bands.c:302, :311, :321

    The IPTC loader builds the band list from an attacker-typed sub-image and passes it to merge with the sub-image at index 0:

    • src/PIL/IptcImagePlugin.py:156-160
    • src/PIL/IptcImagePlugin.py:169 registers the opener with no accept function.

    PoC

    from PIL import Image
    
    # Band 0 is a single-band "I" image: its image8 plane is NULL. merge() validates only
    # bands[1:], so the native ImagingMerge dereferences the NULL plane for band 0.
    band0 = Image.new("I", (4, 4))
    Image.merge("RGB", [band0, Image.new("L", (4, 4)), Image.new("L", (4, 4))])
    

    Run it:

    $ python 02_poc.py
    Segmentation fault (core dumped)
    

    Observed on a source build of commit 3e2ab96.

    Under AddressSanitizer:

    ==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000
        #0 ImagingMerge   src/libImaging/Bands.c:311
        #1 _merge         src/_imaging.c:2492
    SUMMARY: AddressSanitizer: SEGV src/libImaging/Bands.c:311 in ImagingMerge
    

    The null address confirms the dereference of the missing image8 plane for band 0.

    Impact

    NULL pointer dereference in a C extension. A crafted file opened and loaded through the IPTC path crashes the worker process. This is a hard crash, not a Python exception an application can catch.


    {
      "affected": [
        {
          "ecosystem_specific": {
            "fix": null,
            "range_state": "affected",
            "resource": "pillow",
            "resource_purl": "pkg:pypi/pillow@12.1.1",
            "upstream_fixed_in": "13.0.0"
          },
          "package": {
            "ecosystem": "Homebrew",
            "name": "aider",
            "purl": "pkg:brew/aider"
          },
          "ranges": [
            {
              "events": [
                {
                  "introduced": "0.86.2"
                }
              ],
              "type": "ECOSYSTEM"
            }
          ]
        }
      ],
      "database_specific": {
        "confidence": "high",
        "source": "matched",
        "strategy": "registry",
        "upstream_evidence": [
          {
            "ecosystem": "PyPI",
            "key": "pkg:pypi/pillow@12.1.1",
            "name": "pillow",
            "resource": "pillow",
            "strategy": "registry",
            "subject_version": "12.1.1"
          }
        ]
      },
      "details": "### Summary\n`Image.merge()` checks the mode of every input band except band 0. If band 0 is a single-band `I` or `F` image, the native merge routine reads a pixel pointer that is NULL for those modes and the process crashes. The IPTC plugin reaches this from a plain `Image.open()` followed by a load, and IPTC has no magic-byte prefilter, so a crafted file with no recognizable header can drive it.\n\n### Details\nThe validation loop skips band 0:\n\n- `src/PIL/Image.py:3795` iterates `for band in bands[1:]` and checks mode and size only for those.\n\nFor an `I` or `F` image the 8-bit plane `image8` is NULL (only `image32` is set). `ImagingMerge` dereferences `bands[0]-\u003eimage8[y]` for the multi-band output modes:\n\n- `src/libImaging/Bands.c:302`, `:311`, `:321`\n\nThe IPTC loader builds the band list from an attacker-typed sub-image and passes it to merge with the sub-image at index 0:\n\n- `src/PIL/IptcImagePlugin.py:156-160`\n- `src/PIL/IptcImagePlugin.py:169` registers the opener with no accept function.\n\n### PoC\n```python\nfrom PIL import Image\n\n# Band 0 is a single-band \"I\" image: its image8 plane is NULL. merge() validates only\n# bands[1:], so the native ImagingMerge dereferences the NULL plane for band 0.\nband0 = Image.new(\"I\", (4, 4))\nImage.merge(\"RGB\", [band0, Image.new(\"L\", (4, 4)), Image.new(\"L\", (4, 4))])\n```\n\nRun it:\n```\n$ python 02_poc.py\nSegmentation fault (core dumped)\n```\n\nObserved on a source build of commit `3e2ab96`.\n\nUnder AddressSanitizer:\n```\n==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000\n    #0 ImagingMerge   src/libImaging/Bands.c:311\n    #1 _merge         src/_imaging.c:2492\nSUMMARY: AddressSanitizer: SEGV src/libImaging/Bands.c:311 in ImagingMerge\n```\nThe null address confirms the dereference of the missing `image8` plane for band 0.\n\n### Impact\nNULL pointer dereference in a C extension. A crafted file opened and loaded through the IPTC path crashes the worker process. This is a hard crash, not a Python exception an application can catch.",
      "id": "BREW-aider-CVE-2026-112405",
      "modified": "2026-10-29T21:58:11Z",
      "published": "2026-10-22T09:13:55Z",
      "references": [
        {
          "type": "WEB",
          "url": "https://github.com/python-pillow/Pillow/security/advisories/GHSA-cp9v-662q-vvx9"
        },
        {
          "type": "ADVISORY",
          "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-112405"
        },
        {
          "type": "WEB",
          "url": "https://github.com/python-pillow/Pillow/commit/b6ee66e8b2c2c0932bdf65f963268d9f2927ef86"
        },
        {
          "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.7.3",
      "severity": [
        {
          "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N",
          "type": "CVSS_V4"
        }
      ],
      "summary": "Pillow: NULL pointer dereference in Image.merge via an unvalidated band 0",
      "upstream": [
        "GHSA-cp9v-662q-vvx9",
        "CVE-2026-112405",
        "BIT-pillow-2026-112405",
        "PYSEC-2026-4333"
      ]
    }

    CVE-2026-112405 (GCVE-0-2026-112405)

    Vulnerability from cvelistv5 – Published: 2026-10-19 21:29 – Updated: 2026-10-20 15:56
    VLAI
    Title
    Pillow: NULL pointer dereference in Image.merge via an unvalidated band 0
    Summary
    Pillow is a Python imaging library. From 12.0.0 until 13.0.0, Pillow's Image.merge() can dereference a null image8 plane. Validation skips the first input band, allowing a 32-bit integer or floating-point image backed by image32 storage to be merged as a narrower multiband image. A crafted IPTC file can reach this path when an application opens and loads it, or a caller can invoke Image.merge() directly with such a first band. This causes a native process crash. This issue is fixed in version 13.0.0.
    SSVC
    Exploitation: poc Automatable: yes Technical Impact: partial
    CISA Coordinator · CISA-ADP (v2.0.3)
    Decision recorded 2026-10-20 15:56 UTC
    CWE
    • CWE-476 - NULL Pointer Dereference
    Assigner
    GitHub_M CNA
    Impacted products
    Vendor Product Version
    python-pillow Pillow Affected: >= 12.0.0, < 13.0.0
    Create a notification for this product.
    Show details on NVD website

    {
      "containers": {
        "adp": [
          {
            "metrics": [
              {
                "other": {
                  "content": {
                    "id": "CVE-2026-112405",
                    "options": [
                      {
                        "Exploitation": "poc"
                      },
                      {
                        "Automatable": "yes"
                      },
                      {
                        "Technical Impact": "partial"
                      }
                    ],
                    "role": "CISA Coordinator",
                    "timestamp": "2026-10-20T15:56:00.942567Z",
                    "version": "2.0.3"
                  },
                  "type": "ssvc"
                }
              }
            ],
            "providerMetadata": {
              "dateUpdated": "2026-10-20T15:56:29.299Z",
              "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
              "shortName": "CISA-ADP"
            },
            "title": "CISA ADP Vulnrichment"
          }
        ],
        "cna": {
          "affected": [
            {
              "product": "Pillow",
              "vendor": "python-pillow",
              "versions": [
                {
                  "status": "affected",
                  "version": "\u003e= 12.0.0, \u003c 13.0.0"
                }
              ]
            }
          ],
          "descriptions": [
            {
              "lang": "en",
              "value": "Pillow is a Python imaging library. From 12.0.0 until 13.0.0, Pillow\u0027s Image.merge() can dereference a null image8 plane. Validation skips the first input band, allowing a 32-bit integer or floating-point image backed by image32 storage to be merged as a narrower multiband image. A crafted IPTC file can reach this path when an application opens and loads it, or a caller can invoke Image.merge() directly with such a first band. This causes a native process crash. This issue is fixed in version 13.0.0."
            }
          ],
          "metrics": [
            {
              "cvssV4_0": {
                "attackComplexity": "LOW",
                "attackRequirements": "NONE",
                "attackVector": "NETWORK",
                "baseScore": 8.7,
                "baseSeverity": "HIGH",
                "privilegesRequired": "NONE",
                "subAvailabilityImpact": "NONE",
                "subConfidentialityImpact": "NONE",
                "subIntegrityImpact": "NONE",
                "userInteraction": "NONE",
                "vectorString": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N",
                "version": "4.0",
                "vulnAvailabilityImpact": "HIGH",
                "vulnConfidentialityImpact": "NONE",
                "vulnIntegrityImpact": "NONE"
              }
            }
          ],
          "problemTypes": [
            {
              "descriptions": [
                {
                  "cweId": "CWE-476",
                  "description": "CWE-476: NULL Pointer Dereference",
                  "lang": "en",
                  "type": "CWE"
                }
              ]
            }
          ],
          "providerMetadata": {
            "dateUpdated": "2026-10-19T21:29:53.515Z",
            "orgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
            "shortName": "GitHub_M"
          },
          "references": [
            {
              "name": "https://github.com/python-pillow/Pillow/security/advisories/GHSA-cp9v-662q-vvx9",
              "tags": [
                "x_refsource_CONFIRM"
              ],
              "url": "https://github.com/python-pillow/Pillow/security/advisories/GHSA-cp9v-662q-vvx9"
            },
            {
              "name": "https://github.com/python-pillow/Pillow/commit/b6ee66e8b2c2c0932bdf65f963268d9f2927ef86",
              "tags": [
                "x_refsource_MISC"
              ],
              "url": "https://github.com/python-pillow/Pillow/commit/b6ee66e8b2c2c0932bdf65f963268d9f2927ef86"
            },
            {
              "name": "https://github.com/python-pillow/Pillow/releases/tag/13.0.0",
              "tags": [
                "x_refsource_MISC"
              ],
              "url": "https://github.com/python-pillow/Pillow/releases/tag/13.0.0"
            }
          ],
          "source": {
            "advisory": "GHSA-cp9v-662q-vvx9",
            "discovery": "UNKNOWN"
          },
          "title": "Pillow: NULL pointer dereference in Image.merge via an unvalidated band 0"
        }
      },
      "cveMetadata": {
        "assignerOrgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
        "assignerShortName": "GitHub_M",
        "cveId": "CVE-2026-112405",
        "datePublished": "2026-10-19T21:29:53.515Z",
        "dateReserved": "2026-10-19T16:58:51.960Z",
        "dateUpdated": "2026-10-20T15:56:29.299Z",
        "state": "PUBLISHED"
      },
      "dataType": "CVE_RECORD",
      "dataVersion": "5.2"
    }