From 7942a7aa74c2a18b1081f52654ef615b7e9ebef5 Mon Sep 17 00:00:00 2001 From: Brian Foley Date: Mon, 26 Oct 2026 15:31:32 +0000 Subject: [PATCH 1/2] filter_project_list.inc: Only allow primitive types to be unserialized Out of an abundance of caution in case there is some path by which user-provided serialized data can be provided to the project search filters. If that were to happen, it would likely be an exploitable security hole. --- pinc/filter_project_list.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pinc/filter_project_list.inc b/pinc/filter_project_list.inc index 8dbd40fee..8251e7591 100644 --- a/pinc/filter_project_list.inc +++ b/pinc/filter_project_list.inc @@ -416,7 +416,8 @@ function save_raw_data(string $pguser, string $data_name, string $data): void /** @return array */ function get_saved_data(string $pguser, string $filter_type): array { - $data = unserialize(get_raw_saved_data($pguser, "{$filter_type}_data")); + $raw = get_raw_saved_data($pguser, "{$filter_type}_data"); + $data = unserialize($raw, options: ['allowed_classes' => false]); // The raw data "", which we get if there's no saved data for this // user/filter PHP deserializes as false. We need an array. return $data !== false ? $data : []; From 64c11b92d6c61cc874705290b677ebe20f17db2f Mon Sep 17 00:00:00 2001 From: Brian Foley Date: Mon, 26 Oct 2026 15:35:51 +0000 Subject: [PATCH 2/2] tasks.php: Deserialize related_postings from DB more safely. As far as I can tell, only validated user input (arrays of forum posting ID integers) is serialized into the DB, but out of an abundance of caution, only allow primitive types to be deserialized to avoid PHP unserialize() security issues. --- tasks.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks.php b/tasks.php index 250b73658..efdc1688b 100644 --- a/tasks.php +++ b/tasks.php @@ -1051,7 +1051,8 @@ function encode_array(array $a): string */ function decode_array(string $str): array { - $a = unserialize(base64_decode($str)); + $raw = base64_decode($str); + $a = unserialize($raw, options: ['allowed_classes' => false]); if (is_array($a)) { return $a; }