An automation platform parses XML configuration files uploaded by partners. A test shows a crafted file made the parser return the contents of a local server file. Which parser change best mitigates this?
Show the answer
Correct answerC. Disable DTD and external entity resolution
AWhy not this: Encoding controls character interpretation, not whether external entities are fetched from local files.
BWhy not this: Moving attributes into elements changes document shape but leaves entity resolution enabled.
CWhy this is right: Turning off DTD and external entity processing stops the parser from resolving entities that reference local files.
DWhy not this: Comments are ignored data; removing them does not stop the parser from resolving external entities.
This is an XML external entity (XXE) weakness: entities declared in a DTD can point to local files, so the parser should not resolve DTDs or external entities. Stripping comments or fixing encoding does not stop entity expansion.