Skip to content

[Packetbeat] Panic in SIP parser #21668

@andrewkroh

Description

@andrewkroh

I'm seeing runtime error: slice bounds out of range [:-1] from the SIP parser in Packetbeat.

Version: packetbeat version 8.0.0 (arm64), libbeat 8.0.0 [7028e2c9779bff69f7d526af69eb804c024e5776 built 2020-10-07 19:02:26 +0000 UTC]

github.com/elastic/beats/v7/packetbeat/protos/sip.parseFromToContact
	/go/src/github.com/elastic/beats/packetbeat/protos/sip/plugin.go:507
github.com/elastic/beats/v7/packetbeat/protos/sip.populateToFields
	/go/src/github.com/elastic/beats/packetbeat/protos/sip/plugin.go:278
github.com/elastic/beats/v7/packetbeat/protos/sip.(*plugin).populateHeadersFields
	/go/src/github.com/elastic/beats/packetbeat/protos/sip/plugin.go:249
github.com/elastic/beats/v7/packetbeat/protos/sip.(*plugin).buildEvent
	/go/src/github.com/elastic/beats/packetbeat/protos/sip/plugin.go:166
github.com/elastic/beats/v7/packetbeat/protos/sip.(*plugin).doParse
	/go/src/github.com/elastic/beats/packetbeat/protos/sip/plugin.go:123
github.com/elastic/beats/v7/packetbeat/protos/sip.(*plugin).ParseUDP
	/go/src/github.com/elastic/beats/packetbeat/protos/sip/plugin.go:105
github.com/elastic/beats/v7/packetbeat/protos/udp.(*UDP).Process
	/go/src/github.com/elastic/beats/packetbeat/protos/udp/udp.go:76
github.com/elastic/beats/v7/packetbeat/decoder.(*Decoder).onUDP
	/go/src/github.com/elastic/beats/packetbeat/decoder/decoder.go:335
github.com/elastic/beats/v7/packetbeat/decoder.(*Decoder).process
	/go/src/github.com/elastic/beats/packetbeat/decoder/decoder.go:283
github.com/elastic/beats/v7/packetbeat/decoder.(*Decoder).OnPacket
	/go/src/github.com/elastic/beats/packetbeat/decoder/decoder.go:194
github.com/elastic/beats/v7/packetbeat/sniffer.(*Sniffer).Run
	/go/src/github.com/elastic/beats/packetbeat/sniffer/sniffer.go:210
github.com/elastic/beats/v7/packetbeat/beater.(*packetbeat).Run.func2
	/go/src/github.com/elastic/beats/packetbeat/beater/packetbeat.go:228

if pos == -1 {
pos = bytes.IndexByte(fromTo, ' ')
}
displayInfo = bytes.Trim(fromTo[:pos], "'\"\t ")

I do have a pcap that I can share privately if it's needed to solve this.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions