PluginProbe
wpForo Forum / 3.2.1
wpForo Forum v3.2.1
3.2.1 3.2.0 3.1.7 3.1.6 3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 All 141 releases
← All changes | classes/PostMeta.php +3 -1 3.1.2 → 3.2.1 View file →
@@ -374,9 +374,11 @@
374 374 if( in_array( $field['type'], [ 'text', 'textarea', 'email', 'search', 'tel' ] ) ) {
375 375 foreach( $value as $v ) $wheres[] = "`metavalue` LIKE '%" . esc_sql( wp_unslash( $v ) ) . "%'";
376 376 } elseif( $field['type'] === 'checkbox' || ( $field['type'] === 'select' && wpfval( $field, 'isMultiChoice' ) ) || ( $field['type'] === 'autocomplete' && wpfval( $field, 'isMultiChoice' ) ) ) {
377 377 foreach( $value as $v ) {
378 - $v = preg_quote( preg_quote( wp_unslash( $v ) ) );
378 + // esc_sql() neutralizes SQL quotes/backslashes; without it an apostrophe breaks
379 + // out of the REGEXP string literal (unauthenticated SQLi).
380 + $v = esc_sql( wpforo_json_regexp_needle( wp_unslash( $v ) ) );
379 381 $wheres[] = "`metavalue` REGEXP '[\\\[,]\"" . $v . "\"[,\\\]]'";
380 382 }
381 383 } else {
382 384 foreach( $value as $v ) $wheres[] = "`metavalue` LIKE '" . esc_sql( wp_unslash( $v ) ) . "'";