php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19604 source.php has major security vulnerability
Submitted: 2002-09-25 17:54 UTC Modified: 2002-09-25 18:00 UTC
From: h3h at h3h dot net Assigned:
Status: Not a bug Package: Website problem
PHP Version: 4.2.3 OS: Windows 2000 SP3
Private report: No CVE-ID: None
 [2002-09-25 17:54 UTC] h3h at h3h dot net
As I was writing my own source.php script, to basically accomplish the same task as the source.php file on php.net, I noticed a significant vulnerability that was present on my system using this approach. In UNIX and Windows, ../ can be used to access the parent directory of the current working directory. Using this methodology, I was able to transcend above my web directory where the source.php file resides and into protected system files that should not otherwise be accessed. I tried to duplicate this behavior with the source.php script on php.net and was successful. I believe that by continuing to use an arbitrary amount of '../' blocks in the url, any file currently on the server within the web server's permissions can be accessed without authorization. Case in point:
http://www.php.net/source.php?url=../.htaccess
With that simple url, I have gained access to the .htaccess file that resides above the root web directory of php.net.
In my implementation of source.php, I simply checked for any occurence of '..' and denied access accordingly. There may be other exploitable commands along with this, however this is the only one that comes to mind.
My Source: http://h3h.ath.cx/source.php?file=source.php
I hope this comes as a constructive bug report. Thanks.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-25 18:00 UTC] imajes@php.net
if you had read the source this just isn't a problem... we don't allow stuff outside of the docroot to be viewed.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Nov 30 14:05:55 2022 UTC