]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
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)

4 years agodetect: fix read overflow in DetectGetLastSMByListId
Philippe Antoine [Thu, 23 Jul 2020 11:28:57 +0000 (13:28 +0200)] 
detect: fix read overflow in DetectGetLastSMByListId

(cherry picked from commit 5c31383d1c9ecbd93f0eae4ef02ae17ff98bcbed)

4 years agodetect/asn1: Fixes definite long form parsing of length field
Emmanuel Thomspon [Thu, 9 Apr 2020 16:22:11 +0000 (12:22 -0400)] 
detect/asn1: Fixes definite long form parsing of length field

(cherry picked from commit a9f590b350196d06375a926a35c05b6927aead97)

4 years agodnp3: adds unit test against previous bug 5335/head
Philippe Antoine [Tue, 23 Jun 2020 07:08:22 +0000 (09:08 +0200)] 
dnp3: adds unit test against previous bug

(cherry picked from commit 0ffa1c601456c7db67dcc488b016a8ae6dfe22c6)

4 years agonfs: fix 'dangling' files in lossy sessions
Victor Julien [Mon, 20 Jul 2020 12:49:59 +0000 (14:49 +0200)] 
nfs: fix 'dangling' files in lossy sessions

In case of lossy connections the NFS 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 NFS'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.

Based on 65e9a7c31cc68bdb1fb3e1412b0a56260265c608

(cherry picked from commit 44d7dd02b34a678972aeeadc03b68ba267531333)

4 years agonfs: check post-gap timeouts once a second at most
Victor Julien [Mon, 20 Jul 2020 12:30:39 +0000 (14:30 +0200)] 
nfs: check post-gap timeouts once a second at most

Based on 25f2efe97749611760e6e26d388b420091423732

(cherry picked from commit 760d6c187718ed1051607a766a51bfcbeb56c823)

4 years agonfs: update ts only if it changed
Victor Julien [Mon, 20 Jul 2020 12:18:52 +0000 (14:18 +0200)] 
nfs: update ts only if it changed

Based on 8aa380600da15b95e74a6649e6003a1c484c4ce0

(cherry picked from commit f8e9fe95cb233ede9941e893b0e9789900368949)

4 years agooutput/anomaly: Restrict anomaly logger count
Jeff Lucovsky [Sat, 1 Aug 2020 13:45:04 +0000 (09:45 -0400)] 
output/anomaly: Restrict anomaly logger count

This commit restricts the anomaly logger count. The restriction is
necessary due to state maintenance in the logger that doesn't scale
beyond a single logger.

Until that issue's solved, when multiple anomaly loggers are configured,
an error message will be emitted to highlight the restriction.

(cherry picked from commit 8e2aab7467a92cedc8cb67647af8601d43b36e91)

4 years agofuzz: disable DNP3 checksums while fuzzing
Philippe Antoine [Fri, 19 Jun 2020 09:43:04 +0000 (11:43 +0200)] 
fuzz: disable DNP3 checksums while fuzzing

(cherry picked from commit 8a61f754c485b6c956c31c26176112d45d68b6e8)

4 years agoFix stack overflow in DetectFlowbitsAnalyze
Antti Tönkyrä [Fri, 26 Jun 2020 10:37:45 +0000 (10:37 +0000)] 
Fix stack overflow in DetectFlowbitsAnalyze

Use dynamically allocated array instead of stack and free it after it is no longer needed.

(cherry picked from commit fd4ef5cd541ad945fddae5f469e32ef0562447ca)

4 years agosignature: fix linked list for bidirectional signatures
Philippe Antoine [Sat, 2 May 2020 13:55:23 +0000 (15:55 +0200)] 
signature: fix linked list for bidirectional signatures

Bidirectional signatures are really two signatures with one id
This needs to be handled with care when changing a linked list

(cherry picked from commit 5ac8e41a130f7b17678be00a1a5510a85f7baa2e)

4 years agoenip: use status for probing parser
Philippe Antoine [Sat, 2 May 2020 18:17:35 +0000 (20:17 +0200)] 
enip: use status for probing parser

(cherry picked from commit 0da4dc0deab8ae40f2f4476f68faa62a692a0350)

5 years agodnp3: fix buffer over read in responses parsing 5180/head
Philippe Antoine [Sun, 21 Jun 2020 20:22:47 +0000 (22:22 +0200)] 
dnp3: fix buffer over read in responses parsing

(cherry picked from commit d465bb86863acd4c0cd534f0748c5a2ef1283241)

5 years agodnp3: probing parser fixes direction based on dnp3 header
Philippe Antoine [Fri, 19 Jun 2020 09:53:16 +0000 (11:53 +0200)] 
dnp3: probing parser fixes direction based on dnp3 header

(cherry picked from commit 629a16e3733dd577822d0c82d2e81cbeb3b9a4d2)

5 years agodetect/content: Validate content byte array 5130/head
Jeff Lucovsky [Thu, 11 Jun 2020 13:08:42 +0000 (09:08 -0400)] 
detect/content: Validate content byte array

This commit checks whether the content byte array is compatible with the
transforms, if any, for the rule.

(cherry picked from commit 051465ee74422eb7578bdb8ef92f76037d7c47ec)

5 years agodoc: Fix spelling error
Jeff Lucovsky [Fri, 12 Jun 2020 12:37:51 +0000 (08:37 -0400)] 
doc: Fix spelling error

(cherry picked from commit cbcb7c5b99f30ac0555bb47ba9ec093b3be2e55e)

5 years agogeneral: Fix spelling error
Jeff Lucovsky [Fri, 12 Jun 2020 12:37:23 +0000 (08:37 -0400)] 
general: Fix spelling error

(cherry picked from commit aed6356e5b4888e20cff3bdf847bb95b6a6a66b7)

5 years agodetect: Add transform validation api
Jeff Lucovsky [Thu, 11 Jun 2020 13:07:43 +0000 (09:07 -0400)] 
detect: Add transform validation api

This commit extends the API with a function that validates arguments
against the transforms for the SM list (if any).

(cherry picked from commit 8f1a7111ed10f2b017d5190682a6961a1729942d)

5 years agodetect/transform: Add validation function
Jeff Lucovsky [Thu, 11 Jun 2020 13:05:08 +0000 (09:05 -0400)] 
detect/transform: Add validation function

This commit adds a function to pre-validate buffers. If a content
buffer contains whitespace, the validation fails.

(cherry picked from commit bc81474e3fb715b1ef110338676fc15de34744c0)

5 years agodetect/transform: Add transform "validate" function
Jeff Lucovsky [Thu, 11 Jun 2020 12:31:55 +0000 (08:31 -0400)] 
detect/transform: Add transform "validate" function

This commit adds an (optional) entry for a validation function. The
validation function, if present, will be used during rule processing.

Its role is to determine if the arguments are compatible with the
transform. E.g., a content string of "this string has whitespace" is not
compatible with the `strip_whitespace` transform.

(cherry picked from commit 596875fa68af18746abbbd9e307d14a93f23c3f7)

5 years agoutil-log-redis: add support for unix socket
Eric Leblond [Fri, 29 May 2020 10:08:31 +0000 (12:08 +0200)] 
util-log-redis: add support for unix socket

If there is a '/' in the redis server string then we consider that
the connection should be done other a unix socket.

(cherry picked from commit e12437e31e9cab25576e9cb3d70cba620ba3023e)

5 years agoutil-log-redis: ensure a dump per second
Eric Leblond [Thu, 23 Jan 2020 12:30:29 +0000 (13:30 +0100)] 
util-log-redis: ensure a dump per second

In sync mode, Suricata was waiting to have batch size alerts before
logging them. This was introducing delay in some configuration with
low traffic.

(cherry picked from commit 3ae33bb7a10544babc2f2c56543c825a1f29599d)

5 years agoutil-log-redis: fix reconnect in batch mode
Eric Leblond [Thu, 23 Jan 2020 12:10:44 +0000 (13:10 +0100)] 
util-log-redis: fix reconnect in batch mode

In case of redis outage, the redis session was reset but the replies
were still fetch even if there is none replies in the new session.

(cherry picked from commit 21431f166c337a7d3dd8ff8cc3aacbe686414ae3)

5 years agosignature: adds file flag for file_data keyword
pantoine [Fri, 1 May 2020 08:54:51 +0000 (10:54 +0200)] 
signature: adds file flag for file_data keyword

So that SigValidate can check if a protocol not supporting
files was set after this keyword

(cherry picked from commit 2d43d0de4b3828bda4178031c4cf1c6e0cc0bb6e)

5 years agofile-hash-common: fix rule_file truncation
Jason Ish [Fri, 26 Jun 2020 17:45:38 +0000 (11:45 -0600)] 
file-hash-common: fix rule_file truncation

Loading file hash lists uses dirname(3) on the
de_ctx->rule_file which modifies the contents,
removing the last part of the path. So on subsequent
calls the rule_file no longer contains the rule_file,
but instead just the directory name.

Mostly noticed when using "-S" with rule files outside
of the default-rule-path which requires more hunting for
the rule file.

(cherry picked from commit 3b135c609565e9393819b651f9785d58b20d79d2)

5 years agooutput/tftp: Include common options
Jeff Lucovsky [Mon, 29 Jun 2020 13:48:20 +0000 (09:48 -0400)] 
output/tftp: Include common options

This commit will cause common metadata values and the community id to be
included in log output when configured.

(cherry picked from commit 0bb62e0abb0b4956e71b232c4e4094fa2545e1f9)

5 years agooutput/smb: Include common output options
Jeff Lucovsky [Mon, 29 Jun 2020 13:50:21 +0000 (09:50 -0400)] 
output/smb: Include common output options

This commit will cause common metadata values and the community id to be
included in log output when configured.

(cherry picked from commit c590d6f4591fc8127afc3e1468b879b5f4999875)

5 years agooutput/dhcp: Include common output options
Jeff Lucovsky [Mon, 29 Jun 2020 13:50:53 +0000 (09:50 -0400)] 
output/dhcp: Include common output options

This commit will cause common metadata values and the community id to be
included in log output when configured.

(cherry picked from commit 7a939ae9c237b17b31afd3bf91dfa1701be882ea)

5 years agooutput/rdp: Include common output options
Jeff Lucovsky [Mon, 29 Jun 2020 13:51:35 +0000 (09:51 -0400)] 
output/rdp: Include common output options

This commit will cause common metadata values and the community id to be
included in log output when configured.

(cherry picked from commit 9b3cf5db489fbb0cd51ce1a80110529bd8b598e5)

5 years agowindows: fix timestring timezone display 5113/head
Victor Julien [Sat, 23 May 2020 18:57:21 +0000 (20:57 +0200)] 
windows: fix timestring timezone display

Bug: #3690
(cherry picked from commit bbdc11842d324005567bac5eafdea5fd0fc62688)

5 years agohtp: enforce body limits more exact
Victor Julien [Thu, 4 Jun 2020 20:50:38 +0000 (22:50 +0200)] 
htp: enforce body limits more exact

(cherry picked from commit a4568a634d5df223a4caaed4552b54f9e4598c12)

5 years agodetect/http_raw_header: Correct type mismatch
Angelo Mirabella [Tue, 16 Jun 2020 09:04:06 +0000 (10:04 +0100)] 
detect/http_raw_header: Correct type mismatch

This changeset fixes a bug on the computation of the buffer
lenght for raw http headers. The bug is due to a mismatch
on the data type of the length (uint8_t vs uint32_t) and it
was causing signature misses.

(cherry picked from commit 0cdc009da1c97784b3c1742b33fa817e9597ea68)

5 years agoversion: starting work on 5.0.4
Victor Julien [Mon, 15 Jun 2020 07:44:26 +0000 (09:44 +0200)] 
version: starting work on 5.0.4

5 years agoversion: release 5.0.3, require libhtp 0.5.33 suricata-5.0.3
Victor Julien [Mon, 27 Apr 2020 13:25:11 +0000 (15:25 +0200)] 
version: release 5.0.3, require libhtp 0.5.33

5 years agochangelog: update for 5.0.3
Victor Julien [Mon, 27 Apr 2020 13:23:55 +0000 (15:23 +0200)] 
changelog: update for 5.0.3

5 years agohtp: fix test after libhtp changes
Victor Julien [Mon, 27 Apr 2020 07:34:16 +0000 (09:34 +0200)] 
htp: fix test after libhtp changes

5 years agodetect/smtp: Refactor command check
Jeff Lucovsky [Fri, 17 Apr 2020 18:01:36 +0000 (14:01 -0400)] 
detect/smtp: Refactor command check

This commit refactors the code that matches reply with command.

Bug: #3592

5 years agoapp-layer/smtp: Improve RSET handling
Jeff Lucovsky [Thu, 16 Apr 2020 14:44:53 +0000 (10:44 -0400)] 
app-layer/smtp: Improve RSET handling

This commit improves how the parser handles the `RSET` command.
Termination of the transaction occurs when the `RSET` ack is seen (reply
code 250).

Bug: #3592

5 years agoenip: more precise probing parser
Philippe Antoine [Mon, 6 Apr 2020 15:22:33 +0000 (17:22 +0200)] 
enip: more precise probing parser

Bug: #3674

5 years agodetect/port: limit recursion in port parsing
Victor Julien [Tue, 14 Apr 2020 09:00:39 +0000 (11:00 +0200)] 
detect/port: limit recursion in port parsing

Bug: #3600

5 years agodetect/address: limit recursion during parsing
Victor Julien [Tue, 14 Apr 2020 06:01:49 +0000 (08:01 +0200)] 
detect/address: limit recursion during parsing

Allow a max depth of 64.

Bug: #3600

5 years agodetect/address: dead code removal and style cleanups
Victor Julien [Tue, 1 Oct 2019 04:50:38 +0000 (06:50 +0200)] 
detect/address: dead code removal and style cleanups

(cherry picked from commit 42d112e7b6db6c85102c1864905cca0ea2c05f88)

5 years agodetect/address: minor cleanups
Victor Julien [Tue, 14 Apr 2020 06:01:37 +0000 (08:01 +0200)] 
detect/address: minor cleanups

5 years agodecode: cleanup packet properly on bad packets
Victor Julien [Sun, 5 Apr 2020 12:35:29 +0000 (14:35 +0200)] 
decode: cleanup packet properly on bad packets

In case of bad IPv4, TCP or UDP, the per packet ip4vars/tcpvars/udpvar
structures would not be cleaned up because the cleanup depends on the
'header' pointer being set, but the error handling would unset that.

This could mean these structures were already filled with values before
the error was detected. As packets were recycled, the next packet decoding
would use this unclean structure.

To make things worse these structures are part of unions. IPv4/IPv6 and
TCP/ICMPv4/ICMPv6 share the same memory location.

LibFuzzer+UBSAN found this both locally and in Oss-Fuzz:

decode-ipv6.c:654:9: runtime error: load of value 6, which is not a valid value for type 'bool'
    #0 0x6146f0 in DecodeIPV6 /src/suricata/src/decode-ipv6.c:654:9
    #1 0x617e96 in DecodeNull /src/suricata/src/decode-null.c:70:13
    #2 0x9dd8a4 in DecodePcapFile /src/suricata/src/source-pcap-file.c:412:9
    #3 0x4c8ed2 in LLVMFuzzerTestOneInput /src/suricata/src/tests/fuzz/fuzz_sigpcap.c:158:25
    #4 0x457e51 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:556:15
    #5 0x457575 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:470:3
    #6 0x459917 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:698:19
    #7 0x45a6a5 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:830:5
    #8 0x448728 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:824:6
    #9 0x472552 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:19:10
    #10 0x7ff0d097b82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #11 0x41bde8 in _start (/out/fuzz_sigpcap+0x41bde8)

Bug: #3610

5 years agossl: don't say we consumed bytes if we didn't consume them
Victor Julien [Fri, 21 Feb 2020 19:07:19 +0000 (20:07 +0100)] 
ssl: don't say we consumed bytes if we didn't consume them

5 years agossl: fix handshake cert buffer sizing
Victor Julien [Fri, 3 Apr 2020 15:03:47 +0000 (17:03 +0200)] 
ssl: fix handshake cert buffer sizing

'trec' buffer was not grown properly when it was checked as too small.
After this it wasn't checked again so that copying into the buffer could
overflow it.

Bug: #3609

5 years agodetect/keywords: dynamic version part of doc URL 4896/head
Victor Julien [Tue, 28 Apr 2020 07:56:44 +0000 (09:56 +0200)] 
detect/keywords: dynamic version part of doc URL

(cherry picked from commit 26bcc97515e6fd38b36d7cb39373b5bf8a63a5fc)

5 years agologging: fix default log format for release mode
Victor Julien [Tue, 28 Apr 2020 07:25:43 +0000 (09:25 +0200)] 
logging: fix default log format for release mode

(cherry picked from commit 8f2df0f9389d3e8aa99d7cc173004c7c85665eb7)

5 years agodetect: fix typo for ipv6.hdr description
Philippe Antoine [Fri, 28 Feb 2020 11:04:00 +0000 (12:04 +0100)] 
detect: fix typo for ipv6.hdr description

(cherry picked from commit 02d94f5cf24d903913516739b4b6de0868a5db46)

5 years agodetect: refactoring parsing of ip range
Philippe Antoine [Sat, 25 Apr 2020 09:38:53 +0000 (11:38 +0200)] 
detect: refactoring parsing of ip range

To optimize first netmask

(cherry picked from commit ae102ca0961fddd54c1f7d07b8772d43d06f3f41)

5 years agosignature: minimizes ip CIDR for ip range
Philippe Antoine [Wed, 22 Apr 2020 07:54:49 +0000 (09:54 +0200)] 
signature: minimizes ip CIDR for ip range

Example leading to over allocation is 41.232.107.2-43.252.37.6

(cherry picked from commit 8ca9c0e8f04598ebcbe72bafce1512b8fe2f554a)

5 years agonapatech: Correct timestamp rounding issue
Jeff Lucovsky [Fri, 24 Apr 2020 14:28:54 +0000 (10:28 -0400)] 
napatech: Correct timestamp rounding issue

This commit fixes the conversion of timestamps. Without the extra
parens, the resulting timestamp value for usecs will be 1 or 0 due to
the operator precedence order (+ takes precedence over ?:)

(cherry picked from commit 2b938987717b2128c2dcb984563bf876add6f0f7)

5 years agonapatech: Check for out-of-band control operations
Jeff Lucovsky [Fri, 24 Apr 2020 14:28:32 +0000 (10:28 -0400)] 
napatech: Check for out-of-band control operations

This commit causes the packet source to check for out of band control
operations when there are no packets immediately available.

(cherry picked from commit f12adcc58cf5b79aec13609c672918f5279d4a7d)

5 years agodag: Check for out-of-band control operations
Jeff Lucovsky [Fri, 24 Apr 2020 14:27:20 +0000 (10:27 -0400)] 
dag: Check for out-of-band control operations

This commit causes the packet source to check for out of band control
operations when there are no packets immediately available.

(cherry picked from commit 5b13468bfcbbd5d5a2a9743b317d2e5a9c3a5afe)

5 years agoapp-layer: fix protocol detection bail conditions for TCP fastopen 4887/head
Victor Julien [Tue, 21 Apr 2020 08:52:04 +0000 (10:52 +0200)] 
app-layer: fix protocol detection bail conditions for TCP fastopen