Security Bug in PHP 5.3.6

22 August 2011
As SANS is reporting at http://isc.sans.edu/diary.html?storyid=11413 there is an issue with PHP 5.3.7 that could have security implications. I was able to confirm this bug report. However, while this bug is problematic, it is only reported to affect the crypt() function (http://php.net/manual/en/function.crypt.php), and not in any sort of exploitable compromise kind of way that I can think of (which isn't to say one doesn't exist). The report states there is an issue with the way the crypt function handles MD5 (https://bugs.php.net/bug.php?id=55439). The default algorithm for the crypt function is DES and most PHP programs would probably use the md5() function (http://us2.php.net/manual/en/function.md5.php) instead of the crypt() function to generate an MD5 so I think use in this scenario is an edge case. Normally the function performs an encryption operation with an optional salt. According to the bug report if you call the function, specifying that you want an MD5 return value (determined by the format of the salt), and you pass in a salt, the return value is actually just the salt. If you aren't using a salt, or if you're using another format for the salt, then there isn't an issue. PHP 5.3.7 was released (on August 18th) to address several security issues with earlier 5.3.x releases (including a buffer overflow, a stack overflow, and file path injection vulnerability Ref: http://www.php.net/archive/2011.php#id2011-08-18-1), so if you aren't using the crypt function, or if you aren't using MD5 salts with the crypt function the upgrade might still be worthwhile. However, php.net reports that PHP 5.3.8 is going to be available soon ("expected in few days"). Ref: http://www.php.net/archive/2011.php#id2011-08-22-1