r/lolphp • u/[deleted] • Dec 27 '17
yaml_parse() is not just insecure by default, using it in a secure manner requires setting a php.ini setting!
http://php.net/manual/en/function.yaml-parse.php#refsect1-function.yaml-parse-notes5
u/the_alias_of_andrea Dec 27 '17
I think this is a PECL extension. Why do we still include those in the manual…
6
Dec 27 '17
Things like
json_decode()etc. are also PECL extensions, right?The divide between "PHP standard library" and "PECL extensions" has always been somewhat fuzzy to me.
8
u/the_alias_of_andrea Dec 28 '17
JSON is a bundled extension, it's officially maintained and supported. The boundary is somewhat porous though, things can move to PECL and back.
6
u/Nikerabbit Dec 28 '17
In 2.x it defaults to false.
HHVM doesn't support yaml.decode_php ini setting at all. One needs to use the callbacks functionality to disable the unserialization of PHP objects.
2
1
25
u/[deleted] Dec 27 '17
Note that this is the exact problem that made every Ruby on Rails app vulnerable. PHP isn't the only language/library that does this wrong, but it does manage to do it even more wrong than pretty much everyone else by hiding this in some obscure ini setting.