Last active
August 29, 2015 14:17
-
-
Save ym405nm/c9449041cad97fc25157 to your computer and use it in GitHub Desktop.
お問い合わせ XSS テスト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>お問い合わせフォーム</title> | |
</head> | |
<body> | |
<h1>お問い合わせフォーム</h1> | |
<div style="background-color:pink"> | |
このフォームにはXSSがひとつあります。発生個所と対策(ソースのここを直す)を指摘してください。 | |
<br><a href="https://gist.github.com/ym405nm/c9449041cad97fc25157">PHPソース</a> | |
</div> | |
<form action="" method="POST"> | |
<p>名前 : <input type="text" name="name"></p> | |
<p>内容 : </p> | |
<textarea name="cont" rows="5" cols="30"> | |
</textarea> | |
<input type="submit" value="送信"> | |
</form> | |
<div> | |
<?php | |
if(array_key_exists ("name", $_POST)){ | |
echo "<hr>\n"; | |
echo htmlspecialchars($_POST["name"], ENT_QUOTES, "UTF-8") . " さん、お問い合わせありがとうござます"; | |
}?> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>お問い合わせフォーム</title> | |
</head> | |
<body> | |
<h1>お問い合わせフォーム</h1> | |
<div style="background-color:pink"> | |
このフォームにはXSSがひとつあります。発生個所と対策(ソースのここを直す)を指摘してください。 | |
<br><a href="">PHPソース</a> | |
</div> | |
<form action="" method="POST"> | |
<p>名前 : <input type="text" name="name"></p> | |
<p>内容 : </p> | |
<textarea name="cont" rows="5" cols="30"> | |
</textarea> | |
<input type="submit" value="送信"> | |
</form> | |
<div> | |
<?php | |
if(array_key_exists ("name", $_POST)){ | |
echo "<hr>\n"; | |
echo $_POST["name"] . " さん、お問い合わせありがとうござます"; | |
}?> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment