]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
5 years agosource-pcap-file: Pcap File Init Failure Handling (#1694) 4530/head
Danny Browning [Mon, 18 Feb 2019 16:57:21 +0000 (09:57 -0700)] 
source-pcap-file: Pcap File Init Failure Handling (#1694)

Better handle case where pcap file receive thread fails to initialize. Allow
initialize to complete, but terminate the thread quickly. Delay exiting
unix socket runmode as late as possible.

(cherry picked from commit c0ab45aa6fbe1a299facf45e34ba2bcb3d76ce75)

5 years agotravis: remove cocci and macos builds 4515/head
Jason Ish [Thu, 30 Jan 2020 16:20:38 +0000 (10:20 -0600)] 
travis: remove cocci and macos builds

These tests are covered by Github actions and removing
them may speed up the Travis builds to get results sooner.

Its still worth keeping some of these builds as they test
more compile time options than the Github Actions currently
do.

Backport of 222a81f85dfea32f518f68eda51d9f45e1bcc46a.

5 years agorust: remove unnecessary parentheses (Rust 1.40 fixup) 4512/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

(cherry picked from commit 5ee8323028aeb0d2c4926bae3bf8dafd05215d56)

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

(cherry picked from commit d4428d94deba7ba5fafeb76505012492136b0519)

5 years agosmb: handle file transactions post-GAP
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 agoconfigure.ac: fix --disable-geoip 4447/head
Fabrice Fontaine [Sun, 6 Oct 2019 07:53:23 +0000 (09:53 +0200)] 
configure.ac: fix --disable-geoip

$enableval should be used to know if the user has passed --enable-geoip
or --disable-geoip

Fixes:
 - http://autobuild.buildroot.org/results/a7a34f760ae5fe0922fdb720b8234dbcd85ed222

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
(cherry picked from commit 61becb29bf2bcce5febd7f98e09b0006d217c8cb)

5 years agogithub-ci: use container for 18.04 build
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.

(cherry picked from commit b9515671be598c89badf1fb5d2652497d493bcd3)

5 years agochangelog: update for 4.1.6 suricata-4.1.6
Victor Julien [Fri, 13 Dec 2019 12:47:04 +0000 (13:47 +0100)] 
changelog: update for 4.1.6

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

(cherry picked from commit 627cc23769dc574ca13e6fd6e1af1ab34b5bb575)

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.

(cherry picked from commit 8609939e60cdd52dc1745e2eeb5dc3db275acd13)

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

(cherry picked from commit df8db1ddb0736300bad4a7fee811d333ab77cb54)

5 years agodecode: Change return type of IPv4 and TCP options decode
Jeff Lucovsky [Tue, 26 Mar 2019 21:30:09 +0000 (14:30 -0700)] 
decode: Change return type of IPv4 and TCP options decode

The return value from the options decoder in TCP and IPv4 is ignored.
This commit changes the return type of the function to `void` and
modifies existing return points to return without a value.

When an error occurs, the packet state is being set to indicate whether
it's valid or not and the existing return value is never used.

(cherry picked from commit 8e464530ef9c788bb5482ff8806aadb4001c4d43)

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

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
(cherry picked from commit 9f0294fadca3dcc18c919424242a41e01f3e8318)

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

(cherry picked from commit 9bcc1118e18076ac401d9fd47ee20e8fdc9837f3)

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.

(cherry picked from commit 040aff5197ba19caef1113c1c5c323eef72a9f69)

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.

(cherry picked from commit 77539e08fc8a4e548035663c46fc5f9bea8188d3)

5 years agostats: fix stats not always syncing in flow timeout 4439/head
Victor Julien [Thu, 5 Dec 2019 08:20:31 +0000 (09:20 +0100)] 
stats: fix stats not always syncing in flow timeout

(cherry picked from commit 83bbe287e7d2713669990dee41181d33f7cd571b)

5 years agothreading: add debug validation for stale packets
Victor Julien [Mon, 25 Nov 2019 18:45:42 +0000 (19:45 +0100)] 
threading: add debug validation for stale packets

(cherry picked from commit 58b9a2dc2135e491307f6aeb32d007ee325ca458)

5 years agothreading: fix shutdown race condition
Victor Julien [Fri, 8 Nov 2019 11:09:24 +0000 (12:09 +0100)] 
threading: fix shutdown race condition

A BUG_ON statement would seemingly randomly trigger during the threading
shutdown logic. After a packet thread reached the THV_RUNNING_DONE state,
it would sometimes still receive flow timeout packets which would then
remain unprocessed.

1 main:   TmThreadDisableReceiveThreads(); <- stop capturing packets
2 worker: -> TmThreadTimeoutLoop (THV_FLOW_LOOP) phase starts
3 main:   FlowForceReassembly();           <- inject packets from flow engine
4 main:   TmThreadDisablePacketThreads();  <- then disable packet threads
5 main:   -> checks if 'worker' is ready processing packets
6 main:   -> sends THV_KILL to worker
7 worker: breaks out of TmThreadTimeoutLoop and changes to THV_RUNNING_DONE.

Part of the problem was with (5) above. When checking if the worker was
already done with its work, TmThreadDisablePacketThreads would not consider
the injected flow timeout packets. The second part of the problem was with (7),
where the worker checked if it was ready with the TmThreadTimeoutLoop in a
thread unsafe way.

As a result TmThreadDisablePacketThreads would not wait long enough for the
worker(s) to finish its work and move the threads to the THV_RUNNING_DONE
phase by issuing the THV_KILL command.

When waiting for packet processing threads to process all in-flight packets,
also consider the 'stream_pq'. This will have received the flow timeout
packets.

Bug #1871.

(cherry picked from commit fe9aeed0f0e65da7e7f61b5722580efc86f6355a)

5 years agothreading: fix flow timeout loop race
Victor Julien [Fri, 8 Nov 2019 10:35:02 +0000 (11:35 +0100)] 
threading: fix flow timeout loop race

(cherry picked from commit 825173a2baa988ab51ded416811070363f945f7d)

5 years agothreads: improve flow timeout loop
Victor Julien [Wed, 12 Jun 2019 07:56:26 +0000 (09:56 +0200)] 
threads: improve flow timeout loop

Improve thread safety and remove BUG_ON

(cherry picked from commit 92d38683ce8271e5550c1fcc5be6a2e9258a5207)

5 years agothreading: improve thread queues checking by dumping more info
Victor Julien [Sun, 3 Nov 2019 09:37:42 +0000 (10:37 +0100)] 
threading: improve thread queues checking by dumping more info

(cherry picked from commit 56354afd4113c38a72042dd5a5fa3f2b91c2b5b2)

5 years agopacket: set unique pkt_src 'flush' packets
Victor Julien [Thu, 7 Nov 2019 07:57:20 +0000 (08:57 +0100)] 
packet: set unique pkt_src 'flush' packets

Set unique type for capture timeout and for detect reload flush
to assist in debugging.

(cherry picked from commit 0a809bf577d08cb15a93fe56bd15c460607d7384)

5 years agostream: remove unused code
Victor Julien [Wed, 13 Nov 2019 09:38:46 +0000 (10:38 +0100)] 
stream: remove unused code

Remove now unused 'pkt_src' type as well.

Remove related unittests.

(cherry picked from commit 6bc76368269830ed4e19833c29764307548bd174)

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.