note 89567 added to reserved.variables.server
| From: | VladimirKornea at osu1 dot php dot net | Date: | Sat, 14 Mar 2009 01:06:00 +0000 |
| Subject: | note 89567 added to reserved.variables.server | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-151857@lists.php.net to get a copy of this message | ||
1. All elements of the $_SERVER array whose keys begin with 'HTTP_' come from HTTP request
headers and are not to be trusted.
2. All HTTP headers sent to the script are made available through the $_SERVER array, with names
prefixed by 'HTTP_'.
3. $_SERVER['PHP_SELF'] is dangerous if misused. If login.php/nearly_arbitrary_string is
requested, $_SERVER['PHP_SELF'] will contain not just login.php, but the entire
login.php/nearly_arbitrary_string. If you've printed $_SERVER['PHP_SELF'] as the
value of the action attribute of your form tag without performing HTML encoding, an attacker can
perform XSS attacks by offering users a link to your site such as this:
<a href='http://www.example.com/login.php/"><script
type="text/javascript">...</script><span
a="'>Example.com</a>
The javascript block would define an event handler function and bind it to the form's submit
event. This event handler would load via an <img> tag an external file, with the submitted
username and password as parameters.
Use $_SERVER['SCRIPT_NAME'] instead of $_SERVER['PHP_SELF']. HTML encode every
string sent to the browser that should not be interpreted as HTML, unless you are absolutely certain
that it cannot contain anything that the browser can interpret as HTML.
----
Server IP: 64.71.164.2
Probable Submitter: 65.106.184.147
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.server.php
Edit -- https://master.php.net/note/edit/89567
Del: integrated -- https://master.php.net/note/delete/89567/integrated
Del: useless -- https://master.php.net/note/delete/89567/useless
Del: bad code -- https://master.php.net/note/delete/89567/bad+code
Del: spam -- https://master.php.net/note/delete/89567/spam
Del: non-english -- https://master.php.net/note/delete/89567/non-english
Del: in docs -- https://master.php.net/note/delete/89567/in+docs
Del: other reasons-- https://master.php.net/note/delete/89567
Reject -- https://master.php.net/note/reject/89567
Search -- https://master.php.net/manage/user-notes.php