Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packetbeat/protos/mongodb.(*decoder).readDocument: slice bounds out of range #5188

Closed
pierrre opened this issue Sep 15, 2017 · 1 comment
Closed

Comments

@pierrre
Copy link

pierrre commented Sep 15, 2017

PacketBeat version: 5.6.0
MongoDB version: 2.6
OS: Ubuntu 14.04 LTS

Crash log:

017-09-15T06:21:59+02:00 ERR ParseMongodb exception. Recovering, but please report this: runtime error: slice bounds out of range.
2017-09-15T06:21:59+02:00 ERR Stacktrace: goroutine 82 [running]:
runtime/debug.Stack(0xbd68c4, 0x2b, 0xc4235eb5d0)
    /usr/local/go/src/runtime/debug/stack.go:24 +0x79
github.com/elastic/beats/libbeat/logp.Recover(0xbc5590, 0x16)
    /go/src/github.com/elastic/beats/libbeat/logp/log.go:145 +0x138
panic(0xada5c0, 0xc420012140)
    /usr/local/go/src/runtime/panic.go:458 +0x243
github.com/elastic/beats/packetbeat/protos/mongodb.(*decoder).readDocument(0xc4235eb8f8, 0x1, 0x1, 0xc422d62360)
    /go/src/github.com/elastic/beats/packetbeat/protos/mongodb/mongodb_parser.go:348 +0x336
github.com/elastic/beats/packetbeat/protos/mongodb.opReplyParse(0xc4235eb8f8, 0xc4213ca360, 0xc42219bfb0)
    /go/src/github.com/elastic/beats/packetbeat/protos/mongodb/mongodb_parser.go:99 +0x3d4
github.com/elastic/beats/packetbeat/protos/mongodb.mongodbMessageParser(0xc423332120, 0xc4213ca360)
    /go/src/github.com/elastic/beats/packetbeat/protos/mongodb/mongodb_parser.go:57 +0x335
github.com/elastic/beats/packetbeat/protos/mongodb.(*mongodbPlugin).doParse(0xc42008bb00, 0xc4233427b0, 0xc421b12000, 0xc420211698, 0x0, 0x6000000000014)
    /go/src/github.com/elastic/beats/packetbeat/protos/mongodb/mongodb.go:161 +0x150
github.com/elastic/beats/packetbeat/protos/mongodb.(*mongodbPlugin).Parse(0xc42008bb00, 0xc421b12000, 0xc420211698, 0xc42008bb00, 0xa7b200, 0xc4233427b0, 0x0, 0x0)
    /go/src/github.com/elastic/beats/packetbeat/protos/mongodb/mongodb.go:110 +0xf0
github.com/elastic/beats/packetbeat/protos/tcp.(*TCPStream).addPacket(0xc4235ebb50, 0xc421b12000, 0xc421449ba0)
    /go/src/github.com/elastic/beats/packetbeat/protos/tcp/tcp.go:115 +0x176
github.com/elastic/beats/packetbeat/protos/tcp.(*TCP).Process(0xc42152fbf0, 0xc42154c340, 0xc421449ba0, 0xc421b12000)
    /go/src/github.com/elastic/beats/packetbeat/protos/tcp/tcp.go:208 +0x3a2
github.com/elastic/beats/packetbeat/decoder.(*Decoder).onTCP(0xc421449600, 0xc421b12000)
    /go/src/github.com/elastic/beats/packetbeat/decoder/decoder.go:317 +0xee
github.com/elastic/beats/packetbeat/decoder.(*Decoder).process(0xc421449600, 0xc421b12000, 0x2c, 0x35, 0x1180dc0, 0xc421449600)
    /go/src/github.com/elastic/beats/packetbeat/decoder/decoder.go:258 +0x222
github.com/elastic/beats/packetbeat/decoder.(*Decoder).OnPacket(0xc421449600, 0xc422d17fc4, 0x35, 0x35, 0xc42219bf80)
    /go/src/github.com/elastic/beats/packetbeat/decoder/decoder.go:164 +0x343
github.com/elastic/beats/packetbeat/sniffer.(*SnifferSetup).Run(0xc42008bce0, 0xc26fe0, 0xc420dd4ed0)
    /go/src/github.com/elastic/beats/packetbeat/sniffer/sniffer.go:381 +0x493
github.com/elastic/beats/packetbeat/beater.(*packetbeat).Run.func2(0xc420dd4ed0, 0xc4200c1540, 0xc42154e120)
    /go/src/github.com/elastic/beats/packetbeat/beater/packetbeat.go:155 +0x6a
created by github.com/elastic/beats/packetbeat/beater.(*packetbeat).Run
    /go/src/github.com/elastic/beats/packetbeat/beater/packetbeat.go:159 +0x1b2

Steps to reproduce: I don't know, it was running on my server.

adriansr added a commit to adriansr/beats that referenced this issue Feb 16, 2018
Ignore MongoDB message and drop the TCP stream if a malformed
query / response is received, instead of logging a panic.

Closes elastic#5188
kvch pushed a commit that referenced this issue Feb 19, 2018
* Fix out of bounds access to slice in MongoDB parser

Ignore MongoDB message and drop the TCP stream if a malformed
query / response is received, instead of logging a panic.

Closes #5188

* Update CHANGELOG
@pierrre
Copy link
Author

pierrre commented Feb 19, 2018

thanks !

adriansr added a commit to adriansr/beats that referenced this issue Apr 5, 2018
* Fix out of bounds access to slice in MongoDB parser

Ignore MongoDB message and drop the TCP stream if a malformed
query / response is received, instead of logging a panic.

Closes elastic#5188

* Update CHANGELOG
adriansr added a commit to adriansr/beats that referenced this issue Apr 6, 2018
* Fix out of bounds access to slice in MongoDB parser

Ignore MongoDB message and drop the TCP stream if a malformed
query / response is received, instead of logging a panic.

Closes elastic#5188

* Update CHANGELOG
andrewkroh pushed a commit that referenced this issue Apr 6, 2018
* Fix out of bounds access to slice in MongoDB parser

Ignore MongoDB message and drop the TCP stream if a malformed
query / response is received, instead of logging a panic.

Closes #5188

* Update CHANGELOG
andrewkroh pushed a commit that referenced this issue Apr 6, 2018
* Fix out of bounds access to slice in MongoDB parser

Ignore MongoDB message and drop the TCP stream if a malformed
query / response is received, instead of logging a panic.

Closes #5188

* Update CHANGELOG
leweafan pushed a commit to leweafan/beats that referenced this issue Apr 28, 2023
* Fix out of bounds access to slice in MongoDB parser

Ignore MongoDB message and drop the TCP stream if a malformed
query / response is received, instead of logging a panic.

Closes elastic#5188

* Update CHANGELOG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant