XML External Entities
An XML External Entity attack is a type of attack against an application that parses XML input. This attack occurs when XML input containing a reference to an external entity is processed by a weakly configured XML parser. This attack may lead to the disclosure of confidential data, denial of service, server-side request forgery, port scanning from the perspective of the machine where the parser is located, and other system impacts.
Example:
The DtdProcessing.Parse property allows the XmlTextReader to process XML External Entities in such a way that an attacker can add the contents of files on the server to his XML data. Also, well-formed XML can cause XmlTextReader to add information from the Internet that was not originally intended.
It is recommended to avoid DTD processing. In order to achieve this in XmlTextReader, the DtdProcessing property has to be set to Ignore.
XML deserialization is performed with both allowed document type definition and URL resolving. An adversary can forge request data to obtain sensitive server data.
Both document type definition and URL resolving have to be disallowed if unknown XML structs are deserialized. So, DTD commands are ignored, and no XML resolver is used. In this case, only data transmission will be available, and an adversary won't be able to steal sensitive server data.
Comments
Post a Comment