python3-pillow: Fix CVE-2023-50447
PATCH 1/1 python3-pillow: Fix CVE-2023-50447
Pillow through 10.1.0 allows PIL.ImageMath.eval Arbitrary Code Execution via the environment parameter, a different vulnerability than CVE-2022-22817 (which was about the expression parameter).
References:
https://security-tracker.debian.org/tracker/CVE-2023-50447
https://github.com/python-pillow/Pillow/blob/10.2.0/CHANGES.rst
Signed-off-by Rahul Janani Pandi <[email protected]>
--- .../python3-pillow/CVE-2023-50447-1.patch | 29 ++++++++ .../python3-pillow/CVE-2023-50447-2.patch | 31 +++++++++ .../python3-pillow/CVE-2023-50447-3.patch | 56 ++++++++++++++++ .../python3-pillow/CVE-2023-50447-4.patch | 66 +++++++++++++++++++ .../python/python3-pillow_9.4.0.bb | 4 ++ 5 files changed, 186 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-pillow/CVE-2023-50447-1.patch create mode 100644 meta-python/recipes-devtools/python/python3-pillow/CVE-2023-50447-2.patch create mode 100644 meta-python/recipes-devtools/python/python3-pillow/CVE-2023-50447-3.patch create mode 100644 meta-python/recipes-devtools/python/python3-pillow/CVE-2023-50447-4.patch
meta-python/recipes-devtools/python/python3-pillow/CVE-2023-50447-1.patch new file +29 -0
@@ -0,0 +1,29 @@ +From 3652f431c2d8b9c10bf20b70f284d300d12e814a +From: Andrew Murray <[email protected]> +Date: Sat Oct 28 14:22:39 2023 +1100 +Subject: [PATCH] python3-pillow: Simplified code + +CVE: CVE-2023-50447 + +Upstream-Status: Backport [https://github.com/python-pillow/Pillow/commit/3652f431c2d8b9c10bf20b70f284d300d12e814a] + +Signed-off-by: Rahul Janani Pandi <[email protected]> +--- + src/PIL/ImageMath.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/PIL/ImageMath.py b/src/PIL/ImageMath.py +index ac7d36b69..71872a3fb 100644 +--- a/src/PIL/ImageMath.py ++++ b/src/PIL/ImageMath.py +@@ -239,7 +239,7 @@ def eval(expression, _dict={}, **kw): + args = ops.copy() + args.update(_dict) + args.update(kw) +- for k, v in list(args.items()): ++ for k, v in args.items(): + if hasattr(v, "im"): + args[k] = _Operand(v) + +-- +2.40.0
meta-python/recipes-devtools/python/python3-pillow/CVE-2023-50447-2.patch new file +31 -0
@@ -0,0 +1,31 @@ +From 45c726fd4daa63236a8f3653530f297dc87b160a +From: Eric Soroos <[email protected]> +Date: Fri Oct 27 11:21:18 2023 +0200 +Subject: [PATCH] python3-pillow: Don't allow __ or builtins in env dictionarys + +CVE: CVE-2023-50447 + +Upstream-Status: Backport [https://github.com/python-pillow/Pillow/commit/45c726fd4daa63236a8f3653530f297dc87b160a] + +Signed-off-by: Rahul Janani Pandi <[email protected]> +--- + src/PIL/ImageMath.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/PIL/ImageMath.py b/src/PIL/ImageMath.py +index 71872a3fb..923a8eeae 100644 +--- a/src/PIL/ImageMath.py ++++ b/src/PIL/ImageMath.py +@@ -240,6 +240,10 @@ def eval(expression, _dict={}, **kw): + args.update(_dict) + args.update(kw) + for k, v in args.items(): ++ if '__' in k or hasattr(__builtins__, k): ++ msg = f"'{k}' not allowed" ++ raise ValueError(msg) ++ + if hasattr(v, "im"): + args[k] = _Operand(v) + +-- +2.40.0
meta-python/recipes-devtools/python/python3-pillow/CVE-2023-50447-3.patch new file +56 -0
56 lines not on this page · raw message
meta-python/recipes-devtools/python/python3-pillow/CVE-2023-50447-4.patch new file +66 -0
66 lines not on this page · raw message
meta-python/recipes-devtools/python/python3-pillow_9.4.0.bb +4 -0
@@ -10,6 +10,10 @@ SRC_URI = "git://github.com/python-pillow/Pillow.git;branch=main;protocol=https file://0001-explicitly-set-compile-options.patch \ file://run-ptest \ file://CVE-2023-44271.patch \ + file://CVE-2023-50447-1.patch \ + file://CVE-2023-50447-2.patch \ + file://CVE-2023-50447-3.patch \ + file://CVE-2023-50447-4.patch \ " SRCREV ?= "82541b6dec8452cb612067fcebba1c5a1a2bfdc8"
Signature · 1 line
2.40.0