dsiy62758 2017-04-24 11:52
浏览 315

为什么这个xss不起作用

I am just trying to exercise on xss and I want the alert box to pop up on echo which should work on echo. I am doing exercises based on concepts and hier I have a wrong usage of htmlspecialchars, which is vulnerable to xss. However this is not really working and I don't get why. here is my code

$name=htmlspecialchars($_GET['myname']);


echo "<HTML><body>";        
echo '<form action="">';
echo "name: <input type='text' name='myname' ><br>";

echo "<input type='submit' ></form>";

echo $name; // here I want the xss to execute a popup box

echo "</HTML></body>";

The input script looks like this.

<script>alert();</script>

I have also tried many alternatives. The script is displayed as I typed it and there is not alert box.

  • 写回答

2条回答 默认 最新

  • doujiao9866 2017-04-24 12:44
    关注

    I am doing exercises based on concepts and hier I have a wrong usage of htmlspecialchars, which is vulnerable to xss.

    You don't, though. You've used htmlspecialchars exactly as it's supposed to be used, and are thus protected against XSS here.

    评论

报告相同问题?

悬赏问题

  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多