Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ When writing your search string, make sure to wrap your search in forward slashe

== Changelog ==

= 2.6.7 ( beta) =
* Fixed secured unserialized data handling to prevent potential vulnerabilities.

= 2.6.6 (2024-08-21) =
* Fixed missing URL input sanitization.
* Verified compatibility with WordPress 6.6
Expand Down
8 changes: 7 additions & 1 deletion includes/Extension/SearchReplace/Replace/class-sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,14 @@ public function get_edit_url() {
*/
public function recursive_unserialize_replace( $from = '', $to = '', $data = '', $serialised = false ) {
// Some unserialised data cannot be re-serialised eg. SimpleXMLElements.
global $wpdb;

try {
$unserialized = @unserialize( $data );
$unserialized = false;
if ( ! empty( $data ) && ( $wpdb->prefix . 'comments' !== $this->table_name || 'comment_content' !== $this->column_name ) && is_serialized( $data ) ) {
$unserialized = @unserialize( $data, array( 'allowed_classes' => false ) );
}

if ( is_string( $data ) && false !== $unserialized ) {
$data = $this->recursive_unserialize_replace( $from, $to, $unserialized, true );
} elseif ( is_array( $data ) ) {
Expand Down
Loading