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

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

javascriptスキームのXSS

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

<div class="box">
<form method="get" action="">enter url
<input name="url" type="text">
<input type="submit">
</form>
</div>
<?php
echo "<h1><a href=\"".htmlspecialchars(filter_input(INPUT_GET, 'url'), ENT_QUOTES, 'UTF-8')."\">link</a></h1>";
?>

攻撃方法

xss-06.php?url=javascript:alert(1)

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