File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -53,11 +53,19 @@ public function __serialize()
5353
5454 /**
5555 * Unserializes a sfParameterHolder instance for PHP 7.4+.
56+ * [CVE-2024-28861] Check type of returned data to avoid deserialization vulnerabilities.
5657 *
5758 * @param array $data
5859 */
5960 public function __unserialize ($ data )
6061 {
62+ if (!is_array ($ data ) || 2 !== \count ($ data )) {
63+ $ this ->default_namespace = null ;
64+ $ this ->parameters = [];
65+
66+ return ;
67+ }
68+
6169 $ this ->default_namespace = $ data [0 ];
6270 $ this ->parameters = $ data [1 ];
6371 }
Original file line number Diff line number Diff line change @@ -41,11 +41,18 @@ public function __serialize()
4141
4242 /**
4343 * Unserializes a sfParameterHolder instance for PHP 7.4+.
44+ * [CVE-2024-28861] Check type of returned data to avoid deserialization vulnerabilities.
4445 *
4546 * @param array $data
4647 */
4748 public function __unserialize ($ data )
4849 {
50+ if (!is_array ($ data )) {
51+ $ this ->parameters = [];
52+
53+ return ;
54+ }
55+
4956 $ this ->parameters = $ data ;
5057 }
5158
You can’t perform that action at this time.
0 commit comments