duanjiong1952 2013-11-06 11:43
浏览 39
已采纳

如果没有其他用户可以看到未转义的用户输入,是否安全?

There is a web page that has a <textarea>.

You can type any text into that <textarea> and if you hit submit whatever you have typed get rendered on the screen. If you type <script>alert('hello')</script> and hit submit you would get that alert.

The web page doesn't store the typed text so your input could not get rendered on other clients (browsers of other users).

Does the described behavior introduce security risks for the web page owner or its users?

  • 写回答

3条回答 默认 最新

  • dongyuan1870 2013-11-06 11:55
    关注

    Even if the form is never submitted to the server, there are still risks with doing this. The main risk that I see here is if the input field can be populated by an external site.

    Consider a hacker's site can post to your form, and pre-fill it with arbitrary javascript code.

    He could send any JS code he likes, so that could include code that loads other external resources. Anything....

    • It could completely overwrite your page design to mimic that of another site, for a phishing attack. (which means that when it's discovered your site is the one that gets blocked, and not his)

    • It could use your site as a launch pad for sending spam. (ditto for getting blocked, and you really don't want to end up on a spam blacklist)

    • It could leave your site apparently unchanged, but embed a malicious library that tracks the user or exploits a vulnerability on the browser. (hackers often go to great lengths to inject a JS include into a site; here you're giving them an open door for it)

    The trouble with web security is that it is an extremely broad subject -- there are so many possible ways to get hacked and so many angles you need to cover. Ultimately the only way you can keep safe is by exercising best practices at all times; even when you don't see an immediate way for data to be expolited, you should still secure it because ultimately hackers rely on the exploits that we don't see.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大