CVE-2026-29795: stellar-xdr's StringM :from_str Bypasses Max Length Validation Vulnerability

MODERATE
Advisory Identifier: GHSA-x57h-xx53-v53w
CVSS 4.0
CWE-770
Published
Advisory Summary

CVE-2026-29795 is a MODERATE (CVSS 4.0) :from_str bypasses max length validation vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting stellar-xdr's StringM libraries in the crates.io ecosystem. The issue involves :from_str bypasses max length validation. Remediation is available by upgrading affected packages to version 25.0.1.

CVE-2026-29795 at a Glance

CVE Identifier CVE-2026-29795
GHSA Identifier GHSA-x57h-xx53-v53w
Severity MODERATE
CVSS v3.1 Base Score 4.0
CWE Classification CWE-770: Allocation of Resources Without Limits or Throttling
Affected Product stellar-xdr's StringM
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 4.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-29795

To remediate this vulnerability, upgrade all affected stellar-xdr's StringM dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

stellar-xdr fixed: 25.0.1
Upgrade stellar-xdr to 25.0.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for stellar-xdr

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-29795, inspect your project dependencies for stellar-xdr's StringM:

inspect dependencies for stellar-xdr

Analyze the terminal output to locate any version of stellar-xdr's StringM in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 25.0.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. In stellar-xdr's StringM, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact `StringM::from_str` does not validate that the input length is within the declared maximum (`MAX`). Calling `StringM::<N>::from_str(s)` where `s` is longer than `N` bytes succeeds and returns an `Ok` value instead of `Err(Error::LengthExceedsMax)`, producing a `StringM` that violates its length invariant. This affects any code that constructs `StringM` values from string input using `FromStr` (including `str::parse`), and relies on the type's maximum length constraint being enforced. An oversized `StringM` could propagate through serialization, validation, or other logic that assumes the invariant holds. All published versions of the `stellar-xdr` crate up to and including `v25.0.0` are affected. ### Patches The fix is merged in [#500](https://github.com/stellar/rs-stellar-xdr/pull/500). It replaces the direct `Ok(Self(b))` construction with `b.try_into()`, which routes through `TryFrom<Vec<u8>>` and properly validates the length — matching the pattern already used by `BytesM::from_str`. Users should upgrade to the first release containing this fix once published (the next release after `v25.0.0`). ### Workarounds Validate the byte length of string input before calling `StringM::from_str`, or construct `StringM` values via `StringM::try_from(s.as_bytes().to_vec())` which correctly enforces the length constraint. ### References - Issue: https://github.com/stellar/rs-stellar-xdr/issues/499 - Fix: https://github.com/stellar/rs-stellar-xdr/pull/500

CVE-2026-29795 Affected stellar-xdr's StringM Versions

1 component(s)
Fixed Versions:
25.0.1
Product / Package Ecosystem Affected Versions Fixed Version
stellar-xdr
crates.io
< 25.0.1
25.0.1

References

Frequently Asked Questions

What is CVE-2026-29795?
CVE-2026-29795 is a security vulnerability in stellar-xdr's StringM involving :from_str bypasses max length validation under CWE-770: Allocation of Resources Without Limits or Throttling.
Which stellar-xdr's StringM versions are affected?
Affected versions include releases prior to 25.0.1 across affected packages: stellar-xdr.
What version fixes CVE-2026-29795?
Upgrading to 25.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is stellar-xdr affected?
Yes, stellar-xdr is affected in releases prior to 25.0.1. Upgrade your dependency to 25.0.1 or later.
What is the CVSS score of CVE-2026-29795?
CVE-2026-29795 has a CVSS v3.1 base score of 4.0 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N.
What CWE is associated with CVE-2026-29795?
CVE-2026-29795 is classified under CWE-770: Allocation of Resources Without Limits or Throttling (The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.).
How can I check crates.io dependencies for CVE-2026-29795?
Run the dependency tree command: 'inspect dependencies for stellar-xdr'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-x57h-xx53-v53w",
  "modified" : "2026-03-06T22:51:52Z",
  "published" : "2026-03-05T20:45:46Z",
  "aliases" : [ "CVE-2026-29795" ],
  "summary" : "stellar-xdr's StringM::from_str bypasses max length validation",
  "details" : "### Impact\n\n`StringM::from_str` does not validate that the input length is within the declared maximum (`MAX`). Calling `StringM::<N>::from_str(s)` where `s` is longer than `N` bytes succeeds and returns an `Ok` value instead of `Err(Error::LengthExceedsMax)`, producing a `StringM` that violates its length invariant.\n\nThis affects any code that constructs `StringM` values from string input using `FromStr` (including `str::parse`), and relies on the type's maximum length constraint being enforced. An oversized `StringM` could propagate through serialization, validation, or other logic that assumes the invariant holds.\n\nAll published versions of the `stellar-xdr` crate up to and including `v25.0.0` are affected.\n\n### Patches\n\nThe fix is merged in [#500](https://github.com/stellar/rs-stellar-xdr/pull/500). It replaces the direct `Ok(Self(b))` construction with `b.try_into()`, which routes through `TryFrom<Vec<u8>>` and properly validates the length — matching the pattern already used by `BytesM::from_str`.\n\nUsers should upgrade to the first release containing this fix once published (the next release after `v25.0.0`).\n\n### Workarounds\n\nValidate the byte length of string input before calling `StringM::from_str`, or construct `StringM` values via `StringM::try_from(s.as_bytes().to_vec())` which correctly enforces the length constraint.\n\n### References\n\n- Issue: https://github.com/stellar/rs-stellar-xdr/issues/499\n- Fix: https://github.com/stellar/rs-stellar-xdr/pull/500",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "stellar-xdr"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "25.0.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 25.0.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/stellar/rs-stellar-xdr/security/advisories/GHSA-x57h-xx53-v53w"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-29795"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/stellar/rs-stellar-xdr/issues/499"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/stellar/rs-stellar-xdr/pull/500"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/stellar/rs-stellar-xdr/commit/1f840013c3e2fca0321fb844b048afa01d10dda6"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/stellar/rs-stellar-xdr"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-770" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-05T20:45:46Z",
    "nvd_published_at" : "2026-03-06T21:16:15Z"
  }
}