]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
5 years agobuild: allows use of env variable CARGO_BUILD_TARGET 4986/head
Philippe Antoine [Thu, 28 May 2020 11:59:38 +0000 (13:59 +0200)] 
build: allows use of env variable CARGO_BUILD_TARGET

needed by oss-fuzz

5 years agowindows: fix timestring timezone display 4976/head
Victor Julien [Sat, 23 May 2020 18:57:21 +0000 (20:57 +0200)] 
windows: fix timestring timezone display

Bug: #3690

5 years agodetect/pcre: Use the keyword context for JIT stack
Jeff Lucovsky [Wed, 6 May 2020 12:10:44 +0000 (08:10 -0400)] 
detect/pcre: Use the keyword context for JIT stack

When PCRE `jit` is available, store the JIT stack in the keyword context
instead of on a global id. This ensures proper cleanup and
re-initialization over a rule reload.

5 years agoprofiling: c11 atomics fixup
Victor Julien [Mon, 11 May 2020 09:26:19 +0000 (11:26 +0200)] 
profiling: c11 atomics fixup

5 years agogithub actions: extract repo/branch names from PR message
Jason Ish [Tue, 28 Apr 2020 16:29:17 +0000 (10:29 -0600)] 
github actions: extract repo/branch names from PR message

Create a "prep" build that parses libhtp, suricata-update and
suricata-verify repo and branch information from the pull
request message and turn these into artifacts that are
used by the builders

Examples:

libhtp-repo: https://github.com/OISF/libhtp
libhtp-branch: 0.5.x

suricata-verify-repo: http://github.com/OISF/suricata-verify
suricata-verify-branch: master

suricata-update-repo: http://github.com/OISF/suricata-update
suricata-update-branch: master

Other changes:
- checkout@v2 (faster)
- working directory cleanup

5 years agodoc: document file-store v1 to v2 configuration changes
Jason Ish [Fri, 15 May 2020 17:28:49 +0000 (11:28 -0600)] 
doc: document file-store v1 to v2 configuration changes

5 years agosuricata.yaml: remove filestore v1 configuration
Jason Ish [Fri, 15 May 2020 17:28:26 +0000 (11:28 -0600)] 
suricata.yaml: remove filestore v1 configuration

5 years agofilestore v1: remove
Jason Ish [Wed, 6 May 2020 16:49:01 +0000 (10:49 -0600)] 
filestore v1: remove

File store v1 has been deprecated and was scheduled for removal
by June 2020.

Log an error if a file-store configuration is loaded without
version set to 2.

5 years agorules: add SSH decoder events rules 4971/head
Philippe Antoine [Thu, 5 Mar 2020 14:10:46 +0000 (15:10 +0100)] 
rules: add SSH decoder events rules

5 years agoparse: move SSH parser from C to Rust
Philippe Antoine [Thu, 5 Mar 2020 14:11:00 +0000 (15:11 +0100)] 
parse: move SSH parser from C to Rust

5 years agostyle: compressed function headers for rustfmt
Philippe Antoine [Wed, 8 Apr 2020 09:43:33 +0000 (11:43 +0200)] 
style: compressed function headers for rustfmt

5 years agorust: export enums definition to C
Philippe Antoine [Thu, 5 Mar 2020 14:10:06 +0000 (15:10 +0100)] 
rust: export enums definition to C

5 years agosmb: Import constants from DCERPC 4958/head
Shivani Bhardwaj [Tue, 21 Apr 2020 08:20:10 +0000 (13:50 +0530)] 
smb: Import constants from DCERPC

Remove DCERPC constants to avoid duplicate name errors. Import the
required constants from DCERPC implementation.

5 years agodcerpc: Replace C function calls with Rust
Shivani Bhardwaj [Tue, 21 Apr 2020 09:06:06 +0000 (14:36 +0530)] 
dcerpc: Replace C function calls with Rust

All the dead code in C after the Rust implementation is hereby removed.
Invalid/migrated tests have also been deleted.
All the function calls in C have been replaced with appropriate calls to
Rust functions. Same has been done for smb/detect.rs as a part of this
migration.

5 years agorust: Add DCERPC parser
Shivani Bhardwaj [Tue, 21 Apr 2020 08:55:43 +0000 (14:25 +0530)] 
rust: Add DCERPC parser

This parser rewrites the DCE/RPC protocol implementation of Suricata
in Rust. More tests have been added to improve the coverage and some
fixes have been made to the tests already written in C. Most of the
valid tests from C have been imported to Rust.

File anatomy

src/dcerpc.rs
This file contains the implementation of single transactions in DCE/RPC
over TCP. It takes care of REQUEST, RESPONSE, BIND and BINDACK business
logic before and after the data parsing. DCERPCState holds the state
corresponding to a particular transaction and handles all important
aspects. It also defines any common structures and constants required
for DCE/RPC parsing irrespective of the carrier protocol.

src/dcerpc_udp.rs
This file contains the implementation of single transactions in DCE/RPC
over UDP. It takes care of REQUEST and RESPONSE parsing. It borrows the
Request and Response structs from src/dcerpc.rs.

src/detect.rs
This file contains the implementation of dce_iface and opnum detect
keywords. Both the parsing and the matching is taken care of by
functions in this file. Tests have been rewritten with the test data
from C.

src/parser.rs
This file contains all the nom parsers written for DCERPCRequest,
DCERPCResponse, DCERPCBind, DCERPCBindAck, DCERPCHeader, DCERPCHdrUdp.
It also implements functions to assemble and convert UUIDs. All the
fields have their endianness defined unless its an 8bit field or an
unusable one, then it's little endian but it won't make any difference.

src/mod.rs
This file contains all the modules of dcerpc folder which should be
taken into account during compilation.

Function calls

This is a State-wise implementation of the protocol for single
transaction only i.e. a valid state object is required to parse any
record. Function calls start with the app layer parser in C which
detects the application layer protocol to be DCE/RPC and calls the
appropriate functions in C which in turn make a call to these functions
in Rust using FFI. All the necessary information is passed from C to the
parsers and handlers in Rust.

Implementation

When a batch of input comes in, there is an analysis of whether the
input header and the direction is appropriate. Next check is about the
size of fragment. If it is as defined by the header, process goes
through else the data is buffered and more data is awaited. After this,
type of record as indicated by the header is checked. A call to the
appropriate handler is made. After the handling, State is updated with
the latest information about whatever record came in.
AppLayerResult::ok() is returned in case all went well else
AppLayerResult::err() is returned indicating something went wrong.

5 years agorust: Add debug_validate_bug_on macro
Shivani Bhardwaj [Wed, 6 May 2020 18:00:53 +0000 (23:30 +0530)] 
rust: Add debug_validate_bug_on macro

This macro allows to check if certain parts of the code are reachable
during fuzzing.

5 years agorust: Add new crate uuid
Shivani Bhardwaj [Tue, 21 Apr 2020 08:02:26 +0000 (13:32 +0530)] 
rust: Add new crate uuid

5 years agorust: Add Debug and PartialEq to AppLayerResult
Shivani Bhardwaj [Tue, 21 Apr 2020 07:54:25 +0000 (13:24 +0530)] 
rust: Add Debug and PartialEq to AppLayerResult

5 years agofuzz: do not reuse global variable named suricata 4945/head
Philippe Antoine [Sat, 16 May 2020 12:30:13 +0000 (14:30 +0200)] 
fuzz: do not reuse global variable named suricata

5 years agofuzz: improves sigpcap target 4939/head
Philippe Antoine [Mon, 11 May 2020 12:06:10 +0000 (14:06 +0200)] 
fuzz: improves sigpcap target

So that it can cover alert generation
ie in function DetectRun, get past scratch.sgh == NULL condition

5 years agodoc/devguide: create basic layout 4904/head
Victor Julien [Thu, 30 Apr 2020 12:23:24 +0000 (14:23 +0200)] 
doc/devguide: create basic layout

Issue: #3343

5 years agotravis-ci: pin cbindgen to 0.14.1 4903/head
Jason Ish [Fri, 1 May 2020 05:26:32 +0000 (23:26 -0600)] 
travis-ci: pin cbindgen to 0.14.1

0.14.2 breaks builds with Rust 1.34.0, which we still support.

Also build cbdingen in debug mode. It builds much faster
with minimal runtime performance.

5 years agogithub ci: pin cbindgen to 0.14.1
Jason Ish [Fri, 1 May 2020 05:11:45 +0000 (23:11 -0600)] 
github ci: pin cbindgen to 0.14.1

0.14.2 breaks builds with Rust 1.34.0, which we still support.

Also build cbdingen in debug mode. It builds much faster
with minimal runtime performance.

5 years agoappveyor: pin cbindgen to 0.14.1
Jason Ish [Fri, 1 May 2020 05:10:39 +0000 (23:10 -0600)] 
appveyor: pin cbindgen to 0.14.1

0.14.2 breaks builds with Rust 1.34.0, which we still support.

Also build cbdingen in debug mode. It builds much faster
with minimal runtime performance.

5 years agonapatech: Fix parameters passed to thread-check 4899/head
Jeff Lucovsky [Tue, 28 Apr 2020 12:50:29 +0000 (08:50 -0400)] 
napatech: Fix parameters passed to thread-check

This commit corrects an error introduced earlier: the call to
`TmThreadsCaptureHandleTimeout` is passing too many parameters.

5 years agodag: Fix parameters passed to thread-check
Jeff Lucovsky [Tue, 28 Apr 2020 12:48:26 +0000 (08:48 -0400)] 
dag: Fix parameters passed to thread-check

This commit corrects an error introduced earlier: the call to
`TmThreadsCaptureHandleTimeout` is passing too many parameters.

5 years agofuzz/sigpcap: enable protocols, add more outputs
Victor Julien [Wed, 29 Apr 2020 18:49:52 +0000 (20:49 +0200)] 
fuzz/sigpcap: enable protocols, add more outputs

5 years agohtp: fix test after libhtp changes
Victor Julien [Mon, 27 Apr 2020 07:34:16 +0000 (09:34 +0200)] 
htp: fix test after libhtp changes

5 years agodetect/smtp: Refactor command check
Jeff Lucovsky [Fri, 17 Apr 2020 18:01:36 +0000 (14:01 -0400)] 
detect/smtp: Refactor command check

This commit refactors the code that matches reply with command.

Bug: #3677

5 years agoapp-layer/smtp: Improve RSET handling
Jeff Lucovsky [Thu, 16 Apr 2020 14:44:53 +0000 (10:44 -0400)] 
app-layer/smtp: Improve RSET handling

This commit improves how the parser handles the `RSET` command.
Termination of the transaction occurs when the `RSET` ack is seen (reply
code 250).

Bug: #3677

5 years agoenip: more precise probing parser
Philippe Antoine [Mon, 6 Apr 2020 15:22:33 +0000 (17:22 +0200)] 
enip: more precise probing parser

Bug: #3615

5 years agodetect/port: limit recursion in port parsing
Victor Julien [Tue, 14 Apr 2020 09:00:39 +0000 (11:00 +0200)] 
detect/port: limit recursion in port parsing

Bug: #3586

5 years agodetect/address: limit recursion during parsing
Victor Julien [Tue, 14 Apr 2020 06:01:49 +0000 (08:01 +0200)] 
detect/address: limit recursion during parsing

Allow a max depth of 64.

Bug: #3586

5 years agodetect/address: minor cleanups
Victor Julien [Tue, 14 Apr 2020 06:01:37 +0000 (08:01 +0200)] 
detect/address: minor cleanups

5 years agodecode: cleanup packet properly on bad packets
Victor Julien [Sun, 5 Apr 2020 12:35:29 +0000 (14:35 +0200)] 
decode: cleanup packet properly on bad packets

In case of bad IPv4, TCP or UDP, the per packet ip4vars/tcpvars/udpvar
structures would not be cleaned up because the cleanup depends on the
'header' pointer being set, but the error handling would unset that.

This could mean these structures were already filled with values before
the error was detected. As packets were recycled, the next packet decoding
would use this unclean structure.

To make things worse these structures are part of unions. IPv4/IPv6 and
TCP/ICMPv4/ICMPv6 share the same memory location.

LibFuzzer+UBSAN found this both locally and in Oss-Fuzz:

decode-ipv6.c:654:9: runtime error: load of value 6, which is not a valid value for type 'bool'
    #0 0x6146f0 in DecodeIPV6 /src/suricata/src/decode-ipv6.c:654:9
    #1 0x617e96 in DecodeNull /src/suricata/src/decode-null.c:70:13
    #2 0x9dd8a4 in DecodePcapFile /src/suricata/src/source-pcap-file.c:412:9
    #3 0x4c8ed2 in LLVMFuzzerTestOneInput /src/suricata/src/tests/fuzz/fuzz_sigpcap.c:158:25
    #4 0x457e51 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:556:15
    #5 0x457575 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:470:3
    #6 0x459917 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:698:19
    #7 0x45a6a5 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:830:5
    #8 0x448728 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:824:6
    #9 0x472552 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:19:10
    #10 0x7ff0d097b82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #11 0x41bde8 in _start (/out/fuzz_sigpcap+0x41bde8)

Bug: #3496

5 years agossl: support multi-frag certificate assembly
Victor Julien [Mon, 20 Apr 2020 05:06:31 +0000 (07:06 +0200)] 
ssl: support multi-frag certificate assembly

Support reassembling multi-frag certificates. For this the cert queuing
code is changed to queue just the cert, not entire tls record.

Improve message tracking. Better track where a message starts and ends
before passing data around.

Add wrapper macros to check for 'impossible' conditions that are activate
in debug validation mode. This helps fuzzers find input that might trigger
these conditions, if they exist.

5 years agossl: add asserts for 'impossible' conditions
Victor Julien [Thu, 16 Apr 2020 05:44:40 +0000 (07:44 +0200)] 
ssl: add asserts for 'impossible' conditions

Wrap in debug validation so that fuzzing can pick them up.

5 years agotls/sni: parsing cleanup
Victor Julien [Fri, 3 Apr 2020 15:15:20 +0000 (17:15 +0200)] 
tls/sni: parsing cleanup

Set proper event on all invalid sni length values.

5 years agossl: improve error checking
Victor Julien [Fri, 3 Apr 2020 13:34:41 +0000 (15:34 +0200)] 
ssl: improve error checking

5 years agossl: unify main parsing routine
Victor Julien [Wed, 1 Apr 2020 18:59:02 +0000 (20:59 +0200)] 
ssl: unify main parsing routine

5 years agossl: improve debug output
Victor Julien [Wed, 1 Apr 2020 18:58:26 +0000 (20:58 +0200)] 
ssl: improve debug output

5 years agossl: record parsing cleanup
Victor Julien [Wed, 1 Apr 2020 12:58:37 +0000 (14:58 +0200)] 
ssl: record parsing cleanup

5 years agossl: handshake parsing code cleanup
Victor Julien [Fri, 21 Feb 2020 21:52:24 +0000 (22:52 +0100)] 
ssl: handshake parsing code cleanup

5 years agossl: copy data using a safe memcpy wrapper
Victor Julien [Fri, 3 Apr 2020 14:31:00 +0000 (16:31 +0200)] 
ssl: copy data using a safe memcpy wrapper

To avoid future memcpy issues introduce a wrapper and check the
result of it.

When compiled with --enable-debug-validation the wrapper will abort if
the input is wrong.

5 years agossl: don't say we consumed bytes if we didn't consume them
Victor Julien [Fri, 21 Feb 2020 19:07:19 +0000 (20:07 +0100)] 
ssl: don't say we consumed bytes if we didn't consume them

5 years agossl: code cleanups
Victor Julien [Fri, 21 Feb 2020 18:26:42 +0000 (19:26 +0100)] 
ssl: code cleanups

5 years agossl: bump copyright year
Victor Julien [Tue, 21 Apr 2020 06:37:21 +0000 (08:37 +0200)] 
ssl: bump copyright year

5 years agossl: improve 'first cert' check to avoid leaks
Victor Julien [Sun, 19 Apr 2020 09:56:58 +0000 (11:56 +0200)] 
ssl: improve 'first cert' check to avoid leaks

In some error conditions, or potentially in case of multiple 'certificate'
records, the extracted subject, issuerdn and serial could be overwritten
without freeing the original memory.

5 years agossl: fix handshake cert buffer sizing
Victor Julien [Fri, 3 Apr 2020 15:03:47 +0000 (17:03 +0200)] 
ssl: fix handshake cert buffer sizing

'trec' buffer was not grown properly when it was checked as too small.
After this it wasn't checked again so that copying into the buffer could
overflow it.

5 years agodetect/keywords: dynamic version part of doc URL 4895/head
Victor Julien [Tue, 28 Apr 2020 07:56:44 +0000 (09:56 +0200)] 
detect/keywords: dynamic version part of doc URL

5 years agologging: fix default log format for release mode
Victor Julien [Tue, 28 Apr 2020 07:25:43 +0000 (09:25 +0200)] 
logging: fix default log format for release mode

5 years agodatasets: reputation value validation 4888/head
Victor Julien [Mon, 27 Apr 2020 06:17:51 +0000 (08:17 +0200)] 
datasets: reputation value validation

5 years agodetect: refactoring parsing of ip range 4886/head
Philippe Antoine [Sat, 25 Apr 2020 09:38:53 +0000 (11:38 +0200)] 
detect: refactoring parsing of ip range

To optimize first netmask

5 years agosignature: minimizes ip CIDR for ip range
Philippe Antoine [Wed, 22 Apr 2020 07:54:49 +0000 (09:54 +0200)] 
signature: minimizes ip CIDR for ip range

Example leading to over allocation is 41.232.107.2-43.252.37.6

5 years agodecode/erspan: Warn on ERSPAN Type I config 4882/head
Jeff Lucovsky [Thu, 23 Apr 2020 14:07:18 +0000 (10:07 -0400)] 
decode/erspan: Warn on ERSPAN Type I config

This commit checks whether pre-6.x settings for ERSPAN Type I are
present. ERSPAN Type I is no longer enabled/disabled through a
configuration setting -- it's always enabled.

When a setting exists to enable/disable ERSPAN Type I decoding, a
warning message is logged.

Enabling/disabling ERSPAN Type I decode has been deprecated in 6.x

5 years agodecode/erspan: Add warning ERSPAN Type I config
Jeff Lucovsky [Thu, 23 Apr 2020 14:05:05 +0000 (10:05 -0400)] 
decode/erspan: Add warning ERSPAN Type I config

This commit adds a warning value when ERSPAN Type I configuration
settings are detected; specifically, when ERSPAN Type I `enabled` is
specified.

Enabling/disabling ERSPAN Type I decode has been deprecated in 6.x

5 years agodoc: typo: http.server_body should be http.response_body
Jason Ish [Fri, 24 Apr 2020 15:55:13 +0000 (09:55 -0600)] 
doc: typo: http.server_body should be http.response_body

Thanks to Jason Williams for pointing this out.

5 years agoflowbits: fix hang in flowbits 'or' parsing
Victor Julien [Sat, 25 Apr 2020 12:25:29 +0000 (14:25 +0200)] 
flowbits: fix hang in flowbits 'or' parsing

5 years agofuzz: suppress too noisy htp errors check 4878/head
Victor Julien [Sat, 25 Apr 2020 05:48:25 +0000 (07:48 +0200)] 
fuzz: suppress too noisy htp errors check

5 years agonapatech: Correct timestamp rounding issue
Jeff Lucovsky [Fri, 24 Apr 2020 14:28:54 +0000 (10:28 -0400)] 
napatech: Correct timestamp rounding issue

This commit fixes the conversion of timestamps. Without the extra
parens, the resulting timestamp value for usecs will be 1 or 0 due to
the operator precedence order (+ takes precedence over ?:)

5 years agonapatech: Check for out-of-band control operations
Jeff Lucovsky [Fri, 24 Apr 2020 14:28:32 +0000 (10:28 -0400)] 
napatech: Check for out-of-band control operations

This commit causes the packet source to check for out of band control
operations when there are no packets immediately available.

5 years agodag: Check for out-of-band control operations
Jeff Lucovsky [Fri, 24 Apr 2020 14:27:20 +0000 (10:27 -0400)] 
dag: Check for out-of-band control operations

This commit causes the packet source to check for out of band control
operations when there are no packets immediately available.

5 years agonapatech: Restructure Packet/Hostbuffer release
Phil Young [Fri, 24 Apr 2020 21:43:32 +0000 (17:43 -0400)] 
napatech: Restructure Packet/Hostbuffer release

The end-of-processing has been restructured so that Packet and Hostbuffer
data structures are now released within the NapatechReleasePacket() callback
function.

5 years agoaf-packet: change type of cluster_id to uint16_t
Shivani Bhardwaj [Sat, 21 Dec 2019 07:40:25 +0000 (13:10 +0530)] 
af-packet: change type of cluster_id to uint16_t

5 years agosrc: remove multiple uses of atoi
Shivani Bhardwaj [Sat, 21 Dec 2019 07:36:01 +0000 (13:06 +0530)] 
src: remove multiple uses of atoi

atoi() and related functions lack a mechanism for reporting errors for
invalid values. Replace them with calls to the appropriate
ByteExtractString* functions.

Partially closes redmine ticket #3053.

5 years agoAdd wrappers for validating range checks
Shivani Bhardwaj [Tue, 21 Apr 2020 20:52:46 +0000 (02:22 +0530)] 
Add wrappers for validating range checks

5 years agofastlog: copyright year bump and remove stale comments 4864/head
Victor Julien [Fri, 24 Apr 2020 08:28:06 +0000 (10:28 +0200)] 
fastlog: copyright year bump and remove stale comments

5 years agofastlog: fix unlikely memleak
Victor Julien [Fri, 24 Apr 2020 08:27:18 +0000 (10:27 +0200)] 
fastlog: fix unlikely memleak

Fix memleak is case of alloc error during startup.

5 years agothash: suppress coverity fp's
Victor Julien [Fri, 24 Apr 2020 08:23:51 +0000 (10:23 +0200)] 
thash: suppress coverity fp's

5 years agodatasets: suppress coverity fp's
Victor Julien [Fri, 24 Apr 2020 08:21:11 +0000 (10:21 +0200)] 
datasets: suppress coverity fp's

5 years agorfb: Update incomplete handling in parser.
frank honza [Tue, 14 Apr 2020 10:04:13 +0000 (12:04 +0200)] 
rfb: Update incomplete handling in parser.

This commit adds an updated incomplete handling for the RFB-Parser. If
incomplete data is processed, the successfully consumed position and
length of remainder + 1 is returned. If the next packet is not empty
suricata will call the parser again.

This commit is a result of discussion on https://github.com/OISF/suricata/pull/4792.

5 years agogithub-ci: check all commits on pr
Jason Ish [Tue, 21 Apr 2020 15:29:57 +0000 (09:29 -0600)] 
github-ci: check all commits on pr

On a pull request, attempt to compile all commits from
the base branch to the head of the PR branch.

The job is in a separate workflow file to limit it to
pull-requests only, as the base branch is not available
on push (something to look into).

5 years agohttp: adds debug check against too many warnings
Philippe Antoine [Wed, 15 Apr 2020 12:31:37 +0000 (14:31 +0200)] 
http: adds debug check against too many warnings

5 years agodetect/ftp: FTP memory accounting fixes
Jeff Lucovsky [Tue, 21 Apr 2020 14:36:27 +0000 (10:36 -0400)] 
detect/ftp: FTP memory accounting fixes

This commit continues the work started by @vanlink and corrects the
accounting of FTP memory usage against the memcap limit.

5 years agoapp-layer: fix protocol detection bail conditions for TCP fastopen
Victor Julien [Tue, 21 Apr 2020 08:52:04 +0000 (10:52 +0200)] 
app-layer: fix protocol detection bail conditions for TCP fastopen

5 years agodetect/lua: Unregister object during free
Jeff Lucovsky [Wed, 22 Apr 2020 23:12:26 +0000 (19:12 -0400)] 
detect/lua: Unregister object during free

This commit removes the registration for the object being freed.

5 years agodetect: Provide `de_ctx` to free functions
Jeff Lucovsky [Wed, 22 Apr 2020 23:12:02 +0000 (19:12 -0400)] 
detect: Provide `de_ctx` to free functions

This commit makes sure that the `DetectEngineCtx *` is available
to each detector's "free" function.

5 years agodetect: Provide function to clear per-thread ctx
Jeff Lucovsky [Sat, 21 Mar 2020 14:10:09 +0000 (10:10 -0400)] 
detect: Provide function to clear per-thread ctx

This commit provides an interface to free previously allocated
per-thread contextual information on the keyword lists.

5 years agoflowbits: Allow support for flowbit ORing 4847/head
Shivani Bhardwaj [Wed, 29 Jan 2020 14:50:24 +0000 (20:20 +0530)] 
flowbits: Allow support for flowbit ORing

This patch allows to OR multiple flowbits on isset and isnotset flowbit
actions.

e.g.
Earlier in order to check if either fb1 or fb2 was set, it was required
to write two rules,
```
alert ip any any -> any any (msg:\"Flowbit fb1 isset\"; flowbits:isset,fb1; sid:1;)
alert ip any any -> any any (msg:\"Flowbit fb2 isset\"; flowbits:isset,fb2; sid:2;)
```

now, the same can be achieved with
```
alert ip any any -> any any (msg:\"Flowbit fb2 isset\"; flowbits:isset,fb1|fb2; sid:23;)
```

This operator can be used to check if one of the many flowbits is set
and also if one of the many flowbits is not set.

5 years agodoc/perf: minor improvements 4839/head
Victor Julien [Mon, 20 Apr 2020 13:39:32 +0000 (15:39 +0200)] 
doc/perf: minor improvements

5 years agodoc: add performance analysis section
Andreas Herz [Thu, 9 Apr 2020 13:23:40 +0000 (15:23 +0200)] 
doc: add performance analysis section

5 years agoftp: use switch for ftp commands for style
Philippe Antoine [Mon, 16 Mar 2020 13:52:32 +0000 (14:52 +0100)] 
ftp: use switch for ftp commands for style

5 years agoftp: FTPGetAlstateProgress for done port commands
Philippe Antoine [Mon, 16 Mar 2020 13:48:40 +0000 (14:48 +0100)] 
ftp: FTPGetAlstateProgress for done port commands

For a done transaction with command PORT,
we expect FTP_STATE_FINISHED
and we got FTP_STATE_PORT_DONE instead
which prevented logging of these transactions

We change the order of the evaluations to get the right result

5 years agoftp: indent FTPParseResponse again
Philippe Antoine [Fri, 20 Mar 2020 13:42:50 +0000 (14:42 +0100)] 
ftp: indent FTPParseResponse again

5 years agoftp: FTPParseResponse bufferizes lines
Philippe Antoine [Mon, 16 Mar 2020 13:46:51 +0000 (14:46 +0100)] 
ftp: FTPParseResponse bufferizes lines

Protects against evasion by TCP packet splitting

The problem arised if the FTP response is split on multiple packets

The fix is to bufferize the content, until we get a complete line

5 years agodetect: fix insertion in linked list for fast pattern
Philippe Antoine [Mon, 20 Apr 2020 11:57:44 +0000 (13:57 +0200)] 
detect: fix insertion in linked list for fast pattern

Make sure we do not add the same list_id twice
by checking at least all the lists with the current priority

5 years agoconf/datadir: fix possible out of bounds array access
Victor Julien [Fri, 17 Apr 2020 13:00:40 +0000 (15:00 +0200)] 
conf/datadir: fix possible out of bounds array access

5 years agodatasets: remove useless variables
Victor Julien [Fri, 17 Apr 2020 12:58:06 +0000 (14:58 +0200)] 
datasets: remove useless variables

5 years agodatasets: add 'dataset-remove' unix command
Victor Julien [Tue, 14 Apr 2020 12:21:31 +0000 (14:21 +0200)] 
datasets: add 'dataset-remove' unix command

5 years agodatasets: add 'remove' support
Victor Julien [Mon, 13 Apr 2020 14:31:50 +0000 (16:31 +0200)] 
datasets: add 'remove' support

5 years agothash: add 'remove' support
Victor Julien [Mon, 13 Apr 2020 14:31:35 +0000 (16:31 +0200)] 
thash: add 'remove' support

5 years agodatasets: improve 'dataset-add' error checking
Victor Julien [Mon, 13 Apr 2020 13:47:18 +0000 (15:47 +0200)] 
datasets: improve 'dataset-add' error checking

5 years agodatasets: fix return values for 'add's
Victor Julien [Tue, 14 Apr 2020 19:49:33 +0000 (21:49 +0200)] 
datasets: fix return values for 'add's

5 years agodatasets: fix ref cnt handling
Victor Julien [Tue, 14 Apr 2020 19:44:34 +0000 (21:44 +0200)] 
datasets: fix ref cnt handling

Each 'add' and 'lookup' would increment the use_cnt, without anything
bringing it back down.

Since there is no removal yet, nothing is actually affected by it yet.

5 years agodatasets: silence noisy 'dataset-add' log
Victor Julien [Tue, 14 Apr 2020 19:57:06 +0000 (21:57 +0200)] 
datasets: silence noisy 'dataset-add' log

5 years agobuild: default to c11 standard 4832/head
Victor Julien [Mon, 13 Apr 2020 07:10:20 +0000 (09:10 +0200)] 
build: default to c11 standard

Rearrange pcap includes to fix builds on MinGW

5 years agobuild: don't limit C std to c99 (gnu99)
Victor Julien [Mon, 13 Apr 2020 05:47:02 +0000 (07:47 +0200)] 
build: don't limit C std to c99 (gnu99)

Now that C11 atomics and thread local storage are supported, the
compiler can figure out what version to use.

5 years agoconfigure: check for u_int and friends
Victor Julien [Mon, 13 Apr 2020 19:04:45 +0000 (21:04 +0200)] 
configure: check for u_int and friends

5 years agofuzz: include pcap headers through suricata-common.h
Victor Julien [Tue, 14 Apr 2020 09:06:17 +0000 (11:06 +0200)] 
fuzz: include pcap headers through suricata-common.h

5 years agothreads: remove u_long usage
Victor Julien [Tue, 14 Apr 2020 11:19:01 +0000 (13:19 +0200)] 
threads: remove u_long usage