]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
4 years agodecode/vntag: By default, disable vntag decoding 6173/head
Jeff Lucovsky [Fri, 4 Jun 2021 12:26:09 +0000 (08:26 -0400)] 
decode/vntag: By default, disable vntag decoding

This commit makes the VNTag decoder off by default.

4 years agodecode/vntag: Add VNTag decoder logic
Jeff Lucovsky [Sun, 25 Apr 2021 13:20:54 +0000 (09:20 -0400)] 
decode/vntag: Add VNTag decoder logic

(cherry picked from commit 0f0cb5169f378614c753328e2d0396f5b9211a38)

4 years agotests/vntag: VNTAG decoder unittests
Jeff Lucovsky [Sat, 24 Apr 2021 19:44:17 +0000 (15:44 -0400)] 
tests/vntag: VNTAG decoder unittests

(cherry picked from commit 596d7608333290d22ea6cee26a79eb4f9ca8605d)

4 years agodecode/vntag: VNTAG 802.1Qbh decoder
Jeff Lucovsky [Sat, 24 Apr 2021 19:43:50 +0000 (15:43 -0400)] 
decode/vntag: VNTAG 802.1Qbh decoder

(cherry picked from commit 713bace44f05c4b900c35ad2da537ef5e0ad18ec)

4 years agodecode/stats: VNTAG stats
Jeff Lucovsky [Sat, 24 Apr 2021 19:42:48 +0000 (15:42 -0400)] 
decode/stats: VNTAG stats

(cherry picked from commit b944e636a8dfa34971d0375baa1cb3fa764bb2e0)

4 years agodecode/events: VNTAG decoder events
Jeff Lucovsky [Sat, 24 Apr 2021 19:38:16 +0000 (15:38 -0400)] 
decode/events: VNTAG decoder events

(cherry picked from commit 1ddad0a0d610265baea902387eb40d7012c8c841)

4 years agodecode: Add ethertype for VNTAG
Jeff Lucovsky [Sat, 24 Apr 2021 19:36:57 +0000 (15:36 -0400)] 
decode: Add ethertype for VNTAG

(cherry picked from commit 049afde3a275ab748f4ef1f4777b9cfd5dd400ce)

4 years agogithub: Update codeowner handle 6148/head
Shivani Bhardwaj [Fri, 30 Apr 2021 06:55:58 +0000 (12:25 +0530)] 
github: Update codeowner handle

(cherry picked from commit 0c5a8fb35d3f60b3828c5e7b91f4bb9e6c37990c)

4 years agorust: pin memchr to ~2.3 6143/head
Jason Ish [Tue, 25 May 2021 16:18:56 +0000 (10:18 -0600)] 
rust: pin memchr to ~2.3

2.4+ requires a newer version of Rust.

4 years agomakefile: don't include the whole test/ directory
Jason Ish [Tue, 25 May 2021 17:39:31 +0000 (11:39 -0600)] 
makefile: don't include the whole test/ directory

Including the whole directory results in .deps files ending up
in the distribution archive which shouldn't be there. Instead
we have to list all the test sources individually.

Backport of 70b21df75633253ac8318f229de2f521c14a6630.

4 years agordp: correctly returns incomplete in parse_tc 6099/head
Philippe Antoine [Thu, 11 Mar 2021 21:17:13 +0000 (22:17 +0100)] 
rdp: correctly returns incomplete in parse_tc

Adding the already consumed bytes
In case an incomplete tls handshake is handled with/after
a refular rdp t123_tpkt

(cherry picked from commit 6da9a37285a50b513077e5c88094f8112740ffcb)

4 years agoftp: fixes leak with duplicate expectation
Philippe Antoine [Thu, 8 Apr 2021 15:44:01 +0000 (17:44 +0200)] 
ftp: fixes leak with duplicate expectation

(cherry picked from commit 68d6922e3cc47c2608e1ac3614c6bd3a48185a12)

4 years agooutput/log: Ensure files closed in threaded mode
Jeff Lucovsky [Sun, 11 Apr 2021 16:20:15 +0000 (12:20 -0400)] 
output/log: Ensure files closed in threaded mode

This commit ensures that file objects are closed in threaded mode.

(cherry picked from commit 38ae21a19691466b078a6201494df893bc91308c)

4 years agooutput/log: Removed pcie (Tilera) log vestiges
Jeff Lucovsky [Mon, 12 Apr 2021 13:12:23 +0000 (09:12 -0400)] 
output/log: Removed pcie (Tilera) log vestiges

This commit removes the last remnants of the Tilera log output mechanism
(unsupported since 5.0.x).

(cherry picked from commit aa9ad56a5b0faeb9528558f6197ff967c6714e94)

4 years agoflow/bypass: Properly set the ICMP emergency-bypassed value
Luke Coughlan [Mon, 26 Apr 2021 12:05:15 +0000 (13:05 +0100)] 
flow/bypass: Properly set the ICMP emergency-bypassed value

Currently the ICMP emergency-bypassed value defined in suricata.conf is
overwriting the UDP value rather than correctly setting it for ICMP.
This commit corrects this bug so that the ICMP value can be set as
expected.

(cherry picked from commit 7fb56a9075a97cd9781d08efd0f949b0bfca2719)

4 years agokerberos: fix probing parser tag condition
Philippe Antoine [Thu, 11 Mar 2021 15:12:36 +0000 (16:12 +0100)] 
kerberos: fix probing parser tag condition

according to the comment

(cherry picked from commit cb150e97d09baea09a738388426eafad3cccff2a)

4 years agodetect/alert: apply pd only actions to flow
Victor Julien [Wed, 10 Mar 2021 12:25:55 +0000 (13:25 +0100)] 
detect/alert: apply pd only actions to flow

Ticket #4394

(cherry picked from commit 6cf44fc839e8f1da820095928b5b25e7fc0a8521)

4 years agodetect/alert: minor code refactor
Victor Julien [Tue, 9 Mar 2021 19:56:14 +0000 (20:56 +0100)] 
detect/alert: minor code refactor

Use a simpler reject check and move logic into util func.

(cherry picked from commit 6c594d29db55bb0d6f28f0a5fa758c3e00a86ca1)

4 years agodetect/iponly: don't check & set flow flags twice
Victor Julien [Tue, 9 Mar 2021 15:25:14 +0000 (16:25 +0100)] 
detect/iponly: don't check & set flow flags twice

Per flow IP-only flags are checked and set by IP-only engine, so
no need to set/check them per alert.

(cherry picked from commit fbcdd2ec267d49040ca178f8562767d8fb00aa73)

4 years agothreshold-config: Improve support for big IP lists
Jeff Lucovsky [Sat, 5 Dec 2020 14:28:38 +0000 (09:28 -0500)] 
threshold-config: Improve support for big IP lists

(cherry picked from commit ef62761e8c64d1644f2628ca7fc99e815bd96b88)

4 years agodetect/threshold: Improve threshold.config perf
Jeff Lucovsky [Mon, 29 Mar 2021 12:30:59 +0000 (08:30 -0400)] 
detect/threshold: Improve threshold.config perf

This commit improves performance when parsing threshold.config by
removing a loop-invariant to create a one-time object with the parsed
address(es).

Then, as needed, copies of this object are made as the suppression
rule(s) are processed.

(cherry picked from commit 02ceac8b8d4473de5f373a4785a1c143778b06e1)

4 years agodetect/threshold: Function to deep-copy thresh obj
Jeff Lucovsky [Mon, 29 Mar 2021 12:28:50 +0000 (08:28 -0400)] 
detect/threshold: Function to deep-copy thresh obj

This commit adds a function to make a deep copy of a DetectThresholdData
object.

The function is used when parsing threshold.config items to make a
one-time object and then add copies as needed.

(cherry picked from commit e873632a2811be4cd370336d43fcc5619bcd28e2)

4 years agodetect/address: Expose DetectAddressCopy function
Jeff Lucovsky [Mon, 29 Mar 2021 12:26:40 +0000 (08:26 -0400)] 
detect/address: Expose DetectAddressCopy function

(cherry picked from commit 11f9cc6524958d11b6d9ab1f0785bfe16237096f)

4 years agogeneral: Typo cleanup
Jeff Lucovsky [Mon, 29 Mar 2021 12:33:02 +0000 (08:33 -0400)] 
general: Typo cleanup

(cherry picked from commit 2893b04ab014c4dcc0bfc4c6f9dbf83fd44717a1)

4 years agoeve/drop: use highest priority drop
Victor Julien [Fri, 12 Mar 2021 09:22:01 +0000 (10:22 +0100)] 
eve/drop: use highest priority drop

When adding the alert to a drop record make sure the add the highest
priority.

It would until now add all drops from high to low prio, effectively
overwriting the record each time.

Ticket #4397

(cherry picked from commit 398ebf934509a8d27a1c8b858eae061b89d5c44a)

4 years agomisc: include queue.h before other headers 6079/head
Jason Ish [Thu, 22 Apr 2021 14:52:08 +0000 (08:52 -0600)] 
misc: include queue.h before other headers

At least on FreeBSD, some other include is including "sys/queue.h"
which results in FreeBSDs /usr/include/sys/queue.h being picked
up and setting __SYS_QUEUE_H__ so our queue.h is not picked up.

But the FreeBSD queue.h does not have the CIRCLEQ definitions. To
fix just include our queue.h first, which also sets __SYS_QUEUE_H__
preventing the system one from being picked up.

(cherry picked from commit d4554ec6bb6e4e52fb2e36cf0412c981a4d1d2e9)

4 years agotx: fix unidir tx cleanup
Jason Ish [Thu, 22 Apr 2021 15:38:24 +0000 (09:38 -0600)] 
tx: fix unidir tx cleanup

A unidirection protocol parser should only have its transactions
marked as "skipped" if it is skipped in both the TS and TC
directions, otherwise unidir transactions are always considered
skipped and the cleanup will never updates its minimum id.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/4437

(cherry picked from commit afaa18c5ad183d068795cf15d21d3642814ceb23)

4 years agoeve/mqtt: fix mqtt logging with threaded eve 6016/head
Jason Ish [Thu, 25 Mar 2021 18:11:01 +0000 (12:11 -0600)] 
eve/mqtt: fix mqtt logging with threaded eve

Mqtt was not setting up a per-thread file context for logging
in threaded mode, leading a crash when used in threaded mode.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/4404

(cherry picked from commit 64330498f842386cc1f1cdec0409959b5565496f)

4 years agoci: make format check use 6.0.x branch
Victor Julien [Wed, 31 Mar 2021 13:20:14 +0000 (15:20 +0200)] 
ci: make format check use 6.0.x branch

4 years agodetect/icmp: reject invalid rules for icode/itype
Victor Julien [Wed, 3 Mar 2021 13:01:55 +0000 (14:01 +0100)] 
detect/icmp: reject invalid rules for icode/itype

(cherry picked from commit 68f8b2f40f24a8656b09b3a9b1245ab3cf62a11d)

4 years agodetect/prefilter: fix null ptr deref on invalid rule
Victor Julien [Wed, 3 Mar 2021 12:41:26 +0000 (13:41 +0100)] 
detect/prefilter: fix null ptr deref on invalid rule

A bad rule 'icode:<0; prefilter;' would trigger a null ptr deref
in ApplyToU8Hash.

Bug #4375.

(cherry picked from commit 7d6835958bbb6ddf2931c9e20f409eadfc8ca068)

4 years agoversion: start development towards 6.0.3
Victor Julien [Fri, 5 Mar 2021 10:41:37 +0000 (11:41 +0100)] 
version: start development towards 6.0.3

4 years agorelease: 6.0.2; update changelog; require htp 0.5.37 5962/head suricata-6.0.2
Victor Julien [Mon, 1 Mar 2021 15:56:01 +0000 (16:56 +0100)] 
release: 6.0.2; update changelog; require htp 0.5.37

4 years agodetect/prefilter: fix handling of prefilter as fast_pattern alias
Victor Julien [Sat, 20 Feb 2021 14:53:51 +0000 (15:53 +0100)] 
detect/prefilter: fix handling of prefilter as fast_pattern alias

(cherry picked from commit 0dd5921bc9791ac733c8d264212d69e661309df1)

4 years agodetect: forbids unsupported prefilters
Philippe Antoine [Sun, 7 Feb 2021 20:34:12 +0000 (21:34 +0100)] 
detect: forbids unsupported prefilters

(cherry picked from commit b7fd01c86e0d0f3c341031d62ec89e305859aa0b)

4 years agodetect: set HTTP SWF decompress limits
Victor Julien [Thu, 25 Feb 2021 21:38:34 +0000 (22:38 +0100)] 
detect: set HTTP SWF decompress limits

(cherry picked from commit af13d4de180515f92813befc9bca06b66f7233bb)

4 years agoRevert "detect/state: optimize state keeping"
Victor Julien [Mon, 1 Mar 2021 07:02:22 +0000 (08:02 +0100)] 
Revert "detect/state: optimize state keeping"

This reverts commit 13ce474d5e3947389e781f95fa6337d2eb36e129.

The optimization is incomplete. A more complete fix is merged in
master, but this needs a bit more time before getting backported.

4 years agosmb: relax probing parser to handle first NBSS message
Philippe Antoine [Wed, 17 Feb 2021 14:36:12 +0000 (15:36 +0100)] 
smb: relax probing parser to handle first NBSS message

cf dcerpc-udp S-V test :
First message is Message Type: Session request (0x81)
Second message is SMB

(cherry picked from commit 83070102557d2755b9ffc67bb14b9b4d48b039e9)

4 years agosmb: probing parser for start and midstream
Philippe Antoine [Tue, 2 Feb 2021 12:31:08 +0000 (13:31 +0100)] 
smb: probing parser for start and midstream

The probing parser is more strict at the start of the stream

(cherry picked from commit 1b6e81cd7284355cb4315606cac30325e144d25a)

4 years agosmb: split probing function for code style
Philippe Antoine [Tue, 2 Feb 2021 12:29:14 +0000 (13:29 +0100)] 
smb: split probing function for code style

Introduces rs_smb_probe_tcp_midstream

(cherry picked from commit 9dc5258a21cecdabca26aaac108e83d85147d30b)

4 years agoprotodetect: only run ProbingParserTc if STREAM_TOCLIENT
Philippe Antoine [Wed, 17 Feb 2021 13:54:46 +0000 (14:54 +0100)] 
protodetect: only run ProbingParserTc if STREAM_TOCLIENT

(cherry picked from commit 660e9e489b7d898509946d8a66f15c6107fd5a4e)

4 years agodetect: fix overflows in SetupU8Hash
Philippe Antoine [Wed, 17 Feb 2021 16:02:35 +0000 (17:02 +0100)] 
detect: fix overflows in SetupU8Hash

For instance ">255" resulted in overflow

(cherry picked from commit 2d765d6c686449e78e29759b07c4852ebab3c46e)

4 years agossl: reset state when breaking out of SSLV3_HANDSHAKE_PROTOCOL
Philippe Antoine [Fri, 18 Dec 2020 21:12:23 +0000 (22:12 +0100)] 
ssl: reset state when breaking out of SSLV3_HANDSHAKE_PROTOCOL

So that we cannot resumt it with corrupted values

(cherry picked from commit eb460cf78dadc874633a57571245acf2911a6b6e)

4 years agomodbus: stop allocating transactions when flooded
Philippe Antoine [Thu, 17 Dec 2020 20:48:54 +0000 (21:48 +0100)] 
modbus: stop allocating transactions when flooded

cf #4224

(cherry picked from commit 89030d3e59e23d4850ac9a7db5763c3d4d4fd537)

4 years agoicmpv6: bail out for icmpv6.hdr keyword if not ICMPv6
Philippe Antoine [Fri, 18 Dec 2020 13:21:16 +0000 (14:21 +0100)] 
icmpv6: bail out for icmpv6.hdr keyword if not ICMPv6

(cherry picked from commit ddb4d289ae00908d8f25fdd3afbcd5a1da2111a6)

4 years agooutput/http2: Multi-threaded EVE logging support
Jeff Lucovsky [Tue, 8 Dec 2020 13:38:18 +0000 (08:38 -0500)] 
output/http2: Multi-threaded EVE logging support

This commit adds multi-threaded EVE logging support to the HTTP/2
logging path.

(cherry picked from commit 538fc58b37cb6633824fc2e167068b11d09a013a)

4 years agoeve: fix memory leak in metadata
Philippe Antoine [Mon, 7 Dec 2020 11:16:31 +0000 (12:16 +0100)] 
eve: fix memory leak in metadata

Fixes #4205

(cherry picked from commit 35f6c80bbf4eef7ec311ed78dd29819cc471905e)

4 years agoprotodetect: rename direction to flags
Philippe Antoine [Tue, 2 Feb 2021 10:12:12 +0000 (11:12 +0100)] 
protodetect: rename direction to flags

And use whole flags in AppLayerProtoDetectPPGetProto

(cherry picked from commit c6aadf0dfa0d438e3a4a46db2de893b62e76d7ce)

4 years agodecode: limits the number of decoded layers
Philippe Antoine [Thu, 28 Jan 2021 16:48:48 +0000 (17:48 +0100)] 
decode: limits the number of decoded layers

so as to avoid overrecursion leading to stack exhaustion

(cherry picked from commit 7500c29300dcef8716d87461842e7d7c3e5101ac)

4 years agodetect/http.request_body: fix tracking with xforms 5934/head
Victor Julien [Thu, 25 Feb 2021 21:00:17 +0000 (22:00 +0100)] 
detect/http.request_body: fix tracking with xforms

Fix handling of file progress tracking for regular http.request_body
along with transform combinations.

This is done by implementing the 'base id' logic.

Related tickets: #4361 #4199 #3616

(cherry picked from commit 4a1482a1cfab7bbf95be81dff9b9db3708f6626a)

4 years agodetect/file.data: fix mixing transforms (http)
Victor Julien [Thu, 25 Feb 2021 20:36:27 +0000 (21:36 +0100)] 
detect/file.data: fix mixing transforms (http)

Fix handling of file progress tracking for regular file.data along
with transform combinations for the part of the implementation that
uses the HTTP inspection logic.

This is done by implementing the 'base id' logic.

Related tickets: #4361 #4199 #3616

(cherry picked from commit ea3fb4a465e0ecd3f08c2828aa08804335c77a46)

4 years agodetect/file.data: fix mixing transforms (file api)
Victor Julien [Thu, 25 Feb 2021 19:07:41 +0000 (20:07 +0100)] 
detect/file.data: fix mixing transforms (file api)

Fix handling of file progress tracking for regular file.data along
with transform combinations for the part of the implementation that
uses the File API.

This is done by implementing the 'base id' logic.

Related tickets: #4361 #4199 #3616

(cherry picked from commit 54ad7de9cea22b9a3c3e7cc64145155126f4dada)

4 years agodetect: track base id for xform buffers
Victor Julien [Thu, 25 Feb 2021 19:06:40 +0000 (20:06 +0100)] 
detect: track base id for xform buffers

Buffers with transforms are based on the non-transformed "base"
buffer, with a new ID assigned and the transform callbacks added.

This patch stores the id of the original buffer in the new buffer
inspect and prefilter structures. This way the buffers with and
without transforms can share some of the logic are progression
of file and body inspection trackers.

Related tickets: #4361 #4199 #3616

(cherry picked from commit 975062cf401f79c00abf728d923c65aabd143af2)

4 years agodetect/analyzer: fix pkt engine display
Victor Julien [Sun, 7 Feb 2021 08:00:49 +0000 (09:00 +0100)] 
detect/analyzer: fix pkt engine display

(cherry picked from commit 52692da7cf9f66a979bac24f38efd5ce2767d066)

4 years agoclassification: sync and update
Victor Julien [Wed, 24 Feb 2021 15:30:13 +0000 (16:30 +0100)] 
classification: sync and update

Sync to latest ET open and introduce inappropriate as a classification
to replace something some find inappropriate.

(cherry picked from commit f037f6f4ff08ed0442b3bbc1623dfb7ecb23c716)

4 years agotcp: remove debug asserts about large windows
Philippe Antoine [Wed, 17 Feb 2021 14:43:17 +0000 (15:43 +0100)] 
tcp: remove debug asserts about large windows

Completes 00d7c9034be7470177c01e8805831c258b016d0e

(cherry picked from commit 7264f58f2cbf266ba44efd32c5031b692b57967d)

4 years agodcerpc: trigger raw assembly on record completion
Shivani Bhardwaj [Tue, 23 Feb 2021 09:55:52 +0000 (15:25 +0530)] 
dcerpc: trigger raw assembly on record completion

(cherry picked from commit 0ac5c5376a2a6e32ac0c12ff8bc483abf04c9cb8)

4 years agorust/context: add AppLayerParserTriggerRawStreamReassembly
Shivani Bhardwaj [Tue, 23 Feb 2021 08:23:06 +0000 (13:53 +0530)] 
rust/context: add AppLayerParserTriggerRawStreamReassembly

(cherry picked from commit c77c8e70050b865401b3cfd3d5396bec90ac2498)

4 years agodcerpc/udp: improve detection
Shivani Bhardwaj [Sat, 13 Feb 2021 12:27:42 +0000 (17:57 +0530)] 
dcerpc/udp: improve detection

Lately, Wireguard proto starting w pattern |04 00| is misdetected as
DCERPC/UDP which also starts with the same pattern, add more checks
to make sure that it is the best guess for packet to be dcerpc/udp.

(cherry picked from commit f967a491047a6d8eaa232944c690dadfb0cc3c86)

4 years agodcerpc: add probe function
Shivani Bhardwaj [Sat, 20 Feb 2021 06:32:28 +0000 (12:02 +0530)] 
dcerpc: add probe function

(cherry picked from commit 3641f1b52256b7eb289048d6b83e660fe4907aaf)

4 years agorust/applayer: split EOF flag per direction
Shivani Bhardwaj [Sat, 20 Feb 2021 06:31:20 +0000 (12:01 +0530)] 
rust/applayer: split EOF flag per direction

(cherry picked from commit d7a3523b12d0280f6fd8cdadc14118d1ede31fd5)

4 years agodcerpc/udp: remove transmute
Shivani Bhardwaj [Sat, 20 Feb 2021 06:30:17 +0000 (12:00 +0530)] 
dcerpc/udp: remove transmute

The book defines transmute as "This is really, truly, the most horribly unsafe
thing you can do in Rust. The guardrails here are dental floss."
Transmute can result into mind boggling undefined behaviors. Get rid of
it wherever possible.

(cherry picked from commit 0ca8591994abfe92bbef20ea6ab1856b11e3efde)

4 years agogithub-ci: use suricata-update master-1.2.x branch
Jason Ish [Wed, 24 Feb 2021 22:51:28 +0000 (16:51 -0600)] 
github-ci: use suricata-update master-1.2.x branch

Suricata 6.0.x tracks the Suricata-Update 1.2.x branch.

4 years agostream/tcp: fix stream side after direction change 5911/head
Ilya Bakhtin [Tue, 28 Jul 2020 14:33:23 +0000 (16:33 +0200)] 
stream/tcp: fix stream side after direction change

(cherry picked from commit 1ecea0f44c0050feb57c6b26a5a94c8ad8f1b85d)

4 years agodoc/quickstart: use new test url that works
Jason Ish [Mon, 22 Feb 2021 21:23:52 +0000 (15:23 -0600)] 
doc/quickstart: use new test url that works

Replace http://testmyids.org with http://testmynids.org/uid/index.html,
as testmyids.org now always redirects to https.

(cherry picked from commit 560974b2dbd402928e5fa8004ab810919cd86f04)

4 years agodoc: update installation documentation for CentOS and Fedora
Josh Stroschein [Fri, 18 Dec 2020 18:09:48 +0000 (12:09 -0600)] 
doc: update installation documentation for CentOS and Fedora

(cherry picked from commit 7ece0ac31f9a3af13aebf928a1c63c672532dcec)

4 years agohttp: makes decompression time limit configurable
Philippe Antoine [Wed, 17 Feb 2021 08:37:57 +0000 (09:37 +0100)] 
http: makes decompression time limit configurable

(cherry picked from commit a04b5566a62d9d6967587f83dfaca89b5c33eb66)

4 years agofuzz: rightly uses PacketFreeOrRelease in target 5896/head
Philippe Antoine [Wed, 27 Jan 2021 20:21:44 +0000 (21:21 +0100)] 
fuzz: rightly uses PacketFreeOrRelease in target

instead of PacketFree because packets
may belong to the pool

(cherry picked from commit 62e665c8482c90b30f6edfa7b0f0eabf8a4fcc79)

4 years agofuzz: use some value for max_pending_packets
Philippe Antoine [Tue, 26 Jan 2021 19:34:14 +0000 (20:34 +0100)] 
fuzz: use some value for max_pending_packets

so as not to timeout waiting forever for the condition
in PacketPoolWait

(cherry picked from commit e586d8526b3aea6562f7e04d3cde88bded9bd420)

4 years agofuzz: improves sigpcap target with PacketPoolInit
Philippe Antoine [Fri, 18 Dec 2020 20:56:24 +0000 (21:56 +0100)] 
fuzz: improves sigpcap target with PacketPoolInit

(cherry picked from commit 8d659c6500b79b881e16133cbb5719426ceacec7)

4 years agoprotodetect: improve midstream handling 5893/head
Ilya Bakhtin [Mon, 15 Feb 2021 17:36:46 +0000 (18:36 +0100)] 
protodetect: improve midstream handling

Set "done flag" only if parsers for both directions are not found in a
case of midstream parsers from other direction are tried if nothing is found
for the initial one. "done flag" must be set if nothing is found in both
directions. Otherwise processing of incomplete data is terminated at the very
first try.

(cherry picked from commit 5285163d8f31dc89a4ab96b0842099f9792e29be)

4 years agohost: improve compare logic 5860/head
Victor Julien [Sat, 13 Feb 2021 16:10:15 +0000 (17:10 +0100)] 
host: improve compare logic

The old compare macro would compare all bytes of an address, even
when for IPv4 addresses the additional bytes were not in use. This
made the logic vulnerable to mistakes like in issue #4280.

(cherry picked from commit 6bfc5afa2301cc416e2fced23ec1accdfdea0daf)

4 years agodetect/iprep: fix loading of mixed ipv4/ipv6 lists
Victor Julien [Sat, 13 Feb 2021 15:54:56 +0000 (16:54 +0100)] 
detect/iprep: fix loading of mixed ipv4/ipv6 lists

Improper reuse of the address data structure between loading
different lines in the iprep file would lead to the host using
a malformed address.

(cherry picked from commit 7b03e6837e5a7366f546e7a2b681d2921ded1ab1)

4 years agodataset: fix dataset string lookup
Eric Leblond [Wed, 20 Jan 2021 20:17:04 +0000 (21:17 +0100)] 
dataset: fix dataset string lookup

The data was unlocked but the use_cnt was not decreased resulting
in the data entry not being removable.

(cherry picked from commit 64f994f753b9109c8f788e3a6dbe4c72f6e69d94)

4 years agostream: remove debug assert
Victor Julien [Thu, 21 Jan 2021 15:44:39 +0000 (16:44 +0100)] 
stream: remove debug assert

In cases of large windows in the past the check would tigger.

(cherry picked from commit 00d7c9034be7470177c01e8805831c258b016d0e)

4 years agodetect/pcre: Test capture group/var mismatch
Jeff Lucovsky [Mon, 8 Feb 2021 13:06:53 +0000 (08:06 -0500)] 
detect/pcre: Test capture group/var mismatch

(cherry picked from commit cbb03dbb39d76cf1a2770ef35ba07aac5c3657b5)

4 years agodetct/pcre: Correct capture group count check
Jeff Lucovsky [Mon, 8 Feb 2021 13:05:41 +0000 (08:05 -0500)] 
detct/pcre: Correct capture group count check

This commit corrects the validation check between the number of
variables used and the number of specified capture groups.

(cherry picked from commit 469d5bb214195d8939be467c66ef1e6d25ad3e1f)

4 years agosuricata: avoid at exit crash in nfq mode
Eric Leblond [Sun, 24 Jan 2021 21:40:02 +0000 (22:40 +0100)] 
suricata: avoid at exit crash in nfq mode

When Suricata was build with ebpf support and when it was started
in NFQ mode, it was crashing at exit because it was trying to free
the device extension.

This patch fixes the issue by only trigger the eBPF related code
when Suricata is running in AFP_PACKET mode.

(cherry picked from commit 85327890f5bb3b9521a2dfb8268ace6645d02f72)

4 years agoflow/manager: (u)sleep slightly longer
Victor Julien [Wed, 3 Feb 2021 11:00:51 +0000 (12:00 +0100)] 
flow/manager: (u)sleep slightly longer

Sleep 250 microseconds instead of 100 as running in KVM cause the
old value to use 100% CPU for these threads.

Perf testing suggests no measurable impact for the non-KVM case.

Ticket: #4096
(cherry picked from commit 17a38f1823adeb9eb059f666686e35509f3a13d2)

4 years agoapp-layer: fix transaction cleanup
Victor Julien [Mon, 1 Feb 2021 21:23:47 +0000 (22:23 +0100)] 
app-layer: fix transaction cleanup

Fix a 'skipped' transaction early in the list leading to all further
transactions getting skipped, even if they were fully processed and
ready to be cleaned up.

(cherry picked from commit 8baef60d600c5254662633d8275f321a6dafb82c)

4 years agodetect/state: optimize state keeping
Victor Julien [Fri, 5 Feb 2021 07:41:22 +0000 (08:41 +0100)] 
detect/state: optimize state keeping

(cherry picked from commit ed05c51d9943771b985bc90f2a319f1688de7483)

4 years agodetect: fix heap overflow issue with buffer setup
Victor Julien [Thu, 4 Feb 2021 13:48:11 +0000 (14:48 +0100)] 
detect: fix heap overflow issue with buffer setup

In some cases, the InspectionBufferGet function would be followed by
a failure to set the buffer up, for example due to a HTTP body limit
not yet being reached. Yet each call to InspectionBufferGet would lead
to the matching list_id to be added to the
DetectEngineThreadCtx::inspect.to_clear_queue. This array is sized to
add each list only once, but in this case the same id could be added
multiple times, potentially overflowing the array.

(cherry picked from commit 13cebb1857c3637f55a566ed694e7ed7f0ee0d87)

4 years agodetect: initializes memory in bytemath parsing
Philippe Antoine [Thu, 28 Jan 2021 16:02:19 +0000 (17:02 +0100)] 
detect: initializes memory in bytemath parsing

(cherry picked from commit 2b043150ed11b7def7047fb4170c27e95b00099f)

4 years agofilestore: fix global counter init in unix socket mode
Jason Ish [Fri, 18 Dec 2020 17:34:30 +0000 (11:34 -0600)] 
filestore: fix global counter init in unix socket mode

Move initialization of filestore global counter to PreRunInit,
so they get registered during program initialization, or as
required in unix-socket mode, initialized for each file run.

Fixes Redmine issue:
https://redmine.openinfosecfoundation.org/issues/4216

4 years agodns: initialize log flags as an unsigned long long 5819/head
Jason Ish [Mon, 7 Dec 2020 21:31:34 +0000 (15:31 -0600)] 
dns: initialize log flags as an unsigned long long

On 64 bit all 64 bits were being initialized, but on 32 bit
only 32 bits were as it was being initialized as a long.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/4206

(cherry picked from commit f2ab5803fbd88ae613429a382f28e81841832d0d)

4 years agoebpf: avoid need of 32 bit header
Eric Leblond [Mon, 28 Dec 2020 08:41:09 +0000 (09:41 +0100)] 
ebpf: avoid need of 32 bit header

Compilation of xdp_lb.c was failing in some case with the following
error:

/usr/include/x86_64-linux-gnu/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found

This patch add some define to be able to skip recursive inclusion of
header files leading to the problem.

(cherry picked from commit dfe5785bfa630905ae52267baeae5453231f9b2d)

4 years agoproto/names: add SCTP if not defined in system 5806/head
Victor Julien [Mon, 18 Jan 2021 12:56:32 +0000 (13:56 +0100)] 
proto/names: add SCTP if not defined in system

If SCTP is missing from /etc/protocols, add it manually.

(cherry picked from commit bf00285d0acf87c794f6569eb51d1f7d1247a0da)

4 years agolua/test: Test cases using SC prefix 5799/head
Jeff Lucovsky [Wed, 13 Jan 2021 18:43:52 +0000 (13:43 -0500)] 
lua/test: Test cases using SC prefix

This commit adds paired test cases to ensure that the SC variant of the
entry points are tested.

(cherry picked from commit 1c68f4aed66dceed79ce04d0f9cd14ca2fe72589)

4 years agodoc/lua: Lua API name consistency
Jeff Lucovsky [Wed, 13 Jan 2021 18:39:21 +0000 (13:39 -0500)] 
doc/lua: Lua API name consistency

This commit updates the documentation of the SCFlow* function names
available to Lua scripts.

Formerly, they used the prefix "Sc"; now they use "SC".

(cherry picked from commit 25e94831682c6eb641b416afef83d78de6f95729)

4 years agogeneral: Correct typo
Jeff Lucovsky [Tue, 12 Jan 2021 15:16:43 +0000 (10:16 -0500)] 
general: Correct typo

(cherry picked from commit c8459746396d142a9aec53e44a252c4bf4773716)

4 years agolua: Use SC prefix for Lua functions
Jeff Lucovsky [Tue, 12 Jan 2021 15:14:54 +0000 (10:14 -0500)] 
lua: Use SC prefix for Lua functions

This commit adds additional Lua API interfaces to bring consistency to
functions such that the `SC` prefix is available consistently across
flow int and flow var functions.

(cherry picked from commit 431018d6f7d81ec603d29ba990ef22e51d797139)

4 years agostream/midstream: handle packet loss after SYN/ACK 5726/head
Victor Julien [Tue, 29 Dec 2020 19:36:26 +0000 (20:36 +0100)] 
stream/midstream: handle packet loss after SYN/ACK

(cherry picked from commit db2dbaaf40a911200849b235d8408788fa379276)

4 years agostream/tcp: fix invalid ack events in timewait state
Victor Julien [Mon, 28 Dec 2020 18:18:08 +0000 (19:18 +0100)] 
stream/tcp: fix invalid ack events in timewait state

(cherry picked from commit 895938080f52db464faf8d971fd5b06bc139ad0a)

4 years agorust: require test-case 1.0.1; don't use 1.1
Victor Julien [Thu, 14 Jan 2021 08:00:27 +0000 (09:00 +0100)] 
rust: require test-case 1.0.1; don't use 1.1

4 years agomime: postpone md5 calculation to parse complete
Jason Ish [Wed, 30 Dec 2020 19:32:53 +0000 (13:32 -0600)] 
mime: postpone md5 calculation to parse complete

Instead of calculating the MD5 at the end of every part, only
compute it when parsing is complete.

With libnss, the hash never updates after the first HASH_End, so
the md5 of only the first part of the body is logged, rather than
the md5 of all the parts.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/4245

4 years agogithub-ci: use python3 in debian builds
Jason Ish [Fri, 8 Jan 2021 16:32:47 +0000 (10:32 -0600)] 
github-ci: use python3 in debian builds

(cherry picked from commit 18a1fd22c2dfd0613b190a656574077c1230e309)

4 years agogithub-ci/macos: use brew to install Python 3
Jason Ish [Fri, 8 Jan 2021 15:39:19 +0000 (09:39 -0600)] 
github-ci/macos: use brew to install Python 3

The default Python on MacOS is Python 2. Suricata-Verify now
depends on Python 3, so install it with Brew.

(cherry picked from commit 7904ef82d0b2478694025ca0d9043f2ae98be73a)

4 years agogithub-ci: use a unique id for the commit check cargo cache
Jason Ish [Thu, 10 Dec 2020 15:48:06 +0000 (09:48 -0600)] 
github-ci: use a unique id for the commit check cargo cache

All builds have been using the same cache id for ~/.cargo which
could lead us to conflict situations which is what I think we are
seeing with the commit-check job.

(cherry picked from commit 49ca070446cdca49afc42d71aaedaa9a1b458897)

4 years agogithub-ci: fix centos 8 build
Jason Ish [Tue, 8 Dec 2020 15:34:52 +0000 (09:34 -0600)] 
github-ci: fix centos 8 build

The "PowerTools" repo that we need to enable has been renamed
to "powertools".

(cherry picked from commit f09536a936e18cf008ea6457220f6d5600602e7a)

4 years agogithub-ci: build cbindgen during prep
Jason Ish [Tue, 1 Dec 2020 18:55:36 +0000 (12:55 -0600)] 
github-ci: build cbindgen during prep

Instead of building cbindgen in every build, build it once
during prep as a static musl binary to avoid library issues.

(cherry picked from commit 1f1a7651325934a2a96a238ab29d1aba6a086763)