Description Summary The software accepts XML from an untrusted source but does not
validate the XML against the proper schema.
Extended Description Most successful attacks begin with a violation of the programmer's assumptions. By accepting an XML document without validating it against a DTD or XML schema, the programmer leaves a door open for attackers to provide unexpected, unreasonable, or malicious input. Example 1 The following code loads an XML file without validating it against a known XML Schema or DTD. (Bad Code) Java // Read DOM try { ...
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setValidating( false );
....
c_dom = factory.newDocumentBuilder().parse( xmlFile );
} catch(Exception ex) { ...
} Example 2 The following code excerpt creates a non-validating XML DocumentBuilder object (one that doesn't validate an XML document against a schema). (Bad Code) Java DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance(); builderFactory.setNamespaceAware(true); DocumenbBuilder builder =
builderFactory.newDocumentBuilder();
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Page Last Updated:
October 29, 2009
|
|
CWE is a Software Assurance strategic initiative sponsored by the National Cyber Security Division of the U.S. Department of Homeland Security. This Web site is hosted by The MITRE Corporation. Contact cwe@mitre.org for more information. |
|||
