Malicious/compromised server crashes any embedding application via malformed Reply frame (centrifugal/centrifuge-go dependency)
Description
Vulnerability Details
Note on scope: this vulnerability lives in github.com/centrifugal/centrifuge-go, the official Go client SDK for connecting to a Centrifugo/centrifuge server — a fourth, separate repository from centrifugo, centrifuge, and protocol (all covered by earlier reports/advisories this session), with no private vulnerability reporting enabled and no SECURITY.md of its own. Submitting through this working channel, consistent with centrifugal/protocol's own SECURITY.md, which states security reports for the ecosystem's packages are handled through the centrifugo repository.
Threat model note: this is the inverse of a typical server-side finding. The party to distrust here is a malicious or compromised Centrifugo/centrifuge server, or an on-path attacker able to inject bytes into an unencrypted ws:// connection — not an attacker targeting a server. Any application (backend service, CLI tool, etc.) that embeds this SDK to consume real-time data is affected.
File: transport_websocket.go (this repo), lines 127-176, websocketTransport.reader File: protocol.go (this repo), lines 51-56, newReplyDecoder Root cause: github.com/centrifugal/protocol@v0.19.2's decode.go, (*ProtobufReplyDecoder).Decode — this is the exact pre-fix dependency version centrifuge-go currently pins (confirmed via go.sum hash match). This same bug in centrifugal/protocol was already found and reported earlier this session (fixed upstream in v0.20.0 before I could file a separate advisory for it there, since the fix predated my report by ~12 days) — but centrifuge-go, as currently published, has not bumped past the vulnerable v0.19.2, so it is a live, concretely-exploitable artifact today.
CWE: CWE-129 — Improper Validation of Array Index Severity: High CVSS: 6.5 — CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H (Scored from the perspective of the party this SDK must distrust — PR:N because no privilege on the client application is needed, only control of, or a MITM position on, the server the application is already configured to connect to.)
Root Cause
// protocol.go:51-56 (centrifuge-go)
func newReplyDecoder(enc protocol.Type, data []byte) protocol.ReplyDecoder {
if enc == protocol.TypeJSON {
return protocol.NewJSONReplyDecoder(data)
}
return protocol.NewProtobufReplyDecoder(data)
}// transport_websocket.go: reader() runs in a bare, unrecovered goroutine
go t.reader()
func (t *websocketTransport) reader() {
...
for {
_, data, err := t.conn.ReadMessage() // raw bytes from the server
...
decoder := newReplyDecoder(t.protocolType, data)
for {
reply, err := decoder.Decode() // panics on malformed server data
...// centrifugal/protocol@v0.19.2/decode.go (pinned dependency, pre-fix)
func (d *ProtobufReplyDecoder) Decode() (*Reply, error) {
if d.offset < len(d.data) {
var c Reply
l, n := binary.Uvarint(d.data[d.offset:])
replyBytes := d.data[d.offset+n : d.offset+n+int(l)] // no bounds check
err := c.UnmarshalVT(replyBytes)Every WebSocket message received from the server is decoded via this path (protobuf subprotocol is the default: dialer.Subprotocols = []string{"centrifuge-protobuf"}). The pinned decoder reads a length-prefix varint and immediately slices with no bounds check. This happens inside websocketTransport.reader(), a bare goroutine spawned via go t.reader(). This library has zero recover() calls anywhere in its non-test code (confirmed via full-repo grep). An unrecovered panic in a goroutine is fatal to the entire Go process, not just that goroutine or connection.
Dynamic Confirmation (2026-08-16)
func TestVuln101MaliciousServerReplyPanic(t *testing.T) {
malformed := []byte{0x02} // claims 2 bytes follow, 0 present
decoder := newReplyDecoder(protocol.TypeProtobuf, malformed)
_, err := decoder.Decode()
}A single 1-byte malformed message — the smallest possible WS frame carrying just a length-prefix byte — reliably panics via this repo's own decoder wrapper, using the exact dependency version it ships with:
panic: runtime error: slice bounds out of range [:3] with capacity 1
github.com/centrifugal/protocol.(*ProtobufReplyDecoder).Decode(...) decode.go:208
github.com/centrifugal/centrifuge-go.TestVuln101MaliciousServerReplyPanic(...)Attack Scenario
- An application embeds
centrifuge-goto connect to a Centrifugo server (default protobuf subprotocol) - The server side is malicious, compromised, or MITM'd (unencrypted
ws://, or an attacker-controlled TLS termination point) - That party sends a single malformed frame — e.g. a message whose first byte is a varint
0x02with no further bytes present ProtobufReplyDecoder.Decode()panics; the panic is unrecovered int.reader()'s bare goroutine, crashing the entire host application process, not just the connection
Impact
Full crash of any Go application embedding centrifuge-go with the protobuf subprotocol, whenever the server side is malicious, compromised, or MITM-able. No action required from the embedding application beyond normal connect/subscribe usage.
Recommended Fix
- Primary: bump the pinned
github.com/centrifugal/protocoldependency from v0.19.2 to v0.20.0 or later, whereProtobufReplyDecoder.Decodealready has the correct bounds check (fixed upstream in commit1fc2374, 2026-08-04). No consumer-side code changes needed — the fix doesn't alter any exported function signature. - Defense-in-depth: wrap
t.reader()(and any other barego func/go t.X()spawn point in this library) in arecover()that logs and cleanly disconnects rather than crashing the entire host process — a malformed frame from a misbehaving server should degrade to "this connection is broken," not "this whole program is dead."
Verification
Dynamically confirmed via direct in-process invocation of this repo's own newReplyDecoder wrapper, using the exact centrifugal/protocol v0.19.2 dependency this repo currently ships — a single 1-byte crafted message reliably panics the decoder.