开发人员是否应该更新 _vti_bin/lists.asmx 和 _vti_bin/copy.asmx?

问题描述

我们收到了安全团队的评论

对于:_vti_bin/copy.asmx

影响 处理 XML 文档的计算成本可能很高。攻击者可以通过向应用程序提供大量元素导致应用程序耗尽系统资源来利用允许无限元素的模式。 以下是允许无界条形元素的架构示例。

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >
<xs:element name="foo" >
<xs:complexType>
<xs:sequence>
<xs:element name="bar" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

建议 将 maxOccurs 限制为一个合理的数字。 以下是允许 50 个条形元素的架构示例。

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >
<xs:element name="foo" >
<xs:complexType>
<xs:sequence>
<xs:element name="bar" maxOccurs="50" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

对于:_vti_bin/lists.asmx

影响 该元素意味着可以在有效文档中包含任意标签。允许任意内容使攻击者更容易执行 XML 注入等攻击。 示例 1:假设您正在使用以下架构进行验证。

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="cart" >
<xs:complexType>
<xs:sequence>
<xs:element name="itemID" maxOccurs="1" />
<xs:element name="price" maxOccurs="1" />
<xs:element name="description" maxOccurs="1"/>
<xs:any minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="description" type="xs:string"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="price" type="xs:decimal"/>
<xs:element name="code" type="xs:string"/>
</xs:schema>

由于此架构使用该元素,因此以下 XML 文档将被视为有效。

<?xml version=\"1.0\" ?>
<cart>
<itemID>123</itemID>
<price>50.00</price>
<price>1.0</price>
</cart>

这在使用 SAX 解析器时尤其危险,因为后面的节点会覆盖以前的节点。

建议 明确定义允许的元素而不是使用元素。 示例2:为了修复示例1,将元素替换为具体定义的元素,例如。

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="cart" >
<xs:complexType>
<xs:sequence>
<xs:element name="itemID" maxOccurs="1" />
<xs:element name="price" maxOccurs="1" />
<xs:element name="description" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="description" type="xs:string"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="price" type="xs:decimal"/>
<xs:element name="code" type="xs:string"/>
</xs:schema>

我们可以根据安全团队的建议更新这 2 个文件吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)