NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · MCP Go SDK

GHSA-q382-vc8q-7jhj: Improper handling of null Unicode character when parsing JSON in github.com/modelcontextprotocol/go-sdk

highCVSS 4.0 8.2

The MCP Go SDK (github.com/modelcontextprotocol/go-sdk) switched to segmentio/encoding for JSON parsing in 1.3.1. That parser treats a key with null Unicode characters appended as equal to the plain key. With duplicate keys, the last one wins, so a crafted MCP message can slip past a proxy that matches exact field names. Versions up to 1.4.0 are affected; v1.4.1 fixes it.

Published Mar 19, 2026 · Analysis Oct 31, 2026

What an attacker can do

In the affected parser, a key such as field followed by a \u0000 character matched the struct field named field. An attacker can send a message with both the real key and a null-suffixed copy. A filter that reads exact names sees one value. The Go SDK, using last-key-wins, applies the other and so acts on a different MCP message than the one inspected.

The advisory names two consequences. First, intermediaries, such as proxies or policy layers that match exact field names, may fail to detect or filter these messages. Second, the TypeScript and Python SDKs parse case-sensitively and would reject the same messages, so the SDKs disagree on what a message means. That mismatch can confuse a security boundary between components.

The flaw matters most to teams that put a gateway or policy engine in front of a Go-based MCP server and rely on it to block tool calls. The CVSS 4.0 vector rates integrity high, needs no privileges or user interaction, and marks the attack as needing preconditions (AT:P). Without an inspecting layer in front, the practical effect is small.

Who is affected

github.com/modelcontextprotocol/go-sdk from 1.3.1, where segmentio/encoding became the parser, up to and including 1.4.0. The sources list the vulnerable range as <= 1.4.0. Check your module and the parser dependency:

go list -m github.com/modelcontextprotocol/go-sdk github.com/segmentio/encoding

The patched parser is segmentio/encoding v0.5.4.

github.com/modelcontextprotocol/go-sdk

Ecosystem
Go
Affected
<= 1.4.0
Fixed in
1.4.1
Check
go list -m github.com/modelcontextprotocol/go-sdk

How to fix it

Upgrade to v1.4.1:

go get github.com/modelcontextprotocol/[email protected]

The SDK commit 724dd47aa bumps segmentio/encoding from v0.5.3 to v0.5.4. The parser fix is in the segmentio/encoding repository. The commit adds tests that reject keys with a \u0000 at the start, middle or end. The sources give no workaround. Rebuild and redeploy any server binaries so the new dependency is compiled in.

How to tell if you were hit

Look in captured MCP traffic or proxy logs for JSON-RPC messages that contain keys with an escaped \u0000 or a raw NUL byte, or duplicate keys in one object. Such keys have no legitimate use. Compare what your gateway logged for a message with what the server executed, and look for differences.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

The Go SDK recently transitioned to the segmentio/encoding library 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 with null Unicode 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:

  • Bypassing intermediary inspection: Proxies or policy layers that matched on exact field names may have failed to detect or filter these messages.
  • Cross-implementation inconsistency: Other MCP SDKs (TypeScript, Python) use case-sensitive parsing and would reject the same messages, creating potential security-boundary confusion.

Fix:

The segmentio/encoding package was patched with a fix in https://github.com/segmentio/encoding/commit/7d5a25dbc5da13aed3cb047a127e4d0e96f536fb 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.

Credited to anaximand3r.

Questions

Which versions are affected by GHSA-q382-vc8q-7jhj?

The Go SDK up to and including 1.4.0. The segmentio/encoding parser arrived in 1.3.1. Version 1.4.1 uses the patched segmentio/encoding v0.5.4.

Does it give code execution?

Not by itself. It lets a crafted message be read differently by an inspecting proxy and by the SDK, so a filter can be bypassed. The impact depends on what that filter protects.

Does this affect the TypeScript or Python MCP SDKs?

The advisory says they parse case-sensitively and would reject these messages. The inconsistency with them is part of the risk, not a flaw in them.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More MCP Go SDK vulnerabilities

All MCP Go SDK entries