@@ -71,14 +71,14 @@ round-tripping images. Applications that store or render metadata without
7171sanitisation are vulnerable to second-order injection (SQLi, XSS, command
7272injection).
7373
74- *Mitigations: * treat all values from ``image.info ``, ``image._getexif() ``, and
75- ``image.text `` as untrusted; sanitise before storing or rendering; strip
76- metadata when it is not required.
74+ *Mitigations: * treat all values from ``image.info ``, ``image._getexif() ``,
75+ ``image.getexif() ``, and `` image. text `` as untrusted; sanitise before storing
76+ or rendering; strip metadata when it is not required.
7777
7878**T-2 — Covert data channel (steganography) **
7979
80- Pillow does not remove hidden data (JPEG comments, PNG text chunks, appended
81- bytes) when re-saving. An attacker can embed data that survives the
80+ Pillow does not remove hidden data (JPEG comments, PNG text chunks) when
81+ re-saving. An attacker can embed data that survives the
8282encode-decode cycle invisibly.
8383
8484*Mitigations: * to guarantee a clean output when saving, create a new image instance via
@@ -100,13 +100,13 @@ Repudiation
100100
101101**R-1 — No structured audit trail **
102102
103- Pillow does not emit structured audit logs of files opened, formats detected,
104- or operations performed, making forensic investigation harder after an
105- incident.
103+ Without application-level logging there is no record of which images were
104+ opened, what formats were detected, or what operations were performed, making
105+ forensic investigation harder after an incident.
106106
107- *Mitigations: * applications should log the filename/hash, detected format, and
108- dimensions of every image processed; log and alert on
109- ``Image.DecompressionBombWarning `` and ``PIL.UnidentifiedImageError ``.
107+ *Mitigations: * log the filename/hash, detected format, and dimensions of every
108+ image processed; log and alert on `` Image.DecompressionBombWarning ``,
109+ ``Image.DecompressionBombError ``, and ``PIL.UnidentifiedImageError ``.
110110
111111Information disclosure
112112^^^^^^^^^^^^^^^^^^^^^^
@@ -189,6 +189,7 @@ isolated sandbox with no network and no sensitive mounts. Pillow does not
189189provide a stable public API for unregistering individual format plugins, so do
190190not rely on mutating internal registries such as ``Image.OPEN `` as a security
191191control.
192+
192193**E-3 — ``ImageMath.unsafe_eval()`` code injection **
193194
194195:py:meth: `~PIL.ImageMath.unsafe_eval ` calls Python's built-in ``eval() `` with
@@ -224,8 +225,9 @@ The following mitigations are listed in priority order.
224225 Ghostscript in an isolated container.
2252263. **Never use ** ``ImageMath.unsafe_eval() `` **with user input ** — migrate all
226227 callers to :py:meth: `~PIL.ImageMath.lambda_eval `.
227- 4. **Keep all dependencies current ** — Pillow, libjpeg, libpng, libtiff,
228- libwebp, openjpeg, freetype, Ghostscript. Subscribe to `Pillow security
228+ 4. **Keep all dependencies current ** — Pillow and its C library dependencies
229+ (including libjpeg, libpng, libtiff, libwebp, openjpeg, freetype,
230+ littlecms2, Ghostscript, and others). Subscribe to `Pillow security
229231 advisories <https://github.com/python-pillow/Pillow/security/advisories> `_.
2302325. **Enforce ** ``MAX_IMAGE_PIXELS `` — never set it to ``None ``; treat
231233 ``Image.DecompressionBombWarning `` as an error.
0 commit comments