Improper handling of null Unicode character when parsing JSON in github.com/modelcontextprotocol/go-sdk
High severity
GitHub Reviewed
Published
Mar 18, 2026
in
modelcontextprotocol/go-sdk
•
Updated Mar 19, 2026
Package
Affected versions
<= 1.4.0
Patched versions
1.4.1
Description
Published to the GitHub Advisory Database
Mar 19, 2026
Reviewed
Mar 19, 2026
Last updated
Mar 19, 2026
The Go SDK recently transitioned to the
segmentio/encodinglibrary for JSON parsing in version 1.3.1. While this change addressed both case-insensitivity and ASCII folding issues, the new parser implemented aggressive key matching that treated keys withnullUnicode characters appended at the end as equivalent to their base strings.Impact
When combined with duplicate keys, the described behavior leads to a "last key wins" resolution that could override the intended MCP message. This had the potential for:
Fix:
The
segmentio/encodingpackage was patched with a fix in segmentio/encoding@7d5a25d and a new version of the package was released (v0.5.4). The SDK switched to the patched version of the dependency in 724dd47aa. Users are advised to update to v1.4.1 to resolve this issue.Credits:
Thank you to Francesco Lacerenza (Doyensec) for reporting this issue.
References