类型: 安全缺陷
如果XML Schema中将maxOccurs值设为unbounded,当攻击者在xml中设置过多的元素,有可能会导致资源耗尽,最终导致拒绝服务。
例如:下列配置文件中使用了将password设置为unbounded,意味着xml可以出现多个password元素。
<?xml version="1.0"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:element name="User" ><xs:complexType><xs:sequence><xs:element name="userID" maxOccurs="1" /><xs:element name="name" maxOccurs="1" /><xs:element name="password" maxOccurs="unbounded" /><xs:element name="address" maxOccurs="1" /></xs:sequence></xs:complexType></xs:element><xs:element name="name" type="xsd:string"/><xs:element name="password" type="xsd:string"/><xs:element name="address" type="xs:string"/></xs:schema>
