VYPR
High severity7.5NVD Advisory· Published Apr 21, 2025· Updated Apr 15, 2026

CVE-2025-3857

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.

PackageAffected versionsPatched versions
Amazon.IonDotnetNuGet
< 1.3.11.3.1

Patches

2
34a4f5215ece

Fix infinite loop when reading truncated data; Add unit test for expected exception (#157)

https://github.com/amazon-ion/ion-dotnetRichard GiliamFeb 5, 2025via ghsa
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

News mentions

0

No linked articles in our index yet.