Bug #68773 [Opn->Nab]: basename function does not check non-minimum UTF-8 forms
| From: | cmb@php.net | Date: | Sun, 02 Aug 2015 20:27:11 +0000 |
| Subject: | Bug #68773 [Opn->Nab]: basename function does not check non-minimum UTF-8 forms | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-194911@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68773&edit=1
ID: 68773
Updated by: cmb@php.net
Reported by: php at tokumaru dot org
Summary: basename function does not check non-minimum UTF-8
forms
-Status: Open
+Status: Not a bug
Type: Bug
Package: Filesystem function related
Operating System: Ubuntu
PHP Version: 5.6.4
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
basename() is supposed to strip away leading path components, but
not to validate/sanitize the given parameter.
Previous Comments:
------------------------------------------------------------------------
[2015-01-09 06:21:11] php at tokumaru dot org
Description:
------------
Function basename does not check invalid multibyte strings.
For example, non-minimum UTF-8 forms are treated as normal file names.
This is a potential path-traversal vulnerability like CVE-2008-2938.
Test script:
---------------
setlocale('LC_CTYPE', 'en_US.utf8');
var_dump(bin2hex(basename("..\xC0\xAFx"))); // \xC0\xAF is a non-minimum UTF-8 form of
'/'
Expected result:
----------------
string(2) "78"
OR
string(0) ""
Actual result:
--------------
string(10) "2e2ec0af78"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68773&edit=1