Doc #81604 [Opn->Csd]: Parse_url wrong hostname detection
| From: | git@php.net | Date: | Thu, 11 Nov 2021 12:01:15 +0000 |
| Subject: | Doc #81604 [Opn->Csd]: Parse_url wrong hostname detection | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-19327@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81604&edit=1
ID: 81604
Updated by: git@php.net
Reported by: noahcore95 at gmail dot com
Summary: Parse_url wrong hostname detection
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: *URL Functions
Operating System: Linux
PHP Version: 7.4.25
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmb69
Revision: https://github.com/php/doc-en/commit/57f4d8e58f5a0e95cf3c0ee1a14fbc30cb4114d7
Log: Fix #81604: Parse_url wrong hostname detection
Previous Comments:
------------------------------------------------------------------------
[2021-11-09 16:07:58] cmb@php.net
This is an invalid URI, since the host must not be empty[1].
According to the documentation[2]:
| Partial and invalid URLs are also accepted, parse_url() tries
| its best to parse them correctly.
There is no claim that this best effort matches common browser
behavior. However, the documentation should be improved to make it
clear that at least untrusted input should be checked with
FILTER_VALIDATE_URL, which reports this URI as invalid[3] due to
the fix for bug #81122.
[1] <https://datatracker.ietf.org/doc/html/rfc3986#appendix-A>
[2] <https://www.php.net/parse_url>
[3] <https://3v4l.org/6ed54>
------------------------------------------------------------------------
[2021-11-09 13:29:38] noahcore95 at gmail dot com
Description:
------------
Parse_url usage may lead to open redirect vulnerability. Firefox and Chrome opens google.com instead
of php.net.
Test script:
---------------
<?php
$x= 'https://:@google.com\@php.net';
print_r(parse_url($x));
Expected result:
----------------
Array
(
[scheme] => https
[host] => google.com
[user] =>
[pass] => ?
)
Actual result:
--------------
Array
(
[scheme] => https
[host] => php.net
[user] =>
[pass] => @google.com\
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81604&edit=1