From 6cfca8753d54e2025c6020b2af32529e25f58c66 Mon Sep 17 00:00:00 2001 From: Patrick Canterino Date: Sun, 1 Dec 2024 15:05:34 +0100 Subject: [PATCH] Made check for MIME type "image/svg+xml" case insensitive It was possible to bypass this check by sending a manipulated HTTP request with a MIME type like "image/svg+XML". This check was originally implemented to address CVE-2022-30110. Reported by: - Yann CAM (ycam) (https://yann.cam/) - Georges TAUPIN (jo) (https://www.georgestaupin.com/) --- lib/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions.php b/lib/functions.php index 9091af7..0372507 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -623,7 +623,7 @@ function jirafeau_is_viewable($mime) if (!empty($mime)) { $viewable = array('image', 'video', 'audio'); $decomposed = explode('/', $mime); - if (in_array($decomposed[0], $viewable) && strpos($mime, 'image/svg+xml') === false) { + if (in_array($decomposed[0], $viewable) && stripos($mime, 'image/svg+xml') === false) { return true; } $viewable = array('text/plain'); -- 2.34.1