]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
5 years agodetect/parse: move spaces skip up the stack 4718/head
Philippe Antoine [Wed, 9 Oct 2019 14:59:13 +0000 (16:59 +0200)] 
detect/parse: move spaces skip up the stack

Switch to isspace() as well.

(cherry picked from commit 52970d850858bb9784fe562422e9cf2c3aec4230)

5 years agodecode/erspan: ERSPAN TypeI configurable
Jeff Lucovsky [Tue, 3 Mar 2020 13:50:37 +0000 (08:50 -0500)] 
decode/erspan: ERSPAN TypeI configurable

For the backport, ERSPAN TypeI decode is

1. Disabled by default
2. Configurable: `decoder.erspan_typeI.enabled`

(cherry picked from commit ae6beedd13df60b129de702eabc0a7364fd973d5)

5 years agodecode: Handle ERSPAN Type I
Jeff Lucovsky [Sat, 28 Dec 2019 14:44:56 +0000 (09:44 -0500)] 
decode: Handle ERSPAN Type I

(cherry picked from commit aec4e9a032855a710d71a4c397affcdce5351b39)
(cherry picked from commit e00de3dce36b0bc6a912e3754e430908fdcd231a)

5 years agodecode: Fix typos/spelling
Jeff Lucovsky [Sat, 28 Dec 2019 14:45:31 +0000 (09:45 -0500)] 
decode: Fix typos/spelling

(cherry picked from commit 427ec4e739611975b983fcf06bec8fc9b8f8917e)
(cherry picked from commit ed6c976bb0c945ae47169be8e65d354c69514389)

5 years agodoc: Correct RST quote usage
Jeff Lucovsky [Sat, 22 Feb 2020 18:19:28 +0000 (13:19 -0500)] 
doc: Correct RST quote usage

Corrects misplaced backticks preventing proper formatting of `mpm-algo`
section.

(cherry picked from commit 8c132c0b8746ee2b91693c54625076e6a3be123e)

5 years agodetect/filestore: Fix memory leaks from pcre_get_substring
Jeff Lucovsky [Sat, 22 Feb 2020 18:21:36 +0000 (13:21 -0500)] 
detect/filestore: Fix memory leaks from pcre_get_substring

This commit replaces usages of pcre_get_substring with
pcre_copy_substring to avoid leaking memory on error conditions.

(cherry picked from commit c2071e1c4e2d2ff89f7f7e07cefb307c095338e3)

5 years agodetect/flowvar: Fix memory leaks from pcre_get_substring
Jeff Lucovsky [Sat, 22 Feb 2020 18:23:04 +0000 (13:23 -0500)] 
detect/flowvar: Fix memory leaks from pcre_get_substring

This commit replaces usages of pcre_get_substring with
pcre_copy_substring to avoid leaking memory on error conditions.

(cherry picked from commit 9fe51a8bd280c3662d5b48bbd9c8745a7bdd0822)

5 years agodetect/ssl_state: Fix memory leaks from pcre_get_substring
Jeff Lucovsky [Sat, 22 Feb 2020 18:24:13 +0000 (13:24 -0500)] 
detect/ssl_state: Fix memory leaks from pcre_get_substring

This commit replaces usages of pcre_get_substring with
pcre_copy_substring to avoid leaking memory on error conditions.

(cherry picked from commit 6c3503932ff604443820b85421ef0271deaf7032)

5 years agospelling: Fix spelling error
Jeff Lucovsky [Sat, 22 Feb 2020 18:24:45 +0000 (13:24 -0500)] 
spelling: Fix spelling error

(cherry picked from commit 6d94b096a9bdf069465aae447aea036609bfb9bb)

5 years agoutil-error: define SC_ERR_PCRE_COPY_SUBSTRING
Jeff Lucovsky [Sat, 22 Feb 2020 18:25:02 +0000 (13:25 -0500)] 
util-error: define SC_ERR_PCRE_COPY_SUBSTRING

(cherry picked from commit bcea73026635c3bf080d9dab1717077acc23c5f2)

5 years agomime: Test cases for filename length limit
Jeff Lucovsky [Fri, 14 Feb 2020 13:38:53 +0000 (08:38 -0500)] 
mime: Test cases for filename length limit

(cherry picked from commit c92975e22b809e9f4121b653670ae1233fe3e567)

5 years agosmtp/mime: Fix typos
Jeff Lucovsky [Wed, 5 Feb 2020 14:21:05 +0000 (09:21 -0500)] 
smtp/mime: Fix typos

(cherry picked from commit 9a33b5d5ded247e94a6572092ab2aca3f51752b3)

5 years agosmtp/mime: Set event when name exceeds limit
Jeff Lucovsky [Wed, 5 Feb 2020 14:20:29 +0000 (09:20 -0500)] 
smtp/mime: Set event when name exceeds limit

(cherry picked from commit 130b8d26e7e8e64ca42dc7e4db9890619d9730aa)

5 years agosmtp/mime: Restrict file name lengths
Jeff Lucovsky [Tue, 4 Feb 2020 15:13:49 +0000 (10:13 -0500)] 
smtp/mime: Restrict file name lengths

This commit places restrictions on the length of the file name specified
in attachments (`name=` or `filename=`) to `NAME_MAX`. Names exceeding
these limits will be truncated and processing will continue with the
truncated name.

(cherry picked from commit d0d20bd8746ad8933a515fa4facf9e3e10f22ecc)

5 years agodag: Skip over ERF_TYPE_META records
Stephen Donnelly [Thu, 5 Mar 2020 21:49:17 +0000 (10:49 +1300)] 
dag: Skip over ERF_TYPE_META records

Suricata generates an error on unrecognised ERF types.
Suricata should ignore ERF 'Provenance' records with ERF_TYPE_META.

(cherry picked from commit 47082dd5df1b71485333039cd6af75b39cdfffeb)

5 years agostream: fix direction flags in corner case
Victor Julien [Tue, 17 Mar 2020 12:08:33 +0000 (13:08 +0100)] 
stream: fix direction flags in corner case

When a TCP DNS flow would start with a GAP on the TS side, the successful
protocol detection on the TC side would trigger 'opposing side' reassembly
and app-layer processing. In this case the stream flags would indicate the
wrong direction and the wrong parser would be called.

(cherry picked from commit efee458af8a711323d74045af67b1fa9b648569c)

5 years agoversion: starting work on 5.0.3
Victor Julien [Thu, 13 Feb 2020 13:43:59 +0000 (14:43 +0100)] 
version: starting work on 5.0.3

5 years agoversion: release 5.0.2 suricata-5.0.2
Victor Julien [Thu, 13 Feb 2020 10:57:47 +0000 (11:57 +0100)] 
version: release 5.0.2

5 years agochangelog: update for 5.0.2
Victor Julien [Thu, 13 Feb 2020 10:57:04 +0000 (11:57 +0100)] 
changelog: update for 5.0.2

5 years agostream/reassembly: fix data overlap check
vanlink [Thu, 16 Jan 2020 08:27:57 +0000 (16:27 +0800)] 
stream/reassembly: fix data overlap check

Fix function CheckOverlap bug.

(cherry picked from commit 2456f27d08142b571a06ffd211c90a5fa557366a)

5 years agonfs: implement post-GAP transaction cleanup 4545/head
Victor Julien [Tue, 11 Feb 2020 10:55:18 +0000 (11:55 +0100)] 
nfs: implement post-GAP transaction cleanup

Close all prior transactions in the direction of the GAP, except the
file xfers. Those use their own logic described below.

After a GAP all normal transactions are closed. File transactions
are left open as they can handle GAPs in principle. However, the
GAP might have contained the closing of a file and therefore it
may remain active until the end of the flow.

This patch introduces a time based heuristic for these transactions.
After the GAP all file transactions are stamped with the current
timestamp. If 60 seconds later a file has seen no update, its marked
as closed.

This is meant to fix resource starvation issues observed in long
running SMB sessions where packet loss was causing GAPs. Due to the
similarity of the NFS and SMB parsers, this issue is fixed for NFS
as well in this patch.

Bug #3424.
Bug #3425.

(cherry picked from commit f68c255f090a94162df1fcd7e7262548a2119c50)

5 years agotls: fix missing extern logic for cert_id tracking 4541/head
Victor Julien [Wed, 29 Jan 2020 12:50:05 +0000 (13:50 +0100)] 
tls: fix missing extern logic for cert_id tracking

5 years agostats: fix missing extern keyword
Victor Julien [Wed, 29 Jan 2020 12:46:56 +0000 (13:46 +0100)] 
stats: fix missing extern keyword

5 years agodefrag: fix use of globals
Victor Julien [Wed, 29 Jan 2020 12:43:49 +0000 (13:43 +0100)] 
defrag: fix use of globals

5 years agothreading: fix queue handlers globals use
Victor Julien [Wed, 29 Jan 2020 12:30:35 +0000 (13:30 +0100)] 
threading: fix queue handlers globals use

5 years agohtp: fix globals use for flags
Victor Julien [Wed, 29 Jan 2020 12:28:17 +0000 (13:28 +0100)] 
htp: fix globals use for flags

5 years agoproto: fix globals use
Victor Julien [Wed, 29 Jan 2020 12:27:58 +0000 (13:27 +0100)] 
proto: fix globals use

5 years agoflow: fix global variable use
Victor Julien [Wed, 29 Jan 2020 12:23:36 +0000 (13:23 +0100)] 
flow: fix global variable use

5 years agostream: fix global declaration of the config
Victor Julien [Wed, 29 Jan 2020 10:55:27 +0000 (11:55 +0100)] 
stream: fix global declaration of the config

5 years agothreading/modules: fix global declarations
Victor Julien [Wed, 29 Jan 2020 10:51:11 +0000 (11:51 +0100)] 
threading/modules: fix global declarations

5 years agoippair: fix global declarations
Victor Julien [Wed, 29 Jan 2020 09:56:54 +0000 (10:56 +0100)] 
ippair: fix global declarations

5 years agohost: fix global declarations
Victor Julien [Wed, 29 Jan 2020 09:37:44 +0000 (10:37 +0100)] 
host: fix global declarations

5 years agompm: fix global declarations
Victor Julien [Wed, 29 Jan 2020 09:28:16 +0000 (10:28 +0100)] 
mpm: fix global declarations

5 years agodetect: fix global declaration of sigmatch_table
Victor Julien [Wed, 29 Jan 2020 09:22:57 +0000 (10:22 +0100)] 
detect: fix global declaration of sigmatch_table

5 years agospm: fix global declaration of spm_table
Victor Julien [Wed, 29 Jan 2020 09:11:54 +0000 (10:11 +0100)] 
spm: fix global declaration of spm_table

5 years agothreading: fix global declaration of threading_set_cpu_affinity
Victor Julien [Wed, 29 Jan 2020 07:33:18 +0000 (08:33 +0100)] 
threading: fix global declaration of threading_set_cpu_affinity

5 years agothreading: fix global declaration of trans_q
Victor Julien [Wed, 29 Jan 2020 07:27:43 +0000 (08:27 +0100)] 
threading: fix global declaration of trans_q

5 years agounix-socket: avoid using global variable w/o extern
Victor Julien [Wed, 29 Jan 2020 07:15:21 +0000 (08:15 +0100)] 
unix-socket: avoid using global variable w/o extern

5 years agodecode: fix default-packet-size global variable
Victor Julien [Wed, 29 Jan 2020 07:10:59 +0000 (08:10 +0100)] 
decode: fix default-packet-size global variable

5 years agoinit: Fix dropping privileges in nflog runmode 4534/head
Timo Sigurdsson [Mon, 3 Feb 2020 22:17:17 +0000 (23:17 +0100)] 
init: Fix dropping privileges in nflog runmode

Using the run-as configuration option with the nflog capture method
results in the following error during the startup of suricata:
[ERRCODE: SC_ERR_NFLOG_BIND(248)] - nflog_bind_pf() for AF_INET failed

This is because SCDropMainThreadCaps does not have any capabilities
defined for the nflog runmode (unlike other runmodes). Therefore, apply
the same capabilities to the nflog runmode that are already defined for
the nfqueue runmode. This has been confirmed to allow suricata start
and drop its privileges in the nflog runmode.

Fixes redmine issue #3265.

Signed-off-by: Timo Sigurdsson <public_timo.s@silentcreek.de>
(cherry picked from commit 1262ecbde0c2130f3fd4ca336cd2646828de9391)

5 years agoafl: fix compilation
Victor Julien [Fri, 7 Feb 2020 13:50:39 +0000 (14:50 +0100)] 
afl: fix compilation

(cherry picked from commit f05c12b70f78d5369ec19c5759db033fb103f052)

5 years agodefrag: set livedev on the reassembled packet (issue-3380) 4528/head
Jason Ish [Thu, 23 Jan 2020 17:31:06 +0000 (11:31 -0600)] 
defrag: set livedev on the reassembled packet (issue-3380)

Set the livedev on reassembled packets to that of the parent
packet. Fixes issues with multidetect, specifically a segfault
as reported in issue 3380.

Bug #3380.

(cherry picked from commit d1eab5aa462f18f66ada9e5bbc9c89b8104db96a)

5 years agorust/rpc: add partial data test
Victor Julien [Thu, 6 Feb 2020 10:43:55 +0000 (10:43 +0000)] 
rust/rpc: add partial data test

5 years agosmb: handle file transactions post-GAP 4509/head
Victor Julien [Tue, 21 Jan 2020 11:20:40 +0000 (12:20 +0100)] 
smb: handle file transactions post-GAP

After a GAP all normal transactions are closed. File transactions
are left open as they can handle GAPs in principle. However, the
GAP might have contained the closing of a file and therefore it
may remain active until the end of the flow.

This patch introduces a time based heuristic for these transactions.
After the GAP all file transactions are stamped with the current
timestamp. If 60 seconds later a file has seen no update, its marked
as closed.

This is meant to fix resource starvation issues observed in long
running SMB sessions where packet loss was causing GAPs.

5 years agoflow: expose last time as a function
Jason Ish [Tue, 3 Dec 2019 20:10:45 +0000 (14:10 -0600)] 
flow: expose last time as a function

This function returns the individual components
of the timeval in output pointers making it suitable
for use over Rust FFI.

5 years agostreaming/api: fix overlap check 4492/head
Victor Julien [Sat, 14 Dec 2019 19:20:45 +0000 (20:20 +0100)] 
streaming/api: fix overlap check

In some cases a SBB could be seen as overlapping with the requested
offset, when it was in fact precisely before it. In some special cases
this could lead to the stream engine not progressing the 'raw' progress.

5 years agodebug/validation: check tcp/app-layer data lengths
Victor Julien [Sat, 14 Dec 2019 06:11:26 +0000 (07:11 +0100)] 
debug/validation: check tcp/app-layer data lengths

5 years agostream: improve app-layer data retrieval with GAPs
Victor Julien [Fri, 13 Dec 2019 21:26:30 +0000 (22:26 +0100)] 
stream: improve app-layer data retrieval with GAPs

Don't assume that the next block after the sbb head is after the
requested offset.

If the next block was before the offset, the returned data_len
would underflow and return a nonsense value to the app-layer.

Bug #2993.

5 years agomodbus: Correct typo
Jeff Lucovsky [Sat, 11 Jan 2020 14:51:00 +0000 (09:51 -0500)] 
modbus: Correct typo

5 years agomodbus: Update correct TX flags
Jeff Lucovsky [Sat, 11 Jan 2020 14:49:55 +0000 (09:49 -0500)] 
modbus: Update correct TX flags

5 years agoanalysis: exit if table entries are stale
Jeff Lucovsky [Sat, 4 Jan 2020 14:12:38 +0000 (09:12 -0500)] 
analysis: exit if table entries are stale

This commit causes Suricata to exit when a buffer from the analyzer
table is not recognized.

Since the table must match what's registered, exiting will bring noticed
to the condition.

5 years agorust: fix vendor use on MinGW 4490/head
Victor Julien [Fri, 17 Jan 2020 15:40:38 +0000 (16:40 +0100)] 
rust: fix vendor use on MinGW

5 years agorust: Don't use --frozen during build.
Jason Ish [Thu, 16 Jan 2020 15:30:28 +0000 (09:30 -0600)] 
rust: Don't use --frozen during build.

If sources are vendored, we get the same effect of using frozen
with a lock file, and the Cargo.lock is generated based
on the vendored sources.

This also removes the need to ship a Cargo.lock.

Fixed out of source builds with vendored sources.

5 years agorust/Makefile: Don't include Cargo.toml
Jason Ish [Thu, 16 Jan 2020 15:09:13 +0000 (09:09 -0600)] 
rust/Makefile: Don't include Cargo.toml

There is no need to include Cargo.toml in the distribution,
it is always generated from Cargo.toml.in during
./configure.

5 years agogithub-ci: do distcheck on fedora 31 build
Jason Ish [Wed, 8 Jan 2020 16:16:40 +0000 (10:16 -0600)] 
github-ci: do distcheck on fedora 31 build

There were no distchecks being done on builds from git.

5 years agogithub-ci: make distcheck on centos 7 build
Jason Ish [Tue, 31 Dec 2019 15:19:43 +0000 (09:19 -0600)] 
github-ci: make distcheck on centos 7 build

Tests distcheck on a build from a distribution archive.

5 years agodoc/conf: Update copyright and regex for version
Shivani Bhardwaj [Sat, 21 Dec 2019 00:22:42 +0000 (05:52 +0530)] 
doc/conf: Update copyright and regex for version

Make the new regex in compliance with the modern autoconf syntax.
Closes redmine ticket #3423

5 years agodoc: minor capitalization fix 4460/head
jason taylor [Wed, 18 Dec 2019 14:59:54 +0000 (09:59 -0500)] 
doc: minor capitalization fix

Signed-off-by: jason taylor <jtfas90@gmail.com>
5 years agodoc: add bsize documentation and rule example
jason taylor [Wed, 18 Dec 2019 14:59:23 +0000 (09:59 -0500)] 
doc: add bsize documentation and rule example

Signed-off-by: jason taylor <jtfas90@gmail.com>
5 years agorust: remove unnecessary parentheses (Rust 1.40 fixup) 4457/head
Jason Ish [Thu, 19 Dec 2019 17:02:56 +0000 (11:02 -0600)] 
rust: remove unnecessary parentheses (Rust 1.40 fixup)

Rust 1.40 in strict mode will now fail the build on the
presence of unnecessary parentheses.

warning: unnecessary parentheses around type
  --> src/smb/smb2_ioctl.rs:41:12
   |
41 |         -> (&mut SMBTransaction)
   |            ^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
   |
   = note: `#[warn(unused_parens)]` on by default

5 years agogithub-ci: use container for 18.04 build 4444/head
Jason Ish [Fri, 13 Dec 2019 15:14:35 +0000 (09:14 -0600)] 
github-ci: use container for 18.04 build

As the action runs natively on 18.04 we were not explicitly
setting a container, but this means we're using what GitHub
provides us as a default state which might be broken. Instead
use the standard Ubuntu 18.04 container.

5 years agoversion: starting work on 5.0.2
Victor Julien [Fri, 13 Dec 2019 15:49:52 +0000 (16:49 +0100)] 
version: starting work on 5.0.2

5 years agoversion: release 5.0.1 suricata-5.0.1
Victor Julien [Thu, 12 Dec 2019 08:54:45 +0000 (09:54 +0100)] 
version: release 5.0.1

5 years agochangelog: update for 5.0.1
Victor Julien [Fri, 13 Dec 2019 10:09:18 +0000 (11:09 +0100)] 
changelog: update for 5.0.1

5 years agodetect/asn1: fix offset bounds checking
Victor Julien [Sun, 3 Nov 2019 08:50:14 +0000 (09:50 +0100)] 
detect/asn1: fix offset bounds checking

5 years agoipv4: continue parsing options after invalid option
Jason Ish [Thu, 14 Nov 2019 20:56:43 +0000 (14:56 -0600)] 
ipv4: continue parsing options after invalid option

As long as an option has a valid length, we can continue
parsing the options after an invalid one.

5 years agoipv4: fail packet decoding on bad ipv4 option length
Jason Ish [Thu, 14 Nov 2019 17:34:56 +0000 (11:34 -0600)] 
ipv4: fail packet decoding on bad ipv4 option length

Currently all failures in IPv4 option decode are ignore with
respect to continuing to handle the packet.

Change this to fail, and abort handling the packet if the
option length is invalid.

Ticket 3328:
https://redmine.openinfosecfoundation.org/issues/3328

5 years agostream: reject broken ACK packets
Victor Julien [Thu, 21 Nov 2019 15:10:21 +0000 (16:10 +0100)] 
stream: reject broken ACK packets

Fix evasion posibility by rejecting packets with a broken ACK field.
These packets have a non-0 ACK field, but do not have a ACK flag set.

Bug #3324.

Reported-by: Nicolas Adba
5 years agostream: fix SYN_SENT RST/FIN injection
Victor Julien [Thu, 21 Nov 2019 13:47:04 +0000 (14:47 +0100)] 
stream: fix SYN_SENT RST/FIN injection

RST injection during the SYN_SENT state could trick Suricata into marking
a session as CLOSED. The way this was done is: using invalid TSECR value
in RST+ACK packet. The ACK was needed to force Linux into considering the
TSECR value and compare it to the TSVAL from the SYN packet.

The second works only against Windows. The client would not use a TSVAL
but the RST packet would. Windows will reject this, but Suricata considered
the RST valid and triggered the CLOSED logic.

This patch addresses both. When the SYN packet used timestamp support
the timestamp of incoming packet is validated. Otherwise, packet responding
should not have a timestamp.

Bug #3286

Reported-by: Nicolas Adba
5 years agoconfigure: require libhtp 0.5.32 4441/head
Victor Julien [Fri, 13 Dec 2019 10:12:15 +0000 (11:12 +0100)] 
configure: require libhtp 0.5.32

5 years agodecode/tcp: accept TCP fast open cookie request
Victor Julien [Thu, 12 Dec 2019 14:57:29 +0000 (15:57 +0100)] 
decode/tcp: accept TCP fast open cookie request

5 years agoconfigure: fix test -f for rust/vendor, should be -e
Jason Ish [Tue, 10 Dec 2019 22:40:35 +0000 (16:40 -0600)] 
configure: fix test -f for rust/vendor, should be -e

Introduced with commit: c08ec8d8b27280e2bcb066c9caa24da97e0419ee

5 years agogithub-ci: in a dist build, check that --frozen is being used
Jason Ish [Tue, 10 Dec 2019 22:22:02 +0000 (16:22 -0600)] 
github-ci: in a dist build, check that --frozen is being used

Verify that ./configure is picking up the vendored Rust sources
when building from a dist archive.

5 years agohtp: close request only from request side
Victor Julien [Wed, 11 Dec 2019 19:57:57 +0000 (20:57 +0100)] 
htp: close request only from request side

This allows the response side to keep going for just
a bit longer.

5 years agostream: in IDS mode, call app-layer at EOF
Victor Julien [Wed, 11 Dec 2019 19:57:07 +0000 (20:57 +0100)] 
stream: in IDS mode, call app-layer at EOF

On stream end call app-layer with empty message in IDS mode.

5 years agoeve: support pcap_filename for unix socket mode 4436/head
Victor Julien [Tue, 10 Dec 2019 11:48:56 +0000 (12:48 +0100)] 
eve: support pcap_filename for unix socket mode

Bug #3390.

5 years agodoc/commandline: -i option is useable several times
Daisu [Wed, 13 Mar 2019 22:39:48 +0000 (23:39 +0100)] 
doc/commandline: -i option is useable several times

5 years agodoc/install: fix geoip typo
Steven Hostetler [Tue, 29 Oct 2019 03:06:00 +0000 (23:06 -0400)] 
doc/install: fix geoip typo

5 years agodoc/eve: layout and formatting fixes
Victor Julien [Tue, 10 Dec 2019 11:26:44 +0000 (12:26 +0100)] 
doc/eve: layout and formatting fixes

5 years agodoc: update http keywords documentation
Jason Williams [Mon, 25 Nov 2019 23:44:57 +0000 (16:44 -0700)] 
doc: update http keywords documentation

5 years agoyaml: clarify comment about dump-all-headers
Philippe Antoine [Wed, 30 Oct 2019 08:12:42 +0000 (09:12 +0100)] 
yaml: clarify comment about dump-all-headers

Logs a warning if the value is unknown
Fixes #2810

5 years agoconfigure: assume cargo vendor if cargo >= 1.37
Jason Ish [Sun, 24 Nov 2019 05:35:56 +0000 (23:35 -0600)] 
configure: assume cargo vendor if cargo >= 1.37

Rust/Cargo 1.37 and greater has vendor support built-in.

5 years agodetect/parse: track negation during address parsing 4434/head
Victor Julien [Mon, 9 Dec 2019 16:09:20 +0000 (17:09 +0100)] 
detect/parse: track negation during address parsing

Fix address negation detection not resolving variables when
looking for the negation.

This patch makes use of the actual parsing routines to relay this
information to the signature parser.

Bug #3389.

Fixes: 92f08d85aac2 ("detect/iponly: improve negation handling in parsing")
5 years agodetect/iponly: debug output improvements
Victor Julien [Mon, 9 Dec 2019 16:08:45 +0000 (17:08 +0100)] 
detect/iponly: debug output improvements

5 years agoapp-layer: optimize inspection id tracking
Victor Julien [Thu, 5 Dec 2019 14:31:28 +0000 (15:31 +0100)] 
app-layer: optimize inspection id tracking

Increase the inspect id for a completely inspected tx in any case.
This avoids re-evaluating transactions.

Reported-by: Ilya Bakhtin
5 years agosmb1: allow empty trans records
Victor Julien [Wed, 4 Dec 2019 09:22:55 +0000 (10:22 +0100)] 
smb1: allow empty trans records

5 years agosmb1: fix 'event' txs not getting closed
Victor Julien [Wed, 4 Dec 2019 09:06:01 +0000 (10:06 +0100)] 
smb1: fix 'event' txs not getting closed

If the only reason we created a request side TX was to set an event,
we would not close it.

This patch always looks up the TX from the response side.

5 years agosmb/dcerpc: close request tx sooner
Victor Julien [Tue, 3 Dec 2019 08:27:34 +0000 (09:27 +0100)] 
smb/dcerpc: close request tx sooner

5 years agosmb: post-GAP handling update
Victor Julien [Tue, 3 Dec 2019 08:25:48 +0000 (09:25 +0100)] 
smb: post-GAP handling update

Close all prior transactions in the direction of the GAP, except the
file xfers. Those use their own logic.

5 years agosmb: winreg is a DCERPC facility
Victor Julien [Mon, 2 Dec 2019 19:57:59 +0000 (20:57 +0100)] 
smb: winreg is a DCERPC facility

5 years agofiles: add call for setting inspect sizes
Victor Julien [Thu, 5 Dec 2019 14:00:40 +0000 (15:00 +0100)] 
files: add call for setting inspect sizes

The inspect sizes are currently only used during file prune
house keeping for SMTP.

5 years agosmtp: fix and clean up new file handling
Victor Julien [Mon, 2 Dec 2019 10:49:18 +0000 (11:49 +0100)] 
smtp: fix and clean up new file handling

Set tx id on files that were just opened.

Move logic to a small util func.

5 years agosmtp: use FILE_USE_DETECT for raw-extract
Victor Julien [Fri, 22 Nov 2019 12:45:10 +0000 (13:45 +0100)] 
smtp: use FILE_USE_DETECT for raw-extract

5 years agofiles: change pruning behavior
Victor Julien [Fri, 22 Nov 2019 16:27:19 +0000 (17:27 +0100)] 
files: change pruning behavior

If file prune is called inspect has already run. So if file is closed
we can just prune. No need to consider a window anymore.

When still in progress, fix the left_edge calculation.

5 years agofiles: fix FILE_USE_DETECT with --disable-detection
Victor Julien [Sun, 24 Nov 2019 08:16:29 +0000 (09:16 +0100)] 
files: fix FILE_USE_DETECT with --disable-detection

Don't set FILE_USE_DETECT flag if detect is disabled.

5 years agofiles: move smtp prune logic to main
Victor Julien [Sun, 24 Nov 2019 08:16:46 +0000 (09:16 +0100)] 
files: move smtp prune logic to main

Now that we call the file prune loop very regularly, we can move the
SMTP specific inspection pruning logic into this loop. Helps with
cases there we don't (often) update a files inspection trackers.

5 years agohttp/file: modernize unittests
Victor Julien [Mon, 25 Nov 2019 14:17:29 +0000 (15:17 +0100)] 
http/file: modernize unittests

Part of ticket #2975.

5 years agofastlog: apply icmp type logic to icmpv6 too 4431/head
Victor Julien [Mon, 9 Dec 2019 10:30:10 +0000 (11:30 +0100)] 
fastlog: apply icmp type logic to icmpv6 too

5 years agohttp/multipart: small cleanup
Victor Julien [Mon, 25 Nov 2019 18:09:10 +0000 (19:09 +0100)] 
http/multipart: small cleanup

5 years agohttp/multipart: use wider type for boundary lengths
Victor Julien [Mon, 25 Nov 2019 16:16:56 +0000 (17:16 +0100)] 
http/multipart: use wider type for boundary lengths

Use uint32_t for a local type instead of uint8_t to avoid casts.

Length should always stay under this regardless.