T09 · Insecure Skill Coding Practices
- Location
SKILL.md:35- Finding
Unrestricted Parsing of User-Controlled XML Enables Denial of Service
- Content
View full analysis
ET.Element: """Parse XML file and return root element.""" tree = ET.parse(file_path) root = tree.getroot() # Extract namespaces self._extract_namespaces(root) return root def parse_string(self, xml_string: str) -> ET.Element: """Parse XML from string.""" root = ET.fromstring(xml_string) ``` ### Technical Analysis The documented implementation passes user-supplied files and strings directly to `xml.etree.ElementTree.ET.parse` and `ET.fromstring`. It does not enforce limits on document size, element count, nesting depth, processing time, or resulting in-memory object size. The project instructions explicitly permit users to provide project data and file paths. Consequently, these parser entry points form a trust boundary through which an attacker may submit maliciously structured or exceptionally large XML. Parsing builds an in-memory element tree, while later recursive processing in `element_to_dict` can amplify resource use or reach Python's recursion limit when handling deeply nested documents. No evidence indicates that this flaw permits arbitrary code execution, privilege escalation, filesystem writes, or network access. The supported impact is availability loss in the process hosting the skill. ### Attack Path 1. An attacker provides a file path referencing an oversized or deeply nested XML document, or supplies equivalent XML as a string. 2. The agent follows the skill instructions and invokes `parse_file` or `parse_string`. 3. `ET.parse` or `ET.fromstring` constructs the XML tree without application-level size, depth, time, or element-count limits. 4. Tree construction consumes excessive memory or CPU. If recursive dictionary conversion is subsequently requested, ...[truncated 672 chars]- Remediation
View remediation
