【问题标题】:The XSS Filter modifies contentXSS 过滤器修改内容
【发布时间】:2018-01-23 09:05:31
【问题描述】:

我有 asp.net WEB API 在一个操作中我将 json 字符串放在 url 参数中,例如:

http://example.com?config=%7B%0D%0A%20%20%20%20%22paramete1%22%3A%22value1%22%2C%0D%0A%20%20%20%20%22serverulr%22%3A%22http%2F%2Fexample.com%22%0D%0A%7D

其中配置参数包含编码的 json:

{
    "paramete1":"value1",
    "serverulr":"http//example.com"
} 

在所有浏览器上一切正常,我只遇到 Microsoft edge 和 Internet Explorer 的问题。在控制台中,它显示了下一个:

SEC7130: Potential cross-site scripting detected in 'http://example.com?config=%7B%0D%0A%20%20%20%20%22paramete1%22%3A%22value1%22%2C%0D%0A%20%20%20%20%22serverulr%22%3A%22http%2F%2Fexample.com%22%0D%0A%7D'. The content has been modified by the XSS Filter. 

然后我的 json 如下所示:

{
    "paramete1":"value1",
    "serverulr":"http//example^com"
} 

您知道如何避免这个问题吗?

【问题讨论】:

  • 为什么不用request payload发送json?使用 put 或 post 等动词代替 get
  • 我只能使用获取请求。

标签: asp.net json xss microsoft-edge


【解决方案1】:

我考虑了几种避免这种情况的方法。 首先是添加自定义标头并将此配置放入此标头,但随后我遇到了其他问题,因为在相同的情况下,此 url 必须在 iframe 中使用。 所以我决定把这个值编码成base64,它工作正常。

【讨论】:

    猜你喜欢
    • 2018-01-18
    • 1970-01-01
    • 1970-01-01
    • 2011-09-18
    • 2016-03-11
    • 2014-06-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多