|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-08-03 16:00 UTC] sander@php.net
[2002-08-03 16:11 UTC] mattmurphy at kc dot rr dot com
[2002-08-03 16:17 UTC] cynic@php.net
[2002-08-03 16:22 UTC] mattmurphy at kc dot rr dot com
[2002-08-03 16:23 UTC] mattmurphy at kc dot rr dot com
[2002-08-03 16:27 UTC] msopacua at idg dot nl
[2002-08-03 16:28 UTC] eru@php.net
[2002-08-03 16:29 UTC] cynic@php.net
[2002-08-03 16:30 UTC] cynic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 13 05:00:01 2025 UTC |
This applies to any PHP script that opens files based on some kind of user-input inserted into the file name. If the file open fails, PHP returns a warning. In that warning is the file name that was input. If the user-input were to contain a specially crafted piece of data, arbitrary code could be executed: <?php $handle = fopen("C:\\INETPUB\\WWWROOT\\" . $_GET["resource"], "rb"); ?> http://localhost/fopen.php?resource={SCRIPT}alert('xss'){/SCRIPT} Replace "{" with "<" and "}" with ">" and you are ready to go. When you hit the enter key, the browser urlencodes the malicious string, and PHP attempts to open the file, resulting in the vulnerability. Solution fopen() should *not* return the file name in raw form to the browser.