]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
8 years agodetect: add and use util func for alproto sets 2559/head
Victor Julien [Sat, 24 Dec 2016 09:43:36 +0000 (10:43 +0100)] 
detect: add and use util func for alproto sets

8 years agodoc: update for unix socket hostbits
Victor Julien [Wed, 21 Dec 2016 10:39:58 +0000 (11:39 +0100)] 
doc: update for unix socket hostbits

8 years agoflowvar: shrink flowvar type by using padded space
Victor Julien [Thu, 15 Dec 2016 16:40:28 +0000 (17:40 +0100)] 
flowvar: shrink flowvar type by using padded space

8 years agolua: support key/value flowvars in lua
Victor Julien [Sun, 6 Nov 2016 21:43:41 +0000 (16:43 -0500)] 
lua: support key/value flowvars in lua

8 years agoflowvar: remove unused DETECT_VAR_TYPE_ALWAYS
Victor Julien [Thu, 15 Dec 2016 16:09:46 +0000 (17:09 +0100)] 
flowvar: remove unused DETECT_VAR_TYPE_ALWAYS

8 years agodoc: update unix socket
Victor Julien [Thu, 15 Dec 2016 14:10:30 +0000 (15:10 +0100)] 
doc: update unix socket

8 years agosuricatasc: add/list/remove hostbit commands
Victor Julien [Thu, 15 Dec 2016 13:49:40 +0000 (14:49 +0100)] 
suricatasc: add/list/remove hostbit commands

Syntax:
    add-hostbit <ip> <bit name> <expire>
Example:
    add-hostbit 1.2.3.4 blacklist 3600

Syntax:
    remove-hostbit <ip> <bit name>
Example:
    remove-hostbit 1.2.3.4 blacklist

Syntax:
    list-hostbit <ip>
Example:
    list-hostbit 1.2.3.4

8 years agounix-socket: add/list/remove hostbit commands
Victor Julien [Thu, 15 Dec 2016 13:49:17 +0000 (14:49 +0100)] 
unix-socket: add/list/remove hostbit commands

add-hostbit adds a named hostbit with an expire time in seconds.
remove-hostbit removes hostbit by name.

add-hostbit, remove-hostbit return success or failure.

list-hostbit returns a json array of hostbits with their name and
expire time:

    {
        "message": {
            "count": 1,
            "hostbits":
                [{
                    "expire": 3222,
                    "name": "firefox-users"
                }]
        },
        "return": "OK"
    }

8 years agohostbits: add list API
Victor Julien [Wed, 21 Dec 2016 10:16:41 +0000 (11:16 +0100)] 
hostbits: add list API

8 years agopktvars: same name pktvars, key-value vars
Victor Julien [Sat, 5 Nov 2016 13:02:39 +0000 (09:02 -0400)] 
pktvars: same name pktvars, key-value vars

8 years agooutputs: vars log
Victor Julien [Fri, 28 Oct 2016 21:12:43 +0000 (23:12 +0200)] 
outputs: vars log

EVE addition called 'vars' that logs pkt/flow vars for each packet/flow.

8 years agoeve: log pktvars/flowvars/bits/ints
Victor Julien [Fri, 21 Oct 2016 10:55:32 +0000 (12:55 +0200)] 
eve: log pktvars/flowvars/bits/ints

Optionally logs 'vars' into alerts

8 years agopcre: new way of specifying var names
Victor Julien [Fri, 28 Oct 2016 10:27:35 +0000 (12:27 +0200)] 
pcre: new way of specifying var names

Until now the way to specify a var name in pcre substring capture
into pkt and flow vars was to use the pcre named substring support:
e.g. /(?P<pkt_somename>.*)/

This had 2 drawbacks:

1. limitations of the name. The name could be max 32 chars, only have
   alphanumeric and the underscore characters. This imposed limitations
   that are not present in flowbits/ints.

2. we didn't actually use the named substrings in pcre through the
   API. We parsed the names separately. So putting the names in pcre
   would actually be wasteful.

This patch introduces a new way of mapping captures with names:

  pcre:"/(.*)/, pkt:somename";
  pcre:"/([A-z]+) ([0-9]+)/, pkt:somename,flow:anothername";

The order of the captures and the order of the names are mapped 1 on 1.
This method is no longer limited by the pcre API's naming limits. The
'flow:' and 'pkt:' prefixes indicate what the type of variable is. It's
mandatory to specify one.

The old method is still supported as well.

8 years agopkt-var: abuse flowvar postmatch logic for pktvars
Victor Julien [Thu, 27 Oct 2016 15:41:38 +0000 (17:41 +0200)] 
pkt-var: abuse flowvar postmatch logic for pktvars

Flowvars were already using a temporary store in the detect thread
ctx.

Use the same facility for pktvars. The reasons are:

1. packet is not always available, e.g. when running pcre on http
   buffers.

2. setting of vars should be done post match. Until now it was also
   possible that it is done on a partial match.

8 years agopkt-var: use id instead of name pointer
Victor Julien [Thu, 27 Oct 2016 13:41:10 +0000 (15:41 +0200)] 
pkt-var: use id instead of name pointer

8 years agopcre: support multiple captures
Victor Julien [Wed, 26 Oct 2016 14:55:34 +0000 (16:55 +0200)] 
pcre: support multiple captures

Support up to 8 substring captures into pkt or flow vars.

8 years agodetect-pcre: small cleanups
Victor Julien [Wed, 26 Oct 2016 12:35:26 +0000 (14:35 +0200)] 
detect-pcre: small cleanups

8 years agoalert-debug: print flowvar/int names
Victor Julien [Fri, 21 Oct 2016 16:47:48 +0000 (18:47 +0200)] 
alert-debug: print flowvar/int names

8 years agoalert-debug: print flowbit names from VarNameStore
Victor Julien [Fri, 21 Oct 2016 16:19:14 +0000 (18:19 +0200)] 
alert-debug: print flowbit names from VarNameStore

8 years agovar-names: expose outside of detect engine
Victor Julien [Thu, 20 Oct 2016 12:38:33 +0000 (14:38 +0200)] 
var-names: expose outside of detect engine

Until now variable names, such as flowbit names, were local to a detect
engine. This made sense as they were only ever used in that context.

For the purpose of logging these names, this needs a different approach.
The loggers live outside of the detect engine. Also, in the case of
reloads and multi-tenancy, there are even multiple detect engines, so
it would be even more tricky to access them from the outside.

This patch brings a new approach. A any time, there is a single active
hash table mapping the variable names and their id's. For multiple
tenants the table is shared between tenants.

The table is set up in a 'staging' area, where locking makes sure that
multiple loading threads don't mess things up. Then when the preparing
of a detection engine is ready, but before the detect threads are made
aware of the new detect engine, the active varname hash is swapped with
the staging instance.

For this to work, all the mappings from the 'current' or active mapping
are added to the staging table.

After the threads have reloaded and the new detection engine is active,
the old table can be freed.

For multi tenancy things are similar. The staging area is used for
setting up until the new detection engines / tenants are applied to
the system.

This patch also changes the variable 'id'/'idx' field to uint32_t. Due
to data structure padding and alignment, this should have no practical
drawback while allowing for a lot more vars.

8 years agodetect: use engine version instead of id
Victor Julien [Wed, 26 Oct 2016 11:44:53 +0000 (13:44 +0200)] 
detect: use engine version instead of id

Use engine version based on global detect engine master. This is
incremented between reloads.

8 years agodetect: ssh_software sticky buffer
Victor Julien [Fri, 23 Dec 2016 16:18:10 +0000 (17:18 +0100)] 
detect: ssh_software sticky buffer

8 years agodetect: ssh_proto stickybuffer
Victor Julien [Fri, 23 Dec 2016 16:10:18 +0000 (17:10 +0100)] 
detect: ssh_proto stickybuffer

8 years agodetect: remove unused SIGMATCH_PAYLOAD flag
Victor Julien [Fri, 23 Dec 2016 15:03:08 +0000 (16:03 +0100)] 
detect: remove unused SIGMATCH_PAYLOAD flag

8 years agodetect: remove unused state file flag
Victor Julien [Fri, 23 Dec 2016 14:17:19 +0000 (15:17 +0100)] 
detect: remove unused state file flag

8 years agodetect: small API cleanup
Victor Julien [Fri, 23 Dec 2016 13:45:08 +0000 (14:45 +0100)] 
detect: small API cleanup

8 years agodetect: move file hash common code
Victor Julien [Fri, 23 Dec 2016 12:59:25 +0000 (13:59 +0100)] 
detect: move file hash common code

8 years agodetect: unify FileMatch API with other calls
Victor Julien [Fri, 23 Dec 2016 12:57:12 +0000 (13:57 +0100)] 
detect: unify FileMatch API with other calls

8 years agodetect: remove DMATCH list
Victor Julien [Thu, 22 Dec 2016 22:56:48 +0000 (23:56 +0100)] 
detect: remove DMATCH list

8 years agoflow: remove unused Flow::de_state
Victor Julien [Thu, 22 Dec 2016 19:49:32 +0000 (20:49 +0100)] 
flow: remove unused Flow::de_state

8 years agodetect: remove the AMATCH list
Victor Julien [Thu, 22 Dec 2016 19:31:38 +0000 (20:31 +0100)] 
detect: remove the AMATCH list

8 years agodetect: remove AppLayerMatch API call
Victor Julien [Thu, 22 Dec 2016 19:17:49 +0000 (20:17 +0100)] 
detect: remove AppLayerMatch API call

8 years agodce: dynamic lists
Victor Julien [Thu, 22 Dec 2016 19:05:17 +0000 (20:05 +0100)] 
dce: dynamic lists

8 years agosmb/dcerpc: use tx api
Victor Julien [Thu, 22 Dec 2016 18:03:44 +0000 (19:03 +0100)] 
smb/dcerpc: use tx api

8 years agodcerpc: simplify common detect code
Victor Julien [Thu, 22 Dec 2016 15:55:43 +0000 (16:55 +0100)] 
dcerpc: simplify common detect code

8 years agoftp: parser and ftpbounce update
Victor Julien [Thu, 22 Dec 2016 14:21:32 +0000 (15:21 +0100)] 
ftp: parser and ftpbounce update

Convert parser to TX API.

Convert ftpbounce keyword to use that.

8 years agodetect: move lua smtp support to dynamic list
Victor Julien [Thu, 22 Dec 2016 13:48:53 +0000 (14:48 +0100)] 
detect: move lua smtp support to dynamic list

8 years agolua: convert lua output to be tx aware
Victor Julien [Thu, 22 Dec 2016 12:29:07 +0000 (13:29 +0100)] 
lua: convert lua output to be tx aware

8 years agodetect: make ssh detection use dynamic list
Victor Julien [Thu, 22 Dec 2016 12:07:06 +0000 (13:07 +0100)] 
detect: make ssh detection use dynamic list

8 years agossh: remove single logger limit
Victor Julien [Thu, 22 Dec 2016 11:48:59 +0000 (12:48 +0100)] 
ssh: remove single logger limit

8 years agossh: convert app-layer parser to be tx aware
Victor Julien [Thu, 22 Dec 2016 11:45:17 +0000 (12:45 +0100)] 
ssh: convert app-layer parser to be tx aware

Like with SSL, there is only a single 'tx'.

8 years agolua: use tls_generic list for ssl/tls
Victor Julien [Thu, 22 Dec 2016 09:35:44 +0000 (10:35 +0100)] 
lua: use tls_generic list for ssl/tls

8 years agodetect ssl/tls: use dynamic lists
Victor Julien [Thu, 22 Dec 2016 09:32:00 +0000 (10:32 +0100)] 
detect ssl/tls: use dynamic lists

8 years agossl/tls: clean up keywords
Victor Julien [Thu, 22 Dec 2016 09:09:34 +0000 (10:09 +0100)] 
ssl/tls: clean up keywords

8 years agodetect: convert old tls keywords to dynamic list
Victor Julien [Wed, 21 Dec 2016 20:27:56 +0000 (21:27 +0100)] 
detect: convert old tls keywords to dynamic list

8 years agotls.store: convert to postmatch
Victor Julien [Wed, 21 Dec 2016 18:53:00 +0000 (19:53 +0100)] 
tls.store: convert to postmatch

8 years agotls.store: cleanup
Victor Julien [Wed, 21 Dec 2016 18:43:25 +0000 (19:43 +0100)] 
tls.store: cleanup

8 years agoapp-layer-events: remove unused API options
Victor Julien [Wed, 21 Dec 2016 16:58:26 +0000 (17:58 +0100)] 
app-layer-events: remove unused API options

8 years agodetect: http_start sticky buffer
Victor Julien [Tue, 20 Dec 2016 13:04:55 +0000 (14:04 +0100)] 
detect: http_start sticky buffer

Matches on the start of a HTTP request or response.

Uses a buffer constructed from the request line and normalized request
headers, including the Cookie header.

Or for the response side, it uses the response line plus the
normalized response headers, including the Set-Cookie header.

Both buffers are terminated by an extra \r\n.

8 years agodetect: add http_protocol sticky buffer
Victor Julien [Mon, 19 Dec 2016 22:41:40 +0000 (23:41 +0100)] 
detect: add http_protocol sticky buffer

Matches on protocol field in HTTP.

8 years agohttp_header: convert to use common code
Victor Julien [Mon, 19 Dec 2016 16:06:11 +0000 (17:06 +0100)] 
http_header: convert to use common code

8 years agohttp_header: common detection code
Victor Julien [Mon, 19 Dec 2016 14:45:12 +0000 (15:45 +0100)] 
http_header: common detection code

8 years agohttp_header: remove old files
Victor Julien [Mon, 19 Dec 2016 13:43:59 +0000 (14:43 +0100)] 
http_header: remove old files

8 years agohttp_header: move all code into keyword files
Victor Julien [Mon, 19 Dec 2016 13:38:27 +0000 (14:38 +0100)] 
http_header: move all code into keyword files

8 years agodetect: http_header_names sticky buffer keyword
Victor Julien [Mon, 19 Dec 2016 10:25:58 +0000 (11:25 +0100)] 
detect: http_header_names sticky buffer keyword

A sticky buffer that allows content inspection on a contructed buffer
of HTTP header names. The buffer starts with \r\n, the names are
separated by \r\n and the end of the buffer contains an extra \r\n.

E.g. \r\nHost\r\nUser-Agent\r\n\r\n

The leading \r\n is to make sure one can match on a full name in all
cases.

8 years agodetect: global registery for keyword thread data
Victor Julien [Mon, 19 Dec 2016 10:25:27 +0000 (11:25 +0100)] 
detect: global registery for keyword thread data

Some keywords need a scratch space where they can do store the results
of expensive operations that remain valid for the time of a packets
journey through the detection engine.

An example is the reconstructed 'http_header' field, that is needed
in MPM, and then for each rule that manually inspects it. Storing this
data in the flow is a waste, and reconstructing multiple times on
demand as well.

This API allows for registering a keyword with an init and free function.

It it mean to be used an initialization time, when the keyword is
registered.

8 years agoprofiling: output all sort options for rules
Victor Julien [Thu, 15 Dec 2016 10:18:44 +0000 (11:18 +0100)] 
profiling: output all sort options for rules

Limit the default number of sids to 10.

8 years agoprofiling: honor limit in json rule output
Victor Julien [Thu, 15 Dec 2016 10:17:13 +0000 (11:17 +0100)] 
profiling: honor limit in json rule output

8 years agoprofiling: fix keyword profiling
Victor Julien [Thu, 15 Dec 2016 09:12:21 +0000 (10:12 +0100)] 
profiling: fix keyword profiling

8 years agodetect-engine-mpm: api cleanup
Victor Julien [Wed, 14 Dec 2016 12:08:39 +0000 (13:08 +0100)] 
detect-engine-mpm: api cleanup

8 years agodetect: detect engine registration cleanup
Victor Julien [Mon, 12 Dec 2016 19:00:26 +0000 (20:00 +0100)] 
detect: detect engine registration cleanup

8 years agodetect: cleanup built-in list id's
Victor Julien [Mon, 12 Dec 2016 11:20:46 +0000 (12:20 +0100)] 
detect: cleanup built-in list id's

8 years agotemplate: dynamic buffer
Victor Julien [Mon, 12 Dec 2016 11:03:46 +0000 (12:03 +0100)] 
template: dynamic buffer

8 years agoapp-layer-events: dynamic list
Victor Julien [Sun, 11 Dec 2016 08:59:31 +0000 (09:59 +0100)] 
app-layer-events: dynamic list

8 years agofiles: use dynamic list
Victor Julien [Sat, 10 Dec 2016 21:03:46 +0000 (22:03 +0100)] 
files: use dynamic list

8 years agocip/enip: dynamic buffer
Victor Julien [Sat, 10 Dec 2016 20:55:51 +0000 (21:55 +0100)] 
cip/enip: dynamic buffer

8 years agomodbus: dynamic buffer
Victor Julien [Sat, 10 Dec 2016 13:36:06 +0000 (14:36 +0100)] 
modbus: dynamic buffer

8 years agodnp3: dynamic buffers/lists
Victor Julien [Sat, 10 Dec 2016 13:04:50 +0000 (14:04 +0100)] 
dnp3: dynamic buffers/lists

8 years agotls: dynamic buffers
Victor Julien [Sat, 10 Dec 2016 10:36:06 +0000 (11:36 +0100)] 
tls: dynamic buffers

8 years agodns: use dynamic buffers
Victor Julien [Sat, 10 Dec 2016 09:49:51 +0000 (10:49 +0100)] 
dns: use dynamic buffers

8 years agodetect-parse: content modifier cleanup
Victor Julien [Fri, 9 Dec 2016 18:01:01 +0000 (19:01 +0100)] 
detect-parse: content modifier cleanup

8 years agohttp_raw_uri: dynamic buffer
Victor Julien [Fri, 9 Dec 2016 17:29:44 +0000 (18:29 +0100)] 
http_raw_uri: dynamic buffer

8 years agohttp_client_body: dynamic buffer
Victor Julien [Fri, 9 Dec 2016 17:09:48 +0000 (18:09 +0100)] 
http_client_body: dynamic buffer

8 years agohttp_header / http_raw_header: dynamic buffers
Victor Julien [Fri, 9 Dec 2016 14:27:51 +0000 (15:27 +0100)] 
http_header / http_raw_header: dynamic buffers

8 years agohttp_stat_msg: dynamic buffer
Victor Julien [Fri, 9 Dec 2016 13:46:05 +0000 (14:46 +0100)] 
http_stat_msg: dynamic buffer

8 years agohttp_stat_code: dynamic buffer
Victor Julien [Fri, 9 Dec 2016 13:00:48 +0000 (14:00 +0100)] 
http_stat_code: dynamic buffer

8 years agohttp_raw_host: dynamic buffer
Victor Julien [Fri, 9 Dec 2016 12:47:14 +0000 (13:47 +0100)] 
http_raw_host: dynamic buffer

8 years agohttp_host: dynamic buffer
Victor Julien [Fri, 9 Dec 2016 11:07:03 +0000 (12:07 +0100)] 
http_host: dynamic buffer

8 years agohttp_cookie: dynamic buffer
Victor Julien [Thu, 8 Dec 2016 10:40:08 +0000 (11:40 +0100)] 
http_cookie: dynamic buffer

8 years agohttp_user_agent: dynamic buffer
Victor Julien [Thu, 8 Dec 2016 10:05:51 +0000 (11:05 +0100)] 
http_user_agent: dynamic buffer

8 years agohttp_response_line: dynamic buffer
Victor Julien [Thu, 8 Dec 2016 09:33:15 +0000 (10:33 +0100)] 
http_response_line: dynamic buffer

8 years agohttp_uri: dynamic buffer
Victor Julien [Thu, 8 Dec 2016 08:19:34 +0000 (09:19 +0100)] 
http_uri: dynamic buffer

Clean up tests

8 years agohttp_method: make list dynamic
Victor Julien [Wed, 7 Dec 2016 17:02:37 +0000 (18:02 +0100)] 
http_method: make list dynamic

8 years agofile_data: dynamic buffer
Victor Julien [Wed, 14 Dec 2016 10:42:58 +0000 (11:42 +0100)] 
file_data: dynamic buffer

8 years agohttp_request_line: dynamic buffer
Victor Julien [Mon, 17 Oct 2016 22:50:26 +0000 (00:50 +0200)] 
http_request_line: dynamic buffer

8 years agodetect: remove hardcoded sm_list logic from setup
Victor Julien [Wed, 14 Dec 2016 11:39:13 +0000 (12:39 +0100)] 
detect: remove hardcoded sm_list logic from setup

Introduce utility functions to aid this.

8 years agodetect: buffer type API
Victor Julien [Wed, 14 Dec 2016 11:38:58 +0000 (12:38 +0100)] 
detect: buffer type API

To replace the hardcoded SigMatch list id's, use this API to register
and query lists by name.

Also allow for registering descriptions and whether mpm is supported.

Registration is only allowed at startup.

8 years agodetect: inspect engine setup cleanup
Victor Julien [Mon, 17 Oct 2016 22:42:26 +0000 (00:42 +0200)] 
detect: inspect engine setup cleanup

8 years agodetect: dce test fixes and improvements
Victor Julien [Sun, 16 Oct 2016 09:02:50 +0000 (11:02 +0200)] 
detect: dce test fixes and improvements

8 years agodetect-csum: redo tests
Victor Julien [Sun, 16 Oct 2016 08:44:33 +0000 (10:44 +0200)] 
detect-csum: redo tests

8 years agodetect: move init only Signature members to init_data
Victor Julien [Mon, 17 Oct 2016 14:54:40 +0000 (16:54 +0200)] 
detect: move init only Signature members to init_data

8 years agodetect: shrink Signature::sm_arrays
Victor Julien [Mon, 17 Oct 2016 14:08:02 +0000 (16:08 +0200)] 
detect: shrink Signature::sm_arrays

Signature::sm_arrays now only contains 'built-in' lists, and so is
sized appropriately.

8 years agodetect: reorganize id's in prep of dynamic lists
Victor Julien [Mon, 17 Oct 2016 12:17:55 +0000 (14:17 +0200)] 
detect: reorganize id's in prep of dynamic lists

8 years agothreshold: fix and redo tests
Victor Julien [Sun, 16 Oct 2016 19:12:32 +0000 (21:12 +0200)] 
threshold: fix and redo tests

8 years agodetect: improve memory handling & comments
Victor Julien [Sun, 16 Oct 2016 19:29:34 +0000 (21:29 +0200)] 
detect: improve memory handling & comments

8 years agodetect: get rid of Signature::sm_lists
Victor Julien [Sun, 16 Oct 2016 13:30:22 +0000 (15:30 +0200)] 
detect: get rid of Signature::sm_lists

Instead use the lists in init_data during setup and the SigMatchData
arrays during runtime.

8 years agodetect: use detect list passed to generic funcs
Victor Julien [Sat, 15 Oct 2016 22:07:48 +0000 (00:07 +0200)] 
detect: use detect list passed to generic funcs

Until now the GenericList users used hardcoded list id's.

8 years agodetect: pass SigMatchData to inspect functions
Victor Julien [Sat, 15 Oct 2016 20:37:07 +0000 (22:37 +0200)] 
detect: pass SigMatchData to inspect functions

8 years agodetect: template list in engine
Victor Julien [Sat, 15 Oct 2016 17:26:48 +0000 (19:26 +0200)] 
detect: template list in engine

8 years agodetect: enip/cip list in engine
Victor Julien [Sat, 15 Oct 2016 17:24:35 +0000 (19:24 +0200)] 
detect: enip/cip list in engine