pnp4nagios icon indicating copy to clipboard operation
pnp4nagios copied to clipboard

Disallowed key characters in global data

Open emjga opened this issue 9 years ago • 1 comments

Folks

Come across an odd issue that is a result of a cookie file not been correct in pnp4nagios (version 0.6.25)

I get the error "Disallowed key characters in global data."

The File pnp4nagios/lib/kohana/system/libraries/Input.php has the following code /** * This is a helper method. It enforces W3C specifications for allowed * key name strings, to prevent malicious exploitation. * * @param string string to clean * @return string */ public function clean_input_keys($str) { $chars = PCRE_UNICODE_PROPERTIES ? '\pL' : 'a-zA-Z';

            if ( ! preg_match('#^['.$chars.'0-9:_.-]++$#uD', $str))
            {
                    exit('Disallowed key characters in global data.');
            }

            return $str;
    }

I changed the line to show the affected cookie exit('Disallowed key characters in global data.' .$str);

This showed the cookie AMCV_B7FA08E5529E27690A490D4D@...

Changed line if ( ! preg_match('#^['.$chars.'0-9:_.-]++$#uD', $str))

To include @ and problem solved if ( ! preg_match('#^['.$chars.'0-9:_.-@]++$#uD', $str))

Note there may well be other characters allowed in the RFC Spec http://stackoverflow.com/questions/1969232/allowed-characters-in-cookies

emjga avatar Jan 14 '16 17:01 emjga

Clearing cookies helped for me...

amenk avatar Jun 20 '22 09:06 amenk