The main failure is that a field treated as ordinary JSON can become a parser input, which bypasses assumptions built into scanning and review. Once untrusted data reaches an unsafe XML parser, attackers may trigger XXE, local file reads, or SSRF. The control failure is in the trust boundary, not the payload itself.
How a field becomes parser input instead of plain data
The break happens at the boundary where an API field is no longer treated as inert JSON and is instead forwarded into a component that interprets markup. That transition changes the field’s meaning, because the parser applies XML rules, entity resolution, and network or file access behaviours that the API layer did not intend to allow.
In practice, this is an input handling and trust problem. A payload that looks harmless in the request body can become executable parser input later in the processing chain, which is why reviews focused only on the original schema often miss it. The important question is not what the field looks like, but where it is ultimately consumed.
When that consumption path reaches XML parsing, the parser’s features matter more than the field name. If external entity resolution or other unsafe parser defaults are enabled, the application can be tricked into loading attacker-controlled references, contacting internal services, or reading local resources.
Why unsafe XML parsing changes the attack surface
Unsafe XML parsing creates a different class of failure than ordinary JSON validation because the parser may interpret structure, references, and retrieval directives. That can turn a simple data field into a gateway for XXE, SSRF, or local file exposure, especially when the downstream component assumes the input has already been sanitized.
The usual mistake is to trust the earlier API layer as the security boundary. Once data is handed to a parser with broader semantics, the original validation may no longer be sufficient, because the parser can still act on characters and constructs that the API considered ordinary text.
For API-specific abuse patterns and broken trust boundaries around request processing, the OWASP API Security Top 10 is a useful reference point. It helps frame why object and field handling must be assessed across the full processing path, not just at the endpoint contract.
What this means for testing, review, and containment
Security review should follow the data flow, not the API documentation alone. A field deserves special scrutiny whenever it can reach a serializer, parser, templating engine, command wrapper, or any other interpreter that re-reads the text with new rules. That is where apparently ordinary inputs become security-sensitive.
Controls should focus on the parser configuration and the handoff point. Disable dangerous XML features, reject unexpected content types, keep untrusted data out of parser contexts where possible, and treat any transformation step as a new trust boundary. If XML is required, use hardened parsers and test the full chain, including indirect sinks fed by mapped or nested fields.
Practitioner takeaway: the decisive issue is not whether the original API field is valid JSON, but whether any downstream component reinterprets it as active markup. If that can happen, evaluate the entire path for parser-specific behaviour and treat the sink as part of the attack surface.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP API Security Top 10 provides the primary governance reference for this topic.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP API Security Top 10 | API8 — Security Misconfiguration | Unsafe XML parser defaults create exploitable request-processing exposure. |
| API2 — Broken Authentication | Parser-driven SSRF and file reads can bypass assumed request trust boundaries. | |
| API7 — Server Side Request Forgery | XML entity resolution can force server-side requests to attacker-chosen targets. | |
| Recommendation — Harden parser settings and disable XML features that enable XXE or outbound requests. Verify that untrusted fields cannot cross from API input into privileged parser contexts. Block outbound fetches from XML parsing paths and test for SSRF via entity expansion. | ||
Related resources from NHI Mgmt Group
- What breaks when an API parser accepts untrusted XML inside a JSON workflow?
- What breaks when a public API key can also reach Gemini endpoints?
- What breaks when an API gateway is not validating keys before requests reach upstream services?
- What happens when uploaded media can reach an XML parser with external entities enabled?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 12, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org