OpenTelemetry eBPF Instrumentation: MongoDB parser panics on malformed wire messages
Description
Summary
Malformed MongoDB wire messages can trigger uncaught panics in the MongoDB TCP parser, allowing a remote unauthenticated attacker to crash the telemetry agent and cause a denial of service. The parser operates on raw attacker-controlled network payloads before the input is fully validated, so a single crafted message can terminate telemetry collection for the affected process or node.
Details
MongoDB parsing support was introduced by commit 2070f568a (Add Initial support for mongodb), so the explicit released version minimum affected is v0.1.0.
There are two related panic conditions in released go.opentelemetry.io/obi versions:
- In
v0.1.0throughv0.3.0,parseOpMessagereads OP_MSG flag bits frombuf[msgHeaderSize:msgHeaderSize+int32Size]without first ensuring the buffer is at leastmsgHeaderSize + int32Sizebytes long. A truncated OP_MSG packet can therefore trigger a slice-bounds panic before the parser returns an error. - In
v0.1.0throughv0.3.0,parseSectionsconsumes the section type byte and then reads the document-sequence length frombuf[offSet:offSet+int32Size]without re-validating that enough bytes remain after the type byte. A malformed document-sequence section can therefore trigger another slice-bounds panic. - In
v0.1.0throughv0.8.0,parseFirstFieldassumes the collection name for collection-scoped commands is always a string and performs an unchecked type assertion onfield.Value. A malformed BSON document can therefore trigger a runtime panic withinterface conversioninstead of returning a parse error.
The bounds-check panic was fixed by commit 3aa58cdaaa97fbb72f8ef4c3609ae425aacaf8bb (Fix MongoDB client panic), which first appears in release v0.4.0. The unchecked BSON type assertion is still present in v0.8.0.
Because this code runs while decoding attacker-controlled MongoDB traffic, the failure mode is process termination rather than graceful rejection of invalid input. In deployments where the telemetry agent monitors traffic from untrusted or partially trusted clients, a single malformed packet can terminate collection until the agent is restarted.
Affected code paths are in pkg/ebpf/common/mongo_detect_transform.go and correspond to parseOpMessage, parseSections, and parseFirstField.
PoC
The following reproductions are fully self-contained. They create a temporary test file inside an affected checkout and then run go test against the real parser code in the repository.
- Reproduce the
v0.1.0throughv0.3.0bounds-check panics:
git clone https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation.git obi-poc
cd obi-poc
git checkout v0.3.0
cat > pkg/ebpf/common/mongo_security_poc_test.go <<'EOF'
package ebpfcommon
import "testing"
func TestSecurityPoCParseOpMessageShortPanics(t *testing.T) {
parseOpMessage(make([]byte, 16), 0, false, nil)
}
func TestSecurityPoCParseSectionsShortDocSequencePanics(t *testing.T) {
parseSections([]byte{byte(sectionTypeDocumentSequence), 0x01, 0x02, 0x03})
}
EOF
go test ./pkg/ebpf/common -run 'TestSecurityPoCParseOpMessageShortPanics|TestSecurityPoCParseSectionsShortDocSequencePanics' -count=1
Expected result:
TestSecurityPoCParseOpMessageShortPanicspanics with a message similar toslice bounds out of range [:20] with capacity 16TestSecurityPoCParseSectionsShortDocSequencePanicspanics with a message similar toslice bounds out of range [:5] with capacity 4
- Reproduce the
v0.1.0throughv0.8.0unchecked BSON type-assertion panic:
git clone https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation.git obi-poc
cd obi-poc
git checkout v0.8.0
cat > pkg/ebpf/common/mongo_security_poc_test.go <<'EOF'
package ebpfcommon
import (
"testing"
"go.mongodb.org/mongo-driver/v2/bson"
)
func TestSecurityPoCParseFirstFieldTypeAssertionPanics(t *testing.T) {
parseFirstField(bson.E{Key: commFind, Value: int32(123)})
}
EOF
go test ./pkg/ebpf/common -run TestSecurityPoCParseFirstFieldTypeAssertionPanics -count=1
Expected result: panic with a message similar to interface conversion: interface {} is int32, not string.
Impact
This is a remote denial-of-service vulnerability in the MongoDB protocol parser. Any deployment that enables MongoDB parsing and processes attacker-controlled or malformed MongoDB traffic is impacted. Successful exploitation lets an unauthenticated attacker crash the telemetry agent by sending a crafted OP_MSG packet or malformed BSON document, causing loss of observability until the process is restarted.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Malformed MongoDB wire messages trigger uncaught panics in OBI agent's TCP parser, enabling remote unauthenticated denial of service.
Vulnerability
The MongoDB TCP parser in go.opentelemetry.io/obi versions v0.1.0 through v0.3.0 contains two slice-bounds panics: parseOpMessage reads OP_MSG flag bits from a buffer without ensuring it is long enough, and parseSections reads document-sequence length without re-validating remaining bytes [2][3]. In versions v0.1.0 through v0.8.0, parseFirstField performs an unchecked type assertion on BSON field values, assuming the collection name is always a string [2][3]. These panics occur on raw attacker-controlled network payloads before full validation.
Exploitation
A remote unauthenticated attacker can send a single crafted MongoDB wire message to the telemetry agent. No authentication or prior access is required. By sending a truncated OP_MSG packet, a malformed document-sequence section, or a BSON document with a non-string collection name, the attacker triggers a runtime panic that terminates the agent process [2][3].
Impact
Successful exploitation causes the telemetry agent to crash, resulting in denial of service. Telemetry collection for the affected process or node stops. There is no evidence of data corruption or unauthorized access, but monitoring continuity is lost until the agent is restarted [2][3].
Mitigation
The slice-bounds panics are fixed in release v0.4.0 (commit 3aa58cda) [2][3]. The unchecked BSON type assertion remains unpatched in v0.8.0. Upgrade to v0.4.0 or later to address the bounds-check issues. For the type assertion, no official fix is available in the cited references; workarounds include restricting network access to the agent or using network-level filtering to block malformed MongoDB traffic [1][2][3]. The vulnerability is not listed in CISA's Known Exploited Vulnerabilities catalog.
AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
1- Range: < 0.9.0
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
2News mentions
0No linked articles in our index yet.