From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id qIDGLl2k6GOdNAEAbAwnHQ (envelope-from ) for ; Sun, 12 Feb 2023 09:33:33 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id oBvkLV2k6GNOdQAAG6o9tA (envelope-from ) for ; Sun, 12 Feb 2023 09:33:33 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 763483FB40 for ; Sun, 12 Feb 2023 09:33:33 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pR7nK-0007Ig-Gd; Sun, 12 Feb 2023 03:33:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pR7nC-0007E1-G9 for guix-patches@gnu.org; Sun, 12 Feb 2023 03:33:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pR7nC-0003DR-2C for guix-patches@gnu.org; Sun, 12 Feb 2023 03:33:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pR7nB-0007nM-Sw for guix-patches@gnu.org; Sun, 12 Feb 2023 03:33:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#61172] [Nicolas Graves via Guix-patches via] [bug#61172] [PATCH] gnu: python-pillow: Update to 9.3.0 [fixes CVE-2022-45199]. Resent-From: Lars-Dominik Braun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 12 Feb 2023 08:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61172 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Leo Famulari Cc: 61172@debbugs.gnu.org, Nicolas Graves Received: via spool by 61172-submit@debbugs.gnu.org id=B61172.167619072629890 (code B ref 61172); Sun, 12 Feb 2023 08:33:01 +0000 Received: (at 61172) by debbugs.gnu.org; 12 Feb 2023 08:32:06 +0000 Received: from localhost ([127.0.0.1]:43982 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pR7mH-0007m0-5v for submit@debbugs.gnu.org; Sun, 12 Feb 2023 03:32:06 -0500 Received: from mout-p-101.mailbox.org ([80.241.56.151]:49590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pR7mC-0007lT-3v for 61172@debbugs.gnu.org; Sun, 12 Feb 2023 03:32:03 -0500 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4PF10l5vqQz9scW; Sun, 12 Feb 2023 09:31:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6xq.net; s=MBO0001; t=1676190711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ylfv3AHbVXJEyYqGIKo3H5YUejTDM+vg5GihQQMwNYk=; b=mxRfk0RxwVqlb/8Sw27BW3QfonGufub3EygyFj82j0ZJ6xa7U3vDqN4x/oFiLJnZ33c+nX jOP6nVcXQRaGc/YnraZm7HxVvwktJCP8KNeV4ZYfjHSYLvYRB1MRmEN2BuW84I41uCBR29 BVSQvVeHQGNp9lbBwYq8f/Bm1RiV/OneCH0phqzM0lE7nBwpoYyo5SeX96ORT5mK4eU6U8 iOdTud3khUhn0Si2zF+5UQn/sKD2Xl0zoGpi/0jqa/8oyF8az+0L1YyzXwmn1cadhYqssu YppCQJyACSsWkldrb8vmSsZC4zD1P2St0dXFmYOxJAHwIi/YthsRTE9aviRpUQ== Date: Sun, 12 Feb 2023 09:31:45 +0100 From: Lars-Dominik Braun Message-ID: References: <20230130134751.30647-1-ngraves@ngraves.fr> <87mt5vuaru.fsf@ngraves.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="svccWSOucYQZMEze" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: 4PF10l5vqQz9scW X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1676190813; a=rsa-sha256; cv=none; b=pqzjotZVmku0x7GueaROT29Lk5jL2S1/LS51vxciWmyNH9tmTebnSZyVFnAKfIApJbi5gC WJk6X1E0odjU1B4cXz5bRyDoNXhIRwqS15Kb+lEPepBIqUIe87PKkhuwHKd1+k4SbOSvLF +PKHz1Qqvxh0Hz1y3X58VZwtqmPPYf4sVTtLq/JM2BqQrYzhj89NnQ1yyNVV4pBhriE5+w AkV0d4vEldYvOWl+f5mGFUjRCZBo+g3CNYzpyLLwOQpv2XU65zGsq70e8WSa5no5rxQEkT 4ZNupxB0OoM7L3/5gsVXMi7cngQlLjdOd1stUOhu4UfOqD2BN9h9+YuuLl0jqQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=6xq.net header.s=MBO0001 header.b=mxRfk0Rx; dmarc=fail reason="SPF not aligned (relaxed)" header.from=6xq.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676190813; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ylfv3AHbVXJEyYqGIKo3H5YUejTDM+vg5GihQQMwNYk=; b=DHlMwXsa8XSzCACViBVI8vS7Kn/ZcM0TqcMGyU1K7WdBfCtvnI9eWfyN0FbcMOQGO4nuHt c3sS2t5SJB76pKX0blGLJDa1NSKAVXCMNczmryCIxF2HdknM1ssv8++mOsqjqyGusX7nRr T3D58yhwpFpw3JKGnnHyAgZc4YKC9HcHLvdb5Hp4v4M5N/ifDiDKnXymIbMKZyWoq6Ip3P M8fkJVT06wvrtsyXhTh9RavR7k982DT9kRXufW29dFwmjtRYbC3SpxlxYQzgy9cpdxPxbm APbrWHdmcbUGPVR7jK0YPBHLp7xjtJeWEG/Yw7TQ3X9HqGpqd/vPstlO8HcWbw== Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=6xq.net header.s=MBO0001 header.b=mxRfk0Rx; dmarc=fail reason="SPF not aligned (relaxed)" header.from=6xq.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: 5.68 X-Spam-Score: 5.68 X-Migadu-Queue-Id: 763483FB40 X-TUID: 9hndtiCr3VQl --svccWSOucYQZMEze Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hi, > Unless something has changed recently (possible, I haven't paid close attention), yes, it's possible to graft Python packages. that was my feeling too. Attached is a patch that only applies the CVE fix. I’m not comfortable bumping Pillow to 9.3 just like that. We should re-build packages, so they can run their test-suites. > Additionally, we can attempt a rapid rebuilding of pillow's dependents, perhaps along with a few other "ungrafting" changes. We are aiming to do the graft->ungraft cycles more quickly than previously. Do we have a branch for that already? Lars --svccWSOucYQZMEze Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-gnu-python-pillow-Fix-CVE-2022-45199.patch" >From 3e8db92d186a272257319335fe2f131ee824238d Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 11 Feb 2023 14:47:59 +0100 Subject: [PATCH] gnu: python-pillow: Fix CVE-2022-45199. Fixes: * gnu/packages/python-xyz.scm (python-pillow/security-fixes): New variable. (python-pillow): Add replacement. * gnu/packages/patches/python-pillow-CVE-2022-45199.patch: New file. * gnu/local.mk: Register it. --- gnu/local.mk | 1 + .../python-pillow-CVE-2022-45199.patch | 36 +++++++++++++++++++ gnu/packages/python-xyz.scm | 5 +++ 3 files changed, 42 insertions(+) create mode 100644 gnu/packages/patches/python-pillow-CVE-2022-45199.patch diff --git a/gnu/local.mk b/gnu/local.mk index b432a95026..4b72416d3c 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1732,6 +1732,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-peachpy-determinism.patch \ %D%/packages/patches/python-pep8-stdlib-tokenize-compat.patch \ %D%/packages/patches/python-piexif-fix-tests-with-pillow-7.2.patch \ + %D%/packages/patches/python-pillow-CVE-2022-45199.patch \ %D%/packages/patches/python-pyfakefs-remove-bad-test.patch \ %D%/packages/patches/python-pyflakes-test-location.patch \ %D%/packages/patches/python2-pyopenssl-openssl-compat.patch \ diff --git a/gnu/packages/patches/python-pillow-CVE-2022-45199.patch b/gnu/packages/patches/python-pillow-CVE-2022-45199.patch new file mode 100644 index 0000000000..3b01d3a8f4 --- /dev/null +++ b/gnu/packages/patches/python-pillow-CVE-2022-45199.patch @@ -0,0 +1,36 @@ +From 13f2c5ae14901c89c38f898496102afd9daeaf6d Mon Sep 17 00:00:00 2001 +From: Eric Soroos +Date: Fri, 28 Oct 2022 14:11:25 +0200 +Subject: [PATCH 1/5] Prevent DOS with large SAMPLESPERPIXEL in Tiff IFD + +A large value in the SAMPLESPERPIXEL tag could lead to a memory and +runtime DOS in TiffImagePlugin.py when setting up the context for +image decoding. + +diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py +index 04a63bd2b44..46166fc6335 100644 +--- a/src/PIL/TiffImagePlugin.py ++++ b/src/PIL/TiffImagePlugin.py +@@ -257,6 +257,8 @@ + (MM, 8, (1,), 1, (8, 8, 8), ()): ("LAB", "LAB"), + } + ++MAX_SAMPLESPERPIXEL = max(len(key_tp[4]) for key_tp in OPEN_INFO.keys()) ++ + PREFIXES = [ + b"MM\x00\x2A", # Valid TIFF header with big-endian byte order + b"II\x2A\x00", # Valid TIFF header with little-endian byte order +@@ -1396,6 +1398,12 @@ def _setup(self): + SAMPLESPERPIXEL, + 3 if self._compression == "tiff_jpeg" and photo in (2, 6) else 1, + ) ++ ++ if samples_per_pixel > MAX_SAMPLESPERPIXEL: ++ # DOS check, samples_per_pixel can be a Long, and we extend the tuple below ++ logger.error("More samples per pixel than can be decoded: %s", samples_per_pixel) ++ raise SyntaxError("Invalid value for samples per pixel") ++ + if samples_per_pixel < bps_actual_count: + # If a file has more values in bps_tuple than expected, + # remove the excess. + diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 15f1a80fed..bfc3afd5db 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -7589,6 +7589,7 @@ (define-public python-pillow (package (name "python-pillow") (version "9.2.0") + (replacement python-pillow/security-fixes) (source (origin (method url-fetch) (uri (pypi-uri "Pillow" version)) @@ -7636,6 +7637,10 @@ (define-public python-pillow "http://www.pythonware.com/products/pil/license.htm" "The PIL Software License")))) +(define-public python-pillow/security-fixes + (package-with-patches python-pillow + (search-patches "python-pillow-CVE-2022-45199.patch"))) + (define-public python-pillow-2.9 (package (inherit python-pillow) -- 2.39.1 --svccWSOucYQZMEze--