@@ -348,6 +348,11 @@ public function matchParameterValue($match, $value)
348348 return @stripos ($ value , $ matchValue ) === false ;
349349 }
350350
351+ // If a scalar contains single or double quotes.
352+ if (($ matchType == 'quotes ' || $ matchType == 'inline_js_xss ' ) && is_scalar ($ value )) {
353+ return @stripos ($ value , '" ' ) !== false || @stripos ($ value , "' " ) !== false ;
354+ }
355+
351356 // If a string matches a regular expression.
352357 if ($ matchType == 'regex ' && is_string ($ matchValue ) && is_scalar ($ value )) {
353358 return @preg_match ($ matchValue , @urldecode ($ value )) === 1 ;
@@ -400,7 +405,7 @@ public function matchParameterValue($match, $value)
400405 }
401406
402407 // We only care about the hostname.
403- $ host = parse_url ($ value , PHP_URL_HOST );
408+ $ host = @ parse_url ($ value , PHP_URL_HOST );
404409 if (!$ host ) {
405410 return true ;
406411 }
@@ -441,6 +446,24 @@ public function matchParameterValue($match, $value)
441446 return $ this ->matchParameterValue ($ match ['match ' ], $ contents );
442447 }
443448
449+ // If a scalar passes a run through wp_kses_post.
450+ if ($ matchType == 'general_xss ' && is_scalar ($ value ) && function_exists ('wp_kses_post ' )) {
451+ return $ value != @wp_kses_post ($ value );
452+ }
453+
454+ // If a scalar passes a run through inline_js_xss.
455+ if ($ matchType == 'inline_xss ' && is_scalar ($ value )) {
456+ if (@stripos ($ value , '" ' ) === false && @stripos ($ value , "' " ) === false ) {
457+ return false ;
458+ }
459+
460+ if (@stripos ($ value , '> ' ) !== false || @stripos ($ value , '= ' ) !== false ) {
461+ return true ;
462+ }
463+
464+ return false ;
465+ }
466+
444467 return false ;
445468 }
446469
0 commit comments