# RUSTSEC-2026-0195: Unbounded namespace-declaration allocation in \`NsReader\` enables memory-exhaustion denial of service

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** UNSCORED
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Unknown
- **Published:** 2026-06-29T12:00:00.000Z
- **Modified:** 2026-07-02T09:00:04.037Z

## Who should check

- Projects that depend on crates.io package quick-xml (\>= 0.0.0-0, \< 0.41.0)

## Description

\`NsReader\` resolves namespaces by calling \`NamespaceResolver::push\` for every
\`Start\`/\`Empty\` event \*before\* the event is returned to the caller. \`push\`
iterated all \`xmlns\` / \`xmlns:\*\` attributes on the start tag and, for each one,
appended the prefix bytes to an internal buffer and pushed a \`NamespaceBinding\`
(32 bytes on 64-bit) to an internal \`Vec\`, with no upper bound on the number of
declarations.

\#\# Impact

A start tag with \`N\` namespace declarations drove roughly \`3×\` the tag's byte
size in \`NamespaceResolver\` heap, allocated \*inside\* \`quick-xml\` before the
\`NsReader\` consumer ever received the event and could inspect or reject it. A
consumer that bounds its \*input\* size therefore still cannot bound this
allocation: an \`M\`-byte start tag yields on the order of \`3 × M\` bytes of
resolver heap the caller never sees.

On untrusted XML this lets a remote, unauthenticated attacker force large heap
allocations with a single start tag. With several \`NsReader\`s running
concurrently on independent inputs (a common server pattern), the allocations
stack and can exhaust process memory, causing the operating system to kill the
process (OOM). This was confirmed against a real-world RPKI relying party (NLnet
Labs Routinator), where concurrent RRDP validation workers parsing a crafted
\`snapshot.xml\` exceeded the memory limit and the process was OOM-killed.

\#\# Affected code paths

Consumers using \`NsReader\` (which always calls \`NamespaceResolver::push\` before
yielding \`Start\`/\`Empty\`), or calling \`NamespaceResolver::push\` directly. A plain
\`Reader\` that does not perform namespace resolution is not affected.

\#\# Remediation

Upgrade to \`quick-xml \>= 0.41.0\`. \`NamespaceResolver::push\` now rejects a start
tag that declares more than \`DEFAULT\_MAX\_DECLARATIONS\_PER\_ELEMENT\` (256)
namespace bindings, returning the new \`NamespaceError::TooManyDeclarations\`
instead of allocating without limit. The limit is configurable via
\`NamespaceResolver::set\_max\_declarations\_per\_element\` (use \`usize::MAX\` to
restore the previous unbounded behavior), and \`NsReader::resolver\_mut()\` is
provided to reach it.

There is no clean workaround for \`NsReader\` consumers before 0.41.0, as the
allocation happens inside the reader with no configuration knob to cap it.

## Affected and fixed versions

- crates.io `quick-xml`: affected \>= 0.0.0-0, \< 0.41.0; fixed 0.41.0 (osv)

## Mitigation

- Upgrade quick-xml to 0.41.0 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by RUSTSEC-2026-0195. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/RUSTSEC-2026-0195.md
Affected: quick-xml >= 0.0.0-0, < 0.41.0
Fixed in: 0.41.0

Steps:
1. Search this machine and project for quick-xml (crates.io): dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is RUSTSEC-2026-0195 being exploited?

There is no confirmed exploitation: RUSTSEC-2026-0195 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known.

### How serious is RUSTSEC-2026-0195?

It has no CVSS score yet. Unknown.

### Which versions are affected by RUSTSEC-2026-0195?

quick-xml \>= 0.0.0-0, \< 0.41.0.

### Is there a fix for RUSTSEC-2026-0195?

Yes. Fixed in 0.41.0. Upgrade quick-xml to 0.41.0 or later.

### How do I check if I'm affected by RUSTSEC-2026-0195?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://rustsec.org/advisories/RUSTSEC-2026-0195.html>
- patch: <https://github.com/tafia/quick-xml/commit/7ca25266e94987210daa864889ab15c9332c8a2a>
- other: <https://crates.io/crates/quick-xml>
- other: <https://github.com/tafia/quick-xml/issues/970>

## Attribution

- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/RUSTSEC-2026-0195> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/RUSTSEC-2026-0195> · JSON: <https://flawdb.com/api/v1/entries/RUSTSEC-2026-0195>
