Skip to content

Commit ddafde1

Browse files
1 parent 621d730 commit ddafde1

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-x57h-xx53-v53w",
4+
"modified": "2026-03-05T20:45:46Z",
5+
"published": "2026-03-05T20:45:46Z",
6+
"aliases": [],
7+
"summary": "stellar-xdr's StringM::from_str bypasses max length validation",
8+
"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",
9+
"severity": [
10+
{
11+
"type": "CVSS_V3",
12+
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N"
13+
}
14+
],
15+
"affected": [
16+
{
17+
"package": {
18+
"ecosystem": "crates.io",
19+
"name": "stellar-xdr"
20+
},
21+
"ranges": [
22+
{
23+
"type": "ECOSYSTEM",
24+
"events": [
25+
{
26+
"introduced": "0"
27+
},
28+
{
29+
"fixed": "25.0.1"
30+
}
31+
]
32+
}
33+
],
34+
"database_specific": {
35+
"last_known_affected_version_range": "<= 25.0.0"
36+
}
37+
}
38+
],
39+
"references": [
40+
{
41+
"type": "WEB",
42+
"url": "https://github.com/stellar/rs-stellar-xdr/security/advisories/GHSA-x57h-xx53-v53w"
43+
},
44+
{
45+
"type": "WEB",
46+
"url": "https://github.com/stellar/rs-stellar-xdr/issues/499"
47+
},
48+
{
49+
"type": "WEB",
50+
"url": "https://github.com/stellar/rs-stellar-xdr/pull/500"
51+
},
52+
{
53+
"type": "WEB",
54+
"url": "https://github.com/stellar/rs-stellar-xdr/commit/1f840013c3e2fca0321fb844b048afa01d10dda6"
55+
},
56+
{
57+
"type": "PACKAGE",
58+
"url": "https://github.com/stellar/rs-stellar-xdr"
59+
}
60+
],
61+
"database_specific": {
62+
"cwe_ids": [
63+
"CWE-770"
64+
],
65+
"severity": "MODERATE",
66+
"github_reviewed": true,
67+
"github_reviewed_at": "2026-03-05T20:45:46Z",
68+
"nvd_published_at": null
69+
}
70+
}

0 commit comments

Comments
 (0)