投稿

2月, 2010の投稿を表示しています

XSSって怖ぇ~~

とあるサイトでXSSができてしまうことを偶然発見しました。 ところが普段私が使ってるChromeだとブロックしてくれるらしく、スクリプトの実行まではされませんでした。そこで他のブラウザではどうなってるのだろうと思って調べてみました。 検索窓などを想定したXSSぜい弱性のあるPHPコード <?php function xssPrint($post_name){ if($_POST[$post_name] == '') return; $text =mb_convert_encoding($_POST[$post_name],"UTF-8","auto"); if(get_magic_quotes_gpc()) $text= stripslashes($text); print $text; } function xssPrint2($post_name){ if($_GET[$post_name] == '') return; $text =urldecode(mb_convert_encoding($_GET[$post_name],"UTF-8","auto")); if(get_magic_quotes_gpc()) $text= stripslashes($text); print $text; } ?> <html> <head><title>XSS test</title></head> <form name="form" method="post" action="XSS.php"> Fromで送信するタイプ <input ype="text" name="xss1" value="<?php xssPrint('xss1');?>" ><br /> URL引数で送信するタイプ <input ype="text" name="xss2"