|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2018-09-02 10:58 UTC] cmb@php.net
 
-Assigned To:
+Assigned To: stas
  [2018-09-02 10:58 UTC] cmb@php.net
  [2018-09-09 18:44 UTC] stas@php.net
 
-Type:        Security
+Type:        Feature/Change Request
-Assigned To: stas
+Assigned To: cmb
  [2018-09-09 18:44 UTC] stas@php.net
  [2018-12-16 13:02 UTC] cmb@php.net
 
-Status:      Assigned
+Status:      Suspended
-Package:     Unknown/Other Function
+Package:     Streams related
-Assigned To: cmb
+Assigned To:
  [2018-12-16 13:02 UTC] cmb@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 16:00:01 2025 UTC | 
Description: ------------ When file_get_contents("file://google.com/"); is executed The following error is displayed: Warning: file_get_contents(): remote host file access not supported, file://google.com/ in Command line code on line 1 Warning: file_get_contents(file://google.com/): failed to open stream: no suitable wrapper could be found in Command line code on line 1 This behavior is explained at the following URL and you can see that file:// does not support relative path specification: https://bugs.php.net/bug.php?id=28820 However, file_get_contents("0://google.com/../../../../../etc/hosts"); is executed The following error is displayed: 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters 172.17.0.3 ee151a077be0 Although file:// does not support relative path specification in this operation, 0:// can read the local file with relative path specification. It seems that pass traversal is made by bypassing the filter. Test script: --------------- php -r "file_get_contents('file://google.com/../../../../../etc/hosts');" php -r "file_get_contents('0://google.com/../../../../../etc/hosts');" Expected result: ---------------- If an unrecognized protocol is input as an argument of file_get_contents (), appropriate error handling is performed. Actual result: -------------- When file://google.com/../../../../../etc/hosts: Warning: file_get_contents(): remote host file access not supported, file://google.com/../../../../../etc/hosts in Command line code on line 1 Warning: file_get_contents(file://google.com/../../../../../etc/hosts): failed to open stream: no suitable wrapper could be found in Command line code on line 1 When 0://google.com/../../../../../etc/hosts: 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters 172.17.0.3 ee151a077be0