You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We do scan for a get_option() call, get the option and execute the line check again on the value. The return value however can have any type, not only string. Implicit conversion works quite well for most primitives, but fails for objects and arrays.
I am unsure about the intention behind this routine.
So do we need to add some sanitization here? Allow only scalar types that convert to string? Stringify the value? Personally I would simply drop the options check.
The text was updated successfully, but these errors were encountered:
I tried to resolve the problem introducing a is_scalar (is_string should also do the job, because we do not check for numbers or "true"/"false") filter:
Stumbled across one really bad case. Imagine the following line of code:
$o = get_option( 'endless recursion' );
with the option value (string): get_option( 'endless recursion' )
This call does not cause any damage in the theme without an additional eval() or similar, but it breaks Antivirus causing in infinite loop on the server!
Scalar option values do convert to string, however that no longer
applies to arrays and never did for objects. We now do check for
string values before the recursion to avoid warnings. Allowing other
scalars would not fail, but there is no check matching numbers or
boolean expressions.
Originally reported in the WP support forums: https://wordpress.org/support/topic/php-notice-breaks-scan/
antivirus/inc/class-antivirus-checkinternals.php
Lines 235 to 238 in fbc3614
We do scan for a get_option() call, get the option and execute the line check again on the value. The return value however can have any type, not only string. Implicit conversion works quite well for most primitives, but fails for objects and arrays.
I am unsure about the intention behind this routine.
So do we need to add some sanitization here? Allow only scalar types that convert to string? Stringify the value? Personally I would simply drop the options check.
The text was updated successfully, but these errors were encountered: