- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
在Podcast 58 (大约 20 分钟后),Jeff 提示 HTML.Encode()
的问题,Joel 谈到使用类型系统来处理普通字符串和 HTMLStrings:
A brief political rant about the evil of view engines that fail to HTMLencode by default. The problem withthis design choice is that it is not“safe by default”, which is always thewrong choice for a framework or API.Forget to encode some bit ofuser-entered data in one singlestinking place in your web app, andyou will be totally owned with XSS.Believe it. I know because it’shappened to us. Multiple times!
Joel maintains that, with a strongly-typed language and the rightframework, it’s possible (in theory)to completely eliminate XSS — thiswould require using a specific datatype, a type that is your only way tosend data to the browser. That datatype would be validated at compiletime.
博文中的评论提到使用静态分析来发现潜在的弱点。 transcript Wiki还没有完成。
是否可以在没有新的 ASP.NET 框架的情况下实现 Joel 的建议?
是否可以简单地通过子类化每个控件并强制实现基于 HTMLString 的新接口(interface)来实现它?如果大多数人已经将控件子类化以便能够更好地注入(inject)特定于站点的功能,那么这不是很容易实现吗?
这样做而不是投资于静态分析是否值得?
最佳答案
要在所有地方使用 HtmlString,您基本上必须重写每个 Web 控件的每个属性和方法。 System.String 是密封的,因此您不能对其进行子类化。
一种更简单(但仍然非常耗时)的方法是使用控件适配器将 Web 控件替换为安全的替代品。在这种情况下,您将子类化每个 Web 控件并覆盖 Render 方法以对动态内容进行 HTML 编码。
关于html - 按照 Joel 的建议使用类型系统防止 XSS 攻击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1029118/
我想创建一个游戏,您可以在其中尝试避开“攻击”您的物体(圆圈)。我这样做的方式: 首先计算对象和我之间的 x_and y 差值(在这段代码中 AI_x 是对象的 x 位置(AI_y:y 位置),x,y
前言 传统的 DDOS 防御通常使用“硬抗”的方式,导致开销很大,而且有时效果并不好。例如使用 DNS 切换故障 IP 的方案,由于域名会受到缓存等因素的影响通常有分钟级延时,前端难以快速生效。例
我们目前正在使用 OWASP Antisamy 项目来保护我们的应用程序免受 XSS 攻击。当任何给定的表单提交给服务器时,每个输入字段都会被清理。它工作正常,但我们在公司名称、组织名称等字段上遇到问
正则表达式: ^\d+(\.\d+)*$ 我试图打破它: 1234567890.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.
我正在创建一个网页,用户可以在其中交互并在远程计算机上执行基本的文件系统操作(创建文件/目录、删除文件/目录、导航文件系统)。 该网页是基本的 HTML(UTF-8 编码)和 Javascript。我
两个客户端 Alice 和 Bob 使用服务器登录并通过服务器交换消息。登录时,他们都发送他们的公钥以存储在服务器上。当 Alice 想与 Bob 通话时,她用 Bob 的公钥加密一个对称 key ,
一直在阅读 MitB 攻击,有些事情让我担心。 来自 WIKI : The use of strong authentication tools simply creates an increased
很难说出这里问的是什么。这个问题是模棱两可的、模糊的、不完整的、过于宽泛的或修辞的,无法以目前的形式得到合理的回答。如需帮助澄清这个问题以便重新打开它,visit the help center .
我正在使用 Summernote 所见即所得编辑器(如下所示),发现它使用 HTML 标签来格式化文本。 如何保护我的应用程序免受 XSS 攻击?我将输入存储为纯文本,并使用输出:{!! $body
我有一个应用程序,用户可以在其中注册并输入他们的手机和其他数据。 为了验证用户是否有效,在我将其保存到我的数据库之前,我向用户发送了一 strip 有代码的短信。之后他们应该在表单中输入代码。 问题是
由于 xpath 注入(inject)攻击正在攻击网站,因此我们需要保护 xml 文档作为 xpath 查询参数化的解决方案。如果有人可以解释xpath查询的参数化是什么意思,请帮忙?以及这种参数化如
我想知道电子邮件地址是否可以用于 XSS 攻击。 假设有一个网站,您可以在其中注册并提供他的电子邮件地址。如果有人想攻击给定的网站,他或她可能会创建一个电子邮件地址,例如: ""@stmpname
这可能更适合 Serverfault,但许多只来这里的 web 开发人员可能会从这个问题的可能答案中受益。 问题是:您如何有效地保护自己免受针对您的网络服务器的拒绝服务攻击? 看完这篇 article
检查引荐来源网址是否足以防止跨站点请求伪造攻击?我知道引荐来源网址可能会被欺骗,但是攻击者有没有办法为客户端做到这一点?我知道代币是常态,但这行得通吗? 最佳答案 这是一个 3 年前的问题,有四个不同
我从输入类型中获取值,如下所示: var num = $(document).find('#num').val(); 我尝试使用以下代码来避免输入类型受到 XSS 攻击: num = j
我需要使用超链接动态更新以下代码中的“src”链接,该超链接又指向另一个 .js 文件。以下只是用于“src”的示例 URL。我的问题是,允许在运行时更改“src”,此代码是否容易受到 XSS 攻击?
我在 OWASP 和网络上看到了很多关于如何避免/防止 XSS 攻击的信息。但是,我还没有找到任何提及在检测到 XSS 攻击时如何响应的内容。 应返回什么 HTTP 状态代码(即 400、403...
保护站点免受 DoS 攻击的最佳方法是什么?知道流行的网站/服务如何处理这个问题吗? 应用程序、操作系统、网络、托管级别有哪些工具/服务? 如果有人能分享他们处理过的真实经历,那就太好了。 谢谢 最佳
我到处寻找缓解方法 this vulnerability ,我发现类似: Just disable http compression. 嗯,这很痛苦,因为压缩可以节省大量带宽,而且还可以让您的网页加载
服务器,一个运行 Spring 2.5.6 的独立 SE 应用程序和一个嵌入式 jetty 。客户端、Swing 应用程序使用 HttpInvoker 连接到服务器。 服务器公开了很多服务,现在出现了
我是一名优秀的程序员,十分优秀!