|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-07-31 20:37 UTC] ryan at rmauger dot co dot uk
Description: ------------ The paths passed to the imagepng, imagejpeg, imagegif, imagewebp and imagewbmp functions are not validated to not contain null bytes, and as such may allow paths to be prematurely terminated by an attacker. This could be used to overwrite a file in a location other than the intended destination. The attached patch will check for null bytes in the given path, and return false, raising a warning in the event a null byte is encountered. Test script: --------------- phpt tests are included in the patch. Patchesgd-null-injection (last revision 2014-08-04 06:48 UTC by stas@php.net)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 06:00:01 2025 UTC |
Note on 5.3: In 5.3 we already have the check 94 if (strlen(file) != file_len) { 95 RETURN_FALSE; 96 } The issue was introduced with 5.4 while cleaning up stream usage after safe_mode removal. My previous comment on 5.3 can therefore be ignored.