T09 · Insecure Skill Coding Practices
- Location
SKILL.md:10- Finding
Missing XML Escaping for User-Controlled Topology Values
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:10-23
Vulnerability Type: XML injection through unsafe generation instructions
Risk Level: MediumVulnerable Code
markdown ## How to create a topology 1. **Parse user's request** to identify: - Network devices (routers, switches, PCs, Cloud, etc.) - Connections between devices - Optional: text labels, area boxes 2. **Generate UUIDs** for each device using a valid UUID v4 format 3. **Calculate layout coordinates** for devices using auto-layout algorithm 4. **Build the .topo XML** following the format in `references/topo-reference.md` 5. **Write the file** to current directory using Write tool 6. **Open the result** - print the file path so user can open it in eNSPUser-controlled labels are explicitly supported at
SKILL.md:124-132:markdown ## Adding text labels (txttips) Common labels for network diagrams: - Loopback addresses: `Loopback0:10.0.1.1/24` - Network segments: `10.0.12.0/24` - Area labels: `Area0`, `Area1`, `AS 64512` - Device roles: `Core Layer`, `Access Layer`The destination format places these values in XML attributes, as documented at
references/topo-reference.md:501-513:xml <txttip left="100" top="50" right="250" bottom="70" content="Loopback0:10.0.1.1/24" fontname="Consolas" fontstyle="0" editsize="100" txtcolor="-16777216" txtbkcolor="-7278960" charset="1" />Technical Analysis
The Skill directs the agent to parse user-supplied device names, labels, and topology data and insert them into a
.topoXML document. It does not require XML-safe serialization, attribute escaping, or validation of user-controlled values.XML metacharacters such as
&,<,>,", and'have structural meaning. If generated through direct string interpolation, a malicious value containing a quote can ter ...[truncated 1596 chars]- Remediation
View remediation
Remediation Suggestions
- Generate topology files with a proper XML library or structured serializer rather than concatenating strings.
- Escape every user-controlled attribute and text value. At minimum, correctly encode
&,<,>,", and'according to its XML context. - Add an explicit instruction to treat all topology descriptions, device names, and annotations as data rather than raw XML.
- Validate device models and connection types against fixed allowlists.
- Constrain device names and labels by length and permitted character set where practical.
- Validate UUIDs, IP addresses, interface indexes, dimensions, coordinates, and color values using strict type and range checks.
- Reject raw XML declarations, document type declarations, entities, processing instructions, and unexpected markup in user input.
- Parse the completed document with a securely configured XML parser before writing it, with external entities and network access disabled.
- Add tests containing quotes, ampersands, angle brackets, entity syntax, and attempted attribute or element injection.
