]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
5 years agoeve: support pcap_filename for unix socket mode 4438/head
Victor Julien [Tue, 10 Dec 2019 11:48:56 +0000 (12:48 +0100)] 
eve: support pcap_filename for unix socket mode

Bug #3390.

(cherry picked from commit eceb7dcba46621ab0ac5f600812c74fe4152affc)

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
(cherry picked from commit 618ad0d92fccb2a4bd6489e76b695d661da82dd1)

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

(cherry picked from commit f5b33a070acc65ed6706e1904b55aa8cfa7e327a)

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.

(cherry picked from commit 40fe29de96877d32cd315d07d60626e94b6fbcd5)

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

(cherry picked from commit 129cd28058334cf9048cc06764ca112faf1a8b59)

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.

(cherry picked from commit 44ac3e30dd47e3dda202a0a03559d314581e6917)

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

(cherry picked from commit a7ee2ffbde99ae6df24196ffe6cb1b85e60bb22d)

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.

(cherry picked from commit f302f3543fc816723a89c03f94c53bb1f375192b)

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.

(cherry picked from commit f9f958d66e3c080fa83ec74562aad3691c368291)

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.

(cherry picked from commit 21760bfc76fca336de9e914efaff051c0323a0ef)

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.

(cherry picked from commit 682014619f29676f1aab0421ff810318c6f30eb2)

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.

(cherry picked from commit 4ac9cd2c70dbe887f004deb905d1f08b1bc4efcc)

5 years agofiles: remove FILE_USE_TRACKID flag
Victor Julien [Fri, 22 Nov 2019 15:32:43 +0000 (16:32 +0100)] 
files: remove FILE_USE_TRACKID flag

Once it was optional but as it no longer is it is no longer useful.

Remove it.

(cherry picked from commit b82e71b95eb274959d2d942a09a9470d0e9097ca)

5 years agofiles: simplify pruning logic
Victor Julien [Fri, 22 Nov 2019 14:33:27 +0000 (15:33 +0100)] 
files: simplify pruning logic

Since ebcc4db84ac2c1957a6cc23b5154d7d6333f4cb8 the flow worker runs
file pruning after parsing, detection and loging. This means we can
simplify the pruning logic. If a file is in state >= CLOSED, we can
prune it. Detection and outputs will have had a final chance to
process it.

Remove the calls to the pruning code from Rust. They are no longer
needed.

(cherry picked from commit f9155aa1218808f0b26816438e87c2f45b3a51cb)

5 years agodetect/test: update test for file prune changes
Jason Ish [Tue, 8 Oct 2019 16:23:08 +0000 (10:23 -0600)] 
detect/test: update test for file prune changes

As the file prune is now moved to the flow worker, the file
prune is run later, meaning the first file has not yet
been pruned from the file container list.

Adjust test to look for a second file, and check the
flags on that file.

For commit addressing bug 2490.

5 years agofile extraction: always prune files after detect
Jason Ish [Mon, 7 Oct 2019 22:20:02 +0000 (16:20 -0600)] 
file extraction: always prune files after detect

If a keyword like filemd5 was being used without a filestore,
or a file output enabled, it would be pruned before detection
had a chance to match.

Consolidate file pruning to the end of the flow worker so files
are available for detection even when a file output is not
enabled.

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

(cherry picked from commit ebcc4db84ac2c1957a6cc23b5154d7d6333f4cb8)

5 years agotls-log: fix so buffer is reset on custom logging 4435/head
Mats Klepsland [Thu, 19 Sep 2019 21:10:48 +0000 (23:10 +0200)] 
tls-log: fix so buffer is reset on custom logging

Move MemBufferReset() so it also works when using custom tls
logging. This avoids duplicate tls log entries.

Bug #3177

5 years agoconfigure.ac: remove debug output
Jason Ish [Tue, 10 Dec 2019 15:05:09 +0000 (09:05 -0600)] 
configure.ac: remove debug output

Introduced with commit:
e1c07b9f23fdc85f4626b798311f0bbd3542744d

5 years agooutput-lua: register app-layer parser logger for SSH
Mats Klepsland [Fri, 13 Sep 2019 21:49:11 +0000 (23:49 +0200)] 
output-lua: register app-layer parser logger for SSH

Bug #3162

(cherry picked from commit e976d8cf740e6a96b0d3adab92e9111d9bc2ce09)

5 years agooutput-lua: register app-layer parser logger for TLS
Mats Klepsland [Fri, 13 Sep 2019 21:46:36 +0000 (23:46 +0200)] 
output-lua: register app-layer parser logger for TLS

Bug #3162

(cherry picked from commit 1e9f767debac8ac72d9f8c936d534873c2abe767)

5 years agoqa/banned-functions: remove strndup now we have a fall back 4433/head
Victor Julien [Sun, 24 Nov 2019 19:13:30 +0000 (20:13 +0100)] 
qa/banned-functions: remove strndup now we have a fall back

5 years agoqa/coccinelle: fix make distcheck
Eric Leblond [Sat, 30 Nov 2019 18:07:05 +0000 (19:07 +0100)] 
qa/coccinelle: fix make distcheck

We need to use top_srcdir to know where the sources are. Relative
directory is not enough.

5 years agoqa/coccinelle: flag check for setter and getter
Eric Leblond [Sat, 30 Nov 2019 17:24:06 +0000 (18:24 +0100)] 
qa/coccinelle: flag check for setter and getter

WHen adding something like
/* coccinelle: AppLayerParserStateIssetFlag():4,2:APP_LAYER_PARSER_ */
the coccinelle check will consider that AppLayerParserStateIssetFlag
is taking 4 parameters and that the second one is a flag that needs
to be checked against APP_LAYER_PARSER_.

5 years agoqa/coccinelle: fix false positive in setter getter
Eric Leblond [Sat, 30 Nov 2019 16:20:44 +0000 (17:20 +0100)] 
qa/coccinelle: fix false positive in setter getter

Coccinelle test was doing a false positive on the function
AppLayerParserStateSetFlag and AppLayerParserStateIssetFlag.
To address that, this patch adds a new coccinelle markup:

 /* coccinelle: AppLayerParserStateSetFlag():2,2:APP_LAYER_PARSER_ */

It indicates that AppLayerParserStateSetFlag is a setter and getter
and that the checks should be disabled inside the function.

Currently this markup is only used for that but following patch will
add some checks on option value.

5 years agoqa/coccinelle: port struct-flags.py to Python3
Eric Leblond [Sat, 30 Nov 2019 10:20:06 +0000 (11:20 +0100)] 
qa/coccinelle: port struct-flags.py to Python3

5 years agoqa/coccinelle: reformat struct-flags.py
Eric Leblond [Sat, 30 Nov 2019 10:17:50 +0000 (11:17 +0100)] 
qa/coccinelle: reformat struct-flags.py

5 years agoqa: generate struct-flags.cocci at each run
Eric Leblond [Thu, 21 Nov 2019 17:26:49 +0000 (18:26 +0100)] 
qa: generate struct-flags.cocci at each run

5 years agohttp: split request/response tx id handling
Victor Julien [Sat, 23 Nov 2019 21:25:02 +0000 (22:25 +0100)] 
http: split request/response tx id handling

When HTTP pipelining was in use, the transaction id used for events
and files could be off. If the request side was several requests ahead
of the responses, it would use the HtpState::transaction_cnt for events
and files, even though that is only incremented on complete requests.

Split request and response tx id tracking. The response is still handled
by the HtpState::transaction_cnt, but the request side is now handled by
its own logic.

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

5 years agofastlog: use icmp type and code instead of port
Philippe Antoine [Wed, 30 Oct 2019 08:46:53 +0000 (09:46 +0100)] 
fastlog: use icmp type and code instead of port

Fixes #3266

5 years agofastlog: move code to reduce variable scope
Philippe Antoine [Wed, 30 Oct 2019 08:33:51 +0000 (09:33 +0100)] 
fastlog: move code to reduce variable scope

5 years agosuricata: fix computing of default packet size
Eric Leblond [Sat, 7 Dec 2019 09:43:28 +0000 (10:43 +0100)] 
suricata: fix computing of default packet size

Update the default packet size computation to use LiveDeviceName
instead of LiveDevice as the LiveDevice list is not built when
the default packet size is built.

5 years agoconfigure: assume cargo vendor if cargo >= 1.37
Jason Ish [Tue, 3 Dec 2019 22:36:24 +0000 (16:36 -0600)] 
configure: assume cargo vendor if cargo >= 1.37

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

This is a backport to 4.1.x:
https://redmine.openinfosecfoundation.org/issues/3364

5 years agohttp/multipart: use proper progress value to test eof
Victor Julien [Mon, 25 Nov 2019 13:03:13 +0000 (14:03 +0100)] 
http/multipart: use proper progress value to test eof

5 years agodetect/mpm: Improved handling of variable values
Jeff Lucovsky [Sat, 23 Nov 2019 19:33:38 +0000 (14:33 -0500)] 
detect/mpm: Improved handling of variable values

This commit removes the offset and depth if either of these values are
dependent upon a byte-extract operation.

5 years agodetect: Improve handling of variable values
Jeff Lucovsky [Sat, 23 Nov 2019 19:35:40 +0000 (14:35 -0500)] 
detect: Improve handling of variable values

When one of offset/depth/distance is from a variable, adjust the depth
by the offset as is done with scalar values at parse time.

5 years agosource-pcap-file: honor bpf filter on command line
Eric Leblond [Tue, 19 Nov 2019 16:21:10 +0000 (17:21 +0100)] 
source-pcap-file: honor bpf filter on command line

When a BPF filter is given on the command line when reading a
pcap file, the BPF filter is not honored.

The regression has been introduced in:

commit 3ab9120821e2b5cbc5925470bcfa5bcfb53f246b
Author: Dana Helwig <dana.helwig@protectwise.com>
Date:   Thu Apr 27 11:17:16 2017 -0600

    source-pcap-file: Pcap Directory Mode (Feature #2222)

Reported-By: Tim Colin <tcolin@et.esiea.fr>
5 years agosource-pcap-file: fix memory leak on pcap filter
Eric Leblond [Tue, 19 Nov 2019 16:28:05 +0000 (17:28 +0100)] 
source-pcap-file: fix memory leak on pcap filter

5 years agosmb: add detect tx flags shim for smb (non-rust) 4414/head
Victor Julien [Tue, 3 Dec 2019 06:09:19 +0000 (07:09 +0100)] 
smb: add detect tx flags shim for smb (non-rust)

5 years agodetect/file_data: fix buffer reusing id 0
Victor Julien [Mon, 2 Dec 2019 13:50:45 +0000 (14:50 +0100)] 
detect/file_data: fix buffer reusing id 0

5 years agoftp: add support for tx detect flags
Jason Ish [Mon, 2 Dec 2019 17:26:08 +0000 (11:26 -0600)] 
ftp: add support for tx detect flags

Related commit for 5.0:
1930b1f5043d9eae17c6665ba920a2a7863f2a8e

5 years agodetect-engine: check for tx detect flag support
Jason Ish [Mon, 25 Nov 2019 22:57:06 +0000 (16:57 -0600)] 
detect-engine: check for tx detect flag support

When registing a detection engine, check that the app-layer
protocol supports tx detect flags.

This is a code implementation error that should be resolved
during development.

VJ: made this a warning as we're updating an older stable
branch.

5 years agodebug: add SCReturnBool function exit macro
Jason Ish [Mon, 25 Nov 2019 22:55:08 +0000 (16:55 -0600)] 
debug: add SCReturnBool function exit macro

5 years agoapp-layer: method to see if parser supports tx detect flags
Jason Ish [Mon, 25 Nov 2019 22:51:44 +0000 (16:51 -0600)] 
app-layer: method to see if parser supports tx detect flags

Add method to check if a parser for an app-layer protocol
supports tx detect flags.

This is a bit of a hack for now as where we need to run
this check from we do not have the IP protocol.

5 years agoconfigure: add python3 to python's to look for 4410/head
Jason Ish [Fri, 29 Nov 2019 21:24:22 +0000 (15:24 -0600)] 
configure: add python3 to python's to look for

5 years agogithub-actions: builds for our tier one linux distributions
Jason Ish [Sun, 24 Nov 2019 05:36:48 +0000 (23:36 -0600)] 
github-actions: builds for our tier one linux distributions

Example of using GitHub actions to perform builds across
CentOS, Ubuntu, Debian and the latest Fedora.

(cherry picked from commit 3887f8d1f3d2816b3f46fb48560f9de57ae66314)

5 years agoapp-layer: validate TX detect flag callbacks
Jason Ish [Wed, 27 Nov 2019 18:47:01 +0000 (12:47 -0600)] 
app-layer: validate TX detect flag callbacks

Check that both are set or unset.

(cherry picked from commit ba3a2c31bf0544e531789d88b19cefd8f5c75dd9)

5 years agoenip: add tx detect flags
Jason Ish [Wed, 27 Nov 2019 15:50:40 +0000 (09:50 -0600)] 
enip: add tx detect flags

(cherry picked from commit 706558d4d5211c545b779be43eb1b3fe28b3b876)

5 years agodcerpc: add tx detect flags
Jason Ish [Tue, 26 Nov 2019 22:18:51 +0000 (16:18 -0600)] 
dcerpc: add tx detect flags

(cherry picked from commit cb62c8dacffd787795c2f30b12b05342ab70d37c)

5 years agomodbus: add tx detect flags
Jason Ish [Tue, 26 Nov 2019 22:01:09 +0000 (16:01 -0600)] 
modbus: add tx detect flags

(cherry picked from commit 21f014f5c3fa03ca5be8e4ee161842b62febcf21)

5 years agokrb5: register tx detect flags
Jason Ish [Thu, 21 Nov 2019 18:26:32 +0000 (12:26 -0600)] 
krb5: register tx detect flags

Related ticker #3345:
https://redmine.openinfosecfoundation.org/issues/3345

(cherry picked from commit fa4b9d37c2c2d8204aaea209d91734c57c337b19)

5 years agorust: define TxDetectFlag struct and binding macros
Jason Ish [Tue, 26 Nov 2019 19:25:04 +0000 (13:25 -0600)] 
rust: define TxDetectFlag struct and binding macros

Define a TxDetectFlag type and macros to generating C
bindings for getting and settings the tx detect
flags.

(cherry picked from commit 8a232be77e4e766ea5618319b1553e1d2a7749ee)

VJ: std::os::raw::c_void to libc::c_void

5 years agorust: add tx detect flags function to registration struct
Jason Ish [Tue, 19 Nov 2019 19:44:31 +0000 (13:44 -0600)] 
rust: add tx detect flags function to registration struct

(cherry picked from commit cde49ec24660bfab7cd2dc0d14cb08a16654ba4c)

5 years agoapp-layer: add tx detect functions to register struct
Jason Ish [Tue, 19 Nov 2019 19:42:24 +0000 (13:42 -0600)] 
app-layer: add tx detect functions to register struct

(cherry picked from commit 20bc08a72271a6b7237efd663765c872e6d8125e)

5 years agoftpdata: add tx detect flags
Jason Ish [Mon, 25 Nov 2019 22:56:50 +0000 (16:56 -0600)] 
ftpdata: add tx detect flags

(cherry picked from commit b1beb76fd7c6fac527c723139088f4a97a9f5d50)

5 years agodnp3: add tx detect flags support
Victor Julien [Fri, 29 Nov 2019 14:43:30 +0000 (15:43 +0100)] 
dnp3: add tx detect flags support

5 years agoapp-layer: don't consider tx flags if not registered
Victor Julien [Fri, 22 Nov 2019 06:54:04 +0000 (07:54 +0100)] 
app-layer: don't consider tx flags if not registered

If a protocol does not support TxDetectFlags, don't try to use them.

The consequence of trying to use them was that a TX would never be
considered done, and it would never be freed. This would lead to excessive
memory use and performance problems due to walking an ever increasing
list.

(cherry picked from commit ab471c30541338aa9232b001436dec9b870e5ccb)

5 years agodns: log addresses in flow direction, not packet
Jason Ish [Mon, 18 Nov 2019 18:58:06 +0000 (12:58 -0600)] 
dns: log addresses in flow direction, not packet

Ticket #3340.
https://redmine.openinfosecfoundation.org/issues/3340

(cherry picked from commit fccbd36d37dd630a76584b3a7ac6083f4c2eb3ed)

5 years agofilestore: don't assume flow is TCP 4350/head 4370/head
Victor Julien [Thu, 24 Oct 2019 12:51:48 +0000 (14:51 +0200)] 
filestore: don't assume flow is TCP

Filestore can be used by UDP based protocols as well. NFSv2 is one
that Suricata supports.

Bug #3278.

(cherry picked from commit 0824b0413455b668777e83cabe9fbc0ea81c400a)

5 years agoyaml: only enable ikev2 if rust is compiled in
Victor Julien [Sat, 2 Nov 2019 15:37:43 +0000 (16:37 +0100)] 
yaml: only enable ikev2 if rust is compiled in

Bug #3279.

5 years agodecode/pppoe: fix potential crash in debug statement
Victor Julien [Sun, 20 Oct 2019 05:50:32 +0000 (07:50 +0200)] 
decode/pppoe: fix potential crash in debug statement

5 years agolog-pcap: don't print (null) for compression method
Victor Julien [Fri, 18 Oct 2019 08:08:18 +0000 (10:08 +0200)] 
log-pcap: don't print (null) for compression method

5 years agotcp: don't set event on empty SACK opt
Victor Julien [Thu, 17 Oct 2019 13:42:15 +0000 (15:42 +0200)] 
tcp: don't set event on empty SACK opt

TCP_OPT_INVALID_LEN was set if the opt len was 2. While useless
an empty SACK is not uncommon.

Seen on an iOS device talking to an Apple server.

Bug #3254.

5 years agosuricata: use version from autoconf
Victor Julien [Mon, 14 Oct 2019 10:58:57 +0000 (12:58 +0200)] 
suricata: use version from autoconf

5 years agosignature: leak fix in DetectAddressParse2
Philippe Antoine [Fri, 11 Oct 2019 08:11:56 +0000 (10:11 +0200)] 
signature: leak fix in DetectAddressParse2

5 years agoautomake: use tar-ustar for longer filenames
Jason Ish [Sat, 12 Oct 2019 14:37:38 +0000 (08:37 -0600)] 
automake: use tar-ustar for longer filenames

According to the automake manual it should be considered
portable these days.

https://www.gnu.org/software/automake/manual/html_node/List-of-Automake-options.html

Required for the dist generation with Rust vendoring.

5 years agomem: Use correct len with strlcpy
Jeff Lucovsky [Sat, 12 Oct 2019 14:35:53 +0000 (10:35 -0400)] 
mem: Use correct len with strlcpy

5 years agoconfigure.ac: fix static build with pcap
Fabrice Fontaine [Fri, 11 Oct 2019 08:55:51 +0000 (10:55 +0200)] 
configure.ac: fix static build with pcap

pcap can depends on nl-3 so use pkg-config to find these dependencies
otherwise all AC_CHECK_LIB calls will fail when building statically

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
5 years agostream: fix progress for min_inspect_depth
Victor Julien [Fri, 11 Oct 2019 12:25:10 +0000 (14:25 +0200)] 
stream: fix progress for min_inspect_depth

Make sure progress don't exceed raw_progress.

5 years agoafl/decode: fix stats related memleak reports
Victor Julien [Tue, 8 Oct 2019 12:19:42 +0000 (14:19 +0200)] 
afl/decode: fix stats related memleak reports

5 years agoMakefile: Make libhtp available at install-rules stage
Shivani Bhardwaj [Mon, 7 Oct 2019 18:27:43 +0000 (23:57 +0530)] 
Makefile: Make libhtp available at install-rules stage

So far when "make install-rules" stage was executed, libhtp path was not
recognized as ldconfig does not run by this stage.
Set "LD_LIBRARY_PATH" since we already know the path where libhtp would
be.

Closes redmine ticket #2669.

5 years agolua: fix lua int size detection
Victor Julien [Fri, 4 Oct 2019 05:36:56 +0000 (07:36 +0200)] 
lua: fix lua int size detection

Failed to work with non-bundled htp and with some stricter
compile flags.

5 years agoconfigure: detect lua integer size
Jason Ish [Fri, 27 Sep 2019 21:33:45 +0000 (15:33 -0600)] 
configure: detect lua integer size

Lua 5.1 and 5.3 use a different integer size. Run a test program
to set the integer size used in the Rust FFI layer to Rust.

5 years agoenip: fix compile warnings in gcc-8
Victor Julien [Sat, 28 Sep 2019 08:55:34 +0000 (10:55 +0200)] 
enip: fix compile warnings in gcc-8

In file included from suricata-common.h:471,
                 from app-layer-enip-common.c:27:
app-layer-enip-common.c: In function ‘DecodeCIPRequestPathPDU’:
util-debug.h:222:31: warning: ‘req_path_class8’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             int _sc_log_ret = snprintf(_sc_log_msg, SC_LOG_MAX_LOG_MSG_LEN, __VA_ARGS__);   \
                               ^~~~~~~~
app-layer-enip-common.c:589:13: note: ‘req_path_class8’ was declared here
     uint8_t req_path_class8;
             ^~~~~~~~~~~~~~~
app-layer-enip-common.c:607:9: warning: ‘segment’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         switch (segment)
         ^~~~~~
app-layer-enip-common.c: In function ‘DecodeCIPResponsePDU’:
app-layer-enip-common.c:773:13: warning: ‘service’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     service &= 0x7f; //strip off top bit to get service code.  Responses have first bit as 1
             ^~
app-layer-enip-common.c: In function ‘DecodeCIPRequestPDU’:
app-layer-enip-common.c:503:25: warning: ‘path_size’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     offset += path_size * sizeof(uint16_t); //move offset past pathsize
               ~~~~~~~~~~^~~~~~~~~~~~~~~~~~
app-layer-enip-common.c:506:5: warning: ‘service’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     switch (service)
     ^~~~~~

Bug #3139.

5 years agochangelog: update for 4.1.5 suricata-4.1.5
Victor Julien [Sun, 22 Sep 2019 08:13:40 +0000 (10:13 +0200)] 
changelog: update for 4.1.5

5 years agoder/asn1: reduce max depth limit to 32
Victor Julien [Sun, 22 Sep 2019 05:54:57 +0000 (07:54 +0200)] 
der/asn1: reduce max depth limit to 32

OpenSSL uses 30, so this seems a reasonable limit.

Set a smaller limit than before to reduce the resources spent on
specially crafted input designed to be maximally expensive.

5 years agoder/asn1: don't pass on more data than is specified
Victor Julien [Fri, 20 Sep 2019 15:12:17 +0000 (17:12 +0200)] 
der/asn1: don't pass on more data than is specified

Set and Sequence parsers would pass on max available data instead
of the size of their object.

Malformed data could trigger massive recursion this way, leading
to spending much more resources than necessary.

Found using AFL.

Bug #3184.

5 years agodecode/ipv4: fix ts opt flags decoding
Victor Julien [Wed, 18 Sep 2019 11:26:23 +0000 (13:26 +0200)] 
decode/ipv4: fix ts opt flags decoding

Field is at data+1 offset, not +3. Also makes sure we always stay
within checked data bounds.

Reported-by: Sirko Höer -- Code Intelligence for DCSO.
Bug #3173.

5 years agodecode/ipv4: unittest to show parsing issue
Victor Julien [Wed, 18 Sep 2019 10:21:04 +0000 (12:21 +0200)] 
decode/ipv4: unittest to show parsing issue

5 years agossl: fix bounds checking in version decoding
Victor Julien [Fri, 6 Sep 2019 13:07:56 +0000 (15:07 +0200)] 
ssl: fix bounds checking in version decoding

Reported-by: Sirko Höer -- Code Intelligence for DCSO.
Bug #3168.

5 years agodefrag: check minimum size of reassembled packet
Jason Ish [Tue, 17 Sep 2019 10:08:15 +0000 (12:08 +0200)] 
defrag: check minimum size of reassembled packet

Before re-assembling, check that the first fragment is large
enough to contain the IPv4 or IPv6 header to prevent
an out of bounds read (IPv4) or write (IPv6).

Reported-by: Sirko Höer -- Code Intelligence for DCSO.
Bug #3170.

5 years agoAvoid to shutdown NSS if it is not initialized
Yujie Zhao [Tue, 17 Sep 2019 12:47:18 +0000 (12:47 +0000)] 
Avoid to shutdown NSS if it is not initialized

5 years agohttp: backport new events 4230/head
Philippe Antoine [Mon, 4 Mar 2019 12:25:46 +0000 (13:25 +0100)] 
http: backport new events

5 years agohtp/lzma: disable by default for 4.1.x. 4224/head
Jason Ish [Thu, 19 Sep 2019 16:16:33 +0000 (10:16 -0600)] 
htp/lzma: disable by default for 4.1.x.

The configuration logic had to be changed to be disabled by
default, to prevent a limit being set, but not the enable
flag from enabling lzma.

5 years agohttp: disable lzma decompression from configuration
Philippe Antoine [Thu, 19 Sep 2019 14:54:44 +0000 (16:54 +0200)] 
http: disable lzma decompression from configuration

5 years agohtp/lzma: set limit from configuration
Jason Ish [Thu, 12 Sep 2019 20:53:07 +0000 (14:53 -0600)] 
htp/lzma: set limit from configuration

Also use a default defined in Suricata, not libhtp.

5 years agohtp: set lzma memlimit from config
Victor Julien [Tue, 10 Sep 2019 11:06:28 +0000 (13:06 +0200)] 
htp: set lzma memlimit from config

5 years agosmtp: fix file_data inspection 4213/head
Victor Julien [Tue, 17 Sep 2019 13:01:45 +0000 (15:01 +0200)] 
smtp: fix file_data inspection

Continue tracking data if API is used with detect. Detection engine
then manages the tracking.

Bug #2395.

5 years agodecode: prevent segfault on bypass without flow 4191/head
Eric Leblond [Fri, 24 May 2019 21:37:49 +0000 (23:37 +0200)] 
decode: prevent segfault on bypass without flow

When using a rule like:
pass ip any any -> any any (msg:"Bypass"; sid:1; rev:1;)

We could get a match even in case of flow exhaustion where the
Packet has no Flow attached.

5 years agogeoip: add --disable-libgeoip 4179/head
Jason Ish [Fri, 6 Sep 2019 18:26:06 +0000 (12:26 -0600)] 
geoip: add --disable-libgeoip

Add ./configure argument --disable-libgeoip to disable
libgeoip when --enable-geoip is requested. This will allow
libmaxminddb to be picked up instead of libgeoip when
both are installed on the system.

5 years agogeoip: remove instructions to install legacy version
Jason Ish [Fri, 6 Sep 2019 16:47:15 +0000 (10:47 -0600)] 
geoip: remove instructions to install legacy version

The code is never hit.  If geoip is requested, and neither
libgeoip or libmaxminddb are available, libmaxminddb
will be recommended.

5 years agogeoip: display which geoip library is in use in configure
Jason Ish [Fri, 6 Sep 2019 16:38:29 +0000 (10:38 -0600)] 
geoip: display which geoip library is in use in configure

Example:
GeoIP support:                           yes, legacy libgeoip
GeoIP support:                           yes, libmaxminddb

5 years agodoc: fix geoip syntax
Eric Leblond [Wed, 31 Jul 2019 22:02:30 +0000 (00:02 +0200)] 
doc: fix geoip syntax

Spaces are not allowed before country code.

5 years agodetect-geoip: restore libgeoip code
Eric Leblond [Wed, 31 Jul 2019 19:42:43 +0000 (21:42 +0200)] 
detect-geoip: restore libgeoip code

Switching to libmaxminddb on a stable release will cause a
dependency to be changed and this may cause issue with some build
systems. Also yaml needs to be updated as geoip is erroring if
no geoip file is defined in the configuration:
 Unable to locate a GeoIP2 database filename in YAML conf.

This patch update configure.ac to search for libgeoip then switch
to libmaxminddb if the first one is not found.

5 years agoafl/fuzz: fix compiler warnings 4157/head
Victor Julien [Mon, 2 Sep 2019 14:59:38 +0000 (16:59 +0200)] 
afl/fuzz: fix compiler warnings

5 years agohttp: fixes stream flags for http tests 4149/head
Philippe Antoine [Mon, 2 Sep 2019 07:17:19 +0000 (09:17 +0200)] 
http: fixes stream flags for http tests

5 years agohttp: wait for response line for filename
Philippe Antoine [Tue, 2 Apr 2019 14:32:43 +0000 (16:32 +0200)] 
http: wait for response line for filename

See http evader case 481

5 years agodetect: fix FP on ICMP unreachable errors 4119/head
Victor Julien [Thu, 22 Aug 2019 09:28:36 +0000 (11:28 +0200)] 
detect: fix FP on ICMP unreachable errors

ICMP unreachable errors are linked to the flow they send an error for.
This would lead to the detection engine calling the TX inspection
engines on them.

The stream inspect engine would default to a match for non-UDP
and non-TCP as for ICMP we're not expected to use a TX inspect engine
for stream data.

This all would lead to a false positive match.

This patch fixes this by making sure the TX engines are not called if
the packet protocol and flow protocol are not the same.

Bug #2841.

5 years agopcap: fix breakloop error handling
Victor Julien [Wed, 5 Jun 2019 20:06:08 +0000 (22:06 +0200)] 
pcap: fix breakloop error handling

Ticket #3004

5 years agocapture: check for flow packets on capture timeout
Victor Julien [Mon, 27 May 2019 13:46:18 +0000 (15:46 +0200)] 
capture: check for flow packets on capture timeout

The capture threads can receive packets from the flow manager in their
Threadvars::stream_pq packet queue. This mechanism makes sure the packets
the flow manager injects into the engine are processed by the correct
worker thread.

If the capture thread(s) would not receive packets for a long time, the
Threadvars::stream_pq would not be checked and processed. This could
lead to packet pool depletion in the flow manager. It would also lead
to flows not being timed out/logged until either packets started flowing
again or until the engine was shut down.

The scenario is more likely to happen in a test (e.g. replay) but could
also delay logging on low traffic sensors.