diff --git a/README.md b/README.md index 759adaf..f722e0b 100644 --- a/README.md +++ b/README.md @@ -230,7 +230,12 @@ files, so that they agree with the decoder they stand in front of. A weekly job fetches the security advisories for the decoders this library stands in front of and opens an issue for each new one; [docs/advisories/README.md](docs/advisories/README.md) says how we triage -them. +them. What each one meant for this library, and the test that proves any +refusal it claims, is committed as data in +[docs/advisories/record/](docs/advisories/record/), one file per advisory, +and merged into [record.json](docs/advisories/record.json) for anything +that wants to read it. The [security watch on +tetrak.dev](https://tetrak.dev/security/) is built from that file. See [CONTRIBUTING.md](CONTRIBUTING.md) for the checks and the commit style, and [SECURITY.md](SECURITY.md) for how to report a flaw privately. diff --git a/docs/advisories/README.md b/docs/advisories/README.md index 8f46aa3..a8c5185 100644 --- a/docs/advisories/README.md +++ b/docs/advisories/README.md @@ -49,9 +49,13 @@ python scripts/advisories.py record # fold everything published so far into s ## Where the state lives -**The issues are the record.** Every issue the job opens starts with a -hidden marker naming the advisory's identifiers, and the next run reads -those markers back. Nothing is committed by the workflow: that keeps it +Two things are kept, for two questions. *Has this advisory been seen?* is +answered by the issues and `seen.json`, below. *What did we decide about +it, and can we prove it?* is answered by the record, in the section after. + +**The issues are the record of what has been seen.** Every issue the job +opens starts with a hidden marker naming the advisory's identifiers, and +the next run reads those markers back. Nothing is committed by the workflow: that keeps it to `contents: read` and `issues: write`, and spares `main` a bot commit a week, which its ruleset would refuse in any case. @@ -65,6 +69,55 @@ python scripts/advisories.py record git commit -m "chore(advisories): refresh the baseline" docs/advisories/seen.json ``` +## The record + +[`record/`](record/) holds one JSON file per advisory that has been +triaged, named after its key (`CVE-2026-112403.json`). It is the committed +answer to this page's question, as data that other things can read: the +advisory's own facts (library, versions, when, how severe), how the +triggering input reaches the flaw (`reached_by`: by opening a file, on a +save path, through some other call, through a tool), the bucket and the +finding in a sentence, what this library does about it (`refusal`: which +check, whether the default policy refuses it or only a setting does), the +tests that prove the refusal (`verified_by`), and how anyone could protect +themselves with or without this library (`protect.general`, +`protect.specific`). + +The rule that keeps it honest: **a record in bucket A, B or B2 claims a +refusal, and a claimed refusal names at least one test that builds the +triggering file and checks it is refused.** `tests/test_record.py` fails +if the test does not exist, if a record claims a refusal with no test, or +if a bucket that claims no refusal names one. A record in bucket N or C +has `refusal: null` and no tests; it is kept so that nobody expects the +check to prevent what it cannot. Where the default policy does not refuse +the file but a setting would, `refusal.default` is `false` and +`refusal.setting` says which. + +[`record.json`](record.json) is the merged file, newest first, with +counts; it is what the documentation's coverage page and the security +watch on [tetrak.dev](https://tetrak.dev/security/) read. It is +**generated, never edited**: + +```bash +python scripts/advisory_record.py validate # every file against the schema +python scripts/advisory_record.py export # rewrite record.json +python scripts/advisory_record.py export --check # what the tests run: fails if stale +``` + +To add a record: copy the nearest existing file, fill it in from the +advisory and the issue's triage, name the test (or write it first, as a B +finding requires), run `export`, and commit both. Dates are +`YYYY-MM-DD`; `triaged` is when the bucket was decided and `checked` when +the record was last read against the advisory. `published`, `severity` +and `fixed` may be `null` when the upstream record does not say; `notes` +says so when a record was written without the upstream text to hand. + +The first records (1 November 2026) are the advisories the policy table +in the README already cited, each with the test that was written for it; +the 138 advisories of the backfill are in `seen.json` but not yet in the +record, since their buckets were decided before the record existed. +Folding them in is open work. + ## The buckets Each issue ends in one bucket, with a line saying why. The bucket is the diff --git a/docs/advisories/record.json b/docs/advisories/record.json new file mode 100644 index 0000000..b90f749 --- /dev/null +++ b/docs/advisories/record.json @@ -0,0 +1,851 @@ +{ + "generated": "2026-11-01", + "buckets": { + "A": "Already refused by an existing check", + "B": "Preventable from a header field our readers can see", + "B2": "Preventable only by a coarse policy on a PDF's contents", + "C": "Needs decoding to detect; out of this library's reach by design", + "D": "Reaches pdfinfo itself", + "N": "Not reached by opening a file", + "U": "A reserved CVE with no text yet" + }, + "reached_by": { + "open": "by opening or reading a file", + "save": "on a save or encode path", + "api": "through a call beyond opening, such as a filter or transform", + "tool": "through a command-line tool, not the library", + "other": "some other way; the finding says" + }, + "counts": { + "records": 22, + "refused_by_default": 15, + "by_bucket": { + "A": 5, + "B": 15, + "B2": 0, + "C": 0, + "D": 0, + "N": 2, + "U": 0 + }, + "by_library": { + "Pillow": 14, + "libpng": 5, + "libtiff": 3 + } + }, + "records": [ + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112398", + "aliases": [ + "GHSA-5x8w-8jj5-q52h" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A FlashPix file runs code when opened, if olefile is installed", + "summary": "Heap buffer overflow in FlashPix (FPX) JPEG-tile decoding leads to code execution.", + "published": "2026-10-23", + "severity": 9.2, + "affected": "<= 12.3.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "A single crafted FlashPix file, recognised by its OLE2 bytes, opened with Image.open() on an installation with the optional olefile package.", + "bucket": "A", + "finding": "OLE (which carries FlashPix and old Office files) is refused by name from the first bytes.", + "refusal": { + "check": "formats", + "default": true, + "setting": "OLE is refused whatever the policy says" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_renamed_ole_file" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0. Do not install olefile where it is not needed.", + "specific": "formats=[...] on Image.open, or sillybos in front of it." + }, + "sources": [ + "https://github.com/advisories/GHSA-5x8w-8jj5-q52h" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": "Bounded, not closed: the limit turns an unbounded cost into a bounded one.", + "key": "CVE-2026-96643", + "aliases": [ + "GHSA-g4qv-2jxx-769h" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A PNG's EXIF chunk makes parsing take quadratic time", + "summary": "A PNG eXIf chunk full of repeated six-byte markers makes Exif.load() copy the buffer once per marker.", + "published": "2026-10-22", + "severity": 7.1, + "affected": ">= 11.0.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening a PNG and reading its EXIF (getexif()) when the eXIf chunk is large and filled with repeated markers. The advisory says a photo-sized file is enough.", + "bucket": "B", + "finding": "The size of every PNG chunk other than image data is read before decoding and held to max_metadata_bytes (4 MiB by default, 1 MiB strict). That bounds the cost; it does not remove it, since a chunk under the limit still costs seconds.", + "refusal": { + "check": "max_metadata_bytes", + "default": true, + "setting": "lower max_metadata_bytes for files from outside" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_png_with_an_enormous_exif_chunk", + "tests/test_check.py::TestHostileFiles::test_strict_allows_less_metadata" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0.", + "specific": "Cap metadata blocks well below what a scan carries (kilobytes): sillybos --max-metadata-bytes." + }, + "sources": [ + "https://github.com/advisories/GHSA-g4qv-2jxx-769h" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-96639", + "aliases": [ + "GHSA-v9pv-5gc8-w2m6" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A multi-frame file that changes colour mode writes into a buffer sized for the first frame", + "summary": "Multi-frame loaders can reuse stale native image storage after a mode transition, giving out-of-bounds writes; command execution was demonstrated through the MPO path.", + "published": "2026-10-22", + "severity": 9.8, + "affected": ">= 11.0.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Iterating the frames of a crafted multi-picture JPEG (MPO), TIFF or Photoshop file whose later frame is a wider colour mode than the first.", + "bucket": "B", + "finding": "Every frame of a TIFF and every picture of a multi-picture JPEG is read and required to match the first in colour mode, samples and bit depth; a file that changes is refused. Photoshop files are refused by format.", + "refusal": { + "check": "headers", + "default": true, + "setting": "no setting: a frame that differs from the first is always a refusal" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_tiff_that_changes_mode_between_frames", + "tests/test_check.py::TestHostileFiles::test_a_multi_picture_jpeg_that_changes_mode" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0.", + "specific": "Require every frame of a multi-frame file to share the first frame's mode and size before decoding; sillybos does." + }, + "sources": [ + "https://github.com/advisories/GHSA-v9pv-5gc8-w2m6" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-96637", + "aliases": [ + "GHSA-g842-9rc4-69pw" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A SPIDER stack file bypasses the pixel limit on seek", + "summary": "SpiderImagePlugin's seek() re-parses the header without the decompression-bomb check, so a file under 1 KB can trigger a multi-gigabyte allocation.", + "published": "2026-10-22", + "severity": 7.1, + "affected": "< 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening a crafted SPIDER file and loading a later frame.", + "bucket": "A", + "finding": "SPIDER is not a format the check knows, so the file is refused as an unknown format before any reader runs.", + "refusal": { + "check": "formats", + "default": true, + "setting": "unknown formats are refused whatever the policy says" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_an_unknown_format" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0.", + "specific": "Allow-list the formats you mean to read; everything else, including this one, never reaches a reader." + }, + "sources": [ + "https://github.com/advisories/GHSA-g842-9rc4-69pw" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-96636", + "aliases": [ + "GHSA-p8hx-v2p6-rp84" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A later frame of an MPO or DCX file is never checked against the pixel limit", + "summary": "The decompression-bomb check runs only on the first frame; MpoImageFile.seek() and DcxImageFile.seek() do not repeat it.", + "published": "2026-10-22", + "severity": 6.5, + "affected": "< 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Seeking to a later frame of a multi-picture JPEG, or a DCX file, whose first frame is tiny and whose later frame declares enormous dimensions.", + "bucket": "B", + "finding": "Every picture of a multi-picture JPEG is read from the index and each held to max_pixels. DCX is not a known format and is refused as unknown.", + "refusal": { + "check": "max_pixels", + "default": true, + "setting": "applied to every picture, not the first" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_multi_picture_jpeg_whose_second_picture_is_a_bomb", + "tests/test_check.py::TestHostileFiles::test_an_unknown_format" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0.", + "specific": "Apply the pixel limit to every frame, not the first; sillybos does." + }, + "sources": [ + "https://github.com/advisories/GHSA-p8hx-v2p6-rp84" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112901", + "aliases": [ + "GHSA-xgh8-jp6q-p5x8", + "PYSEC-2026-4335" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A 512-byte XBM file stalls Image.open() for minutes", + "summary": "A regular expression in XbmImagePlugin takes about six minutes of CPU on a crafted 512-byte file before Image.open() gives up.", + "published": "2026-10-21", + "severity": 6.9, + "affected": "<= 12.3.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening a crafted file that looks enough like an XBM for Pillow to try its XBM reader.", + "bucket": "A", + "finding": "XBM is not a format the check knows, so the file is refused as an unknown format; with formats=[...] set, Pillow never tries the XBM reader either.", + "refusal": { + "check": "formats", + "default": true, + "setting": "unknown formats are refused whatever the policy says" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_an_unknown_format" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0.", + "specific": "Allow-list the formats you mean to read." + }, + "sources": [ + "https://github.com/advisories/GHSA-xgh8-jp6q-p5x8" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112900", + "aliases": [ + "GHSA-w889-685w-c8fh" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "An EPS file's name is passed to Ghostscript as an option", + "summary": "Argument injection in the Ghostscript call, potentially leading to remote code execution.", + "published": "2026-10-21", + "severity": 9.2, + "affected": ">= 2.6.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening an EPS (PostScript) file, recognised by content whatever its name, when Ghostscript is installed; the file's own name is read as a Ghostscript option.", + "bucket": "A", + "finding": "PostScript is not one of the four formats and is refused by name from the first bytes, so no PostScript file reaches Pillow's EPS reader through the check.", + "refusal": { + "check": "formats", + "default": true, + "setting": "PostScript is refused whatever the policy says" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_renamed_postscript_file" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0. Do not install Ghostscript on a machine that opens files from outside unless it is needed.", + "specific": "Image.open(path, formats=[\"JPEG\", \"PNG\", \"TIFF\"]) keeps the EPS reader from ever running; sillybos refuses the file before that." + }, + "sources": [ + "https://github.com/advisories/GHSA-w889-685w-c8fh" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112399", + "aliases": [ + "GHSA-5xm2-6676-qcp9" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "An animated PNG allocates its full canvas before the pixel limit is checked", + "summary": "APNG background disposal allocates the full canvas before the decompression-bomb check; a 126-byte file claiming 22,000 x 22,000 pixels costs about 1.9 GB.", + "published": "2026-10-21", + "severity": 8.7, + "affected": ">= 8.1.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening a small animated PNG whose IHDR claims enormous dimensions.", + "bucket": "B", + "finding": "Width and height are read from the IHDR, and the frame count from acTL, before any decoder runs; the product is held to max_pixels and the count to max_pages.", + "refusal": { + "check": "max_pixels", + "default": true, + "setting": "from the header, before Pillow allocates" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_pixel_bomb" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0.", + "specific": "Read the declared size from the header and refuse before the decoder allocates; sillybos does." + }, + "sources": [ + "https://github.com/advisories/GHSA-5xm2-6676-qcp9" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112393", + "aliases": [ + "GHSA-332p-7hrc-92wf" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "Saving a TIFF to memory overruns a heap buffer", + "summary": "Heap buffer overflow in _tiffWriteProc when saving TIFF to BytesIO.", + "published": "2026-10-21", + "severity": 9.2, + "affected": ">= 2.0.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "save", + "trigger": "Saving any image as TIFF to an in-memory destination (io.BytesIO) rather than a file; the data written past the buffer is attacker-chosen when the image came from outside.", + "bucket": "N", + "finding": "A save-path flaw. Nothing read from the incoming file's header decides it, so a check before decoding cannot reach it.", + "refusal": null, + "verified_by": [], + "protect": { + "general": "Upgrade to Pillow 13.0.0. Until then, save TIFFs to a file on disk, not to memory.", + "specific": "Not something a pre-decode check can prevent; listed so that nobody expects it to." + }, + "sources": [ + "https://github.com/advisories/GHSA-332p-7hrc-92wf" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112391", + "aliases": [ + "GHSA-254f-3936-288h" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "Pillow's PDF parser recurses without limit when appending", + "summary": "PdfParser can recurse without limit in get_value() and linearize_page_tree().", + "published": "2026-10-21", + "severity": 6.3, + "affected": ">= 5.1.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "save", + "trigger": "Image.save(..., format=\"PDF\", append=True) onto an attacker-controlled existing PDF.", + "bucket": "N", + "finding": "Reached only through Pillow's PDF append path, which Image.open never runs.", + "refusal": null, + "verified_by": [], + "protect": { + "general": "Upgrade to Pillow 13.0.0. Do not append to PDFs you did not make.", + "specific": "Not a pre-decode matter." + }, + "sources": [ + "https://github.com/advisories/GHSA-254f-3936-288h" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112390", + "aliases": [ + "GHSA-22hg-r758-rrw9" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A MIC file makes counting its frames loop for ever", + "summary": "Infinite loop in MIC n_frames when the embedded TIFF has three or more directories; needs the optional olefile package.", + "published": "2026-10-21", + "severity": 8.2, + "affected": ">= 7.2.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening a crafted MIC (Microsoft Image Composer) file, an OLE container, and reading n_frames.", + "bucket": "A", + "finding": "OLE is refused by name from the first bytes.", + "refusal": { + "check": "formats", + "default": true, + "setting": "OLE is refused whatever the policy says" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_renamed_ole_file" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0. Do not install olefile where it is not needed.", + "specific": "formats=[...] on Image.open, or sillybos in front of it." + }, + "sources": [ + "https://github.com/advisories/GHSA-22hg-r758-rrw9" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112404", + "aliases": [ + "GHSA-c6hw-5grf-ff96" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A malformed compressed TIFF leaks heap memory into its pixels", + "summary": "Out-of-bounds read in TiffDecode.c tile and RGBA paths copies heap memory into the returned image.", + "published": "2026-10-20", + "severity": 8.8, + "affected": ">= 8.1.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening and loading a malformed compressed TIFF; the returned pixels carry fragments of the process's memory, which a service that returns thumbnails hands back.", + "bucket": "B", + "finding": "The tiled path is refused under the strict preset; the RGBA path is not something the header distinguishes, so this is only partly within reach.", + "refusal": { + "check": "allow_tiled_tiff", + "default": false, + "setting": "STRICT, or Policy(allow_tiled_tiff=False); the RGBA path is not covered" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_tiled_tiff_passes_by_default_and_not_under_strict" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0. Never return pixels decoded from an untrusted file without re-encoding them first.", + "specific": "Refuse tiled TIFFs where scans are striped; keep the decoder current for the rest." + }, + "sources": [ + "https://github.com/advisories/GHSA-c6hw-5grf-ff96" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112403", + "aliases": [ + "GHSA-8g5g-8vmr-9782" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A lossless JPEG overruns the decode buffer when scaled", + "summary": "Heap buffer overflow in ImagingJpegDecode: a lossless (SOF3) frame ignores the requested scaling and writes full-width rows into a buffer sized for the scaled width.", + "published": "2026-10-20", + "severity": 9.2, + "affected": "<= 12.3.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "A standards-compliant lossless JPEG, opened and then drafted or thumbnailed (Image.thumbnail() does this on its own). The advisory notes that formats=[\"JPEG\"] does not prevent it.", + "bucket": "B", + "finding": "The frame coding is read from the JPEG's frame header. The default policy allows baseline, extended and progressive frames only; a lossless frame is refused with the coding named.", + "refusal": { + "check": "jpeg_frames", + "default": true, + "setting": "jpeg_frames excludes lossless by default" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_lossless_jpeg" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0. Call load() before thumbnail(), or pass reducing_gap=None, until then.", + "specific": "Refuse frame codings a scanner never writes: lossless, hierarchical, arithmetic. sillybos does this by default." + }, + "sources": [ + "https://github.com/advisories/GHSA-8g5g-8vmr-9782" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112395", + "aliases": [ + "GHSA-462x-pgg6-55fp" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A tiled TIFF makes the decoder read past its tile buffer", + "summary": "The tiled-TIFF decoder reads past the tile buffer in copy4 when libtiff returns a tile smaller than the worst case.", + "published": "2026-10-20", + "severity": 6.5, + "affected": ">= 8.2.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening and loading a malformed tiled TIFF.", + "bucket": "B", + "finding": "Whether a TIFF is tiled is in its directory. The default policy allows tiles (digitisation and mapping software write them) and holds each tile to max_pixels; the strict preset refuses tiled TIFFs outright.", + "refusal": { + "check": "allow_tiled_tiff", + "default": false, + "setting": "STRICT, or Policy(allow_tiled_tiff=False)" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_tiled_tiff_passes_by_default_and_not_under_strict", + "tests/test_check.py::TestHostileFiles::test_a_tile_bigger_than_the_pixel_limit" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0.", + "specific": "If your scans are striped, not tiled, refuse tiled TIFFs: sillybos --no-tiled-tiff, or the strict preset." + }, + "sources": [ + "https://github.com/advisories/GHSA-462x-pgg6-55fp" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-12912", + "aliases": [ + "GHSA-cg4c-j43f-qcg7" + ], + "library": "libtiff", + "package": "tiff", + "ecosystem": "Debian", + "title": "A PixarLog-compressed TIFF overflows a libtiff heap buffer", + "summary": "Decoding a PixarLog image with the 8-bit ABGR output format and a specific stride leads to a heap-based buffer overflow.", + "published": "2026-06-29", + "severity": 7.3, + "affected": "libtiff, as packaged; see the upstream record", + "fixed": null, + "reached_by": "open", + "trigger": "Opening a TIFF compressed with PixarLog.", + "bucket": "B", + "finding": "The compression scheme is a directory tag. The default policy allows none, CCITT, LZW, JPEG, Deflate and PackBits; PixarLog and the other codecs a scan never uses are refused by name.", + "refusal": { + "check": "tiff_compressions", + "default": true, + "setting": "tiff_compressions excludes PixarLog by default" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_pixarlog_tiff" + ], + "protect": { + "general": "Keep libtiff current.", + "specific": "Allow only the compression schemes your files use; sillybos --tiff-compressions." + }, + "sources": [ + "https://github.com/advisories/GHSA-cg4c-j43f-qcg7" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": "Cited from the policy's own notes (policy.py), written from the advisory at the time; the OSV record was unreachable when this entry was made and its fields should be filled in.", + "key": "CVE-2026-33636", + "aliases": [ + "GHSA-wjr5-c57x-95m2" + ], + "library": "libpng", + "package": "libpng1.6", + "ecosystem": "Debian", + "title": "A palette PNG reaches a flaw in libpng's palette handling", + "summary": "One of three libpng flaws in the paths that handle palette (indexed-colour) PNGs. The upstream record was not re-fetched when this entry was written; see notes.", + "published": "2026-03-26", + "severity": 7.6, + "affected": ">= 1.6.36, <= 1.6.55", + "fixed": "1.6.56", + "reached_by": "open", + "trigger": "Opening a palette-type PNG.", + "bucket": "B", + "finding": "The colour type is in the PNG's IHDR. The default allows all five colour types; a policy for scans alone can keep to greyscale and RGB, which keeps palette PNGs from the decoder.", + "refusal": { + "check": "png_colour_types", + "default": false, + "setting": "Policy(png_colour_types={\"greyscale\", \"rgb\"})" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_palette_png_under_a_scans_only_policy" + ], + "protect": { + "general": "Keep libpng current.", + "specific": "If nothing you handle is a palette PNG, say so in the policy: sillybos --png-colour-types greyscale,rgb." + }, + "sources": [ + "https://github.com/advisories/GHSA-wjr5-c57x-95m2", + "https://osv.dev/vulnerability/CVE-2026-33636" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-4775", + "aliases": [ + "GHSA-cm99-m826-vgg7" + ], + "library": "libtiff", + "package": "tiff", + "ecosystem": "Debian", + "title": "A YCbCr TIFF subsampled four to one overflows a libtiff buffer", + "summary": "Signed integer overflow in putcontig8bitYCbCr44tile leads to an out-of-bounds heap write.", + "published": "2026-03-24", + "severity": 7.8, + "affected": "libtiff, as packaged; see the upstream record", + "fixed": null, + "reached_by": "open", + "trigger": "Opening a YCbCr TIFF whose chroma subsampling is 4x4, through the RGBA reading path.", + "bucket": "B", + "finding": "A YCbCr TIFF's subsampling is a directory tag. The default policy allows 1x1, 2x1, 1x2 and 2x2, which is what scanners and cameras write; 4x4 and the other factor-of-four values are refused.", + "refusal": { + "check": "tiff_subsamplings", + "default": true, + "setting": "tiff_subsamplings excludes factor-of-four by default" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_ycbcr_tiff_subsampled_four_by_four" + ], + "protect": { + "general": "Keep libtiff current.", + "specific": "Allow only the subsamplings your files use; sillybos --tiff-subsamplings." + }, + "sources": [ + "https://github.com/advisories/GHSA-cm99-m826-vgg7" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": "Cited from the policy's own notes (policy.py); the OSV record was unreachable when this entry was made and its fields should be filled in.", + "key": "CVE-2026-22695", + "aliases": [ + "GHSA-mmq5-27w3-rxpp" + ], + "library": "libpng", + "package": "libpng1.6", + "ecosystem": "Debian", + "title": "An interlaced 16-bit PNG overflows a libpng buffer", + "summary": "One of two libpng overflows on the Adam7-interlaced 16-bit path. The upstream record was not re-fetched when this entry was written; see notes.", + "published": "2026-01-12", + "severity": 6.1, + "affected": ">= 1.6.51, <= 1.6.53", + "fixed": "1.6.54", + "reached_by": "open", + "trigger": "Opening an Adam7-interlaced PNG with 16-bit samples.", + "bucket": "B", + "finding": "Interlacing is in the IHDR. No scanner writes an interlaced PNG, so the default refuses one.", + "refusal": { + "check": "allow_interlaced_png", + "default": true, + "setting": "allow_interlaced_png is off by default" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_an_interlaced_png" + ], + "protect": { + "general": "Keep libpng current.", + "specific": "Refuse interlaced PNGs; nothing that scans a page writes one. sillybos does by default." + }, + "sources": [ + "https://github.com/advisories/GHSA-mmq5-27w3-rxpp", + "https://osv.dev/vulnerability/CVE-2026-22695" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": "Cited from the policy's own notes (policy.py), written from the advisory at the time; the OSV record was unreachable when this entry was made and its fields should be filled in.", + "key": "CVE-2025-66293", + "aliases": [ + "GHSA-9mpm-9pxh-mg4f" + ], + "library": "libpng", + "package": "libpng1.6", + "ecosystem": "Debian", + "title": "A palette PNG reaches a flaw in libpng's palette handling", + "summary": "One of three libpng flaws in the paths that handle palette (indexed-colour) PNGs. The upstream record was not re-fetched when this entry was written; see notes.", + "published": "2025-12-03", + "severity": 7.1, + "affected": "< 1.6.52", + "fixed": "1.6.52", + "reached_by": "open", + "trigger": "Opening a palette-type PNG.", + "bucket": "B", + "finding": "The colour type is in the PNG's IHDR. The default allows all five colour types; a policy for scans alone can keep to greyscale and RGB, which keeps palette PNGs from the decoder.", + "refusal": { + "check": "png_colour_types", + "default": false, + "setting": "Policy(png_colour_types={\"greyscale\", \"rgb\"})" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_palette_png_under_a_scans_only_policy" + ], + "protect": { + "general": "Keep libpng current.", + "specific": "If nothing you handle is a palette PNG, say so in the policy: sillybos --png-colour-types greyscale,rgb." + }, + "sources": [ + "https://github.com/advisories/GHSA-9mpm-9pxh-mg4f", + "https://osv.dev/vulnerability/CVE-2025-66293" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": "Cited from the policy's own notes (policy.py); the OSV record was unreachable when this entry was made and its fields should be filled in.", + "key": "CVE-2025-65018", + "aliases": [ + "GHSA-7wv6-48j4-hj3g" + ], + "library": "libpng", + "package": "libpng1.6", + "ecosystem": "Debian", + "title": "An interlaced 16-bit PNG overflows a libpng buffer", + "summary": "One of two libpng overflows on the Adam7-interlaced 16-bit path. The upstream record was not re-fetched when this entry was written; see notes.", + "published": "2025-11-24", + "severity": 7.1, + "affected": ">= 1.6.0, < 1.6.51", + "fixed": "1.6.51", + "reached_by": "open", + "trigger": "Opening an Adam7-interlaced PNG with 16-bit samples.", + "bucket": "B", + "finding": "Interlacing is in the IHDR. No scanner writes an interlaced PNG, so the default refuses one.", + "refusal": { + "check": "allow_interlaced_png", + "default": true, + "setting": "allow_interlaced_png is off by default" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_an_interlaced_png" + ], + "protect": { + "general": "Keep libpng current.", + "specific": "Refuse interlaced PNGs; nothing that scans a page writes one. sillybos does by default." + }, + "sources": [ + "https://github.com/advisories/GHSA-7wv6-48j4-hj3g", + "https://osv.dev/vulnerability/CVE-2025-65018" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": "Cited from the policy's own notes (policy.py), written from the advisory at the time; the OSV record was unreachable when this entry was made and its fields should be filled in.", + "key": "CVE-2025-64720", + "aliases": [ + "GHSA-hfc7-ph9c-wcww" + ], + "library": "libpng", + "package": "libpng1.6", + "ecosystem": "Debian", + "title": "A palette PNG reaches a flaw in libpng's palette handling", + "summary": "One of three libpng flaws in the paths that handle palette (indexed-colour) PNGs. The upstream record was not re-fetched when this entry was written; see notes.", + "published": "2025-11-24", + "severity": 7.1, + "affected": ">= 1.6.0, < 1.6.51", + "fixed": "1.6.51", + "reached_by": "open", + "trigger": "Opening a palette-type PNG.", + "bucket": "B", + "finding": "The colour type is in the PNG's IHDR. The default allows all five colour types; a policy for scans alone can keep to greyscale and RGB, which keeps palette PNGs from the decoder.", + "refusal": { + "check": "png_colour_types", + "default": false, + "setting": "Policy(png_colour_types={\"greyscale\", \"rgb\"})" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_palette_png_under_a_scans_only_policy" + ], + "protect": { + "general": "Keep libpng current.", + "specific": "If nothing you handle is a palette PNG, say so in the policy: sillybos --png-colour-types greyscale,rgb." + }, + "sources": [ + "https://github.com/advisories/GHSA-hfc7-ph9c-wcww", + "https://osv.dev/vulnerability/CVE-2025-64720" + ] + }, + { + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2023-6277", + "aliases": [ + "GHSA-fq8g-55cp-756j" + ], + "library": "libtiff", + "package": "tiff", + "ecosystem": "Debian", + "title": "A TIFF tag that points past the file makes libtiff allocate for nothing", + "summary": "An out-of-memory flaw in libtiff: a crafted file passed to TIFFOpen() makes it allocate from a tag's declared size.", + "published": "2023-11-24", + "severity": 7.5, + "affected": "libtiff before 4.6.0 (as packaged)", + "fixed": null, + "reached_by": "open", + "trigger": "Opening a TIFF whose directory declares a tag with a count that puts its data beyond the end of the file.", + "bucket": "B", + "finding": "Every tag's out-of-line data is checked to lie inside the file before anything decodes, and the largest block is held to max_metadata_bytes.", + "refusal": { + "check": "max_metadata_bytes", + "default": true, + "setting": "and the tag-inside-the-file check, which has no setting" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_tiff_tag_over_the_limit" + ], + "protect": { + "general": "Keep libtiff current; it is the TIFF reader under Pillow, poppler and most of the rest.", + "specific": "Check tag offsets and sizes against the file size before opening; sillybos does." + }, + "sources": [ + "https://github.com/advisories/GHSA-fq8g-55cp-756j" + ] + } + ] +} diff --git a/docs/advisories/record/CVE-2023-6277.json b/docs/advisories/record/CVE-2023-6277.json new file mode 100644 index 0000000..eeb2379 --- /dev/null +++ b/docs/advisories/record/CVE-2023-6277.json @@ -0,0 +1,37 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2023-6277", + "aliases": [ + "GHSA-fq8g-55cp-756j" + ], + "library": "libtiff", + "package": "tiff", + "ecosystem": "Debian", + "title": "A TIFF tag that points past the file makes libtiff allocate for nothing", + "summary": "An out-of-memory flaw in libtiff: a crafted file passed to TIFFOpen() makes it allocate from a tag's declared size.", + "published": "2023-11-24", + "severity": 7.5, + "affected": "libtiff before 4.6.0 (as packaged)", + "fixed": null, + "reached_by": "open", + "trigger": "Opening a TIFF whose directory declares a tag with a count that puts its data beyond the end of the file.", + "bucket": "B", + "finding": "Every tag's out-of-line data is checked to lie inside the file before anything decodes, and the largest block is held to max_metadata_bytes.", + "refusal": { + "check": "max_metadata_bytes", + "default": true, + "setting": "and the tag-inside-the-file check, which has no setting" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_tiff_tag_over_the_limit" + ], + "protect": { + "general": "Keep libtiff current; it is the TIFF reader under Pillow, poppler and most of the rest.", + "specific": "Check tag offsets and sizes against the file size before opening; sillybos does." + }, + "sources": [ + "https://github.com/advisories/GHSA-fq8g-55cp-756j" + ] +} diff --git a/docs/advisories/record/CVE-2025-64720.json b/docs/advisories/record/CVE-2025-64720.json new file mode 100644 index 0000000..125e51a --- /dev/null +++ b/docs/advisories/record/CVE-2025-64720.json @@ -0,0 +1,38 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": "Cited from the policy's own notes (policy.py), written from the advisory at the time; the OSV record was unreachable when this entry was made and its fields should be filled in.", + "key": "CVE-2025-64720", + "aliases": [ + "GHSA-hfc7-ph9c-wcww" + ], + "library": "libpng", + "package": "libpng1.6", + "ecosystem": "Debian", + "title": "A palette PNG reaches a flaw in libpng's palette handling", + "summary": "One of three libpng flaws in the paths that handle palette (indexed-colour) PNGs. The upstream record was not re-fetched when this entry was written; see notes.", + "published": "2025-11-24", + "severity": 7.1, + "affected": ">= 1.6.0, < 1.6.51", + "fixed": "1.6.51", + "reached_by": "open", + "trigger": "Opening a palette-type PNG.", + "bucket": "B", + "finding": "The colour type is in the PNG's IHDR. The default allows all five colour types; a policy for scans alone can keep to greyscale and RGB, which keeps palette PNGs from the decoder.", + "refusal": { + "check": "png_colour_types", + "default": false, + "setting": "Policy(png_colour_types={\"greyscale\", \"rgb\"})" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_palette_png_under_a_scans_only_policy" + ], + "protect": { + "general": "Keep libpng current.", + "specific": "If nothing you handle is a palette PNG, say so in the policy: sillybos --png-colour-types greyscale,rgb." + }, + "sources": [ + "https://github.com/advisories/GHSA-hfc7-ph9c-wcww", + "https://osv.dev/vulnerability/CVE-2025-64720" + ] +} diff --git a/docs/advisories/record/CVE-2025-65018.json b/docs/advisories/record/CVE-2025-65018.json new file mode 100644 index 0000000..3a0f503 --- /dev/null +++ b/docs/advisories/record/CVE-2025-65018.json @@ -0,0 +1,38 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": "Cited from the policy's own notes (policy.py); the OSV record was unreachable when this entry was made and its fields should be filled in.", + "key": "CVE-2025-65018", + "aliases": [ + "GHSA-7wv6-48j4-hj3g" + ], + "library": "libpng", + "package": "libpng1.6", + "ecosystem": "Debian", + "title": "An interlaced 16-bit PNG overflows a libpng buffer", + "summary": "One of two libpng overflows on the Adam7-interlaced 16-bit path. The upstream record was not re-fetched when this entry was written; see notes.", + "published": "2025-11-24", + "severity": 7.1, + "affected": ">= 1.6.0, < 1.6.51", + "fixed": "1.6.51", + "reached_by": "open", + "trigger": "Opening an Adam7-interlaced PNG with 16-bit samples.", + "bucket": "B", + "finding": "Interlacing is in the IHDR. No scanner writes an interlaced PNG, so the default refuses one.", + "refusal": { + "check": "allow_interlaced_png", + "default": true, + "setting": "allow_interlaced_png is off by default" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_an_interlaced_png" + ], + "protect": { + "general": "Keep libpng current.", + "specific": "Refuse interlaced PNGs; nothing that scans a page writes one. sillybos does by default." + }, + "sources": [ + "https://github.com/advisories/GHSA-7wv6-48j4-hj3g", + "https://osv.dev/vulnerability/CVE-2025-65018" + ] +} diff --git a/docs/advisories/record/CVE-2025-66293.json b/docs/advisories/record/CVE-2025-66293.json new file mode 100644 index 0000000..d24225f --- /dev/null +++ b/docs/advisories/record/CVE-2025-66293.json @@ -0,0 +1,38 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": "Cited from the policy's own notes (policy.py), written from the advisory at the time; the OSV record was unreachable when this entry was made and its fields should be filled in.", + "key": "CVE-2025-66293", + "aliases": [ + "GHSA-9mpm-9pxh-mg4f" + ], + "library": "libpng", + "package": "libpng1.6", + "ecosystem": "Debian", + "title": "A palette PNG reaches a flaw in libpng's palette handling", + "summary": "One of three libpng flaws in the paths that handle palette (indexed-colour) PNGs. The upstream record was not re-fetched when this entry was written; see notes.", + "published": "2025-12-03", + "severity": 7.1, + "affected": "< 1.6.52", + "fixed": "1.6.52", + "reached_by": "open", + "trigger": "Opening a palette-type PNG.", + "bucket": "B", + "finding": "The colour type is in the PNG's IHDR. The default allows all five colour types; a policy for scans alone can keep to greyscale and RGB, which keeps palette PNGs from the decoder.", + "refusal": { + "check": "png_colour_types", + "default": false, + "setting": "Policy(png_colour_types={\"greyscale\", \"rgb\"})" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_palette_png_under_a_scans_only_policy" + ], + "protect": { + "general": "Keep libpng current.", + "specific": "If nothing you handle is a palette PNG, say so in the policy: sillybos --png-colour-types greyscale,rgb." + }, + "sources": [ + "https://github.com/advisories/GHSA-9mpm-9pxh-mg4f", + "https://osv.dev/vulnerability/CVE-2025-66293" + ] +} diff --git a/docs/advisories/record/CVE-2026-112390.json b/docs/advisories/record/CVE-2026-112390.json new file mode 100644 index 0000000..03d48ac --- /dev/null +++ b/docs/advisories/record/CVE-2026-112390.json @@ -0,0 +1,37 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112390", + "aliases": [ + "GHSA-22hg-r758-rrw9" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A MIC file makes counting its frames loop for ever", + "summary": "Infinite loop in MIC n_frames when the embedded TIFF has three or more directories; needs the optional olefile package.", + "published": "2026-10-21", + "severity": 8.2, + "affected": ">= 7.2.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening a crafted MIC (Microsoft Image Composer) file, an OLE container, and reading n_frames.", + "bucket": "A", + "finding": "OLE is refused by name from the first bytes.", + "refusal": { + "check": "formats", + "default": true, + "setting": "OLE is refused whatever the policy says" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_renamed_ole_file" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0. Do not install olefile where it is not needed.", + "specific": "formats=[...] on Image.open, or sillybos in front of it." + }, + "sources": [ + "https://github.com/advisories/GHSA-22hg-r758-rrw9" + ] +} diff --git a/docs/advisories/record/CVE-2026-112391.json b/docs/advisories/record/CVE-2026-112391.json new file mode 100644 index 0000000..3449adb --- /dev/null +++ b/docs/advisories/record/CVE-2026-112391.json @@ -0,0 +1,31 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112391", + "aliases": [ + "GHSA-254f-3936-288h" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "Pillow's PDF parser recurses without limit when appending", + "summary": "PdfParser can recurse without limit in get_value() and linearize_page_tree().", + "published": "2026-10-21", + "severity": 6.3, + "affected": ">= 5.1.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "save", + "trigger": "Image.save(..., format=\"PDF\", append=True) onto an attacker-controlled existing PDF.", + "bucket": "N", + "finding": "Reached only through Pillow's PDF append path, which Image.open never runs.", + "refusal": null, + "verified_by": [], + "protect": { + "general": "Upgrade to Pillow 13.0.0. Do not append to PDFs you did not make.", + "specific": "Not a pre-decode matter." + }, + "sources": [ + "https://github.com/advisories/GHSA-254f-3936-288h" + ] +} diff --git a/docs/advisories/record/CVE-2026-112393.json b/docs/advisories/record/CVE-2026-112393.json new file mode 100644 index 0000000..0873562 --- /dev/null +++ b/docs/advisories/record/CVE-2026-112393.json @@ -0,0 +1,31 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112393", + "aliases": [ + "GHSA-332p-7hrc-92wf" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "Saving a TIFF to memory overruns a heap buffer", + "summary": "Heap buffer overflow in _tiffWriteProc when saving TIFF to BytesIO.", + "published": "2026-10-21", + "severity": 9.2, + "affected": ">= 2.0.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "save", + "trigger": "Saving any image as TIFF to an in-memory destination (io.BytesIO) rather than a file; the data written past the buffer is attacker-chosen when the image came from outside.", + "bucket": "N", + "finding": "A save-path flaw. Nothing read from the incoming file's header decides it, so a check before decoding cannot reach it.", + "refusal": null, + "verified_by": [], + "protect": { + "general": "Upgrade to Pillow 13.0.0. Until then, save TIFFs to a file on disk, not to memory.", + "specific": "Not something a pre-decode check can prevent; listed so that nobody expects it to." + }, + "sources": [ + "https://github.com/advisories/GHSA-332p-7hrc-92wf" + ] +} diff --git a/docs/advisories/record/CVE-2026-112395.json b/docs/advisories/record/CVE-2026-112395.json new file mode 100644 index 0000000..b913332 --- /dev/null +++ b/docs/advisories/record/CVE-2026-112395.json @@ -0,0 +1,38 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112395", + "aliases": [ + "GHSA-462x-pgg6-55fp" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A tiled TIFF makes the decoder read past its tile buffer", + "summary": "The tiled-TIFF decoder reads past the tile buffer in copy4 when libtiff returns a tile smaller than the worst case.", + "published": "2026-10-20", + "severity": 6.5, + "affected": ">= 8.2.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening and loading a malformed tiled TIFF.", + "bucket": "B", + "finding": "Whether a TIFF is tiled is in its directory. The default policy allows tiles (digitisation and mapping software write them) and holds each tile to max_pixels; the strict preset refuses tiled TIFFs outright.", + "refusal": { + "check": "allow_tiled_tiff", + "default": false, + "setting": "STRICT, or Policy(allow_tiled_tiff=False)" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_tiled_tiff_passes_by_default_and_not_under_strict", + "tests/test_check.py::TestHostileFiles::test_a_tile_bigger_than_the_pixel_limit" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0.", + "specific": "If your scans are striped, not tiled, refuse tiled TIFFs: sillybos --no-tiled-tiff, or the strict preset." + }, + "sources": [ + "https://github.com/advisories/GHSA-462x-pgg6-55fp" + ] +} diff --git a/docs/advisories/record/CVE-2026-112398.json b/docs/advisories/record/CVE-2026-112398.json new file mode 100644 index 0000000..ba16f6d --- /dev/null +++ b/docs/advisories/record/CVE-2026-112398.json @@ -0,0 +1,37 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112398", + "aliases": [ + "GHSA-5x8w-8jj5-q52h" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A FlashPix file runs code when opened, if olefile is installed", + "summary": "Heap buffer overflow in FlashPix (FPX) JPEG-tile decoding leads to code execution.", + "published": "2026-10-23", + "severity": 9.2, + "affected": "<= 12.3.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "A single crafted FlashPix file, recognised by its OLE2 bytes, opened with Image.open() on an installation with the optional olefile package.", + "bucket": "A", + "finding": "OLE (which carries FlashPix and old Office files) is refused by name from the first bytes.", + "refusal": { + "check": "formats", + "default": true, + "setting": "OLE is refused whatever the policy says" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_renamed_ole_file" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0. Do not install olefile where it is not needed.", + "specific": "formats=[...] on Image.open, or sillybos in front of it." + }, + "sources": [ + "https://github.com/advisories/GHSA-5x8w-8jj5-q52h" + ] +} diff --git a/docs/advisories/record/CVE-2026-112399.json b/docs/advisories/record/CVE-2026-112399.json new file mode 100644 index 0000000..77e9a8e --- /dev/null +++ b/docs/advisories/record/CVE-2026-112399.json @@ -0,0 +1,37 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112399", + "aliases": [ + "GHSA-5xm2-6676-qcp9" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "An animated PNG allocates its full canvas before the pixel limit is checked", + "summary": "APNG background disposal allocates the full canvas before the decompression-bomb check; a 126-byte file claiming 22,000 x 22,000 pixels costs about 1.9 GB.", + "published": "2026-10-21", + "severity": 8.7, + "affected": ">= 8.1.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening a small animated PNG whose IHDR claims enormous dimensions.", + "bucket": "B", + "finding": "Width and height are read from the IHDR, and the frame count from acTL, before any decoder runs; the product is held to max_pixels and the count to max_pages.", + "refusal": { + "check": "max_pixels", + "default": true, + "setting": "from the header, before Pillow allocates" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_pixel_bomb" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0.", + "specific": "Read the declared size from the header and refuse before the decoder allocates; sillybos does." + }, + "sources": [ + "https://github.com/advisories/GHSA-5xm2-6676-qcp9" + ] +} diff --git a/docs/advisories/record/CVE-2026-112403.json b/docs/advisories/record/CVE-2026-112403.json new file mode 100644 index 0000000..e81fbe4 --- /dev/null +++ b/docs/advisories/record/CVE-2026-112403.json @@ -0,0 +1,37 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112403", + "aliases": [ + "GHSA-8g5g-8vmr-9782" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A lossless JPEG overruns the decode buffer when scaled", + "summary": "Heap buffer overflow in ImagingJpegDecode: a lossless (SOF3) frame ignores the requested scaling and writes full-width rows into a buffer sized for the scaled width.", + "published": "2026-10-20", + "severity": 9.2, + "affected": "<= 12.3.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "A standards-compliant lossless JPEG, opened and then drafted or thumbnailed (Image.thumbnail() does this on its own). The advisory notes that formats=[\"JPEG\"] does not prevent it.", + "bucket": "B", + "finding": "The frame coding is read from the JPEG's frame header. The default policy allows baseline, extended and progressive frames only; a lossless frame is refused with the coding named.", + "refusal": { + "check": "jpeg_frames", + "default": true, + "setting": "jpeg_frames excludes lossless by default" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_lossless_jpeg" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0. Call load() before thumbnail(), or pass reducing_gap=None, until then.", + "specific": "Refuse frame codings a scanner never writes: lossless, hierarchical, arithmetic. sillybos does this by default." + }, + "sources": [ + "https://github.com/advisories/GHSA-8g5g-8vmr-9782" + ] +} diff --git a/docs/advisories/record/CVE-2026-112404.json b/docs/advisories/record/CVE-2026-112404.json new file mode 100644 index 0000000..5dfd1b5 --- /dev/null +++ b/docs/advisories/record/CVE-2026-112404.json @@ -0,0 +1,37 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112404", + "aliases": [ + "GHSA-c6hw-5grf-ff96" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A malformed compressed TIFF leaks heap memory into its pixels", + "summary": "Out-of-bounds read in TiffDecode.c tile and RGBA paths copies heap memory into the returned image.", + "published": "2026-10-20", + "severity": 8.8, + "affected": ">= 8.1.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening and loading a malformed compressed TIFF; the returned pixels carry fragments of the process's memory, which a service that returns thumbnails hands back.", + "bucket": "B", + "finding": "The tiled path is refused under the strict preset; the RGBA path is not something the header distinguishes, so this is only partly within reach.", + "refusal": { + "check": "allow_tiled_tiff", + "default": false, + "setting": "STRICT, or Policy(allow_tiled_tiff=False); the RGBA path is not covered" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_tiled_tiff_passes_by_default_and_not_under_strict" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0. Never return pixels decoded from an untrusted file without re-encoding them first.", + "specific": "Refuse tiled TIFFs where scans are striped; keep the decoder current for the rest." + }, + "sources": [ + "https://github.com/advisories/GHSA-c6hw-5grf-ff96" + ] +} diff --git a/docs/advisories/record/CVE-2026-112900.json b/docs/advisories/record/CVE-2026-112900.json new file mode 100644 index 0000000..81939fc --- /dev/null +++ b/docs/advisories/record/CVE-2026-112900.json @@ -0,0 +1,37 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112900", + "aliases": [ + "GHSA-w889-685w-c8fh" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "An EPS file's name is passed to Ghostscript as an option", + "summary": "Argument injection in the Ghostscript call, potentially leading to remote code execution.", + "published": "2026-10-21", + "severity": 9.2, + "affected": ">= 2.6.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening an EPS (PostScript) file, recognised by content whatever its name, when Ghostscript is installed; the file's own name is read as a Ghostscript option.", + "bucket": "A", + "finding": "PostScript is not one of the four formats and is refused by name from the first bytes, so no PostScript file reaches Pillow's EPS reader through the check.", + "refusal": { + "check": "formats", + "default": true, + "setting": "PostScript is refused whatever the policy says" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_renamed_postscript_file" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0. Do not install Ghostscript on a machine that opens files from outside unless it is needed.", + "specific": "Image.open(path, formats=[\"JPEG\", \"PNG\", \"TIFF\"]) keeps the EPS reader from ever running; sillybos refuses the file before that." + }, + "sources": [ + "https://github.com/advisories/GHSA-w889-685w-c8fh" + ] +} diff --git a/docs/advisories/record/CVE-2026-112901.json b/docs/advisories/record/CVE-2026-112901.json new file mode 100644 index 0000000..d19c5c5 --- /dev/null +++ b/docs/advisories/record/CVE-2026-112901.json @@ -0,0 +1,38 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-112901", + "aliases": [ + "GHSA-xgh8-jp6q-p5x8", + "PYSEC-2026-4335" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A 512-byte XBM file stalls Image.open() for minutes", + "summary": "A regular expression in XbmImagePlugin takes about six minutes of CPU on a crafted 512-byte file before Image.open() gives up.", + "published": "2026-10-21", + "severity": 6.9, + "affected": "<= 12.3.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening a crafted file that looks enough like an XBM for Pillow to try its XBM reader.", + "bucket": "A", + "finding": "XBM is not a format the check knows, so the file is refused as an unknown format; with formats=[...] set, Pillow never tries the XBM reader either.", + "refusal": { + "check": "formats", + "default": true, + "setting": "unknown formats are refused whatever the policy says" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_an_unknown_format" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0.", + "specific": "Allow-list the formats you mean to read." + }, + "sources": [ + "https://github.com/advisories/GHSA-xgh8-jp6q-p5x8" + ] +} diff --git a/docs/advisories/record/CVE-2026-12912.json b/docs/advisories/record/CVE-2026-12912.json new file mode 100644 index 0000000..5d628b7 --- /dev/null +++ b/docs/advisories/record/CVE-2026-12912.json @@ -0,0 +1,37 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-12912", + "aliases": [ + "GHSA-cg4c-j43f-qcg7" + ], + "library": "libtiff", + "package": "tiff", + "ecosystem": "Debian", + "title": "A PixarLog-compressed TIFF overflows a libtiff heap buffer", + "summary": "Decoding a PixarLog image with the 8-bit ABGR output format and a specific stride leads to a heap-based buffer overflow.", + "published": "2026-06-29", + "severity": 7.3, + "affected": "libtiff, as packaged; see the upstream record", + "fixed": null, + "reached_by": "open", + "trigger": "Opening a TIFF compressed with PixarLog.", + "bucket": "B", + "finding": "The compression scheme is a directory tag. The default policy allows none, CCITT, LZW, JPEG, Deflate and PackBits; PixarLog and the other codecs a scan never uses are refused by name.", + "refusal": { + "check": "tiff_compressions", + "default": true, + "setting": "tiff_compressions excludes PixarLog by default" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_pixarlog_tiff" + ], + "protect": { + "general": "Keep libtiff current.", + "specific": "Allow only the compression schemes your files use; sillybos --tiff-compressions." + }, + "sources": [ + "https://github.com/advisories/GHSA-cg4c-j43f-qcg7" + ] +} diff --git a/docs/advisories/record/CVE-2026-22695.json b/docs/advisories/record/CVE-2026-22695.json new file mode 100644 index 0000000..b152a6b --- /dev/null +++ b/docs/advisories/record/CVE-2026-22695.json @@ -0,0 +1,38 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": "Cited from the policy's own notes (policy.py); the OSV record was unreachable when this entry was made and its fields should be filled in.", + "key": "CVE-2026-22695", + "aliases": [ + "GHSA-mmq5-27w3-rxpp" + ], + "library": "libpng", + "package": "libpng1.6", + "ecosystem": "Debian", + "title": "An interlaced 16-bit PNG overflows a libpng buffer", + "summary": "One of two libpng overflows on the Adam7-interlaced 16-bit path. The upstream record was not re-fetched when this entry was written; see notes.", + "published": "2026-01-12", + "severity": 6.1, + "affected": ">= 1.6.51, <= 1.6.53", + "fixed": "1.6.54", + "reached_by": "open", + "trigger": "Opening an Adam7-interlaced PNG with 16-bit samples.", + "bucket": "B", + "finding": "Interlacing is in the IHDR. No scanner writes an interlaced PNG, so the default refuses one.", + "refusal": { + "check": "allow_interlaced_png", + "default": true, + "setting": "allow_interlaced_png is off by default" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_an_interlaced_png" + ], + "protect": { + "general": "Keep libpng current.", + "specific": "Refuse interlaced PNGs; nothing that scans a page writes one. sillybos does by default." + }, + "sources": [ + "https://github.com/advisories/GHSA-mmq5-27w3-rxpp", + "https://osv.dev/vulnerability/CVE-2026-22695" + ] +} diff --git a/docs/advisories/record/CVE-2026-33636.json b/docs/advisories/record/CVE-2026-33636.json new file mode 100644 index 0000000..bf0d64c --- /dev/null +++ b/docs/advisories/record/CVE-2026-33636.json @@ -0,0 +1,38 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": "Cited from the policy's own notes (policy.py), written from the advisory at the time; the OSV record was unreachable when this entry was made and its fields should be filled in.", + "key": "CVE-2026-33636", + "aliases": [ + "GHSA-wjr5-c57x-95m2" + ], + "library": "libpng", + "package": "libpng1.6", + "ecosystem": "Debian", + "title": "A palette PNG reaches a flaw in libpng's palette handling", + "summary": "One of three libpng flaws in the paths that handle palette (indexed-colour) PNGs. The upstream record was not re-fetched when this entry was written; see notes.", + "published": "2026-03-26", + "severity": 7.6, + "affected": ">= 1.6.36, <= 1.6.55", + "fixed": "1.6.56", + "reached_by": "open", + "trigger": "Opening a palette-type PNG.", + "bucket": "B", + "finding": "The colour type is in the PNG's IHDR. The default allows all five colour types; a policy for scans alone can keep to greyscale and RGB, which keeps palette PNGs from the decoder.", + "refusal": { + "check": "png_colour_types", + "default": false, + "setting": "Policy(png_colour_types={\"greyscale\", \"rgb\"})" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_palette_png_under_a_scans_only_policy" + ], + "protect": { + "general": "Keep libpng current.", + "specific": "If nothing you handle is a palette PNG, say so in the policy: sillybos --png-colour-types greyscale,rgb." + }, + "sources": [ + "https://github.com/advisories/GHSA-wjr5-c57x-95m2", + "https://osv.dev/vulnerability/CVE-2026-33636" + ] +} diff --git a/docs/advisories/record/CVE-2026-4775.json b/docs/advisories/record/CVE-2026-4775.json new file mode 100644 index 0000000..beb115d --- /dev/null +++ b/docs/advisories/record/CVE-2026-4775.json @@ -0,0 +1,37 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-4775", + "aliases": [ + "GHSA-cm99-m826-vgg7" + ], + "library": "libtiff", + "package": "tiff", + "ecosystem": "Debian", + "title": "A YCbCr TIFF subsampled four to one overflows a libtiff buffer", + "summary": "Signed integer overflow in putcontig8bitYCbCr44tile leads to an out-of-bounds heap write.", + "published": "2026-03-24", + "severity": 7.8, + "affected": "libtiff, as packaged; see the upstream record", + "fixed": null, + "reached_by": "open", + "trigger": "Opening a YCbCr TIFF whose chroma subsampling is 4x4, through the RGBA reading path.", + "bucket": "B", + "finding": "A YCbCr TIFF's subsampling is a directory tag. The default policy allows 1x1, 2x1, 1x2 and 2x2, which is what scanners and cameras write; 4x4 and the other factor-of-four values are refused.", + "refusal": { + "check": "tiff_subsamplings", + "default": true, + "setting": "tiff_subsamplings excludes factor-of-four by default" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_ycbcr_tiff_subsampled_four_by_four" + ], + "protect": { + "general": "Keep libtiff current.", + "specific": "Allow only the subsamplings your files use; sillybos --tiff-subsamplings." + }, + "sources": [ + "https://github.com/advisories/GHSA-cm99-m826-vgg7" + ] +} diff --git a/docs/advisories/record/CVE-2026-96636.json b/docs/advisories/record/CVE-2026-96636.json new file mode 100644 index 0000000..910a3af --- /dev/null +++ b/docs/advisories/record/CVE-2026-96636.json @@ -0,0 +1,38 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-96636", + "aliases": [ + "GHSA-p8hx-v2p6-rp84" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A later frame of an MPO or DCX file is never checked against the pixel limit", + "summary": "The decompression-bomb check runs only on the first frame; MpoImageFile.seek() and DcxImageFile.seek() do not repeat it.", + "published": "2026-10-22", + "severity": 6.5, + "affected": "< 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Seeking to a later frame of a multi-picture JPEG, or a DCX file, whose first frame is tiny and whose later frame declares enormous dimensions.", + "bucket": "B", + "finding": "Every picture of a multi-picture JPEG is read from the index and each held to max_pixels. DCX is not a known format and is refused as unknown.", + "refusal": { + "check": "max_pixels", + "default": true, + "setting": "applied to every picture, not the first" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_multi_picture_jpeg_whose_second_picture_is_a_bomb", + "tests/test_check.py::TestHostileFiles::test_an_unknown_format" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0.", + "specific": "Apply the pixel limit to every frame, not the first; sillybos does." + }, + "sources": [ + "https://github.com/advisories/GHSA-p8hx-v2p6-rp84" + ] +} diff --git a/docs/advisories/record/CVE-2026-96637.json b/docs/advisories/record/CVE-2026-96637.json new file mode 100644 index 0000000..3267f77 --- /dev/null +++ b/docs/advisories/record/CVE-2026-96637.json @@ -0,0 +1,37 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-96637", + "aliases": [ + "GHSA-g842-9rc4-69pw" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A SPIDER stack file bypasses the pixel limit on seek", + "summary": "SpiderImagePlugin's seek() re-parses the header without the decompression-bomb check, so a file under 1 KB can trigger a multi-gigabyte allocation.", + "published": "2026-10-22", + "severity": 7.1, + "affected": "< 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening a crafted SPIDER file and loading a later frame.", + "bucket": "A", + "finding": "SPIDER is not a format the check knows, so the file is refused as an unknown format before any reader runs.", + "refusal": { + "check": "formats", + "default": true, + "setting": "unknown formats are refused whatever the policy says" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_an_unknown_format" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0.", + "specific": "Allow-list the formats you mean to read; everything else, including this one, never reaches a reader." + }, + "sources": [ + "https://github.com/advisories/GHSA-g842-9rc4-69pw" + ] +} diff --git a/docs/advisories/record/CVE-2026-96639.json b/docs/advisories/record/CVE-2026-96639.json new file mode 100644 index 0000000..37b892b --- /dev/null +++ b/docs/advisories/record/CVE-2026-96639.json @@ -0,0 +1,38 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": null, + "key": "CVE-2026-96639", + "aliases": [ + "GHSA-v9pv-5gc8-w2m6" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A multi-frame file that changes colour mode writes into a buffer sized for the first frame", + "summary": "Multi-frame loaders can reuse stale native image storage after a mode transition, giving out-of-bounds writes; command execution was demonstrated through the MPO path.", + "published": "2026-10-22", + "severity": 9.8, + "affected": ">= 11.0.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Iterating the frames of a crafted multi-picture JPEG (MPO), TIFF or Photoshop file whose later frame is a wider colour mode than the first.", + "bucket": "B", + "finding": "Every frame of a TIFF and every picture of a multi-picture JPEG is read and required to match the first in colour mode, samples and bit depth; a file that changes is refused. Photoshop files are refused by format.", + "refusal": { + "check": "headers", + "default": true, + "setting": "no setting: a frame that differs from the first is always a refusal" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_tiff_that_changes_mode_between_frames", + "tests/test_check.py::TestHostileFiles::test_a_multi_picture_jpeg_that_changes_mode" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0.", + "specific": "Require every frame of a multi-frame file to share the first frame's mode and size before decoding; sillybos does." + }, + "sources": [ + "https://github.com/advisories/GHSA-v9pv-5gc8-w2m6" + ] +} diff --git a/docs/advisories/record/CVE-2026-96643.json b/docs/advisories/record/CVE-2026-96643.json new file mode 100644 index 0000000..2c74e3d --- /dev/null +++ b/docs/advisories/record/CVE-2026-96643.json @@ -0,0 +1,38 @@ +{ + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": "Bounded, not closed: the limit turns an unbounded cost into a bounded one.", + "key": "CVE-2026-96643", + "aliases": [ + "GHSA-g4qv-2jxx-769h" + ], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A PNG's EXIF chunk makes parsing take quadratic time", + "summary": "A PNG eXIf chunk full of repeated six-byte markers makes Exif.load() copy the buffer once per marker.", + "published": "2026-10-22", + "severity": 7.1, + "affected": ">= 11.0.0, < 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening a PNG and reading its EXIF (getexif()) when the eXIf chunk is large and filled with repeated markers. The advisory says a photo-sized file is enough.", + "bucket": "B", + "finding": "The size of every PNG chunk other than image data is read before decoding and held to max_metadata_bytes (4 MiB by default, 1 MiB strict). That bounds the cost; it does not remove it, since a chunk under the limit still costs seconds.", + "refusal": { + "check": "max_metadata_bytes", + "default": true, + "setting": "lower max_metadata_bytes for files from outside" + }, + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_a_png_with_an_enormous_exif_chunk", + "tests/test_check.py::TestHostileFiles::test_strict_allows_less_metadata" + ], + "protect": { + "general": "Upgrade to Pillow 13.0.0.", + "specific": "Cap metadata blocks well below what a scan carries (kilobytes): sillybos --max-metadata-bytes." + }, + "sources": [ + "https://github.com/advisories/GHSA-g4qv-2jxx-769h" + ] +} diff --git a/scripts/advisory_record.py b/scripts/advisory_record.py new file mode 100644 index 0000000..ee55572 --- /dev/null +++ b/scripts/advisory_record.py @@ -0,0 +1,274 @@ +"""The advisory record: what each triaged advisory means for sillybos, as data. + +``docs/advisories/record/.json`` holds one file per advisory that has +been triaged (``docs/advisories/README.md`` says how): the advisory's own +facts, the bucket it landed in, the finding, which check refuses the +triggering file and under which policy, the tests that prove it, and how +anyone could protect themselves whether or not they use this library. + +``docs/advisories/record.json`` is the merged file that other things read: +the documentation's coverage page, and the security watch on tetrak.dev, +which fetches it at build time. It is generated, never edited:: + + python scripts/advisory_record.py validate # every file against the schema + python scripts/advisory_record.py export # write record.json + python scripts/advisory_record.py export --check # fail if record.json is stale + +Standard library only, like the rest of the repository. +""" + +from __future__ import annotations + +import argparse +import json +import re +import sys +from datetime import date +from pathlib import Path +from typing import Any + +ROOT = Path(__file__).resolve().parent.parent +RECORD_DIR = ROOT / "docs" / "advisories" / "record" +RECORD_FILE = ROOT / "docs" / "advisories" / "record.json" +TESTS_DIR = ROOT / "tests" + +#: The buckets of docs/advisories/README.md, in its words. +BUCKETS = { + "A": "Already refused by an existing check", + "B": "Preventable from a header field our readers can see", + "B2": "Preventable only by a coarse policy on a PDF's contents", + "C": "Needs decoding to detect; out of this library's reach by design", + "D": "Reaches pdfinfo itself", + "N": "Not reached by opening a file", + "U": "A reserved CVE with no text yet", +} + +#: How the triggering input reaches the flaw. +REACHED_BY = { + "open": "by opening or reading a file", + "save": "on a save or encode path", + "api": "through a call beyond opening, such as a filter or transform", + "tool": "through a command-line tool, not the library", + "other": "some other way; the finding says", +} + +#: The buckets in which a refusal is claimed and so must be proved. +REFUSING_BUCKETS = {"A", "B", "B2"} + +KEY = re.compile(r"^(CVE-\d{4}-\d{4,}|GHSA-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}|PYSEC-\d{4}-\d+)$") +DATE = re.compile(r"^\d{4}-\d{2}-\d{2}$") +TEST_ID = re.compile(r"^(tests/[\w/]+\.py)::(?:(\w+)::)?(\w+)$") + +REQUIRED: dict[str, type | tuple[type, ...]] = { + "key": str, + "aliases": list, + "library": str, + "package": str, + "ecosystem": str, + "title": str, + "summary": str, + "published": (str, type(None)), + "severity": (int, float, type(None)), + "affected": str, + "fixed": (str, type(None)), + "reached_by": str, + "trigger": str, + "bucket": str, + "finding": str, + "refusal": (dict, type(None)), + "verified_by": list, + "protect": dict, + "sources": list, + "triaged": str, + "checked": str, + "notes": (str, type(None)), +} + + +def load(path: Path) -> dict[str, Any]: + with path.open(encoding="utf-8") as f: + data: dict[str, Any] = json.load(f) + return data + + +def _test_exists(test_id: str, tests_dir: Path) -> bool: + """True if the test the id names is defined, read from the file's text.""" + match = TEST_ID.match(test_id) + if match is None: + return False + file, cls, name = match.groups() + path = tests_dir.parent / file + if not path.is_file(): + return False + text = path.read_text(encoding="utf-8") + if cls is not None and not re.search(rf"^class {cls}\b", text, re.MULTILINE): + return False + return re.search(rf"^\s*def {name}\(", text, re.MULTILINE) is not None + + +def problems(record: dict[str, Any], path: Path, tests_dir: Path = TESTS_DIR) -> list[str]: + """Everything wrong with one record, in sentences; empty when it is sound.""" + found: list[str] = [] + for field, kind in REQUIRED.items(): + if field not in record: + found.append(f"missing {field}") + elif not isinstance(record[field], kind): + found.append(f"{field} is {type(record[field]).__name__}") + extra = set(record) - set(REQUIRED) + if extra: + found.append(f"unknown fields: {', '.join(sorted(extra))}") + if found: + return found + + key = record["key"] + if not KEY.match(key): + found.append(f"key {key!r} is not a CVE, GHSA or PYSEC id") + if path.stem != key: + found.append(f"file is named {path.name}, key is {key}") + for alias in record["aliases"]: + if not isinstance(alias, str) or not KEY.match(alias): + found.append(f"alias {alias!r} is not a CVE, GHSA or PYSEC id") + if key in record["aliases"]: + found.append("key repeated in aliases") + if record["bucket"] not in BUCKETS: + found.append(f"bucket {record['bucket']!r} is not one of {', '.join(BUCKETS)}") + if record["reached_by"] not in REACHED_BY: + found.append(f"reached_by {record['reached_by']!r} is not one of {', '.join(REACHED_BY)}") + for field in ("published", "triaged", "checked"): + value = record[field] + if value is not None and not DATE.match(value): + found.append(f"{field} {value!r} is not YYYY-MM-DD") + if record["checked"] < record["triaged"]: + found.append("checked is before triaged") + for field in ("title", "trigger", "finding"): + if not record[field].strip(): + found.append(f"{field} is empty") + protect = record["protect"] + for part in ("general", "specific"): + if not isinstance(protect.get(part), str) or not protect[part].strip(): + found.append(f"protect.{part} is missing or empty") + if not record["sources"] or not all( + isinstance(s, str) and s.startswith("https://") for s in record["sources"] + ): + found.append("sources must be one or more https links") + + refusal = record["refusal"] + claims = record["bucket"] in REFUSING_BUCKETS + if claims and refusal is None: + found.append(f"bucket {record['bucket']} claims a refusal but refusal is null") + if not claims and refusal is not None: + found.append(f"bucket {record['bucket']} claims no refusal but refusal is set") + if refusal is not None: + for part, kind in (("check", str), ("default", bool), ("setting", str)): + if not isinstance(refusal.get(part), kind): + found.append(f"refusal.{part} is missing or not {kind.__name__}") + if claims and not record["verified_by"]: + found.append("a claimed refusal needs at least one test in verified_by") + if not claims and record["verified_by"]: + found.append("verified_by names tests but no refusal is claimed") + for test_id in record["verified_by"]: + if not isinstance(test_id, str) or not TEST_ID.match(test_id): + found.append(f"verified_by {test_id!r} is not tests/file.py::Class::test_name") + elif not _test_exists(test_id, tests_dir): + found.append(f"verified_by names a test that does not exist: {test_id}") + return found + + +def validate(record_dir: Path = RECORD_DIR, tests_dir: Path = TESTS_DIR) -> dict[Path, list[str]]: + """Every record's problems, keyed by file; an empty dict means all sound.""" + result: dict[Path, list[str]] = {} + seen: dict[str, Path] = {} + for path in sorted(record_dir.glob("*.json")): + try: + record = load(path) + except (OSError, ValueError) as exc: + result[path] = [f"not readable as JSON: {exc}"] + continue + found = problems(record, path, tests_dir) + for name in [record.get("key"), *record.get("aliases", [])]: + if isinstance(name, str): + if name in seen and seen[name] != path: + found.append(f"{name} is also in {seen[name].name}") + seen.setdefault(name, path) + if found: + result[path] = found + return result + + +def _sort_key(record: dict[str, Any]) -> tuple[str, str]: + # Newest first; an undated record sorts after the dated ones. + return (record["published"] or "0000-00-00", record["key"]) + + +def merged(record_dir: Path = RECORD_DIR, today: str | None = None) -> dict[str, Any]: + """The merged record: the records, newest first, and the counts.""" + records = [load(path) for path in sorted(record_dir.glob("*.json"))] + records.sort(key=_sort_key, reverse=True) + by_bucket = {bucket: 0 for bucket in BUCKETS} + by_library: dict[str, int] = {} + refused_by_default = 0 + for record in records: + by_bucket[record["bucket"]] += 1 + by_library[record["library"]] = by_library.get(record["library"], 0) + 1 + if record["refusal"] is not None and record["refusal"]["default"]: + refused_by_default += 1 + return { + "generated": today or date.today().isoformat(), + "buckets": BUCKETS, + "reached_by": REACHED_BY, + "counts": { + "records": len(records), + "refused_by_default": refused_by_default, + "by_bucket": by_bucket, + "by_library": dict(sorted(by_library.items())), + }, + "records": records, + } + + +def render(record_dir: Path = RECORD_DIR, today: str | None = None) -> str: + return json.dumps(merged(record_dir, today), indent=2, ensure_ascii=False) + "\n" + + +def is_current(record_file: Path = RECORD_FILE, record_dir: Path = RECORD_DIR) -> bool: + """True if record.json matches the records, ignoring the generated date.""" + if not record_file.is_file(): + return False + current: dict[str, Any] = json.loads(record_file.read_text(encoding="utf-8")) + fresh = merged(record_dir, today=current.get("generated")) + return bool(current == fresh) + + +def main(argv: list[str] | None = None) -> int: + parser = argparse.ArgumentParser( + description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter + ) + parser.add_argument("command", choices=("validate", "export")) + parser.add_argument("--check", action="store_true", help="export: fail if record.json is stale") + args = parser.parse_args(argv) + + found = validate() + for path, lines in found.items(): + for line in lines: + print(f"{path.relative_to(ROOT)}: {line}", file=sys.stderr) + if found: + return 1 + if args.command == "validate": + print(f"{len(list(RECORD_DIR.glob('*.json')))} records are sound") + return 0 + if args.check: + if is_current(): + print(f"{RECORD_FILE.relative_to(ROOT)} is current") + return 0 + print( + f"{RECORD_FILE.relative_to(ROOT)} is stale: run `python scripts/advisory_record.py export`", + file=sys.stderr, + ) + return 1 + RECORD_FILE.write_text(render(), encoding="utf-8") + print(f"wrote {RECORD_FILE.relative_to(ROOT)}") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tests/test_record.py b/tests/test_record.py new file mode 100644 index 0000000..44a0e2a --- /dev/null +++ b/tests/test_record.py @@ -0,0 +1,161 @@ +"""The advisory record: every committed record is sound, and record.json is current.""" + +from __future__ import annotations + +import json +from pathlib import Path +from typing import Any + +import pytest + +from scripts import advisory_record as ar + +SOUND: dict[str, Any] = { + "key": "CVE-2026-1001", + "aliases": ["GHSA-aaaa-bbbb-cccc"], + "library": "Pillow", + "package": "pillow", + "ecosystem": "PyPI", + "title": "A thing", + "summary": "What upstream said.", + "published": "2026-10-21", + "severity": 9.2, + "affected": "< 13.0.0", + "fixed": "13.0.0", + "reached_by": "open", + "trigger": "Opening it.", + "bucket": "A", + "finding": "Refused by name.", + "refusal": {"check": "formats", "default": True, "setting": "always"}, + "verified_by": ["tests/test_check.py::TestHostileFiles::test_a_renamed_postscript_file"], + "protect": {"general": "Upgrade.", "specific": "Allow-list formats."}, + "sources": ["https://github.com/advisories/GHSA-aaaa-bbbb-cccc"], + "triaged": "2026-11-01", + "checked": "2026-11-01", + "notes": None, +} + + +def _write(tmp_path: Path, record: dict[str, Any], name: str | None = None) -> Path: + path = tmp_path / f"{name or record['key']}.json" + path.write_text(json.dumps(record), encoding="utf-8") + return path + + +class TestTheCommittedRecords: + def test_every_record_is_sound(self) -> None: + assert ar.validate() == {} + + def test_every_record_is_in_the_baseline(self) -> None: + """So the weekly job never opens an issue for an advisory already triaged.""" + state = json.loads((ar.ROOT / "docs/advisories/seen.json").read_text(encoding="utf-8")) + known = set(state["seen"]) | set(state.get("pending", [])) + for path in ar.RECORD_DIR.glob("*.json"): + record = ar.load(path) + names = {record["key"], *record["aliases"]} + assert names & known, f"{path.name} is not in seen.json; run `advisories.py record`" + + def test_record_json_is_current(self) -> None: + assert ar.is_current(), "run `python scripts/advisory_record.py export`" + + def test_the_merged_file_counts_what_it_holds(self) -> None: + merged = ar.merged() + assert merged["counts"]["records"] == len(merged["records"]) + assert sum(merged["counts"]["by_bucket"].values()) == len(merged["records"]) + published = [r["published"] or "" for r in merged["records"]] + assert published == sorted(published, reverse=True) + + +class TestProblems: + def test_a_sound_record_has_none(self, tmp_path: Path) -> None: + assert ar.problems(SOUND, _write(tmp_path, SOUND), ar.TESTS_DIR) == [] + + @pytest.mark.parametrize( + ("change", "expected"), + [ + ({"bucket": "Z"}, "bucket 'Z' is not one of"), + ({"reached_by": "magic"}, "reached_by 'magic' is not one of"), + ({"published": "October"}, "published 'October' is not YYYY-MM-DD"), + ({"checked": "2026-10-01"}, "checked is before triaged"), + ({"finding": " "}, "finding is empty"), + ({"sources": ["http://insecure"]}, "sources must be one or more https links"), + ({"protect": {"general": "x"}}, "protect.specific is missing or empty"), + ({"aliases": ["CVE-2026-1001"]}, "key repeated in aliases"), + ({"refusal": None}, "bucket A claims a refusal but refusal is null"), + ({"verified_by": []}, "a claimed refusal needs at least one test"), + ({"bucket": "N", "refusal": None}, "verified_by names tests but no refusal is claimed"), + ({"bucket": "N", "verified_by": []}, "bucket N claims no refusal but refusal is set"), + ( + { + "verified_by": [ + "tests/test_check.py::TestHostileFiles::test_nothing_of_the_sort" + ] + }, + "names a test that does not exist", + ), + ( + {"verified_by": ["tests/test_check.py::TestNoSuchClass::test_a_pixel_bomb"]}, + "names a test that does not exist", + ), + ({"verified_by": ["test_a_pixel_bomb"]}, "is not tests/file.py::Class::test_name"), + ({"refusal": {"check": "formats", "default": "yes", "setting": ""}}, "refusal.default"), + ({"extra": 1}, "unknown fields: extra"), + ({"severity": "high"}, "severity is str"), + ], + ) + def test_catches(self, tmp_path: Path, change: dict[str, Any], expected: str) -> None: + record = {**SOUND, **change} + found = ar.problems(record, _write(tmp_path, record), ar.TESTS_DIR) + assert any(expected in line for line in found), found + + def test_a_missing_field_is_reported_first(self, tmp_path: Path) -> None: + record = {k: v for k, v in SOUND.items() if k != "trigger"} + assert ar.problems(record, _write(tmp_path, record, "CVE-2026-1001"), ar.TESTS_DIR) == [ + "missing trigger" + ] + + def test_the_file_must_be_named_after_the_key(self, tmp_path: Path) -> None: + found = ar.problems(SOUND, _write(tmp_path, SOUND, "CVE-2026-1002"), ar.TESTS_DIR) + assert found == ["file is named CVE-2026-1002.json, key is CVE-2026-1001"] + + +class TestValidate: + def test_two_files_naming_one_advisory(self, tmp_path: Path) -> None: + _write(tmp_path, SOUND) + other = {**SOUND, "key": "CVE-2026-1002", "aliases": ["GHSA-aaaa-bbbb-cccc"]} + _write(tmp_path, other) + found = ar.validate(tmp_path, ar.TESTS_DIR) + assert [p.name for p in found] == ["CVE-2026-1002.json"] + assert found[tmp_path / "CVE-2026-1002.json"] == [ + "GHSA-aaaa-bbbb-cccc is also in CVE-2026-1001.json" + ] + + def test_unreadable_json(self, tmp_path: Path) -> None: + (tmp_path / "CVE-2026-1001.json").write_text("{", encoding="utf-8") + found = ar.validate(tmp_path, ar.TESTS_DIR) + assert "not readable as JSON" in found[tmp_path / "CVE-2026-1001.json"][0] + + +class TestExport: + def test_render_is_stable_and_counts(self, tmp_path: Path) -> None: + _write(tmp_path, SOUND) + _write(tmp_path, {**SOUND, "key": "CVE-2026-1002", "aliases": [], "published": None}) + merged = ar.merged(tmp_path, today="2026-11-01") + assert merged["generated"] == "2026-11-01" + assert [r["key"] for r in merged["records"]] == ["CVE-2026-1001", "CVE-2026-1002"] + assert merged["counts"] == { + "records": 2, + "refused_by_default": 2, + "by_bucket": {"A": 2, "B": 0, "B2": 0, "C": 0, "D": 0, "N": 0, "U": 0}, + "by_library": {"Pillow": 2}, + } + assert ar.render(tmp_path, "2026-11-01") == ar.render(tmp_path, "2026-11-01") + + def test_is_current_ignores_the_date_and_sees_a_change(self, tmp_path: Path) -> None: + _write(tmp_path, SOUND) + out = tmp_path.parent / f"{tmp_path.name}-record.json" + out.write_text(ar.render(tmp_path, "2020-01-01"), encoding="utf-8") + assert ar.is_current(out, tmp_path) + _write(tmp_path, {**SOUND, "key": "CVE-2026-1002", "aliases": []}) + assert not ar.is_current(out, tmp_path) + assert not ar.is_current(tmp_path / "missing.json", tmp_path)