SEVERITY NOT PROVIDED · CVSS 4.0 EPSS 0.2% · 8th percentile CWE-91

CVE-2026-66295: Processing instruction target and content emitted unescaped in Saxy encoder allows XML injection

Published 2026-11-06 · Updated 2026-11-26 · Also known as EEF-CVE-2026-66295, GHSA-f9r9-vrxq-g566

Summary

Saxy's XML encoder fails to properly validate or escape processing instruction targets and contents, allowing XML injection. Engineering teams using Saxy for XML serialization should update their dependencies.

Who is affected

Deployments that serialize documents using untrusted input within processing instructions (via Saxy.XML.processing_instruction/2) are vulnerable. Attackers can inject arbitrary elements, attributes, or processing instructions by including the '?>' sequence to break out of the construct, creating discrepancies between the encoded tree and the downstream parsed tree.

Exploitability

The vulnerability has a local attack vector with low attack complexity and requires low privileges under specific attack conditions. The EPSS score is 0.002, indicating a very low probability of exploitation, and it is not listed in CISA's Known Exploited Vulnerabilities catalog.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-26. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
Hex saxy >= 0.7.0, < 1.7.0 1.7.0 mix deps.update saxy

CVSS 4.0 vector

CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:L/SA:N

Attack vectorLocal
Attack complexityLow
Attack requirementsPresent
Privileges requiredNone
User interactionNone
Confidentiality (vulnerable system)None
Integrity (vulnerable system)Low
Availability (vulnerable system)None
Confidentiality (subsequent systems)None
Integrity (subsequent systems)Low
Availability (subsequent systems)None

Base score is not computed for CVSS 4.0 vectors; severity is taken from the advisory.

FAQ

What causes the vulnerability in Saxy?

The Saxy XML encoder writes processing instruction targets and contents verbatim without escaping or checking against XML constraints, allowing attackers to terminate the instruction early using '?>'.

Are other XML constructs like element content or attributes affected?

No, character data, attribute values, and comments are properly escaped by the encoder; processing instructions are the sole construct affected.

Which versions of the saxy package are affected?

Versions introduced from 0.7.0 up to, but not including, 1.7.0 are affected.

Original advisory description
## Summary Saxy's XML encoder writes the target and the content of a processing instruction into the output document verbatim, without validation or escaping. The encoder builds the construct by concatenating both fields between `<?` and `?>`, so neither field is checked against the constraints the XML specification places on it. Because `?>` terminates a processing instruction, a target or content value containing that sequence closes the construct at a position the attacker chooses. Everything the attacker writes after it is emitted as ordinary markup at document level, which allows arbitrary elements, attributes, and further processing instructions to be injected into the serialized document. Appending a matching `<?` keeps the encoder's own terminator well-formed, so the result still parses and the injection is silent rather than a visible corruption. The target is additionally unconstrained by the XML `Name` production, which permits injection before the remainder of the processing instruction. The result is XML injection into a serialized document: the tree the application asks Saxy to encode and the tree a downstream parser reads back are no longer the same. Character data, attribute values, and comments are all escaped by the encoder, so processing instructions are the one construct that passes user bytes through untouched. Since `Saxy.XML.processing_instruction/2` is a documented public builder, an application inherits the flaw without misusing the API. The consequences depend on what consumes the XML: forged records in a feed or export read by another system, injected stylesheet or rendering directives, or active content where the output is served to a browser as XML or SVG. This issue affects saxy: from 0.7.0 before 1.7.0. ## Workarounds Do not place untrusted data in processing instructions. Where a dynamic value is unavoidable, validate it before building the node: reject any content containing `?>`, and reject any target that does not match the XML `Name` production or that equals `xml` case-insensitively. Alternatively, carry the value in element content or an attribute instead, both of which the encoder escapes. ## Configurations The application must serialize a document containing a processing instruction whose target or content is derived from untrusted input, by passing a `{:processing_instruction, name, content}` node (typically built with `Saxy.XML.processing_instruction/2`) to `Saxy.encode!/2` or `Saxy.encode_to_iodata!/2`. Applications that never place dynamic data in processing instructions are not affected.

References

Source records: EEF-CVE-2026-66295 (OSV.dev) · EPSS by FIRST, 2026-11-26.