如下php代码<?phperror_reporting(0);
$name = $_GET["name"];?><input id="text" type="text" value="<?php echo $name;?>" />
<div id="print"></div><script type="text/javascript">var text = document.getElementById("text");
var print = document.getElementById("print");
print.innerHTML = text.value; // 获取 text的值,并且输出在print内。这里是导致xss的主要原因。</script>为什么会有两种不同情况?chrome 55版本http://localhost/test/?name=<script>alert(1)</script>//失败http://localhost/test/?name=<img src=1 onerror=alert(1)>//成功
添加回答
举报
0/150
提交
取消