【问题标题】:Output Encoding security issue in ASP.NET Web FormsASP.NET Web 窗体中的输出编码安全问题
【发布时间】:2021-02-23 00:40:37
【问题描述】:

我正在处理一些使用 ASP.NET Webforms 创建的旧版 Web 应用程序,这些应用程序正在使用 Trustwave 进行扫描。我们正在使用 .NET Framework 4.6。

扫描报告显示我们有一个输出编码问题,这里有一些细节:

Types of encoding detected:
URL encoding

Unencoded injection string: **CENZIC123 !"#$%&'()*+,-./:;<=>?@[]^_`{|}~\CENZIC456**

Characters that were not encoded in the detection string: !()*-._~
Characters that should have been encoded for URL encoding: ****!()~****

Injection URI: https://mywebsite/Authentication/Login.aspx?CENZIC123%20!%22%23%24%25%26'()*%2B%2C-.%2F%3A%3B%3C%3D%3E%3F%40%5B%5D%5E_%60%7B%7C%7D~%5CCENZIC456

我已尝试通过将默认 HTTP 编码器更改为我的 Web.Config 内的 HTTP 运行时节点中的 AntiXss 编码器来解决此问题,正如 Microsoft 文档所建议的那样。但我仍然在扫描中报告了这个问题。

我应该怎么做才能解决这个问题?

谢谢。

https://docs.microsoft.com/en-us/dotnet/api/system.web.security.antixss.antixssencoder?view=netframework-4.8

【问题讨论】:

    标签: asp.net owasp websecurity


    【解决方案1】:

    我遇到了与您的问题有些相似的问题。网关阻止了查询字符串中包含 ' 的请求。这与您的网站设置不太相关,由安全扫描程序报告。

    我们的解决方案是将查询字符串编码为Base64,网关不再进行块请求。在客户端,您可以使用 btoa(encodeURIComponent(...)) 将该字符串编码为 base64 编码。在服务器端,Convert.FromBase64String(HttpUtility.UrlDecode(base64String)) 会将其转换回来。

    【讨论】:

      猜你喜欢
      • 2012-01-23
      • 2016-11-12
      • 2015-03-25
      • 1970-01-01
      • 2012-09-23
      • 2019-05-22
      • 1970-01-01
      • 1970-01-01
      • 2017-08-28
      相关资源
      最近更新 更多