{"vuln_id":"CVE-2026-112902","aliases":["GHSA-xvh5-g6gv-559v"],"description":"Pillow: Memory disclosure and segfault in libtiff encoder via crafted TIFF tags","published_at":"2026-10-21T21:29:16Z","modified_at":"2026-11-17T13:41:13.808355Z","first_seen_at":"2026-11-21T19:15:56.685567Z","severity":"critical","severity_source":"cvss","cvss_score":9.1,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","cwe":["CWE-686"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.00638,"epss_percentile":0.51526,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-112902"},"matched_alias":null,"items":[{"id":10794,"source":{"id":"osv","name":"OSV.dev"},"title":"PYSEC-2026-4363: Pillow is a Python imaging library. In versions through 12.3.0, the libtiff TIFF encoder can pass arguments to  TIFFSetField()  that do not match libtiff’s def…","summary":"Pillow is a Python imaging library. In versions through 12.3.0, the libtiff TIFF encoder can pass arguments to  TIFFSetField()  that do not match libtiff’s definition of the corresponding tag. When an application saves attacker-controlled image metadata through this encoder, crafted tag values can cause invalid memory reads, copying process memory into the encoded output or crashing the process. Applications that return the encoded output to an attacker can disclose that memory. The issue is reachable when re-saving compressed TIFF images and through certain conversions that preserve EXIF metadata into compressed TIFF output. This vulnerability is fixed in version 13.0.0.\n\nAffected: PyPI:pillow\n\nFixed in: 13.0.0\n\nReferences:\nhttps://github.com/python-pillow/Pillow/releases/tag/13.0.0\nhttps://github.com/python-pillow/Pillow/commit/570df030c0d30c2bf5336b2ab59f3902d8ab0b6d\nhttps://github.com/python-pillow/Pillow/pull/10227\nhttps://github.com/python-pillow/Pillow/security/advisories/GHSA-xvh5-g6gv-559v","url":"https://osv.dev/vulnerability/PYSEC-2026-4363","published_at":"2026-11-05T21:18:36.713000Z","updated_at":"2026-11-17T13:41:13.808355Z","fetched_at":"2026-11-21T19:15:55.946180Z","severity":"critical","cvss_score":9.1,"epss":0.00638,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"pillow","vuln_id":"CVE-2026-112902","vuln_ids":["CVE-2026-112902","BIT-PILLOW-2026-112902","GHSA-XVH5-G6GV-559V","PYSEC-2026-4363"],"tags":["osv","pypi","fix-available"],"cluster_id":10652,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10794","html":"https://vulnwatch.ve1ve2.com/item/10794"}},{"id":10793,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-xvh5-g6gv-559v: Pillow: Memory disclosure and segfault in libtiff encoder via crafted TIFF tags","summary":"Pillow: Memory disclosure and segfault in libtiff encoder via crafted TIFF tags\n\n```\n============================================================================\nMemory disclosure and segfault in libtiff encoder via crafted TIFF tags\nLocation: src/encode.c:1014  in PyImaging_LibTiffEncoderNew()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nA crafted TIFF file of a few hundred bytes makes Pillow copy an attacker-chosen amount of its own process memory into the TIFF it writes back out, or crash the process outright. The trigger is an ordinary `Image.open()` followed by a bare `im.save(fp, \"TIFF\")`. The only precondition is that the application re-saves images as TIFF. When the uploaded file is compressed, Pillow routes that save through libtiff automatically, with no options from the application. The attached reproducer does this with a 356-byte LZW TIFF: one crafted tag comes back holding 65536 bytes taken from `_imaging.so`'s read-only data, and a second crafted tag makes the worker die with SIGSEGV on every run.\n\nThe bug is in `PyImaging_LibTiffEncoderNew` (`src/encode.c`). It decides what arguments to pass to the variadic `TIFFSetField()` from the shape of the Python value (scalar, tuple or bytes). It assumes its `ImagingLibTiffMergeFieldInfo()` call defined how libtiff will read them. But `TIFFMergeFieldInfo()` never overrides libtiff's built-in field table, so libtiff reads the arguments according to its own definition of the tag:\n\n- For a counted array tag such as DNGPrivateData (50740), a count-1 integer in the source file is taken as the byte count. The data pointer is then read from an argument slot Pillow never wrote, and that many bytes are copied into the output.\n- For a fixed-size array tag such as ActiveArea (50829), the integer itself is used as the source address.\n\nWhere that unwritten slot points depends on the compiler. In the tested clang build it points into `_imaging.so`, and a larger count returned thousands of pointers into libpython, libc and libtiff, which defeats address-space randomisation for anyone chaining another bug. When the application preserves metadata with `tiffinfo=im.tag_v2`, a 64-bit entry turns ActiveArea into a 16-byte read from an address the attacker chooses. All observed memory errors are reads; no out-of-bounds write was found.\n\nOther branches of the same loop share the defect and are reachable from crafted TIFFs or from EXIF in JPEG/PNG/WebP re-saved as compressed TIFF. These are the `bytes`, RATIONAL-tuple and typed-tuple branches, and a BYTE-typed ColorMap. The file-reachable forwarding was introduced in `a3d45e9cefd0` (\"Added custom int and float TIFF tags\") and first released in 5.4.0.\n\n## Details\n\n`PyImaging_LibTiffEncoderNew` (`src/encode.c:777-1060`) chooses the argument\nlist it hands to the variadic `TIFFSetField()` from the *Python* value of each\ntag — scalar vs. tuple vs. `bytes`, and a type that is either autodetected or\ncopied from the source file's IFD — and assumes that its own\n`Im\n\nAffected: PyPI:pillow\n\nFixed in: 13.0.0\n\nReferences:\nhttps://github.com/python-pillow/Pillow/security/advisories/GHSA-xvh5-g6gv-559v\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-112902\nhttps://github.com/github/advisory-database/pull/10903\nhttps://github.com/python-pillow/Pillow/pull/10227\nhttps://github.com/python-pillow/Pillow/commit/570df030c0d30c2bf5336b2ab59f3902d8ab0b6d\nhttps://github.com/python-pillow/Pillow/commit/af56ace297b0991d02988fcc2ea933e4824b4fb3\nhttps://github.com/python-pillow/Pillow\nhttps://github.com/python-pillow/Pillow/releases/tag/13.0.0","url":"https://osv.dev/vulnerability/GHSA-xvh5-g6gv-559v","published_at":"2026-10-21T21:29:16Z","updated_at":"2026-11-17T13:41:13.808355Z","fetched_at":"2026-11-21T19:15:55.946179Z","severity":"critical","cvss_score":9.1,"epss":0.00638,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"pillow","vuln_id":"CVE-2026-112902","vuln_ids":["CVE-2026-112902","BIT-PILLOW-2026-112902","GHSA-XVH5-G6GV-559V","PYSEC-2026-4363"],"tags":["osv","pypi","fix-available"],"cluster_id":10651,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10793","html":"https://vulnwatch.ve1ve2.com/item/10793"}}]}