<div dir="rtl">This is a case of poor-programming, on the script coder&#39;s part, it is not so<br>much a vunerability.<br><br>That variable only contains what it is sent by apache. it doesn&#39;t parse it.<br>nor is it supposed to. If you want to ensure there is no XSS going on, parse
<br>the variable, escape characters, etc as it IS user input.<br><br>This CAN be a vulnerability with individual scripts, however, it is not a vuln<br>with PHP or Apache.<br><br>On Monday 23 April 2007 17:31, Michal Majchrowicz wrote:
<br>&gt; There exist a flaw in a way how Apache and php combination handle the<br>&gt; $_SERVER array.<br>&gt; If the programmer writes scrip like this:<br>&gt; &lt;?php<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo $_SERVER[&#39;REQUEST_METHOD&#39;];
<br>&gt; ?&gt;<br>&gt; He will assume that REQUEST_METHOD can only by: GET,POST,OPTIONS,TRACE<br>&gt; and all that stuff. However this is not true, since Apache accepts<br>&gt; requests that look like this:<br>&gt; GET&lt;script&gt;alert(
document.coookie);&lt;/script&gt; /test.php HTTP/1.0<br>&gt; And the output for this would be:<br>&gt; GET&lt;script&gt;alert(document.coookie);&lt;/script&gt;<br>&gt; Of course it is hard to exploit (I think some Flash might help ;)) and
<br>&gt; I don&#39;t know if it is exploitable at all. But programmers should be<br>&gt; warned about this behaviour. You can&#39;t trust any &nbsp;variable in the<br>&gt; $_SERVER table!<br>&gt; Regards Michal Majchrowicz.<br>
&gt;<br><br><br>
<div><span class="gmail_quote">2007/4/24, Micha³ Majchrowicz &lt;<a href="mailto:mmajchrowicz@gmail.com">mmajchrowicz@gmail.com</a>&gt;:</span>
<blockquote class="gmail_quote" style="BORDER-RIGHT: #ccc 1px solid; PADDING-RIGHT: 1ex; PADDING-LEFT: 1ex; MARGIN: 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>I agree. But (as a programmer) would you assume that there can be such
<br>things in the REQUEST_METHOD? The flaw is that Apache accepts anything<br>after the valid request i.e. GET. There should be an error the the<br>request was not correct.<br>Regards Michal.<br><br>On 4/24/07, Kradorex Xeron &lt;
<a href="mailto:admin@digibase.ca">admin@digibase.ca</a>&gt; wrote:<br>&gt; This is a case of poor-programming, on the script coder&#39;s part, it is not so<br>&gt; much a vunerability.<br>&gt;<br>&gt; That variable only contains what it is sent by apache. it doesn&#39;t parse it.
<br>&gt; nor is it supposed to. If you want to ensure there is no XSS going on, parse<br>&gt; the variable, escape characters, etc as it IS user input.<br>&gt;<br>&gt; This CAN be a vulnerability with individual scripts, however, it is not a vuln
<br>&gt; with PHP or Apache.<br>&gt;<br>&gt; On Monday 23 April 2007 17:31, Michal Majchrowicz wrote:<br>&gt; &gt; There exist a flaw in a way how Apache and php combination handle the<br>&gt; &gt; $_SERVER array.<br>&gt; &gt; If the programmer writes scrip like this:
<br>&gt; &gt; &lt;?php<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo $_SERVER[&#39;REQUEST_METHOD&#39;];<br>&gt; &gt; ?&gt;<br>&gt; &gt; He will assume that REQUEST_METHOD can only by: GET,POST,OPTIONS,TRACE<br>&gt; &gt; and all that stuff. However this is not true, since Apache accepts
<br>&gt; &gt; requests that look like this:<br>&gt; &gt; GET&lt;script&gt;alert(document.coookie);&lt;/script&gt; /test.php HTTP/1.0<br>&gt; &gt; And the output for this would be:<br>&gt; &gt; GET&lt;script&gt;alert(document.coookie
);&lt;/script&gt;<br>&gt; &gt; Of course it is hard to exploit (I think some Flash might help ;)) and<br>&gt; &gt; I don&#39;t know if it is exploitable at all. But programmers should be<br>&gt; &gt; warned about this behaviour. You can&#39;t trust any&nbsp;&nbsp;variable in the
<br>&gt; &gt; $_SERVER table!<br>&gt; &gt; Regards Michal Majchrowicz.<br>&gt; &gt;<br>&gt; &gt; _______________________________________________<br>&gt; &gt; Full-Disclosure - We believe in it.<br>&gt; &gt; Charter: <a href="http://lists.grok.org.uk/full-disclosure-charter.html">
http://lists.grok.org.uk/full-disclosure-charter.html</a><br>&gt; &gt; Hosted and sponsored by Secunia - <a href="http://secunia.com/">http://secunia.com/</a><br>&gt;<br>&gt; _______________________________________________
<br>&gt; Full-Disclosure - We believe in it.<br>&gt; Charter: <a href="http://lists.grok.org.uk/full-disclosure-charter.html">http://lists.grok.org.uk/full-disclosure-charter.html</a><br>&gt; Hosted and sponsored by Secunia - 
<a href="http://secunia.com/">http://secunia.com/</a><br>&gt;<br><br>_______________________________________________<br>Full-Disclosure - We believe in it.<br>Charter: <a href="http://lists.grok.org.uk/full-disclosure-charter.html">
http://lists.grok.org.uk/full-disclosure-charter.html</a><br>Hosted and sponsored by Secunia - <a href="http://secunia.com/">http://secunia.com/</a><br></blockquote></div><br></div>