CVE-2025-3857
Description
When reading binary Ion data through Amazon.IonDotnet using the RawBinaryReader class, Amazon.IonDotnet does not check the number of bytes read from the underlying stream while deserializing the binary format. If the Ion data is malformed or truncated, this triggers an infinite loop condition that could potentially result in a denial of service. Users should upgrade to Amazon.IonDotnet version 1.3.1 and ensure any forked or derivative code is patched to incorporate the new fixes.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
Amazon.IonDotnetNuGet | < 1.3.1 | 1.3.1 |
Patches
29d416b56e23034a4f5215eceFix infinite loop when reading truncated data; Add unit test for expected exception (#157)
2 files changed · +26 −0
Amazon.IonDotnet/Internals/Binary/RawBinaryReader.cs+7 −0 modified@@ -1167,6 +1167,13 @@ private void ReadAll(Span<byte> bufferSpan, int length) while (length > 0) { var amount = this.input.Read(bufferSpan.Slice(0, length)); + + // length > 0 (because we didn't stop) + if (amount == 0) + { + throw new UnexpectedEofException(); + } + length -= amount; bufferSpan = bufferSpan.Slice(amount); this.localRemaining -= amount;
Amazon.IonDotnet.Tests/Internals/BinaryReaderTest.cs+19 −0 modified@@ -335,6 +335,25 @@ public void MultipleBlobs() } } + [TestMethod] + public void ReadAll_FailOnTruncatedData() + { + IIonReader binReader; + using (var ms = new MemoryStream()) { + ReadOnlySpan<byte> fullString = new ReadOnlySpan<byte>(new byte[] { + 0xE0, 0x01, 0x00, 0xEA, 0x85, 0x31, 0x32, 0x33, 0x34, 0x35 + }); + ms.Write(fullString.Slice(0, 9)); + + ms.Seek(0, SeekOrigin.Begin); + binReader = IonReaderBuilder.Build(ms); + + var type = binReader.MoveNext(); + Assert.AreEqual(IonType.String, type); + Assert.ThrowsException<UnexpectedEofException>(() => binReader.StringValue()); + } + } + /// <summary> /// Aims to test the correctness of skipping with step in-out in the middle /// of container
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
7- github.com/advisories/GHSA-gm2p-wf5c-w3pjghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-3857ghsaADVISORY
- aws.amazon.com/security/security-bulletins/AWS-2025-009ghsaWEB
- github.com/amazon-ion/ion-dotnet/commit/34a4f5215eceac1bb7bf434c4f2310d64d1b703bghsaWEB
- github.com/amazon-ion/ion-dotnet/releases/tag/v1.3.1nvdWEB
- github.com/amazon-ion/ion-dotnet/security/advisories/GHSA-gm2p-wf5c-w3pjnvdWEB
- aws.amazon.com/security/security-bulletins/AWS-2025-009/nvd
News mentions
0No linked articles in our index yet.