]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
4 years agostream/tcp: fix stream side after direction change 5912/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 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 agoprotodetect: improve midstream handling 5895/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 agotcp: remove debug asserts about large windows 5890/head
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 agodetct/pcre: Correct capture group count check 5887/head
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 agoalert/syslog: fix minor compile warning 5867/head
Victor Julien [Thu, 22 Oct 2020 14:10:14 +0000 (16:10 +0200)] 
alert/syslog: fix minor compile warning

(cherry picked from commit 62cc0c7acf2270d63e0e164d9e39f47b811e1fb3)

4 years agoproto/names: add SCTP if not defined in system
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 agohost: improve compare logic
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 5864/head
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 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 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 agodetect-fast-pattern: Mark as OPTIONAL_OPT, instead of NOOPT 5861/head
Gianni Tedesco [Sun, 13 Dec 2020 14:50:23 +0000 (23:50 +0900)] 
detect-fast-pattern: Mark as OPTIONAL_OPT, instead of NOOPT

Also update the erroneous comment about it.

(cherry picked from commit cebe15c23b48e92df5181b3f0b0e6ac7195d717b)

4 years agodetect: Validate that NOOPT options don't have optvals
Gianni Tedesco [Sun, 13 Dec 2020 14:54:13 +0000 (23:54 +0900)] 
detect: Validate that NOOPT options don't have optvals

Without this, a simple typo between : and ; is able to hide actual bugs
in rules.

I discovered 2 bugs in ET open ruleset this way.

(cherry picked from commit 10ea60a237cf41ddd10f7a887e2824b4b8e1c419)

4 years agodns: initialize log flags as an unsigned long long
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 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 agorust/json: Rework scope for short-lived vars 5733/head
Jeff Lucovsky [Sat, 16 Jan 2021 14:34:20 +0000 (09:34 -0500)] 
rust/json: Rework scope for short-lived vars

This commit corrects scope issues identified during CI with
FC32/strict-rust:
"this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
"

4 years agorust: lock major versions of crates 5732/head
Victor Julien [Sat, 16 Jan 2021 09:17:35 +0000 (10:17 +0100)] 
rust: lock major versions of crates

4 years agorust: lock to byteorder ~1.3.4 to avoid MSRV bump
Victor Julien [Sat, 16 Jan 2021 08:59:31 +0000 (09:59 +0100)] 
rust: lock to byteorder ~1.3.4 to avoid MSRV bump

4 years agosignature: Fix leak in urilen parsing 5729/head
Philippe Antoine [Thu, 7 Jan 2021 08:46:02 +0000 (09:46 +0100)] 
signature: Fix leak in urilen parsing

cf #4254

(cherry picked from commit 47dd9a5ebc26dac25b63b5ca37062e7a63cd5335)

4 years agodetect/file.name: register inspect engine for ftp-data
Victor Julien [Mon, 11 Jan 2021 14:17:02 +0000 (15:17 +0100)] 
detect/file.name: register inspect engine for ftp-data

(cherry picked from commit 45eddde573ab2e807a5fa44170d544288a60ea12)

4 years agodecode/tcp: Improved handling of TFO options
Jeff Lucovsky [Tue, 5 Jan 2021 14:31:11 +0000 (09:31 -0500)] 
decode/tcp: Improved handling of TFO options

This commit improves handling of TCP fast open options
- Option length must be in [6, 18]
- Option length must be an even value

(cherry picked from commit f8fef0dd05e87c3bf25e4e5c0bcf136e94c98393)

4 years agostream/midstream: handle packet loss after SYN/ACK
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 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 agoflow/timeout: fix TCP seq/ack for reversed flows 5680/head
Victor Julien [Wed, 23 Dec 2020 14:55:19 +0000 (15:55 +0100)] 
flow/timeout: fix TCP seq/ack for reversed flows

When a flow is swapped it also swaps the stream trackers, so it does
not make sense to reverse them during pseudo packet creation.

(cherry picked from commit 49bd1f85b99e8bd473ae28c6eb93510b2b3c7668)

4 years agodetect/stream: fix async stream inspection
Victor Julien [Thu, 17 Dec 2020 20:04:13 +0000 (21:04 +0100)] 
detect/stream: fix async stream inspection

Move raw progress forward only if detect uses stream data, indicated
by the PKT_DETECT_HAS_STREAMDATA flag.

(cherry picked from commit 3c7c361b603653a4c0bb30a4261babc45988d163)

4 years agostream/tcp: fix async mode ACK validation
Victor Julien [Thu, 17 Dec 2020 09:54:05 +0000 (10:54 +0100)] 
stream/tcp: fix async mode ACK validation

(cherry picked from commit 8aa02c6d15f013f9ce934e440ee073701d3ea502)

4 years agoversion: branch is going towards 5.0.6
Victor Julien [Tue, 15 Dec 2020 12:15:03 +0000 (13:15 +0100)] 
version: branch is going towards 5.0.6

4 years agoci: buildbot is decommissioned, so remove prscript refs 5663/head
Victor Julien [Fri, 11 Dec 2020 09:19:41 +0000 (10:19 +0100)] 
ci: buildbot is decommissioned, so remove prscript refs

(cherry picked from commit 372fc26739b414684ad0a7e25f444ceceb379173)

4 years agodoc: build all manpages
Sascha Steinbiss [Wed, 9 Dec 2020 17:34:49 +0000 (18:34 +0100)] 
doc: build all manpages

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".

4 years agogithub-ci: use a unique id for the commit check cargo cache 5652/head
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: Master CI improvements re: Travis CI 5631/head
Jason Ish [Wed, 12 Aug 2020 15:06:23 +0000 (09:06 -0600)] 
github-ci: Master CI improvements re: Travis CI

This is a squashed commit of the following items:

github-ci: Fedora 32 builder with asan enabled

Also enables -Wshadow and rust-strict to cover those cases
from Travis.

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

(cherry picked from commit c91b43a3fdf2e072f354c2082247b20804629b67)

github-ci: ubuntu 20.04 build without nss/nspr

Adds a test that builds and tests Suricata without nss/nspr
to replace the similar test on Travis-CI.

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

(cherry picked from commit 7ea2187f9191225cdab40d8fde49439c94824023)

github-ci: Ubuntu 20.4 build with -NDEBUG

To cover Travis-CI test that builds with -NDEBUG.

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

(cherry picked from commit 0dc6434e61e6a37c38f0ccda59ae56d714a2b268)

github-ci: enable debug on Fedora 32 build

(cherry picked from commit db0be04988d238d89c1a27cdc35dfcd1b0ab4a14)

github-ci: update debian 9 test to use known Rust version

Choose Rust 1.39.0 as a known version of Rust that we build against
to see in CI if we build with this version, but fail with latest.

This is to cover a similar test from Travis CI.

(cherry picked from commit 94ac702159f263bad6e480498ed894d8cb91be4a)

github-ci: add test build without jansson

This is to cover a test from Travis CI where we make sure
that ./configure fails if libjansson is not available.

(cherry picked from commit a35756e140bc48302cea55399a0cb09158d9cbc7)

github-ci: apply default CFLAGS to all builds

(cherry picked from commit b3a55a4cd5b291c66a79b6a56a49571152e5ba7f)

github-ci: Fixups for parity with master

rust: add doc target to build rust docs

Uses "cargo doc --no-deps" to build the documentation just for
our Suricata package. Without --no-deps, documentation will be
build for all our dependencies as well.

The generated documentation will end up in target/doc as HTML.

(cherry picked from commit 7ca24041b666bc9c9190a3c78d03d66b6ebebac6)

github-ci: CentOS 6 is EOL

(cherry picked from commit 3ea33f5e4756c9bdb5b9f0535b1acf46e392202b)

4 years agorelease: 5.0.5; update changelog; require htp 0.5.36 suricata-5.0.5
Victor Julien [Fri, 4 Dec 2020 07:00:40 +0000 (08:00 +0100)] 
release: 5.0.5; update changelog; require htp 0.5.36

4 years agoapp-layer: Remove errant validation BUG
Jeff Lucovsky [Wed, 2 Dec 2020 13:58:03 +0000 (08:58 -0500)] 
app-layer: Remove errant validation BUG

This commit removes an errant validation debug check brought into 5.0.x
mistakenly.

4 years agodnp3: regenerate dnp3 object decoders
Jason Ish [Thu, 3 Dec 2020 21:51:42 +0000 (15:51 -0600)] 
dnp3: regenerate dnp3 object decoders

4 years agoscript/dnp3-gen: update generator to reflect in tree changes
Jason Ish [Fri, 10 Jul 2020 19:19:35 +0000 (13:19 -0600)] 
script/dnp3-gen: update generator to reflect in tree changes

Some changes were made to the generated files instead of the
generator script. Update the script to generate what is
in the current state of the in-tree generated files.

(cherry picked from commit 4976afd96abf7b8dd49b444ee81df8091668f75e)

4 years agossl: upgarde to uint32 for bytes_processed
Philippe Antoine [Thu, 15 Oct 2020 19:32:27 +0000 (21:32 +0200)] 
ssl: upgarde to uint32 for bytes_processed

as it can overflow, and is compared with uint32 such as
message_length and message_start and

4 years agodetect: null sanity checks for pkthdr
Philippe Antoine [Wed, 14 Oct 2020 19:25:40 +0000 (21:25 +0200)] 
detect: null sanity checks for pkthdr

Even when the rules are only applied on traffic with the protocol
the structure for the protocol header can be set to NULL if there
was an error parsing the header

4 years agodnp3: fix memory leak with object containing bytearrays
Philippe Antoine [Thu, 19 Nov 2020 13:29:48 +0000 (14:29 +0100)] 
dnp3: fix memory leak with object containing bytearrays

4 years agodnp3: fix signed integer overflow
Philippe Antoine [Thu, 19 Nov 2020 13:28:43 +0000 (14:28 +0100)] 
dnp3: fix signed integer overflow

By using unsigned integers everywhere

4 years agodnp3: avoids DOS by too long loop over null-sized objects
Philippe Antoine [Thu, 19 Nov 2020 13:30:27 +0000 (14:30 +0100)] 
dnp3: avoids DOS by too long loop over null-sized objects

4 years agoftp: optimize FTPGetOldestTx by starting from last handled tx
Philippe Antoine [Tue, 3 Nov 2020 10:55:52 +0000 (11:55 +0100)] 
ftp: optimize FTPGetOldestTx by starting from last handled tx

Avoids DOS by quadratic complexity algorithm.
Attack is
1 stack many requests/transactions (like cwd commands on a line)
2 get many answers

4 years agodecode/null: fix type parsing
Victor Julien [Mon, 23 Nov 2020 20:59:18 +0000 (21:59 +0100)] 
decode/null: fix type parsing

(cherry picked from commit 14aacbd067c483c72578a86c78d16253b7dc3e93)

4 years agodetect: fix inspection order with stateful rules
Victor Julien [Mon, 30 Nov 2020 06:44:54 +0000 (07:44 +0100)] 
detect: fix inspection order with stateful rules

When stateful detection rules, for which detection has already started
for a previous packet, are added to the candidates array, the array
is sorted to mantain the correct inspection order. However, due to a
trivial error in the sort helper the array was sorted in descending
instead of ascending order.

(cherry picked from commit 46644440671c3bfeb9c1423aa1684191ff6db961)

4 years agopacket: set length of 0 for too big copy
Philippe Antoine [Thu, 19 Nov 2020 13:10:58 +0000 (14:10 +0100)] 
packet: set length of 0 for too big copy

(cherry picked from commit d5ac77ee8b2008e3e401fff6cbe28ced3bdf69ba)

4 years agorust: fix warnings found by nightly compiler
Philippe Antoine [Thu, 19 Nov 2020 14:50:54 +0000 (15:50 +0100)] 
rust: fix warnings found by nightly compiler

warning: getting the inner pointer of a temporary `CString`
this `CString` is deallocated at the end of the statement,
bind it to a variable to extend its lifetime

(cherry picked from commit 8db78208f94db524c98af3f84caf6a8951e0d884)

4 years agodnp3: set byte order when logging dnp3 src and dst
Jason Ish [Mon, 23 Nov 2020 18:11:42 +0000 (12:11 -0600)] 
dnp3: set byte order when logging dnp3 src and dst

DNP3 uses little endian on the wire, for the most part this
is handled as the messages are deserialize. However, the link
header is a cast over raw data, so swap these bytes as they
are being logged.

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

(cherry picked from commit 76e011a5ba9ef50b53692bbfeaf25ad28bc96389)

4 years agounix-socket: fix alert metadata logging
Angelo Mirabella [Wed, 11 Mar 2020 15:11:19 +0000 (15:11 +0000)] 
unix-socket: fix alert metadata logging

This changeset fixes a bug that was preventing suricata to dump
alert metadata info when running in unix-socket mode.
When running in unix-socket mode, suricata was skipping the
initialization of the output modules and, as a consequence,
the metadata output module was never invoked.

(cherry picked from commit ea15282f47c6ff781533e3a063f9c903dd6f1afb)

4 years agogithub-ci: CentOS 6 is EOL
Victor Julien [Wed, 2 Dec 2020 12:30:53 +0000 (13:30 +0100)] 
github-ci: CentOS 6 is EOL

4 years agodoc: http.uri.raw has no spaces 5625/head
Philippe Antoine [Wed, 25 Nov 2020 14:20:02 +0000 (15:20 +0100)] 
doc: http.uri.raw has no spaces

as they are in the protocol

cf bug #2881

(cherry picked from commit 6b30890de97f1c58ecda2c60e308e8d167a36bcc)

4 years agorust: handle windows naming change from .lib to .a 5623/head
Jason Ish [Mon, 30 Nov 2020 21:11:57 +0000 (15:11 -0600)] 
rust: handle windows naming change from .lib to .a

Prior to Rust 1.44, Cargo would name static libs with the .lib
extension. 1.44 changes this extension to .a when running under
a GNU environment on Windows like msys to make it more similar
to other unix environments.

Now assume static library name to be the same on Windows and
unix, but rename the .lib if found to still support older
versions of Rust on Windows.

(cherry picked from commit f3c59ef8a64f576c8784ab99a125b270f7b9c680)

4 years agoconfigure/mingw: move libs in LDFLAGS to LDADD
Jason Ish [Mon, 30 Nov 2020 21:37:02 +0000 (15:37 -0600)] 
configure/mingw: move libs in LDFLAGS to LDADD

Moving the libs specified in LDFLAGS to LDADD put them into the
correct placement on in the link command.

(cherry picked from commit 10f639e9d1edae14d87feb66059723d87b3efdb8)

4 years agodetect/mpm: remove usused cleanup function 5609/head
Victor Julien [Wed, 25 Nov 2020 08:49:54 +0000 (09:49 +0100)] 
detect/mpm: remove usused cleanup function

(cherry picked from commit e7b52010168a5b26a0d18500edd731f234b17646)

4 years agodetect: optimize prefilter result handling
Victor Julien [Wed, 25 Nov 2020 08:22:44 +0000 (09:22 +0100)] 
detect: optimize prefilter result handling

(cherry picked from commit e799357d9fbadb295468466907ab1972564b9a8c)

4 years agodetect/prefilter: small cleanup
Victor Julien [Wed, 25 Nov 2020 08:22:21 +0000 (09:22 +0100)] 
detect/prefilter: small cleanup

(cherry picked from commit ffb0945b4cc707bc8459e64771af677c2a673841)

4 years agogithub-ci: Replace deprecated add-path usage 5607/head
Jeff Lucovsky [Fri, 27 Nov 2020 13:59:42 +0000 (08:59 -0500)] 
github-ci: Replace deprecated add-path usage

4 years agodetect/magic: fix crash on rule reloading
Angelo Mirabella [Tue, 26 May 2020 17:00:06 +0000 (18:00 +0100)] 
detect/magic: fix crash on rule reloading

This changseset fixes a bug causing a segmentation fault.
When rules are reloaded and a rule using libmagic matches, suricata
crashes due to an improper reinitialization of the thread contexts.

Bug: #3726
(cherry picked from commit c72069c3b2c276a3b6cef627f1d8983d2df25bbe)

4 years agonapatech: Fix potential double release of packet
Phil Young [Wed, 11 Nov 2020 19:21:39 +0000 (14:21 -0500)] 
napatech: Fix potential double release of packet

This addresses readmine issue #4018.  There was the potential for a packet
buffer to be released twice in response to an error condition.  This
addresses this by only calling NT_NetRxRelease() when the p->ReleasePacket
is called.

(cherry picked from commit 789dcbd49d077b54726fb09738fb0f42112d00d0)

4 years agodecode: Improved handling of ICMPv4 messages
Jeff Lucovsky [Wed, 4 Nov 2020 13:34:51 +0000 (08:34 -0500)] 
decode: Improved handling of ICMPv4 messages

This commit improves handling of ICMPv4 messages, especially those with
variable sized headers.

This commit also adds a header length variable for use by the new
sticky buffer for the header.

(cherry picked from commit 988bb26828fc4f18a42b9eb44bf513a1eacf1066)

4 years agosmb: check post-gap timeouts once a second at most 5491/head
Victor Julien [Sun, 17 May 2020 12:24:07 +0000 (14:24 +0200)] 
smb: check post-gap timeouts once a second at most

(cherry picked from commit 25f2efe97749611760e6e26d388b420091423732)

4 years agosmb: update ts only if it changed
Victor Julien [Sun, 17 May 2020 12:48:52 +0000 (14:48 +0200)] 
smb: update ts only if it changed

(cherry picked from commit 8aa380600da15b95e74a6649e6003a1c484c4ce0)

4 years agosmb: fix 'dangling' files in lossy sessions
Victor Julien [Fri, 15 May 2020 07:57:42 +0000 (09:57 +0200)] 
smb: fix 'dangling' files in lossy sessions

In case of lossy connections the SMB state would properly clean up
transactions, including file transactions. However for files the
state was never set to 'truncated', leading to files to stay 'active'.

This would lead these files staying in the SMB's state. In long running
sessions with lots of files this would lead to performance and memory
use issues.

This patch cleans truncates the file that was being transmitted when
a file transaction is being closed.

(cherry picked from commit 65e9a7c31cc68bdb1fb3e1412b0a56260265c608)

4 years agoversion: release 5.0.4, require libhtp 0.5.35 suricata-5.0.4
Victor Julien [Wed, 7 Oct 2020 11:51:52 +0000 (13:51 +0200)] 
version: release 5.0.4, require libhtp 0.5.35

4 years agochangelog: update for 5.0.4
Victor Julien [Wed, 7 Oct 2020 11:49:40 +0000 (13:49 +0200)] 
changelog: update for 5.0.4

4 years agodcerpc: validate signature with dcerpc keywords
Philippe Antoine [Thu, 27 Aug 2020 15:32:41 +0000 (17:32 +0200)] 
dcerpc: validate signature with dcerpc keywords

so that they do not use another protocol's keywords

(cherry picked from commit c06d8f246303d767d2b5e8c504f58de401e64c0a)

4 years agossl: do not reuse struct session_id_length
Philippe Antoine [Tue, 6 Oct 2020 18:52:42 +0000 (20:52 +0200)] 
ssl: do not reuse struct session_id_length

As it can be confused between SSLv2 and TLSv13
In SSLv2, this variable is not used after the function scope, so
we can use a temporary variable.

4 years agossl: ensure the client version is valid by checking hello flags
Philippe Antoine [Tue, 6 Oct 2020 18:49:19 +0000 (20:49 +0200)] 
ssl: ensure the client version is valid by checking hello flags

4 years agosmb: resistance against padding evasions
Philippe Antoine [Tue, 14 Apr 2020 12:24:22 +0000 (14:24 +0200)] 
smb: resistance against padding evasions

Scenario is use of dummy padding in write AndX request
or other similar commands using a data offset.

Parsing skips now these dummy bytes, and generates one event

4 years agosmb: adds file overlap event against evasions
Philippe Antoine [Tue, 14 Apr 2020 08:30:33 +0000 (10:30 +0200)] 
smb: adds file overlap event against evasions

Evasion scenario is
- a first dummy write of one byte at offset 0 is done
- the second full write of EICAR at offset 0 is then done
and does not trigger detection

The last write had the final value, and as we cannot "cancel"
the previous write, we set an event which is then transformed into
an app-layer decoder alert

4 years agoapplayer: fix a leak in protocol change
Philippe Antoine [Wed, 9 Sep 2020 08:09:33 +0000 (10:09 +0200)] 
applayer: fix a leak in protocol change

TCPProtoDetect can either set f->alproto, change f->alstate
and return error.

When the original alstate gets freed, we shall set the pointer
to NULL, as it can get reused.

4 years agodnp3: more precise probing for banners
Philippe Antoine [Wed, 30 Sep 2020 20:04:32 +0000 (22:04 +0200)] 
dnp3: more precise probing for banners

4 years agodnp3: fixed wrong flow direction identification
Ilya Bakhtin [Tue, 25 Aug 2020 13:01:22 +0000 (15:01 +0200)] 
dnp3: fixed wrong flow direction identification

dnp3 is a communication between so-called master and outstation
in our terms master is a client and outstation is a server
DIR flag in dnp3 header is nonzero when a packet is from master
so if DIR is nonzero then packet is 'toserver'

4 years agodnp3: fix probing test not using final null in string
Philippe Antoine [Tue, 6 Oct 2020 11:46:47 +0000 (13:46 +0200)] 
dnp3: fix probing test not using final null in string

4 years agosignature: checks protocol for file.name keyword
Philippe Antoine [Thu, 17 Sep 2020 13:22:49 +0000 (15:22 +0200)] 
signature: checks protocol for file.name keyword

By setting the flags as for the filename keyword (not sticky version)

(cherry picked from commit 61d0cd139972bd7767c7a0013b756fb7e0e2219c)

4 years agoenip: set unidirection transaction flag
Jason Ish [Mon, 5 Oct 2020 21:05:41 +0000 (15:05 -0600)] 
enip: set unidirection transaction flag

(cherry picked from commit 2b215a45e04ff21ce8aa8fb421b4b053ef63b6c2)

4 years agodhcp: set unidirection transaction flag
Jason Ish [Mon, 14 Sep 2020 19:47:17 +0000 (13:47 -0600)] 
dhcp: set unidirection transaction flag

(cherry picked from commit 0529a00ffdd05e9613c160008e16252851d86b0a)

4 years agoikev2: set unidirection transaction flag
Jason Ish [Mon, 14 Sep 2020 19:47:10 +0000 (13:47 -0600)] 
ikev2: set unidirection transaction flag

(cherry picked from commit 3036ec4db0f80baa42ebde7b81de77352603089a)

4 years agosip: set unidirection transaction flag
Jason Ish [Mon, 14 Sep 2020 19:32:13 +0000 (13:32 -0600)] 
sip: set unidirection transaction flag

(cherry picked from commit 54d5f336d4f26074e642d2155c056f17a9563435)

4 years agordp: set unidirection transaction flag
Jason Ish [Mon, 14 Sep 2020 19:31:56 +0000 (13:31 -0600)] 
rdp: set unidirection transaction flag

(cherry picked from commit 1d40d0c5f93f7233834eb1eeae569b7f794a8a6b)

4 years agokrb5: set unidirection transaction flag
Jason Ish [Mon, 14 Sep 2020 19:30:46 +0000 (13:30 -0600)] 
krb5: set unidirection transaction flag

(cherry picked from commit f7dee602e9490c0d98729d1d8d11a06c67ebb0ab)

4 years agontp: set unidirection transaction flag
Jason Ish [Mon, 14 Sep 2020 19:05:09 +0000 (13:05 -0600)] 
ntp: set unidirection transaction flag

(cherry picked from commit 984d3c7f20560dae0adeae7fa09ba740f65d0868)

4 years agosnmp: set unidirectional transaction flag
Jason Ish [Tue, 18 Aug 2020 16:40:00 +0000 (10:40 -0600)] 
snmp: set unidirectional transaction flag

(cherry picked from commit fc7d59d92fb52a2ced979e0ff92a95bce390edfb)

4 years agoapplayer: add flags to parser registration struct
Jason Ish [Mon, 13 Jul 2020 16:24:24 +0000 (10:24 -0600)] 
applayer: add flags to parser registration struct

This will allow Rust parsers to register for gap handing from
Rust (some Rust parsers do handle gaps, but they set the flag
from C).

(cherry picked from commit 53aa967e0b89417f2714fcbcbb6463be6ce8282e)

4 years agoapp-layer: handle unidirectional transactions
Jason Ish [Tue, 18 Aug 2020 16:39:42 +0000 (10:39 -0600)] 
app-layer: handle unidirectional transactions

(cherry picked from commit 60ebc27c4eb755800e6d3f4ec1a5d55a5230a214)

4 years agoapp-layer: backport unidirectional tx option
Jason Ish [Thu, 24 Sep 2020 17:50:03 +0000 (11:50 -0600)] 
app-layer: backport unidirectional tx option

This is a partial backport of:
ac3cf6ff75a3e5be39867bba1830076ac43e9f50

    detect/config: set config for special cases

    Allow app-layer to declare the txs are uni-directional and special
    care is needed for applying config.

4 years agodetect/asn1: Fix relative_offset keyword option
Emmanuel Thompson [Tue, 28 Apr 2020 18:03:26 +0000 (14:03 -0400)] 
detect/asn1: Fix relative_offset keyword option

- Fix relative_offset keyword option to be relative in regards to the
last content match
- Change relative_offset to int32_t with bounds check to allow the full
range of the packet buffer size (uint16_t)
- Added checks for over/underflows
- Changed the offset type to uint16_t because the offset is applied to
the payload length, which is a uint16_t
- Adjusted test cases to work relative to the content match
- Added test case to verify bounds

(cherry picked from commit be3379f00e30fd4776c6a3a622c2b27ca60a92e1)

4 years agodetect/rules: Fix copy/paste error
Jeff Lucovsky [Wed, 23 Sep 2020 12:15:41 +0000 (08:15 -0400)] 
detect/rules: Fix copy/paste error

This commit corrects a copy/paste error handling the `include-mpm-stats`
configuration setting.

(cherry picked from commit db9776af64dfd0872cb4374b01e9871dea2a03b5)

4 years agodetect/rules: Increase array size to remove SEGV
Jeff Lucovsky [Sat, 19 Sep 2020 12:47:56 +0000 (08:47 -0400)] 
detect/rules: Increase array size to remove SEGV

This commit changes the size of reporting variables to be dynamic based
on the buffer ids in use instead of a fixed value to address a SEGV when
the fixed value was less than the max buffer/type id in use.

(cherry picked from commit d911fb87b8c9bb496adebed03a7113ec0b6526d8)

4 years agohttp: error check htp_list_size
Victor Julien [Mon, 5 Oct 2020 06:17:19 +0000 (08:17 +0200)] 
http: error check htp_list_size

This avoids a potential casting to uint64_t of -1, leading to a very
high upper bound of the tx loop.

(cherry picked from commit e07a4393a9dc07d199a04540d0b54119ee95a2a5)

4 years agodecode/geneve: fix unittests now that config is disabled 5465/head
Victor Julien [Mon, 5 Oct 2020 07:43:57 +0000 (09:43 +0200)] 
decode/geneve: fix unittests now that config is disabled

4 years agodecode/geneve: disable by default w/o config
Victor Julien [Mon, 5 Oct 2020 06:38:56 +0000 (08:38 +0200)] 
decode/geneve: disable by default w/o config

4 years agoapplayer: keep running detection on protocol change 5440/head
Philippe Antoine [Wed, 9 Sep 2020 08:09:33 +0000 (10:09 +0200)] 
applayer: keep running detection on protocol change

ie do not stop on first try if we do not have enough data

(cherry picked from commit 07cbdb32b3f6e63e2d08b29e6db0c0ac3d819a70)

4 years agodecode/geneve: Disable geneve decoding by default.
Jeff Lucovsky [Tue, 22 Sep 2020 12:36:55 +0000 (08:36 -0400)] 
decode/geneve: Disable geneve decoding by default.

4 years agodecode/geneve: add config to yaml
Victor Julien [Fri, 4 Sep 2020 08:11:40 +0000 (10:11 +0200)] 
decode/geneve: add config to yaml

(cherry picked from commit 57a611b429d5108c5793e9b6b55f85d29d3f0758)

4 years agodecode/geneve: Add Geneve decoding functionality
Ali Jad Khalil [Wed, 29 Apr 2020 07:36:18 +0000 (07:36 +0000)] 
decode/geneve: Add Geneve decoding functionality

These changes are in response to feature request 3063. Geneve is
very similar to VXLAN, but uses a slightly different encapsulation
scheme.

(cherry picked from commit ef9e532f0739a87ffc163ed5ffb3699ffa9aa07b)

4 years agodetect: checks for overflow when comparing signatures priorities
Philippe Antoine [Thu, 27 Aug 2020 15:11:10 +0000 (17:11 +0200)] 
detect: checks for overflow when comparing signatures priorities

(cherry picked from commit 16742394424e8c9654708fbc93b990b9ddc70dff)

4 years agosignature: checks for integer overflow in limits propagation
Philippe Antoine [Thu, 23 Jul 2020 09:26:16 +0000 (11:26 +0200)] 
signature: checks for integer overflow in limits propagation

(cherry picked from commit a99ad4c1e4251c8a4a667d613ccb1fb334a9b268)

4 years agosignature: checks for integer overflow in limits propagation
Philippe Antoine [Thu, 23 Jul 2020 09:26:16 +0000 (11:26 +0200)] 
signature: checks for integer overflow in limits propagation

(cherry picked from commit 61c327dd80f02484481cbea6d48168063ae90a69)