|
[PHP] $_SERVER['PHP_SELF'] Validation
|
|||
| Author | Message | ||
|
12-18-2007, 01:57 PM
(This post was last modified: 12-18-2007 01:58 PM by Xiao.)
Post: #1
|
|||
|
|||
|
[PHP] $_SERVER['PHP_SELF'] Validation
First: why would I want to validate PHP_SELF?
It's a server side value, so how could it be a security issue? Wrong! It can be altered by the user for XSS (Cross Side Scripting). A lot of people don't know this and would use this for example: PHP Code: <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">http://www.yoursite.com/form.php/%22%3E%3Cscript%3Ealert(’XSS attack!’)%3C/script%3E%3Cbr In your script, that would like this: PHP Code: <form method="post" action="http://www.mysite.com/form.php/">What can I do about it? There are quite some articles about this on the internet, but they rarely give a solution, or say how you can validate PHP_SELF. Well, here's a way: PHP Code: //Get the name of the file (form.php)I'm the only one around here that can ban people, what else do you need to know?
|
|||
« Next Oldest | Next Newest »
|












View a Printable Version
Send this Thread to a Friend
Subscribe to this thread