.NET:XmlReaderSettings 中 ProhibitDtd 属性的用途是什么?为什么 DTD 是一个安全问题?

发布于 2024-08-27 06:56:42 字数 497 浏览 0 评论 0原文

文档说:

设置为 true 时,XmlReader 在遇到任何 DTD 内容时都会引发 XmlException。 如果您担心拒绝服务问题或正在处理不受信任的来源,请不要启用 DTD 处理。

如果启用了 DTD 处理,则可以使用 XmlSecureResolver 来限制 XmlReader 可以访问的资源。您还可以设计应用程序,使 XML 处理受到内存和时间的限制。例如,在 ASP.NET 应用程序中配置超时限制。

有人可以解释一下这个问题吗?

为什么读取器应用程序想要禁止检索 DTD?如果是阅读应用程序,拒绝服务问题在哪里?这里提到的“信任”问题是什么?

谢谢

The documentation says:

When set to true, the XmlReader throws an XmlException when any DTD content is encountered. Do not enable DTD processing if you are concerned about Denial of Service issues or if you are dealing with untrusted sources.

If you have DTD processing enabled, you can use the XmlSecureResolver to restrict the resources that the XmlReader can access. You can also design your application so that the XML processing is memory and time constrained. For example, configure time-out limits in your ASP.NET application.

Can someone please explain the issue?

Why would a reader application want to prohibit the retrieval of a DTD? Where is the denial-of-service issue, if it is a reading application? What is the "trust" issue that is mentioned?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

裂开嘴轻声笑有多痛 2024-09-03 06:56:42

请查看 MSDN 杂志,其中解释了与 DTD 相关的攻击。总之,我们可以创建一个相对较短的 XML 文件,当该文件由于 DTD 而扩展时,会消耗大量 MB 的 RAM,从而导致处理机资源不足。

Have a look at MSDN Magazine which explains the attack related to DTD. In summary, one can create a relatively short XML file which, when expanded because of the DTD, consumes lots of MB of RAM, starving the processing machine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文