]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
5 years agolog/anomaly: remove leading underscore from static var
Jeff Lucovsky [Sat, 5 Oct 2019 13:57:18 +0000 (09:57 -0400)] 
log/anomaly: remove leading underscore from static var

5 years agodoc/eve.alert: Expand metadata description
Jeff Lucovsky [Sat, 28 Sep 2019 13:02:18 +0000 (09:02 -0400)] 
doc/eve.alert: Expand metadata description

5 years agologging/alert: Warn if metadata not selected
Jeff Lucovsky [Sat, 28 Sep 2019 13:00:24 +0000 (09:00 -0400)] 
logging/alert: Warn if metadata not selected

Warn when HTTP body logging has been selected but applayer/metadata
logging is not configured.

5 years agologging/anomaly: Clarify anomaly logging
Jeff Lucovsky [Sat, 28 Sep 2019 12:59:04 +0000 (08:59 -0400)] 
logging/anomaly: Clarify anomaly logging

Clarify the description of the anomaly logging types.

5 years agologging/alert: Expand alert logging description
Jeff Lucovsky [Sat, 28 Sep 2019 12:57:29 +0000 (08:57 -0400)] 
logging/alert: Expand alert logging description

Clarify the configuration requirements for alerts and http-body logging.

5 years agoftp: Handle malformed RETR/STOR
Jeff Lucovsky [Wed, 9 Oct 2019 00:14:23 +0000 (20:14 -0400)] 
ftp: Handle malformed RETR/STOR

Ensure that RETR (STOR) have a filename -- otherwise, treat the command
string as malformed.

Added unittests for each command and verified that SEGV's occur without
parser change and no longer occur with the parser change.

5 years agoconfigure.ac: fix --disable-geoip
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>
5 years agoconfig: install classification.config (and ref) to $datadir
Jason Ish [Tue, 1 Oct 2019 16:00:29 +0000 (10:00 -0600)] 
config: install classification.config (and ref) to $datadir

Install classification.config and reference.config to $datadir,
where they can be updated on every upgrade.

This required moving them into a sub-directory for autotools
to do its thing.

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

5 years agoRevert "runmode: consider test mode a user mode"
Victor Julien [Tue, 8 Oct 2019 19:48:24 +0000 (21:48 +0200)] 
Revert "runmode: consider test mode a user mode"

This reverts commit 6dca50a322b08bbd6391f091787671305649671a.

The test mode should actually test in system mode by default as
that is what tools like Suricata-Update need before issuing a
reload command.

5 years agodetect/ja3: print error for one rule only
Victor Julien [Mon, 7 Oct 2019 14:02:16 +0000 (16:02 +0200)] 
detect/ja3: print error for one rule only

Use 'silent error' logic for any other rules using ja3 as well.

5 years agodetect/parse: allow signature parsing to fail silently
Victor Julien [Mon, 7 Oct 2019 13:50:09 +0000 (15:50 +0200)] 
detect/parse: allow signature parsing to fail silently

A sigmatches 'Setup' function may indicate it intends to fail
silently after the first error. It will return -2 instead of -1
in this case.

This is tracked in the DetectEngineCtx object, so errors will
be shown again at rule reloads.

5 years agodetect/parser: minor cleanup
Victor Julien [Mon, 7 Oct 2019 11:09:02 +0000 (13:09 +0200)] 
detect/parser: minor cleanup

5 years agotls/ja3: allow 'auto' setting for ja3
Victor Julien [Sun, 6 Oct 2019 10:01:32 +0000 (12:01 +0200)] 
tls/ja3: allow 'auto' setting for ja3

5 years agotls/ja3: try to enable ja3 if rule keywords need it
Victor Julien [Thu, 3 Oct 2019 11:30:53 +0000 (13:30 +0200)] 
tls/ja3: try to enable ja3 if rule keywords need it

5 years agotls/ja3: add way to check active config
Victor Julien [Thu, 3 Oct 2019 11:26:43 +0000 (13:26 +0200)] 
tls/ja3: add way to check active config

5 years agotls/ja3: don't disable; allowing runtime enabling
Victor Julien [Thu, 3 Oct 2019 10:51:08 +0000 (12:51 +0200)] 
tls/ja3: don't disable; allowing runtime enabling

5 years agotls/ja3: allow dynamic enabling of ja3
Victor Julien [Thu, 3 Oct 2019 10:48:00 +0000 (12:48 +0200)] 
tls/ja3: allow dynamic enabling of ja3

5 years agodetect/reference: implement strict parsing option
Victor Julien [Thu, 3 Oct 2019 08:39:06 +0000 (10:39 +0200)] 
detect/reference: implement strict parsing option

5 years agodetect/classtype: implement strict parsing option
Victor Julien [Thu, 3 Oct 2019 08:36:03 +0000 (10:36 +0200)] 
detect/classtype: implement strict parsing option

5 years agodetect/parse: add --strict-rule-keywords option
Victor Julien [Thu, 3 Oct 2019 08:32:42 +0000 (10:32 +0200)] 
detect/parse: add --strict-rule-keywords option

Add --strict-rule-keywords commandline option to enable strict rule
parsing.

It can be used without options or with a comma separated list:
--strict-rule-keywords
--strict-rule-keywords=all
--strict-rule-keywords=classtype,reference

Parsing implementations can use SigMatchStrictEnabled to check
if strict parsing is enabled for them and act accordingly.

5 years agodetect: use named enum for keyword types
Victor Julien [Thu, 3 Oct 2019 08:17:20 +0000 (10:17 +0200)] 
detect: use named enum for keyword types

5 years agodetect/reference: allow undefined references
Victor Julien [Wed, 2 Oct 2019 19:47:29 +0000 (21:47 +0200)] 
detect/reference: allow undefined references

References are currently not used in Suricata, so erroring out on
rules using a undefined reference is too harsh.

Just issue a warning once per unique missing reference.

5 years agoreference: change scope of add func to global
Victor Julien [Wed, 2 Oct 2019 19:29:32 +0000 (21:29 +0200)] 
reference: change scope of add func to global

5 years agoreference: use global defines for size limits
Victor Julien [Wed, 2 Oct 2019 13:01:29 +0000 (15:01 +0200)] 
reference: use global defines for size limits

5 years agodetect/reference: code cleanups
Victor Julien [Wed, 2 Oct 2019 12:52:36 +0000 (14:52 +0200)] 
detect/reference: code cleanups

5 years agodetect/classtype: check size of rule input
Victor Julien [Wed, 2 Oct 2019 08:30:48 +0000 (10:30 +0200)] 
detect/classtype: check size of rule input

5 years agoclasstype: handle missing classification.config
Victor Julien [Tue, 1 Oct 2019 18:19:20 +0000 (20:19 +0200)] 
classtype: handle missing classification.config

Still initialize the classtype hash table so that the classtypes
rules use can be added to it.

The file missing now reports a warning instead of error, as we
will continue to work.

5 years agoclasstype: use global defines for size limits
Victor Julien [Wed, 2 Oct 2019 08:30:28 +0000 (10:30 +0200)] 
classtype: use global defines for size limits

5 years agodetect/classtype: show file and line for unknown classtype
Victor Julien [Tue, 1 Oct 2019 13:20:55 +0000 (15:20 +0200)] 
detect/classtype: show file and line for unknown classtype

5 years agodetect/priority: use global define for default prio
Victor Julien [Tue, 1 Oct 2019 12:05:08 +0000 (14:05 +0200)] 
detect/priority: use global define for default prio

5 years agodetect/classtype: allow undefined classtypes
Victor Julien [Tue, 1 Oct 2019 11:22:01 +0000 (13:22 +0200)] 
detect/classtype: allow undefined classtypes

Effect of classification on Suricata's working is minimal. Impact
of adding undefined classtypes is large: rules will fail to load
completely. This also leads multiple lines of log output per rule,
which in a large ruleset can lead to excessive output.

This patch changes the classtype keyword behavior. Instead of erroring
and invalidating a rule, we will merely warn.

The undefined classtype is then defined with a default priority,
so other rules using the classtype will not also warn. This way
there will be just a single warning per missing classtype.

5 years agoclasstype: increase id size
Victor Julien [Tue, 1 Oct 2019 10:50:13 +0000 (12:50 +0200)] 
classtype: increase id size

Switch from u8 to u16 to allow for more classtypes.

Rename Signature::class to Signature::class_id to make it clear
it is an id.

5 years agoclasstype: small memory reduction
Victor Julien [Tue, 1 Oct 2019 10:07:05 +0000 (12:07 +0200)] 
classtype: small memory reduction

Reduce memory use by making sure SCClassConfClasstype
has a more optimal memory layout.

5 years agoclasstype: put UNITTESTS guards where appropriate
Victor Julien [Tue, 1 Oct 2019 10:02:47 +0000 (12:02 +0200)] 
classtype: put UNITTESTS guards where appropriate

5 years agoclasstype: reduce scope of functions
Victor Julien [Tue, 1 Oct 2019 09:59:58 +0000 (11:59 +0200)] 
classtype: reduce scope of functions

5 years agodetect/classtype: change duplicate classtype behavior
Victor Julien [Tue, 1 Oct 2019 09:33:25 +0000 (11:33 +0200)] 
detect/classtype: change duplicate classtype behavior

Detect duplicate instances and use the one with the highest
priority.

Use new priority flag to make the logic around explicit priority
sets easier to follow.

Minor code cleanups. Also clean up unittests.

5 years agodetect/priority: change duplicate priority behavior
Victor Julien [Tue, 1 Oct 2019 08:55:37 +0000 (10:55 +0200)] 
detect/priority: change duplicate priority behavior

Introduce Signature init_flag to indicate priority has been set.
This will be needed in a follow-up classtype update.

Detect duplicate priority instances in a keyword, and use the
highest priority in the rule. Do issue a warning in this case.

5 years agodetect: use BIT_U32 macros for INIT flags
Victor Julien [Tue, 1 Oct 2019 08:37:51 +0000 (10:37 +0200)] 
detect: use BIT_U32 macros for INIT flags

5 years agodetect/priority: minor cleanups
Victor Julien [Tue, 1 Oct 2019 08:32:22 +0000 (10:32 +0200)] 
detect/priority: minor cleanups

5 years agodetect/classtype: clean up error handling
Victor Julien [Tue, 1 Oct 2019 08:25:11 +0000 (10:25 +0200)] 
detect/classtype: clean up error handling

5 years agodetect/classtype: warn on duplicate classtype
Victor Julien [Tue, 1 Oct 2019 08:23:17 +0000 (10:23 +0200)] 
detect/classtype: warn on duplicate classtype

Issue warning instead of erroring and invalidating the rule.

It's not a very serious issue, so don't error out.

5 years agodetect/classtype: fix parsing error checking
Victor Julien [Tue, 1 Oct 2019 08:19:53 +0000 (10:19 +0200)] 
detect/classtype: fix parsing error checking

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

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 agoafp: nicer error message in case of fanout failure 4280/head
Shivani Bhardwaj [Mon, 7 Oct 2019 18:32:40 +0000 (00:02 +0530)] 
afp: nicer error message in case of fanout failure

Use clearer message in case fanout is not supported or cluster_id is
already in use.

Closes redmine ticket #1940.

5 years agosuricata: Check if default log dir is writable
Shivani Bhardwaj [Mon, 7 Oct 2019 18:30:07 +0000 (00:00 +0530)] 
suricata: Check if default log dir is writable

At the startup, if the default log dir provided either by command line
options or suricat.yaml is not writable, the error comes quite later.
This patch makes suricata exit if there is such an error in the
beginning itself.

Closes redmine ticket #2386.

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 agodoc/datasets: update example config to map
Victor Julien [Sat, 5 Oct 2019 08:52:30 +0000 (10:52 +0200)] 
doc/datasets: update example config to map

5 years agorunmode: consider test mode a user mode 4275/head
Victor Julien [Fri, 4 Oct 2019 13:55:52 +0000 (15:55 +0200)] 
runmode: consider test mode a user mode

5 years agodatasets: fix error handling
Victor Julien [Fri, 4 Oct 2019 13:48:23 +0000 (15:48 +0200)] 
datasets: fix error handling

5 years agodatasets: improve and doc return codes
Victor Julien [Fri, 4 Oct 2019 08:03:33 +0000 (10:03 +0200)] 
datasets: improve and doc return codes

5 years agodataset: fix return value check on isnotset
Jason Ish [Thu, 3 Oct 2019 21:54:51 +0000 (15:54 -0600)] 
dataset: fix return value check on isnotset

The dataset api returns -1 for not found.

5 years agothash: fix prealloc config setting
Victor Julien [Thu, 3 Oct 2019 15:12:00 +0000 (17:12 +0200)] 
thash: fix prealloc config setting

5 years agodatasets: fix hash table config
Victor Julien [Thu, 3 Oct 2019 15:08:36 +0000 (17:08 +0200)] 
datasets: fix hash table config

Example:

datasets:
  ua-seen:
    type: string
    state: ua-seen.lst
    hash:
      hash-size: 100000
      prealloc: 1000
      memcap: 256mb

5 years agodatasets: change config to map
Victor Julien [Thu, 3 Oct 2019 14:40:45 +0000 (16:40 +0200)] 
datasets: change config to map

Example:

datasets:
  ua-seen:
    type: string
    state: ua-seen.lst
  dns-sha256-seen:
    type: sha256
    state: dns-sha256-seen.lst

5 years agolua: fix lua int size detection 4273/head
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 agomagic/test: remove NULL as format string 4271/head
Jason Ish [Fri, 27 Sep 2019 22:28:54 +0000 (16:28 -0600)] 
magic/test: remove NULL as format string

Remove passing NULL as a format string parameter
in test. Convert to FAIL_IF_NULL.

5 years agoconfigure: remove unused LUA_PC_NAME.
Jason Ish [Fri, 27 Sep 2019 22:06:06 +0000 (16:06 -0600)] 
configure: remove unused LUA_PC_NAME.

This variable is no longer used. Instead multiple
lua pkg-config names are checked.

5 years agoconfig: update lzma size notes to match others
jason taylor [Mon, 30 Sep 2019 18:44:50 +0000 (14:44 -0400)] 
config: update lzma size notes to match others

Signed-off-by: jason taylor <jtfas90@gmail.com>
5 years agodoc: reformat linux ips guide
Victor Julien [Thu, 3 Oct 2019 14:01:15 +0000 (16:01 +0200)] 
doc: reformat linux ips guide

5 years agodoc: add nftables IPS configuration
Eric Leblond [Sun, 29 Sep 2019 08:46:17 +0000 (10:46 +0200)] 
doc: add nftables IPS configuration

5 years agodoc: information about scaling AF_PACKET IPS mode
Eric Leblond [Sun, 29 Sep 2019 08:17:04 +0000 (10:17 +0200)] 
doc: information about scaling AF_PACKET IPS mode

5 years agodoc: add info about AF_PACKET IPS
Eric Leblond [Sat, 28 Sep 2019 20:06:50 +0000 (22:06 +0200)] 
doc: add info about AF_PACKET IPS

Based on https://home.regit.org/2012/09/new-af_packet-ips-mode-in-suricata/

Also fix some typo in Netfilter setup.

5 years agodoc: mark independent json loggers as deprecated
Jason Ish [Tue, 1 Oct 2019 15:30:21 +0000 (09:30 -0600)] 
doc: mark independent json loggers as deprecated

This is the loggers such as alert-json-log, dns-json-log, etc.
They are not even referenced in the default configuration file,
and are easily replaced with multiple eve instances.

5 years agodrop.log: log deprecation warning if used
Jason Ish [Tue, 1 Oct 2019 15:13:22 +0000 (09:13 -0600)] 
drop.log: log deprecation warning if used

5 years agosuricata.yaml: mark drop.log as deprecated
Jason Ish [Tue, 1 Oct 2019 15:10:23 +0000 (09:10 -0600)] 
suricata.yaml: mark drop.log as deprecated

5 years agodoc/drop.log: mark as deprecated and scheduled to be removed
Jason Ish [Tue, 1 Oct 2019 15:09:10 +0000 (09:09 -0600)] 
doc/drop.log: mark as deprecated and scheduled to be removed

Also make sure options are in sync with those in
suricata.yaml.

5 years agosuricata.yaml: mark unified2 as deprecated
Jason Ish [Mon, 30 Sep 2019 17:35:24 +0000 (11:35 -0600)] 
suricata.yaml: mark unified2 as deprecated

5 years agodoc/unified2: add deprecation/removal notice
Jason Ish [Mon, 30 Sep 2019 17:35:05 +0000 (11:35 -0600)] 
doc/unified2: add deprecation/removal notice

5 years agounified2: log deprecation warning when used
Jason Ish [Mon, 30 Sep 2019 17:31:17 +0000 (11:31 -0600)] 
unified2: log deprecation warning when used

5 years agoconfig: remove all but a stub of file-store v1.
Jason Ish [Mon, 30 Sep 2019 17:22:43 +0000 (11:22 -0600)] 
config: remove all but a stub of file-store v1.

Remove most of the file-store v1 configuration section and mark
it as deprecated. Provide a link where to find the available
options.

5 years agofilestore(v1): deprecation log warning when enabled
Jason Ish [Mon, 30 Sep 2019 17:16:59 +0000 (11:16 -0600)] 
filestore(v1): deprecation log warning when enabled

Notify the user with a warning log that this feature is
deprecated and will be remove in v6 of Suricata.

5 years agodoc/filestore(v1) - make deprecation text a note
Jason Ish [Mon, 30 Sep 2019 17:16:11 +0000 (11:16 -0600)] 
doc/filestore(v1) - make deprecation text a note

Highlights that is is deprecated in the HTML output.

5 years agodoc/filestore(v1) - document force-filestore field
Jason Ish [Mon, 30 Sep 2019 17:13:53 +0000 (11:13 -0600)] 
doc/filestore(v1) - document force-filestore field

5 years agodoc/anomaly Remove event_no
Jeff Lucovsky [Thu, 3 Oct 2019 03:49:36 +0000 (20:49 -0700)] 
doc/anomaly Remove event_no

5 years agolog/anomaly: Remove event_no from alert
Jeff Lucovsky [Thu, 3 Oct 2019 03:49:15 +0000 (20:49 -0700)] 
log/anomaly: Remove event_no from alert

5 years agostream: remove fix stream.depth references
Victor Julien [Thu, 3 Oct 2019 13:37:37 +0000 (15:37 +0200)] 
stream: remove fix stream.depth references

5 years agodoc: Update tuning considerations doc 4264/head
Peter Manev [Thu, 3 Oct 2019 09:15:27 +0000 (11:15 +0200)] 
doc: Update tuning considerations doc

5 years agodoc: Update high performance config doc
Peter Manev [Thu, 3 Oct 2019 09:14:58 +0000 (11:14 +0200)] 
doc: Update high performance config doc

5 years agoenip: fix compile warnings in gcc-8 4252/head
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 agoeve/stats: update warning for new default behavior
Victor Julien [Sat, 28 Sep 2019 08:12:49 +0000 (10:12 +0200)] 
eve/stats: update warning for new default behavior

5 years agodoc/stats: minor clarrifications on 5.0 defaults
Victor Julien [Sat, 28 Sep 2019 08:10:13 +0000 (10:10 +0200)] 
doc/stats: minor clarrifications on 5.0 defaults

5 years agocounters: improve handling missing global config
Victor Julien [Sat, 28 Sep 2019 08:05:02 +0000 (10:05 +0200)] 
counters: improve handling missing global config

Improve warnings when eve.stats can't work because of the global config
missing or disabled.

Issue warning if global config is missing but stats are still enabled due
to the legacy stats.log.

Issue clearer warning when stats are disabled and unix socket dump-counters
command is issued.

Warnings include links to docs.

Bug #2465.

5 years agostats: add global way to check if API is enabled
Victor Julien [Sat, 28 Sep 2019 06:16:45 +0000 (08:16 +0200)] 
stats: add global way to check if API is enabled

5 years agoebpf: make sure 'make dist' include eBPF files
Eric Leblond [Thu, 26 Sep 2019 09:16:07 +0000 (11:16 +0200)] 
ebpf: make sure 'make dist' include eBPF files

5 years agoposix: replace bzero with memset
Victor Julien [Wed, 25 Sep 2019 20:37:43 +0000 (22:37 +0200)] 
posix: replace bzero with memset

bzero(3): The bzero() function is deprecated (marked as LEGACY in
POSIX.1-2001); use memset(3) in new programs.  POSIX.1-2008 removes
the specification of bzero().

Use memset instead.

5 years agoposix: remove deprecated index/rindex calls
Victor Julien [Wed, 25 Sep 2019 20:23:51 +0000 (22:23 +0200)] 
posix: remove deprecated index/rindex calls

Replace index by strchr and rindex by strrchr.

index(3) states "POSIX.1-2008 removes the specifications of index() and
rindex(), recommending strchr(3) and strrchr(3) instead."

Add index/rindex to banned function check so they don't get reintroduced.

Bug #1443.

5 years agodetect/port: more cleanups
Victor Julien [Wed, 25 Sep 2019 08:28:15 +0000 (10:28 +0200)] 
detect/port: more cleanups

Remove unused funcs. Minor style updates.

5 years agodetect/port: remove function only used in tests
Victor Julien [Tue, 24 Sep 2019 09:30:38 +0000 (11:30 +0200)] 
detect/port: remove function only used in tests

5 years agodetect/port: unittest cleanups
Victor Julien [Tue, 24 Sep 2019 05:06:41 +0000 (07:06 +0200)] 
detect/port: unittest cleanups

5 years agochangelog: update for 5.0.0-rc1 release suricata-5.0.0-rc1
Victor Julien [Mon, 23 Sep 2019 13:59:19 +0000 (15:59 +0200)] 
changelog: update for 5.0.0-rc1 release

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 #3185.

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 #3176.

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 #3169.

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 #3171.

5 years agossl: minor cleanups 4236/head
Victor Julien [Fri, 6 Sep 2019 13:02:05 +0000 (15:02 +0200)] 
ssl: minor cleanups