为了账号安全,请及时绑定邮箱和手机立即绑定

xss 脚本攻击问题

xss 脚本攻击问题

呼唤远方 2018-10-25 22:15:14
如下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)>//成功
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 596 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号