Skip to content

Commit 394f034

Browse files
authored
Merge pull request #403 from InstaWP/86cxc2djx-fix-pop-chain-vulnerability
Fixed secured unserialized data handling
2 parents fec77f9 + b5debbf commit 394f034

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docs/readme.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ When writing your search string, make sure to wrap your search in forward slashe
4646

4747
== Changelog ==
4848

49+
= 2.6.7 ( beta) =
50+
* Fixed secured unserialized data handling to prevent potential vulnerabilities.
51+
4952
= 2.6.6 (2024-08-21) =
5053
* Fixed missing URL input sanitization.
5154
* Verified compatibility with WordPress 6.6

includes/Extension/SearchReplace/Replace/class-sql.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,14 @@ public function get_edit_url() {
166166
*/
167167
public function recursive_unserialize_replace( $from = '', $to = '', $data = '', $serialised = false ) {
168168
// Some unserialised data cannot be re-serialised eg. SimpleXMLElements.
169+
global $wpdb;
170+
169171
try {
170-
$unserialized = @unserialize( $data );
172+
$unserialized = false;
173+
if ( ! empty( $data ) && ( $wpdb->prefix . 'comments' !== $this->table_name || 'comment_content' !== $this->column_name ) && is_serialized( $data ) ) {
174+
$unserialized = @unserialize( $data, array( 'allowed_classes' => false ) );
175+
}
176+
171177
if ( is_string( $data ) && false !== $unserialized ) {
172178
$data = $this->recursive_unserialize_replace( $from, $to, $unserialized, true );
173179
} elseif ( is_array( $data ) ) {

0 commit comments

Comments
 (0)