|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-08-02 11:36 UTC] judas dot iscariote at gmail dot com
Description: ------------ the "Example 12.11. More complex form variables" in http://php.net/manual/en/language.variables.external.php contains a security hole. Reproduce code: --------------- says: echo '<a href="'. $_SERVER['PHP_SELF'] .'">Please try again</a>'; <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> as well print_r($_POST)... Expected result: ---------------- manual teaching good practices always, PHP_SELF escaped as well $_POST not printed without escaping Actual result: -------------- a how to permit XSS in your code. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 04:00:01 2025 UTC |
This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. <?php if ($_POST) { echo '<pre>'; echo htmlspecialchars(print_r($_POST, true)); echo '</pre>'; } ?> <form action="" method="post"> Name: <input type="text" name="personal[name]" /><br /> Email: <input type="text" name="personal[email]" /><br /> Beer: <br /> <select multiple name="beer[]"> <option value="warthog">Warthog</option> <option value="guinness">Guinness</option> <option value="stuttgarter">Stuttgarter Schwabenbr嵼/option> </select><br /> <input type="submit" value="submit me!" /> </form>