|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesfix-73910 (last revision 2017-01-12 01:05 UTC by cmb@php.net)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-01-12 00:09 UTC] cmb@php.net
-Package: zip
+Package: Zip Related
[2017-01-12 00:52 UTC] cmb@php.net
-Summary: Missing null byte checks for paths in
ZipArchive -> extractTo
+Summary: Missing null byte checks for paths in
ZipArchive::extractTo
-Status: Open
+Status: Verified
-PHP Version: 7.1.0
+PHP Version: 5.6.29
[2017-01-12 01:05 UTC] cmb@php.net
[2017-01-12 01:31 UTC] cmb@php.net
-Operating System: BSD
+Operating System: *
[2017-01-16 01:36 UTC] stas@php.net
-Status: Verified
+Status: Closed
-Type: Security
+Type: Bug
-Assigned To:
+Assigned To: stas
[2017-01-16 01:36 UTC] stas@php.net
[2017-01-16 07:05 UTC] max at cert dot cx
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 00:00:01 2025 UTC |
Description: ------------ ZipArchive->extractTo() doesn’t ensure that pathnames lack NULL byte, which might allow attacker to manipulate the directory path. Affected method: ------------------------------------------ static ZIPARCHIVE_METHOD(extractTo) { struct zip *intern; zval *self = getThis(); zval *zval_files = NULL; zval *zval_file = NULL; php_stream_statbuf ssb ;.. if (!self) { RETURN_FALSE; } if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z", &pathto, &pathto_len, &zval_files) == FAILURE) { return; } if (pathto_len < 1) { RETURN_FALSE; } ------------------------------------------ Test script: --------------- <?php if(file_exists("LEVELA/EXTRACTED__HERE")) echo "LEVELA/EXTRACTED__HERE EXISTS!!!1\n"; if(file_exists("LEVELA/LEVELB/EXTRACTED__HERE")) echo "LEVELB/EXTRACTED__HERE EXISTS!!!2\n"; $zip = new ZipArchive; if ($zip->open('toPack/EXTRACTED__HERE.zip') === TRUE) { $zip->extractTo("./LEVELA/\0LEVELB"); $zip->close(); echo "ok\n"; } else { echo "failed\n"; } if(file_exists("LEVELA/EXTRACTED__HERE")) echo "LEVELA/EXTRACTED__HERE EXISTS!!!3\n"; if(file_exists("LEVELA/LEVELB/EXTRACTED__HERE")) echo "LEVELB/EXTRACTED__HERE EXISTS!!!4\n"; ?> Expected result: ---------------- expected parameter not string Actual result: -------------- # php zip.php ok LEVELA/EXTRACTED__HERE EXISTS!!!3