]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
5 years agofuzz: add configure wrapper for oss-fuzz 4813/head
Victor Julien [Tue, 14 Apr 2020 09:02:50 +0000 (11:02 +0200)] 
fuzz: add configure wrapper for oss-fuzz

5 years agoincludes: don't include sys/types.h twice 4811/head
Victor Julien [Mon, 13 Apr 2020 08:22:43 +0000 (10:22 +0200)] 
includes: don't include sys/types.h twice

5 years agoprivs: include headers in suricata-common.h
Victor Julien [Mon, 13 Apr 2020 08:21:46 +0000 (10:21 +0200)] 
privs: include headers in suricata-common.h

5 years agoconf/yaml: include yaml.h after suricata-common.h
Victor Julien [Mon, 13 Apr 2020 08:21:07 +0000 (10:21 +0200)] 
conf/yaml: include yaml.h after suricata-common.h

5 years agodoc/install: refer to buster as Debian stable
Sascha Steinbiss [Fri, 10 Apr 2020 09:53:54 +0000 (11:53 +0200)] 
doc/install: refer to buster as Debian stable

5 years agofuzz/sigpcap: enable all of eve
Victor Julien [Mon, 13 Apr 2020 06:19:14 +0000 (08:19 +0200)] 
fuzz/sigpcap: enable all of eve

5 years agodetect/iponly: fix parsing of '0' valued netmask
Victor Julien [Sat, 11 Apr 2020 11:54:00 +0000 (13:54 +0200)] 
detect/iponly: fix parsing of '0' valued netmask

5 years agoutil/mem: reduce scope of win32 specific include 4806/head
Victor Julien [Thu, 28 Nov 2019 14:05:05 +0000 (15:05 +0100)] 
util/mem: reduce scope of win32 specific include

5 years agoutil/mem: cleanup by moving atomic from mem hdr
Victor Julien [Wed, 27 Nov 2019 19:03:44 +0000 (20:03 +0100)] 
util/mem: cleanup by moving atomic from mem hdr

5 years agoutil/mem: move most logic to functions
Victor Julien [Wed, 27 Nov 2019 16:37:37 +0000 (17:37 +0100)] 
util/mem: move most logic to functions

Reduce macro use and simplify code. Also reduces compiled code
size.

5 years agoutil/mem: remove old debug code for counting allocs
Victor Julien [Wed, 27 Nov 2019 17:13:32 +0000 (18:13 +0100)] 
util/mem: remove old debug code for counting allocs

5 years agologging: turn SCLog and SCLogErr into funcs
Victor Julien [Wed, 27 Nov 2019 11:01:01 +0000 (12:01 +0100)] 
logging: turn SCLog and SCLogErr into funcs

Reduces compiled code size.

5 years agocommon: add ATTR_FMT_PRINTF wrapper
Victor Julien [Thu, 28 Nov 2019 13:55:29 +0000 (14:55 +0100)] 
common: add ATTR_FMT_PRINTF wrapper

Wraps around __attribute__((format(printf, (x), (y))))

5 years agocommon: use suricata-common.h in more places
Victor Julien [Thu, 28 Nov 2019 13:47:53 +0000 (14:47 +0100)] 
common: use suricata-common.h in more places

5 years agocommon: use WARN_UNUSED macro
Victor Julien [Thu, 28 Nov 2019 13:18:59 +0000 (14:18 +0100)] 
common: use WARN_UNUSED macro

5 years agodetect/mpm: don't process empty store
Victor Julien [Thu, 28 Nov 2019 10:47:56 +0000 (11:47 +0100)] 
detect/mpm: don't process empty store

5 years agodns/tests: comment typo fixes 4802/head
Victor Julien [Fri, 10 Apr 2020 11:50:33 +0000 (13:50 +0200)] 
dns/tests: comment typo fixes

5 years agodecode: return bool network layer
Victor Julien [Mon, 2 Mar 2020 14:45:25 +0000 (15:45 +0100)] 
decode: return bool network layer

So that the caller can set the correct event type on error.

5 years agodecode/hdlc: initial support
Victor Julien [Thu, 13 Feb 2020 20:43:30 +0000 (21:43 +0100)] 
decode/hdlc: initial support

5 years agodecode: single network layer entrypoint
Victor Julien [Wed, 26 Feb 2020 13:06:26 +0000 (14:06 +0100)] 
decode: single network layer entrypoint

This way new layers can be added in a single place.

5 years agodecode: create linklayer entry point
Victor Julien [Fri, 21 Feb 2020 15:07:57 +0000 (16:07 +0100)] 
decode: create linklayer entry point

Make AF_PACKET and PCAP mode use it.

5 years agodecode/ieee8021ah: fix possible packet truncation
Victor Julien [Wed, 26 Feb 2020 19:34:25 +0000 (20:34 +0100)] 
decode/ieee8021ah: fix possible packet truncation

5 years agofuzz/siginit: cleanup detect engine every 1024 runs
Victor Julien [Thu, 9 Apr 2020 08:05:21 +0000 (10:05 +0200)] 
fuzz/siginit: cleanup detect engine every 1024 runs

5 years agoapp-layer-template: fix log typo
Andreas Herz [Thu, 9 Apr 2020 13:24:14 +0000 (15:24 +0200)] 
app-layer-template: fix log typo

5 years agoconf/yaml: limit recursion depth while paring YAML
Jason Ish [Thu, 9 Apr 2020 21:59:23 +0000 (15:59 -0600)] 
conf/yaml: limit recursion depth while paring YAML

A deeply nested YAML file can cause a stack-overflow while
reading in the configuration to do the recursive parser. Limit
the recursion level to something sane (128) to prevent this
from happening.

The default Suricata configuration has a recursion level of 128
so there is still lots of room to grow (not that we should).

Redmine ticket:
https://redmine.openinfosecfoundation.org/issues/3630

5 years agodetect/parse: properly free bidir sigs in error path
Victor Julien [Fri, 10 Apr 2020 08:02:43 +0000 (10:02 +0200)] 
detect/parse: properly free bidir sigs in error path

5 years agodetect/parse: fix minor memory leak in error path
Victor Julien [Fri, 10 Apr 2020 07:55:36 +0000 (09:55 +0200)] 
detect/parse: fix minor memory leak in error path

Only reachable on SCMalloc so should be unlikely to be reached.

5 years agofuzz: allow uninitialized stats api 4793/head
Victor Julien [Wed, 8 Apr 2020 20:08:39 +0000 (22:08 +0200)] 
fuzz: allow uninitialized stats api

5 years agofuzz: remove UNITTEST dependency
Victor Julien [Tue, 7 Apr 2020 10:41:12 +0000 (12:41 +0200)] 
fuzz: remove UNITTEST dependency

Expose UTH flow builder to new 'FUZZ' define as well. Move UTHbufferToFile
as well and rename it to a more generic 'TestHelperBufferToFile'.

This way UNITTESTS can be disabled. This leads to smaller code size
and more realistic testing as in some parts of the code things
behave slightly differently when UNITTESTS are enabled.

5 years agodns: improve probe_tcp handling of incomplete data
Philippe Antoine [Mon, 16 Mar 2020 09:22:35 +0000 (10:22 +0100)] 
dns: improve probe_tcp handling of incomplete data

5 years agosource/erf: validate record length before read
Jason Ish [Mon, 6 Apr 2020 16:50:36 +0000 (10:50 -0600)] 
source/erf: validate record length before read

Check the ERF record length before attempting to read it as
a record length less than the size of the record header
is invalid.

Redmine ticket:
https://redmine.openinfosecfoundation.org/issues/3593

5 years agofuzz/sigpcap: initialize empty packet pool 4785/head
Victor Julien [Tue, 7 Apr 2020 05:01:59 +0000 (07:01 +0200)] 
fuzz/sigpcap: initialize empty packet pool

Fixes runs with --enable-debug-validation. The target did not init a
packet pool, so for a tunnel packet would try to get a packet from
an uninitialized pool. In non-debug mode, this silently works by
falling back to a packet from alloc.

    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff35a6801 in __GI_abort () at abort.c:79
    #2  0x00007ffff359639a in __assert_fail_base (fmt=0x7ffff371d7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x555557fe7260 "!(pool->initialized == 0)",
        file=file@entry=0x555557fe7220 "tmqh-packetpool.c", line=line@entry=253, function=function@entry=0x555557fe7500 <__PRETTY_FUNCTION__.21181> "PacketPoolGetPacket") at assert.c:92
    #3  0x00007ffff3596412 in __GI___assert_fail (assertion=0x555557fe7260 "!(pool->initialized == 0)", file=0x555557fe7220 "tmqh-packetpool.c", line=253,
        function=0x555557fe7500 <__PRETTY_FUNCTION__.21181> "PacketPoolGetPacket") at assert.c:101
    #4  0x00005555577e24be in PacketPoolGetPacket () at tmqh-packetpool.c:253
    #5  0x0000555556914ecd in PacketGetFromQueueOrAlloc () at decode.c:183
    #6  0x00005555569161e1 in PacketTunnelPktSetup (tv=0x555559863980 <tv>, dtv=0x614000068e40, parent=0x61e0000fc080, pkt=0x61e0000fc470 "LL", len=72, proto=DECODE_TUNNEL_IPV4) at decode.c:286
    #7  0x00005555569de694 in DecodeIPv4inIPv6 (tv=0x555559863980 <tv>, dtv=0x614000068e40, p=0x61e0000fc080, pkt=0x61e0000fc470 "LL", plen=72) at decode-ipv6.c:59
    #8  0x00005555569e60b5 in DecodeIPV6ExtHdrs (tv=0x555559863980 <tv>, dtv=0x614000068e40, p=0x61e0000fc080, pkt=0x61e0000fc470 "LL", len=112) at decode-ipv6.c:522
    #9  0x00005555569e846f in DecodeIPV6 (tv=0x555559863980 <tv>, dtv=0x614000068e40, p=0x61e0000fc080, pkt=0x61e0000fc420 "cLL", len=255) at decode-ipv6.c:641
    #10 0x0000555556a032f9 in DecodeRaw (tv=0x555559863980 <tv>, dtv=0x614000068e40, p=0x61e0000fc080, pkt=0x61e0000fc420 "cLL", len=255) at decode-raw.c:70
    #11 0x0000555557659ba8 in DecodePcapFile (tv=0x555559863980 <tv>, p=0x61e0000fc080, data=0x614000068e40) at source-pcap-file.c:412
    #12 0x0000555556573401 in LLVMFuzzerTestOneInput (data=0x613000000047 "\241\262\315\064", size=339) at tests/fuzz/fuzz_sigpcap.c:158
    #13 0x0000555557a4dc66 in main (argc=2, argv=0x7fffffffdfa8) at tests/fuzz/onefile.c:51

That line:

    BUG_ON(pool->initialized == 0);

5 years agodoc: Update documentation for by_rule and by_both thresholds.
Todd Mortimer [Mon, 30 Mar 2020 23:49:32 +0000 (23:49 +0000)] 
doc: Update documentation for by_rule and by_both thresholds.

5 years agodetect/threshold: Add tests for thresholding by_rule and by_both.
Todd Mortimer [Mon, 30 Mar 2020 23:49:04 +0000 (23:49 +0000)] 
detect/threshold: Add tests for thresholding by_rule and by_both.

5 years agodetect/threshold: Add a common function to (re)allocate the by_rule threshold table.
Todd Mortimer [Mon, 30 Mar 2020 23:47:47 +0000 (23:47 +0000)] 
detect/threshold: Add a common function to (re)allocate the by_rule threshold table.

Ensure that the by_rule threshold table is initialized if a rule
is thresholded by_rule. Replace manual table reallocaton with calls
to the common function.

5 years agodetect/threshold: Refactor threshold calculation to handle by_rule and by_both.
Todd Mortimer [Mon, 30 Mar 2020 23:45:50 +0000 (23:45 +0000)] 
detect/threshold: Refactor threshold calculation to handle by_rule and by_both.

The only difference between threshold calculations for by_src/by_dst,
by_rule or by_both is which table stores the DetectThresholdEntry.
Refactor the ThresholdHandlePacket* functions to do table lookup and
storage individually, but calculate thresholds in a common function.

5 years agotime: Add TIMEVAL_EARLIER and TIMEVAL_DIFF_SEC macros.
Todd Mortimer [Mon, 30 Mar 2020 23:38:24 +0000 (23:38 +0000)] 
time: Add TIMEVAL_EARLIER and TIMEVAL_DIFF_SEC macros.

Make it easy to compare 'struct timeval's and get their difference.

5 years agodetect/threshold: Parse by_rule and by_both in rules.
Todd Mortimer [Mon, 30 Mar 2020 23:36:12 +0000 (23:36 +0000)] 
detect/threshold: Parse by_rule and by_both in rules.

Also add tests for parsing them.

5 years agoapp-layer/proto-detect: minor cleanup 4784/head
Victor Julien [Mon, 6 Apr 2020 17:35:24 +0000 (19:35 +0200)] 
app-layer/proto-detect: minor cleanup

Make sure the mask calculation is u32.

5 years agodetect/pktvar: fix memory leaks
Victor Julien [Sun, 5 Apr 2020 14:56:35 +0000 (16:56 +0200)] 
detect/pktvar: fix memory leaks

5 years agofuzz: limit input size for protocol detection consistency check
Philippe Antoine [Mon, 6 Apr 2020 15:28:33 +0000 (17:28 +0200)] 
fuzz: limit input size for protocol detection consistency check

5 years agodetect/ssl: Fix memory leak in version parsing
Jeff Lucovsky [Mon, 6 Apr 2020 13:55:41 +0000 (09:55 -0400)] 
detect/ssl: Fix memory leak in version parsing

This commit fixes a memory leak in the SSL version handling that
manifests when the version identifier is incomplete or incorrect.

5 years agofuzz: build compatibility with oss-fuzz flags 4780/head
Philippe Antoine [Mon, 6 Apr 2020 08:58:23 +0000 (10:58 +0200)] 
fuzz: build compatibility with oss-fuzz flags

ie C define FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION

5 years agodoc/devguide: Submission and style 4777/head
Jeff Lucovsky [Mon, 30 Mar 2020 15:01:59 +0000 (11:01 -0400)] 
doc/devguide: Submission and style

This commit adds code submission and coding style guidelines to the
devguide. Most of the material is a straight port from the wiki but
there have been some content modifications and additions.

5 years agodevguide: include sources in EXTRA_DIST
Jason Ish [Thu, 19 Mar 2020 22:27:37 +0000 (16:27 -0600)] 
devguide: include sources in EXTRA_DIST

Required for distcheck to pass, and required to build docs
from a dist archive.

5 years agogithub-ci: on centos-8 build, use distcheck
Jason Ish [Thu, 19 Mar 2020 20:13:33 +0000 (14:13 -0600)] 
github-ci: on centos-8 build, use distcheck

And verify that man page is built.

5 years agogithub-ci: build documentation on Ubuntu 18.04
Jason Ish [Thu, 19 Mar 2020 19:30:45 +0000 (13:30 -0600)] 
github-ci: build documentation on Ubuntu 18.04

5 years agogithub-ci: build documentation on Fedora-31 build
Jason Ish [Thu, 19 Mar 2020 18:30:06 +0000 (12:30 -0600)] 
github-ci: build documentation on Fedora-31 build

Install sphinx and latex tools to test the building
of documentation on the Fedora 31 build, including
the PDF.

5 years agoci: adds a build with make tags 4776/head
Philippe Antoine [Fri, 3 Apr 2020 13:31:59 +0000 (15:31 +0200)] 
ci: adds a build with make tags

5 years agoconfigure: correctly display nss/nspr status
Eric Leblond [Tue, 11 Feb 2020 14:21:39 +0000 (16:21 +0200)] 
configure: correctly display nss/nspr status

If autodiscovery of libnss was used (default), then the line
 libnss support:                          yes
was never set to no.

Same behavior for libnspr.

Broken by commit 'configure: fix nspr check logic' (7ea269a212a3a2209effc3cc9300873d6a06859e)

5 years agoflow: cleanup expectations first
Victor Julien [Fri, 3 Apr 2020 08:09:07 +0000 (10:09 +0200)] 
flow: cleanup expectations first

Make sure to cleanup expectations for a flow as the first step, before
parts of the flow itself are getting cleaned/freed.

Also indicate use unlikely as flows with expectations should be relatively
rare.

5 years agoapp-layer-expectation: update copyright date
Eric Leblond [Sun, 9 Feb 2020 19:33:21 +0000 (20:33 +0100)] 
app-layer-expectation: update copyright date

5 years agoapp-layer-expectation: clean expectation at flow end
Eric Leblond [Fri, 7 Feb 2020 23:05:01 +0000 (00:05 +0100)] 
app-layer-expectation: clean expectation at flow end

When a flow timeout, we can have still existing expectations that
are linked to this flow. Given that there is a delay between the
real ending of the flow and its destruction by Suricata, the
expectation should be already honored so we can assume the risk
to clean the expectations that have been triggered by the
to-be-deleted flow.

5 years agoapp-layer-expectation: limit number of expectations
Eric Leblond [Fri, 7 Feb 2020 23:01:28 +0000 (00:01 +0100)] 
app-layer-expectation: limit number of expectations

This patch introduces a limitation in term of number of
expectations attached to one IPPair. This is done using
a circle list so we have a FIFO approach on expectation
handling.

Circleq list code is copied from BSD code like was pre existing code
in queue.h.

5 years agoapp-layer-expectation: remove unused parameter
Eric Leblond [Tue, 10 Dec 2019 21:15:14 +0000 (22:15 +0100)] 
app-layer-expectation: remove unused parameter

5 years agotests/bsize: Fuzzing test case added 4765/head
Jeff Lucovsky [Tue, 31 Mar 2020 12:46:38 +0000 (08:46 -0400)] 
tests/bsize: Fuzzing test case added

This commit adds a test case to validate the issue found during fuzz
testing.

5 years agodetect/bsize: Ensure numeric values fit
Jeff Lucovsky [Mon, 30 Mar 2020 13:51:27 +0000 (09:51 -0400)] 
detect/bsize: Ensure numeric values fit

This commit ensures that the numeric values will not exceed the size of
the containers used to hold them.

5 years agodetect/parse: fix crash on 'internal' keyword use
Victor Julien [Tue, 31 Mar 2020 12:04:07 +0000 (14:04 +0200)] 
detect/parse: fix crash on 'internal' keyword use

When keyword __flowvar__postmatch__, an internal keyword, is used
in a rule the 'Setup' func ptr will be NULL. This caused a crash.

5 years agofuzz/siginit: fix leak in case of bidir sig
Victor Julien [Tue, 31 Mar 2020 11:53:40 +0000 (13:53 +0200)] 
fuzz/siginit: fix leak in case of bidir sig

5 years agofuzz/siginit: minor improvements
Victor Julien [Tue, 31 Mar 2020 11:32:35 +0000 (13:32 +0200)] 
fuzz/siginit: minor improvements

Enable detect engine 'quiet' mode to generate less output.

Set a fake filename so that datarep doesn't hit a reachable assert.

5 years agodetect/pkt_data: error on unconsumed transforms
Victor Julien [Tue, 31 Mar 2020 08:38:06 +0000 (10:38 +0200)] 
detect/pkt_data: error on unconsumed transforms

If a rule has transforms w/o consuming them (e.g. a content keyword),
don't consider 'pkt_data' valid.

5 years agodetect/pkt_data: code and test cleanup
Victor Julien [Tue, 31 Mar 2020 09:37:51 +0000 (11:37 +0200)] 
detect/pkt_data: code and test cleanup

5 years agodetect: more robust against transform issues
Victor Julien [Tue, 31 Mar 2020 08:35:54 +0000 (10:35 +0200)] 
detect: more robust against transform issues

In case of transform issues (transform not consumed before pkt_data
for example), the code would hit an ugly BUG_ON.

Address this by a more graceful error message, that will still
invalidate the sig but not crash the engine.

5 years agorfb: make sure size calculations do not overflow
Sascha Steinbiss [Sun, 29 Mar 2020 17:33:29 +0000 (19:33 +0200)] 
rfb: make sure size calculations do not overflow

Addresses #3570 by extra checking of calculated size requests.

With the given input, the parser eventually arrived at
parser::parse_failure_reason() which parsed from the remaining four
bytes (describing the string length) that the failure string to follow
would be 4294967295 bytes long. While calculating the total size of the
data to request via AppLayerResult::incomplete(), adding the four bytes
for the parsed but not consumed string length caused the u32 length to
overflow, resulting in a much smaller value triggering the bug condition.

This problem was addressed by more careful checking of values in each step
that could overflow: one subtraction, one addition (which could overflow
the usize length values), and a final check to determine whether the result
still fit into the u32 values required by AppLayerResult::incomplete().
If so, we would safely convert the values and pass them to the result type.
If not, we simply return AppLayerResult::err() but do not erroneously and
silently request the wrong amount.

5 years agodetect/tls: Use pcre_copy_substring to avoid leak
Jeff Lucovsky [Mon, 30 Mar 2020 11:57:36 +0000 (07:57 -0400)] 
detect/tls: Use pcre_copy_substring to avoid leak

This commit eliminates a memory leak while parsing TLS version
information. The leak was identified through fuzzing.

5 years agobuild: wrap fuzz targets in guard to fix 'make tags' 4750/head
Victor Julien [Mon, 30 Mar 2020 07:11:54 +0000 (09:11 +0200)] 
build: wrap fuzz targets in guard to fix 'make tags'

5 years agofuzz/sigpcap: fix FPs due to missing pkt cleanup
Victor Julien [Sun, 29 Mar 2020 17:34:18 +0000 (19:34 +0200)] 
fuzz/sigpcap: fix FPs due to missing pkt cleanup

5 years agodecode/vxlan: minor yaml example clarrification 4746/head
Victor Julien [Fri, 27 Mar 2020 11:48:27 +0000 (12:48 +0100)] 
decode/vxlan: minor yaml example clarrification

5 years agodecode/teredo: implement port support
Victor Julien [Mon, 23 Mar 2020 10:06:55 +0000 (11:06 +0100)] 
decode/teredo: implement port support

Implement support for limiting Teredo detection and decoding to specific
UDP ports, with 3544 as the default.

If no ports are specified, the old behaviour of detecting/decoding on any
port is still in place. This can also be forced by specifying 'any' as the
port setting.

5 years agoUse StringParse* for all parsers and configurations 4739/head
Shivani Bhardwaj [Wed, 18 Dec 2019 11:01:10 +0000 (16:31 +0530)] 
Use StringParse* for all parsers and configurations

5 years agoUse appropriate ByteExtractString* functions
Shivani Bhardwaj [Wed, 18 Dec 2019 08:21:08 +0000 (13:51 +0530)] 
Use appropriate ByteExtractString* functions

5 years agoutil: Add StringParse* functions
Shivani Bhardwaj [Sun, 22 Dec 2019 16:58:54 +0000 (22:28 +0530)] 
util: Add StringParse* functions

StringParse* functions would perform a stricter check compared to
ByteExtractString* functions. These new functions shall also check if
any extra characters follow the extracted numeric value in addition to
the checks performed by ByteExtractString* and return -1 in that case.
This is particularly important in parser, configuration and setup functions.

5 years agofuzz: remove obsolete AFL code 4735/head
Philippe Antoine [Thu, 26 Mar 2020 15:11:21 +0000 (16:11 +0100)] 
fuzz: remove obsolete AFL code

5 years agoci: add fuzztargets and afl build test 4732/head
Victor Julien [Thu, 26 Mar 2020 13:44:58 +0000 (14:44 +0100)] 
ci: add fuzztargets and afl build test

5 years agofuzz: simpler way to force usage of CXX linker
Philippe Antoine [Thu, 26 Mar 2020 13:55:31 +0000 (14:55 +0100)] 
fuzz: simpler way to force usage of CXX linker

5 years agofuzz: remove decodeder fuzz target
Philippe Antoine [Thu, 26 Mar 2020 13:42:50 +0000 (14:42 +0100)] 
fuzz: remove decodeder fuzz target

As we removed decodeder function

5 years agoconfigure: right test for AFLFUZZ_PERSISTANT_MODE 4731/head
Philippe Antoine [Thu, 26 Mar 2020 13:29:38 +0000 (14:29 +0100)] 
configure: right test for AFLFUZZ_PERSISTANT_MODE

5 years agoci: enables fuzz targets in one build 4729/head
Philippe Antoine [Thu, 26 Mar 2020 13:06:32 +0000 (14:06 +0100)] 
ci: enables fuzz targets in one build

github workflow wih debian

5 years agostream/tcp: fix STREAM_HAS_SEEN_DATA macro 4726/head
Victor Julien [Tue, 24 Mar 2020 12:11:03 +0000 (13:11 +0100)] 
stream/tcp: fix STREAM_HAS_SEEN_DATA macro

The macro would not return true for smaller TCP streams, leading to
cases where the app-layer was not notified of EOF.

5 years agostream/tcp: clean up stream flags
Victor Julien [Tue, 24 Mar 2020 10:37:01 +0000 (11:37 +0100)] 
stream/tcp: clean up stream flags

5 years agorust/x509: map decoding errors to decoder events 4721/head
Pierre Chifflier [Sun, 22 Mar 2020 15:19:57 +0000 (16:19 +0100)] 
rust/x509: map decoding errors to decoder events

5 years agossl/tls: call rs_cstring_free for strings allocated in Rust
Pierre Chifflier [Mon, 9 Mar 2020 20:49:51 +0000 (21:49 +0100)] 
ssl/tls: call rs_cstring_free for strings allocated in Rust

5 years agorust/x509: use the raw serial number so leading zeros are not removed
Pierre Chifflier [Mon, 9 Mar 2020 19:36:21 +0000 (20:36 +0100)] 
rust/x509: use the raw serial number so leading zeros are not removed

5 years agoDER: remove the C parser for DER
Pierre Chifflier [Mon, 9 Mar 2020 19:35:27 +0000 (20:35 +0100)] 
DER: remove the C parser for DER

5 years agossl/tls: use the rust decoder to decode X.509 certificates
Pierre Chifflier [Mon, 9 Mar 2020 12:38:13 +0000 (13:38 +0100)] 
ssl/tls: use the rust decoder to decode X.509 certificates

5 years agorust: add common function to exchange CString objects from/to C
Pierre Chifflier [Mon, 23 Mar 2020 15:53:51 +0000 (16:53 +0100)] 
rust: add common function to exchange CString objects from/to C

5 years agodetect: byte-test convert neg_op flag to a bool 4717/head
Jeff Lucovsky [Mon, 16 Dec 2019 22:07:20 +0000 (17:07 -0500)] 
detect: byte-test convert neg_op flag to a bool

Only 8 flags are permitted so convert one of them to a struct member. I
choose neg_op

5 years agodetect: Add unittests to exercise bitmask
Jeff Lucovsky [Sun, 15 Dec 2019 19:47:27 +0000 (14:47 -0500)] 
detect: Add unittests to exercise bitmask

5 years agodetect: fixup incorrect comments, indentation
Jeff Lucovsky [Sun, 15 Dec 2019 19:47:00 +0000 (14:47 -0500)] 
detect: fixup incorrect comments, indentation

5 years agodetect: byte_test impl for bitmask
Jeff Lucovsky [Sun, 15 Dec 2019 19:45:50 +0000 (14:45 -0500)] 
detect: byte_test impl for bitmask

This commit implements byte_test's bitmask feature.

5 years agodoc: fix documentation typos
Jeff Lucovsky [Sun, 15 Dec 2019 19:44:45 +0000 (14:44 -0500)] 
doc: fix documentation typos

5 years agodoc: Update byte_test documentation
Jeff Lucovsky [Sun, 15 Dec 2019 19:44:07 +0000 (14:44 -0500)] 
doc: Update byte_test documentation

5 years agorfb: use more idiomatic Rust code 4715/head
Sascha Steinbiss [Thu, 19 Mar 2020 18:19:56 +0000 (19:19 +0100)] 
rfb: use more idiomatic Rust code

Using 'if let Some()...' makes the code in these many checks more
concise and readable.

5 years agostream/tcp: fix fast open off by one
Victor Julien [Thu, 19 Mar 2020 20:30:45 +0000 (21:30 +0100)] 
stream/tcp: fix fast open off by one

With data on SYN the sequence number used for the first data
was off by one, leading to the next segments to appear to come
after a one byte gap.

5 years agofuzz: check tcp splitting evasions in protocol detection
Philippe Antoine [Thu, 19 Mar 2020 08:00:29 +0000 (09:00 +0100)] 
fuzz: check tcp splitting evasions in protocol detection

5 years agofuzz: enable AFLFUZZ_PERSISTANT_MODE for libfuzzer targets
Philippe Antoine [Fri, 28 Feb 2020 08:41:52 +0000 (09:41 +0100)] 
fuzz: enable AFLFUZZ_PERSISTANT_MODE for libfuzzer targets

5 years agofuzz: use env variable to restrict app layer
Philippe Antoine [Fri, 21 Feb 2020 10:47:37 +0000 (11:47 +0100)] 
fuzz: use env variable to restrict app layer

5 years agofuzz: adds eight fuzz targets
Philippe Antoine [Mon, 27 May 2019 15:02:22 +0000 (17:02 +0200)] 
fuzz: adds eight fuzz targets

And ways to compile them with enable-fuzztargets at configure time
Adds utility function in util-unittest-helper

5 years agoadd RFB parser 4710/head
Frank Honza [Fri, 7 Feb 2020 12:22:17 +0000 (13:22 +0100)] 
add RFB parser

This commit adds support for the Remote Framebuffer Protocol (RFB) as
used, for example, by various VNC implementations. It targets the
official versions 3.3, 3.7 and 3.8 of the protocol and provides logging
for the RFB handshake communication for now. Logged events include
endpoint versions, details of the security (i.e. authentication)
exchange as well as metadata about the image transfer parameters.
Detection is enabled using keywords for:

 - rfb.name: Session name as sticky buffer
 - rfb.sectype: Security type, e.g. VNC-style challenge-response
 - rfb.secresult: Result of the security exchange, e.g. OK, FAIL, ...

The latter could be used, for example, to detect brute-force attempts
on open VNC servers, while the name could be used to map unwanted VNC
sessions to the desktop owners or machines.

We also ship example EVE-JSON output and keyword docs as part of the
Sphinx source for Suricata's RTD documentation.

5 years agooutput/anomaly: minor code cleanups
Victor Julien [Thu, 19 Mar 2020 14:13:22 +0000 (15:13 +0100)] 
output/anomaly: minor code cleanups