chore(deps): update rust crate quick-xml to 0.41.0 [security]#14
Open
renovate[bot] wants to merge 1 commit into
Open
chore(deps): update rust crate quick-xml to 0.41.0 [security]#14renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
Latest build artifactsRun #28580647293 · 7033910030 · 02.07.2026 09:42:31 UTC generated by Artifactview 0.5.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
0.40.1→0.41.0Quadratic run time when checking a start tag for duplicate attribute names
RUSTSEC-2026-0194
More information
Details
BytesStart::attributes()returns anAttributesiterator which, by default(
with_checks(true)), rejects a start tag that repeats an attribute name. Foreach attribute yielded, the iterator compared the new name against every name
seen so far in the same tag using a linear scan, so a start tag with
Ndistinct attribute names cost
O(N²)byte comparisons. There was no bound onNother than the size of the buffered start tag.Impact
Any code that parses untrusted XML and iterates a start tag's attributes with
the default duplicate check enabled can be made to spend CPU time quadratic in
the number of attributes on a single tag. Because the check is pure computation
with no
.await/I/O, an I/O-based timeout on the consumer (for example a reador request timeout) cannot interrupt it while it runs.
Measured cost of a single start tag, release build:
The cost grows with the square of the attribute count, so a start tag of a few
tens of megabytes can stall a parsing thread for hours. No memory is exhausted
and the parser does not crash; the effect is CPU exhaustion on the thread doing
the parsing: a single crafted start tag can pin a CPU core for minutes to hours,
denying service to that worker. A deployment that places a wall-clock bound on
parsing, or confines it to a non-critical thread, may consider the availability
impact lower.
Affected code paths
BytesStart::attributes()/Attributesiterated with checks enabled (thedefault), and
BytesStart::try_get_attribute.NsReader, which resolves namespaces by iterating a tag's attributes and soreaches the same check internally.
Consumers that iterate attributes with
.attributes().with_checks(false)and donot use
NsReaderare not affected.This was reported as reachable by a remote, unauthenticated attacker in a
real-world RPKI relying party (NLnet Labs Routinator) via a crafted RRDP
snapshot.xml.Remediation
Upgrade to
quick-xml >= 0.41.0, where the duplicate check keeps the linearscan for start tags with a small number of attributes and switches to an
O(1)hash pre-filter above a threshold, making the whole tag
O(N). The reportedAttrError::Duplicatedpositions are unchanged.If upgrading is not possible and duplicate-name detection is not required,
disable it with
.attributes().with_checks(false)(this does not helpNsReaderconsumers, which have no equivalent opt-out before 0.41.0).Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HReferences
This data is provided by OSV and the Rust Advisory Database (CC0 1.0).
Unbounded namespace-declaration allocation in
NsReaderenables memory-exhaustion denial of serviceRUSTSEC-2026-0195
More information
Details
NsReaderresolves namespaces by callingNamespaceResolver::pushfor everyStart/Emptyevent before the event is returned to the caller.pushiterated 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 ofdeclarations.
Impact
A start tag with
Nnamespace declarations drove roughly3×the tag's bytesize in
NamespaceResolverheap, allocated insidequick-xmlbefore theNsReaderconsumer ever received the event and could inspect or reject it. Aconsumer that bounds its input size therefore still cannot bound this
allocation: an
M-byte start tag yields on the order of3 × Mbytes ofresolver 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
NsReaders runningconcurrently 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.xmlexceeded the memory limit and the process was OOM-killed.Affected code paths
Consumers using
NsReader(which always callsNamespaceResolver::pushbeforeyielding
Start/Empty), or callingNamespaceResolver::pushdirectly. A plainReaderthat does not perform namespace resolution is not affected.Remediation
Upgrade to
quick-xml >= 0.41.0.NamespaceResolver::pushnow rejects a starttag that declares more than
DEFAULT_MAX_DECLARATIONS_PER_ELEMENT(256)namespace bindings, returning the new
NamespaceError::TooManyDeclarationsinstead of allocating without limit. The limit is configurable via
NamespaceResolver::set_max_declarations_per_element(useusize::MAXtorestore the previous unbounded behavior), and
NsReader::resolver_mut()isprovided to reach it.
There is no clean workaround for
NsReaderconsumers before 0.41.0, as theallocation happens inside the reader with no configuration knob to cap it.
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HReferences
This data is provided by OSV and the Rust Advisory Database (CC0 1.0).
Release Notes
tafia/quick-xml (quick-xml)
v0.41.0Compare Source
New Features
NsReader::resolver_mut()andNamespaceResolver::{max_declarations_per_element, set_max_declarations_per_element}.Bug Fixes
Attributes(and anything that iteratesBytesStart::attributes()with the default
with_checks(true)) no longer takes O(N²) time on a starttag with a large number of attributes. Small tags keep the previous linear
scan; larger ones switch to a 64-bit hash pre-filter, so the whole tag is
O(N). The exact
AttrError::Duplicated(new, prev)positions are unchanged.NamespaceResolver::push(and hence everyNsReaderStart/Emptyevent) now rejects a start tag that declares more than
DEFAULT_MAX_DECLARATIONS_PER_ELEMENT(256)xmlns/xmlns:*namespacebindings, returning the new
NamespaceError::TooManyDeclarations. Previouslypushallocated oneNamespaceBindingper declaration with no upper bound,before the event was returned to the caller, so an
NsReaderconsumer couldnot bound its memory exposure on untrusted input. The limit is configurable
via
NamespaceResolver::set_max_declarations_per_element(useusize::MAXto disable).
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.