]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
10 years agoUpdate changelog for 2.0.8 release suricata-2.0.8
Victor Julien [Wed, 6 May 2015 14:51:49 +0000 (16:51 +0200)] 
Update changelog for 2.0.8 release

10 years agopcap-file: fix malformed timestamp crash
Victor Julien [Tue, 21 Apr 2015 17:29:12 +0000 (19:29 +0200)] 
pcap-file: fix malformed timestamp crash

A bad timestamp would lead to SCLocalTime returning NULL. This case
wasn't checked, leading to a NULL deref.

Reported-by: Kostya Kortchinsky of the Google Security Team
10 years agoFix possible wrap in uint32_t addition in DER parser
Pierre Chifflier [Sat, 18 Apr 2015 12:24:45 +0000 (14:24 +0200)] 
Fix possible wrap in uint32_t addition in DER parser

Signed-off-by: Pierre Chifflier <pierre.chifflier@ssi.gouv.fr>
10 years agostream: fix --disable-detection reassembly issue 1463/head
Victor Julien [Wed, 6 May 2015 11:08:32 +0000 (13:08 +0200)] 
stream: fix --disable-detection reassembly issue

Due to an error at initialization, the stream engine would not disable
'raw' reassembly automatically when --disable-detection was used.

This lead to segments not getting cleared from the segment lists.

10 years agotls: force 'raw' reassembly after each record 1462/head
Victor Julien [Fri, 1 May 2015 13:12:47 +0000 (15:12 +0200)] 
tls: force 'raw' reassembly after each record

Trigger raw reassembly after each record and after the handshake.

10 years agoDetectAddressParseString(): fix IPv6 address handling 1459/head
Alexander Gozman [Mon, 23 Mar 2015 17:06:47 +0000 (20:06 +0300)] 
DetectAddressParseString(): fix IPv6 address handling

10 years agotcp-reuse: fix potential dead lock
Victor Julien [Mon, 20 Apr 2015 12:46:57 +0000 (14:46 +0200)] 
tcp-reuse: fix potential dead lock

If the capture method would offer the packets of a new flow to a
different thread, and this flow would still be in use for the previous
TCP session, a deadlock could happen.

Suricata didn't consider a flow to be timed out, while the capture
method considered it to be a new session that could be send to a
different thread.

This patch defers the flow's de_state cleanup to the next 'Detect()'
invocation, so that we preserve the proper locking order.

10 years agothreading: add missing locks to threading storage
Victor Julien [Thu, 23 Apr 2015 07:32:01 +0000 (09:32 +0200)] 
threading: add missing locks to threading storage

Lock threading root lock when walking or updating the threading
storage for 'ThreadVars' objects.

10 years agospelling - dubbed -> duped (for duplicate)
Jason Ish [Thu, 16 Apr 2015 21:56:51 +0000 (15:56 -0600)] 
spelling - dubbed -> duped (for duplicate)

10 years agoDetectGidSet - safer stripping of quotes.
Jason Ish [Thu, 16 Apr 2015 21:33:32 +0000 (15:33 -0600)] 
DetectGidSet - safer stripping of quotes.

Discovered by AFL when using a rule like:
    alert tcp any any -> any any (content:"ABC"; gid:";)
resulting a negative array index.

10 years agoDetectSidSetup - safer stripping of quotes.
Jason Ish [Thu, 16 Apr 2015 20:46:24 +0000 (14:46 -0600)] 
DetectSidSetup - safer stripping of quotes.

Discovered by AFL when using a rule like:
    alert tcp any any -> any any (content:"ABC"; sid:";)
would result in a negative array index.

10 years agoParseSizeString - don't abort on unknown unit type.
Jason Ish [Thu, 16 Apr 2015 17:44:55 +0000 (11:44 -0600)] 
ParseSizeString - don't abort on unknown unit type.

10 years agoFix alert-debuglog file rotation.
Jason Ish [Thu, 22 Jan 2015 16:08:31 +0000 (10:08 -0600)] 
Fix alert-debuglog file rotation.

The alert-debuglog writer for non-decoder events was writing
directly to the log file so the write wrapper was not checking
for file rotation like it would in the decoder event case.

10 years agoWhen re-opening a log file on HUP, always append.
Jason Ish [Fri, 27 Feb 2015 17:30:47 +0000 (11:30 -0600)] 
When re-opening a log file on HUP, always append.

This will prevent log files that have not been rotated by some
external tool from being deleted, but log files that were
rotated (moved out of the way) will be re-opened.

This is a better default behaviour, especially when not all
log files are rotated at the same time.

Thanks to iro on IRC.

10 years agoBug 1420: on midstream pickup, fix packet direction 1394/head
Victor Julien [Tue, 17 Mar 2015 10:48:17 +0000 (11:48 +0100)] 
Bug 1420: on midstream pickup, fix packet direction

On midstream SYN/ACK pickups, we would flip the direction of packets
after the first. This meant the first (pickup) packet's direction
was wrong.

This patch fixes that.

10 years agodetect-state: remove DeStateResetFileInspection 1379/head
Victor Julien [Thu, 26 Feb 2015 16:32:36 +0000 (17:32 +0100)] 
detect-state: remove DeStateResetFileInspection

It was effectively unused.

10 years agodetect-state: remove redundant code
Victor Julien [Thu, 26 Feb 2015 16:49:30 +0000 (17:49 +0100)] 
detect-state: remove redundant code

10 years agodetect-state: add helper to test state
Victor Julien [Thu, 26 Feb 2015 15:11:31 +0000 (16:11 +0100)] 
detect-state: add helper to test state

Add little helper function StateIsValid() to test if the state
can be inspected safely.

Cleans up stateful detection loops.

10 years agodetect-state: add helper to indicate last tx
Victor Julien [Thu, 26 Feb 2015 14:58:43 +0000 (15:58 +0100)] 
detect-state: add helper to indicate last tx

Add little helper to indicate current tx is that last we have.

10 years agodetect-state: cleanup ContinueDetection
Victor Julien [Thu, 26 Feb 2015 14:23:41 +0000 (15:23 +0100)] 
detect-state: cleanup ContinueDetection

Only lock f->de_state->m when we start to access it. So after
declaration and initialization of local vars.

10 years agodetect-state: cleanup retvals
Victor Julien [Thu, 26 Feb 2015 14:02:21 +0000 (15:02 +0100)] 
detect-state: cleanup retvals

Use DETECT_ENGINE_INSPECT_SIG_* instead of 0, 1, 2 and 3.

10 years agofile: don't 'close' file if we need to track it
Victor Julien [Fri, 27 Feb 2015 16:10:09 +0000 (17:10 +0100)] 
file: don't 'close' file if we need to track it

10 years agohttp: fix stat_msg and stat_code state tracking
Victor Julien [Thu, 26 Feb 2015 23:04:11 +0000 (00:04 +0100)] 
http: fix stat_msg and stat_code state tracking

10 years agoUpdate changelog for 2.0.7 suricata-2.0.7
Victor Julien [Wed, 25 Feb 2015 13:29:16 +0000 (14:29 +0100)] 
Update changelog for 2.0.7

10 years agohttp: add event for suspicious method delimeter
Victor Julien [Wed, 18 Feb 2015 22:46:19 +0000 (23:46 +0100)] 
http: add event for suspicious method delimeter

Add event and rule for suspicious delim(s) between method and uri.

Add unittests as well.

10 years agohttp: add libhtp uri warning event
Victor Julien [Wed, 18 Feb 2015 15:45:20 +0000 (16:45 +0100)] 
http: add libhtp uri warning event

Add event for libhtp warning added 0.5.17 for URI's with suspicious
delimeters.

10 years agostream: init global config after flow engine
Victor Julien [Wed, 25 Feb 2015 10:06:41 +0000 (11:06 +0100)] 
stream: init global config after flow engine

Stream depends on flow engine.

10 years agohttp: remove unused and broken 'content-len' logic
Victor Julien [Fri, 23 Jan 2015 12:06:44 +0000 (13:06 +0100)] 
http: remove unused and broken 'content-len' logic

The HTTP tracking code would parse the content lenght and store it
in the TX user data. It didn't take the possibility or errors into
account though, leading to a possible negative int being cases to
unsigned int. Luckily, the result was unused.

This patch simply removes the offending code.

Reported-by: The Yahoo pentest team
10 years agodcerpc: don't exit() on malloc failure
Victor Julien [Fri, 23 Jan 2015 11:12:53 +0000 (12:12 +0100)] 
dcerpc: don't exit() on malloc failure

In 2 places we would exit() if malloc failed. We should never exit in
such cases. This patch silently handles it.

10 years agodcerpc: fix error handling for alloc errors
Victor Julien [Fri, 23 Jan 2015 11:09:29 +0000 (12:09 +0100)] 
dcerpc: fix error handling for alloc errors

Fix error handling of stub parsers. In case of SCRealloc error the
function would return a non-error code. This could possibly lead to
memory corruption.

Reported-By: The Yahoo pentest team
10 years agoFix make distcheck on CentOS 5.11 1344/head
Victor Julien [Thu, 19 Feb 2015 10:45:09 +0000 (11:45 +0100)] 
Fix make distcheck on CentOS 5.11

datarootdir was undefined. Define it.

10 years agoCentOS 5.11 pkg-config fix
Victor Julien [Thu, 19 Feb 2015 09:29:14 +0000 (10:29 +0100)] 
CentOS 5.11 pkg-config fix

Check for the minimal pkg-config 0.21 version. Without it, CentOS'
pkg-config will fail with the warning:

configure: error: The pkg-config script could not be found or is too old.

10 years agosmtp: fix compiler warning
Victor Julien [Wed, 25 Feb 2015 07:00:18 +0000 (08:00 +0100)] 
smtp: fix compiler warning

cc1: warnings being treated as errors
app-layer-smtp.c: In function â€˜SMTPParseCommandBDAT’:
app-layer-smtp.c:639: warning: dereferencing type-punned pointer will break strict-aliasing rules
make[3]: *** [app-layer-smtp.o] Error 1

10 years agoutil-magic: make unittests less specific
Victor Julien [Wed, 25 Feb 2015 06:37:54 +0000 (07:37 +0100)] 
util-magic: make unittests less specific

So they pass on CentOS 5.11 as well.

10 years agosuricatasc: fix dump-counters command
Eric Leblond [Fri, 20 Feb 2015 21:28:59 +0000 (22:28 +0100)] 
suricatasc: fix dump-counters command

As the exit of dump-counters command is really long and takes time
to get it can take more 5 iterations to get the complete message.
Increasing to 20 seems to fix the issue (10 was ok too).

10 years agoutil-running-mode: setup config file
Eric Leblond [Tue, 27 Jan 2015 20:22:29 +0000 (21:22 +0100)] 
util-running-mode: setup config file

Without that we get warning message.

10 years agolist keywords: fix regression on app layer name
Eric Leblond [Fri, 16 Jan 2015 13:37:41 +0000 (14:37 +0100)] 
list keywords: fix regression on app layer name

It was not anymore displayed.

10 years agolist keywords: restore 1.4 similar output
Eric Leblond [Fri, 16 Jan 2015 09:12:55 +0000 (10:12 +0100)] 
list keywords: restore 1.4 similar output

Unset was previously displayed if the application layer was not
set. Code before this patch was displaying '(null)' which is not
user friendly.

10 years agostream-tcp: init config before spawning threads
Victor Julien [Wed, 25 Feb 2015 06:09:51 +0000 (07:09 +0100)] 
stream-tcp: init config before spawning threads

Bug 1318.

10 years agopcap-file: add missing atomic init 1336/head
Eric Leblond [Thu, 12 Feb 2015 21:27:07 +0000 (22:27 +0100)] 
pcap-file: add missing atomic init

It is mandatory to init all atomic to avoid problem on system
without atomic support.

10 years agorunmode-pcap-file: suppress useless include
Eric Leblond [Thu, 12 Feb 2015 21:18:23 +0000 (22:18 +0100)] 
runmode-pcap-file: suppress useless include

10 years agotcp midstream: fix window scaling 1332/head
Victor Julien [Tue, 10 Feb 2015 11:03:42 +0000 (12:03 +0100)] 
tcp midstream: fix window scaling

If stream is picked by ACK, we can't know the wscale, so we assume it's
set to max. Howver, we didn't apply this to the initial window size we
set.

10 years agofile: register filedata log before file log 1313/head
Victor Julien [Fri, 23 Jan 2015 09:22:55 +0000 (10:22 +0100)] 
file: register filedata log before file log

This way the file log can log the 'stored' info that the filedata
log sets.

10 years agofile: improve file pruning
Victor Julien [Fri, 23 Jan 2015 09:22:01 +0000 (10:22 +0100)] 
file: improve file pruning

Check if file has been logged/stored before considering it 'done'.

10 years agorunmodes: add funcs to check if file loggers enabled
Victor Julien [Fri, 23 Jan 2015 09:20:37 +0000 (10:20 +0100)] 
runmodes: add funcs to check if file loggers enabled

Add functions to check if file/filedata loggers are enabled.

10 years agofile: optimize file pruning
Victor Julien [Thu, 22 Jan 2015 18:24:35 +0000 (19:24 +0100)] 
file: optimize file pruning

FilePrune would clear the files, but not free them and remove them
from the list. This lead to ever growing lists in some cases.
Especially in HTTP sessions with many transactions, this could slow
us down.

10 years agoUpdate Changelog for 2.0.6 release suricata-2.0.6
Victor Julien [Thu, 15 Jan 2015 09:08:25 +0000 (10:08 +0100)] 
Update Changelog for 2.0.6 release

10 years agoFix OS X 10.10 unittest failure
Victor Julien [Wed, 14 Jan 2015 22:49:54 +0000 (23:49 +0100)] 
Fix OS X 10.10 unittest failure

Work around OS X 10.10 Yosemite returning EDEADLK on a rwlock wrlocked
then tested by wrtrylock. All other OS' (and versions of OS X that I
tested) seem to return EBUSY instead.

10 years agoAdd test for memcmp issue.
Victor Julien [Tue, 16 Dec 2014 18:41:32 +0000 (19:41 +0100)] 
Add test for memcmp issue.

10 years agomemcmp: fix lowercase compare issue
Victor Julien [Tue, 16 Dec 2014 18:12:20 +0000 (19:12 +0100)] 
memcmp: fix lowercase compare issue

MemcmpLowercase would not compare the first byte of both input buffers
leading to two non-identical buffers to be considered the same.

Tile version is not affected.

10 years agoFix a fix: defrag OOM condition
Victor Julien [Fri, 12 Dec 2014 17:20:24 +0000 (18:20 +0100)] 
Fix a fix: defrag OOM condition

** CID 1257764:  Dereference after null check  (FORWARD_NULL)
/src/defrag.c: 291 in Defrag4Reassemble()

** CID 1257763:  Dereference after null check  (FORWARD_NULL)
/src/defrag.c: 409 in Defrag6Reassemble()

In the error case 'rp' can be both NULL or non-NULL.

10 years agoFix compilation on OS X Yosemite 1292/head
Victor Julien [Wed, 14 Jan 2015 08:48:39 +0000 (09:48 +0100)] 
Fix compilation on OS X Yosemite

Due to our unconditional declaration of the strlcat and strlcpy
functions, compilation failed on OS X Yosemite.

Bug #1192

10 years agoUpdate reference.config 1290/head
Travis Green [Tue, 23 Dec 2014 22:10:21 +0000 (15:10 -0700)] 
Update reference.config

Updated reference.config to match ET Open reference.config found here:
https://rules.emergingthreats.net/open/suricata/reference.config

Due to startup error shown here:
root@xxxxxxx01:/etc/suricata/rules# /usr/bin/suricata -c /etc/suricata/suricata.yaml --pidfile /var/run/suricata.pid --af-packet
23/12/2014 -- 22:07:56 - <Error> - [ERRCODE: SC_ERR_REFERENCE_UNKNOWN(150)] - unknown reference key "osvdb". Supported keys are defined in reference.config file.  Please have a look at the conf param "reference-config-file"
<...>
Killed

10 years agostream: improve inline mode GAP handling 1273/head
Victor Julien [Tue, 9 Dec 2014 12:37:54 +0000 (13:37 +0100)] 
stream: improve inline mode GAP handling

Don't conclude a GAP is 'final' until the missing data is ack'd.

Further, cleanup and unify more with the non-inline code.

10 years agostream: move utility functions
Victor Julien [Tue, 9 Dec 2014 11:55:19 +0000 (12:55 +0100)] 
stream: move utility functions

This way they can be used by the *Inline* functions as well.

10 years agooutput-json: fix duplicate logging 1266/head
Eric Leblond [Mon, 15 Dec 2014 23:14:59 +0000 (00:14 +0100)] 
output-json: fix duplicate logging

This patches is fixing a issue in the OutputJSONBuffer function. It
was writing to file the content of the buffer starting from the start
to the final offset. But as the writing is done for each JSON string
we are duplicating the previous events if we are reusing the same
buffer.

Duplication was for example triggered when we have multiple alerts
attached to a packet. In the case of two alerts, the first one was
logged twice more as the second one.

This si almost the same code as the one of master but it fixes a
conflict during cherry picking in:
src/output-json-alert.c

10 years agoUpdate Changelog for 2.0.5 suricata-2.0.5
Victor Julien [Fri, 12 Dec 2014 10:34:21 +0000 (11:34 +0100)] 
Update Changelog for 2.0.5

10 years agoMake bad copy-mode be an error in runmode-tile. 1249/head
Ken Steele [Wed, 5 Nov 2014 16:43:40 +0000 (11:43 -0500)] 
Make bad copy-mode be an error in runmode-tile.

10 years agoBug 1329: error out on invalid rule protocol
Victor Julien [Fri, 5 Dec 2014 13:32:56 +0000 (14:32 +0100)] 
Bug 1329: error out on invalid rule protocol

Due to a logic error in AppLayerProtoDetectGetProtoByName invalid
protocols would not be detected as such. Instead of ALPROTO_UNKNOWN
ALPROTO_MAX was returned.

Bug #1329

10 years agounix-manager: fix cppcheck errors
Eric Leblond [Mon, 8 Dec 2014 13:49:16 +0000 (14:49 +0100)] 
unix-manager: fix cppcheck errors

This patch fixes the following errors:
 [src/unix-manager.c:306]: (error) Memory pointed to by 'client' is freed twice.
 [src/unix-manager.c:313]: (error) Memory pointed to by 'client' is freed twice.
 [src/unix-manager.c:323]: (error) Memory pointed to by 'client' is freed twice.
 [src/unix-manager.c:334]: (error) Memory pointed to by 'client' is freed twice.

Unix manager was treating the packet after closing the socket if message was
too long.

10 years agostream: don't send EOF to AppLayer too soon 1248/head
Victor Julien [Wed, 10 Dec 2014 16:31:57 +0000 (17:31 +0100)] 
stream: don't send EOF to AppLayer too soon

Sending EOF too soon results in the AppLayer cleaning up prematurely.

10 years agoCorrect flow memory usage bookkeeping error
Ken Steele [Wed, 19 Nov 2014 18:48:41 +0000 (13:48 -0500)] 
Correct flow memory usage bookkeeping error

Fix bug 1321 where flow_memuse was incremented more on allocation than
free.

10 years agohttp: don't crash when normalizing uri on low memory
Victor Julien [Wed, 3 Dec 2014 15:08:19 +0000 (16:08 +0100)] 
http: don't crash when normalizing uri on low memory

10 years agodefrag: don't crash when out of memory
Victor Julien [Wed, 3 Dec 2014 15:07:00 +0000 (16:07 +0100)] 
defrag: don't crash when out of memory

Handle memory allocation errors in defrag better. Could lead to
crashes if malloc errors happened.

10 years agopcre: fix var capture for non relative matches 1230/head
Victor Julien [Mon, 1 Dec 2014 09:36:52 +0000 (10:36 +0100)] 
pcre: fix var capture for non relative matches

Var capture setup depended on the match being relative due to a logic
error.

11 years agoFix to output a JSON buffer to an Unix domain socket.
Christophe M [Tue, 29 Jul 2014 14:20:34 +0000 (16:20 +0200)] 
Fix to output a JSON buffer to an Unix domain socket.

Create the JSON buffer and write to it like regular file.

Upper function SCConfLogOpenGeneric already handle it properly.

Closes issue #1246.

11 years agoMake suricata_ctl_flags be volatile
Ken Steele [Wed, 29 Oct 2014 19:43:42 +0000 (15:43 -0400)] 
Make suricata_ctl_flags be volatile

The global variable suricata_ctl_flags needs to volatile, otherwise the
compiler might not cause the variable to be read every time because it
doesn't know other threads might write the variable.

This was causing Suricata to not exit under some conditions.

11 years agostream/async: improve handling of syn/ack pickup
Victor Julien [Thu, 30 Oct 2014 10:07:38 +0000 (11:07 +0100)] 
stream/async: improve handling of syn/ack pickup

If we picked up the ssn with a syn/ack, we don't need to make more
assumptions about sack and wscale after that.

11 years agostream/async: fix session setup issues
Victor Julien [Thu, 30 Oct 2014 09:16:40 +0000 (10:16 +0100)] 
stream/async: fix session setup issues

For these 2 cases:

1. Missing SYN:
-> syn <= missing
<- syn/ack
-> ack
-> data

2. Missing SYN and 3whs ACK:
-> syn <= missing
<- syn/ack
-> ack <= missing
-> data

Fix session pickup. The next_win settings weren't correctly set, so that
packets were rejected.

Bug 1190.

11 years agoprscript: use master-2.0.x in master-2.0.x branch
Victor Julien [Wed, 29 Oct 2014 16:43:54 +0000 (17:43 +0100)] 
prscript: use master-2.0.x in master-2.0.x branch

11 years agostream: improve tracking with pkt loss in async 1192/head
Victor Julien [Sun, 26 Oct 2014 09:07:15 +0000 (10:07 +0100)] 
stream: improve tracking with pkt loss in async

If 3whs SYN/ACK and ACK are missing we can still pick up the session if
in async-oneside mode.

-> syn
<- syn/ack <= missing
-> ack     <= missing
-> data

Bug 1190.

11 years agoSuppress ARM valgrind warning 1185/head
Victor Julien [Sat, 18 Oct 2014 19:47:52 +0000 (21:47 +0200)] 
Suppress ARM valgrind warning

Not Suricata related, so suppress.

11 years agostream: improve bad window update detection
Victor Julien [Thu, 23 Oct 2014 10:54:13 +0000 (12:54 +0200)] 
stream: improve bad window update detection

Ignore more valid ACKs in FIN shutdown phase.

Improve heuristic for window shrinking in case of packet loss.

11 years agostream: fix 'bad window update' false positive
Victor Julien [Thu, 16 Oct 2014 16:38:19 +0000 (18:38 +0200)] 
stream: fix 'bad window update' false positive

ACK packets completing a valid FIN shutdown could be flagged as
'bad window update' if they would shrink the window.

This patch detects this case before doing the bad window update
check.

11 years agosanity check tcp SACK edges prior to recording. Attempt to avoid Cisco ASA
Tom DeCanio [Fri, 10 Oct 2014 16:40:37 +0000 (09:40 -0700)] 
sanity check tcp SACK edges prior to recording. Attempt to avoid Cisco ASA
tcp randomization issue with it not properly writing sequence numbers in SACK.

11 years agostream: improve handling of 3whs packet loss
Victor Julien [Thu, 16 Oct 2014 12:59:38 +0000 (14:59 +0200)] 
stream: improve handling of 3whs packet loss

If the 3whs ACK and some data after this is lost, we would get stuck
in the 'SYN_RECV' state, where from there each packet might be
considered invalid.

This patch improves the handling of this case.

11 years agostream: fix ssh/ssl logging on tcp session reuse
Victor Julien [Thu, 16 Oct 2014 12:54:22 +0000 (14:54 +0200)] 
stream: fix ssh/ssl logging on tcp session reuse

TCP session reuse wouldn't unset FLOW_NO_APPLAYER_INSPECTION.

11 years agossh.softwareversion: allow more characters
Victor Julien [Thu, 16 Oct 2014 12:41:59 +0000 (14:41 +0200)] 
ssh.softwareversion: allow more characters

The keyword would not allow matching on "OpenSSH_5.5p1 Debian-6+squeeze5"
as the + and space characters were not allowed.

This patch adds support for them.

11 years agoBug 1230: Check all SigMatch lists for a named byte_extract variable.
Jason Ish [Mon, 29 Sep 2014 16:00:06 +0000 (10:00 -0600)] 
Bug 1230: Check all SigMatch lists for a named byte_extract variable.

11 years agoBug 1230: Simple test case demonstrating failure.
Jason Ish [Mon, 29 Sep 2014 15:37:03 +0000 (09:37 -0600)] 
Bug 1230: Simple test case demonstrating failure.

11 years agoFix compiler warning about uninitialized variable in mpipe. 1159/head
Ken Steele [Tue, 12 Aug 2014 23:57:41 +0000 (19:57 -0400)] 
Fix compiler warning about uninitialized variable in mpipe.

11 years agotile: silence harmless cc warnings
Victor Julien [Wed, 8 Oct 2014 10:59:39 +0000 (12:59 +0200)] 
tile: silence harmless cc warnings

11 years agolua: improve configure checks
Victor Julien [Mon, 11 Aug 2014 12:14:59 +0000 (14:14 +0200)] 
lua: improve configure checks

The base 'lua' library has different names on different OS' and even
Linux distro's. Instead of selecting the proper one, we now just try
all. This way no OS/distro specific knowledge about the name is needed.

11 years agotcp session reuse: reset detect state
Victor Julien [Tue, 7 Oct 2014 09:27:54 +0000 (11:27 +0200)] 
tcp session reuse: reset detect state

Reset the detect state on TCP session reuse. We reset the app layer,
so we need to reset the stateful detection as well.

11 years agodetect state: always lock de_state_m
Victor Julien [Tue, 7 Oct 2014 09:25:25 +0000 (11:25 +0200)] 
detect state: always lock de_state_m

Always lock the de_state_m on access, also at flow recycle or
cleanup.

11 years agofilestore: fix parsing bug 1149/head 1150/head
Victor Julien [Tue, 30 Sep 2014 07:56:41 +0000 (09:56 +0200)] 
filestore: fix parsing bug

Filestore keyword can have options or no options, and the parser
was enforcing the NOOPT flag too strictly.

Bug #1288

11 years agoUpdate changelog for 2.0.4 suricata-2.0.4
Victor Julien [Tue, 23 Sep 2014 10:16:15 +0000 (12:16 +0200)] 
Update changelog for 2.0.4

11 years agossh: convert error message to debug statement
Victor Julien [Thu, 18 Sep 2014 08:13:18 +0000 (10:13 +0200)] 
ssh: convert error message to debug statement

Don't print errors based on traffic issues.

11 years agoapp-layer-ssh: fix banner parser
Eric Leblond [Fri, 12 Sep 2014 08:02:12 +0000 (10:02 +0200)] 
app-layer-ssh: fix banner parser

Carefully crafted SSH banner could result in parser error.

CVE 2014-6603

Signed-off-by: Eric Leblond <eric@regit.org>
Reported-By: Steffen Bauch
11 years agoipv6: RH extension header parsing issue
Victor Julien [Wed, 17 Sep 2014 12:26:27 +0000 (14:26 +0200)] 
ipv6: RH extension header parsing issue

A logic error in the IPv6 Routing header parsing caused accidental
updating of the original packet buffer. The calculated extension
header lenght was set to the length field of the routing header,
causing it to be wrong.

This has 2 consequences:

1. defrag failure. As the now modified payload was used in defrag,
the decoding of the reassembled packet now contained a broken length
field for the routing header. This would lead to decoding failure.

The potential here is evasion, although it would trigger:
[1:2200014:1] SURICATA IPv6 truncated extension header

2. in IPS mode, especially the AF_PACKET mode, the modified and now
broken packet would be transmitted on the wire. It's likely that
end hosts and/or routers would reject this packet.

NFQ based IPS mode would be less affected, as it 'verdicts' based on
the packet handle. In case of replacing the packet (replace keyword
or stream normalization) it could broadcast the bad packet.

Additionally, the RH Type 0 address parsing was also broken. It too
would modify the original packet. As the result of this code was not
used anywhere else in the engine, this code is now disabled.

Reported-By: Rafael Schaefer <rschaefer@ernw.de>
11 years agoaf-packet: check pointers before use
Victor Julien [Mon, 22 Sep 2014 15:33:40 +0000 (17:33 +0200)] 
af-packet: check pointers before use

11 years agoaf-packet: force suricata in IPS mode when needed
Eric Leblond [Fri, 19 Sep 2014 14:54:00 +0000 (16:54 +0200)] 
af-packet: force suricata in IPS mode when needed

AF_PACKET is not setting the engine mode to IPS when some
interfaces are peered and use IPS mode. This is due to the
fact, it is possible to peer 2 interfaces and run an IPS on
them and have a third one that is running in normal IDS mode.

In fact this choice is the bad one as unwanted side effect is
that there is no drop log and that stream inline is not used.

To fix that, this patch puts suricata in IPS mode as soon as
there is two interfaces in IPS mode. And it displays a error
message to warn user that the accuracy of detection on IDS only
interfaces will be low.

11 years agorule parser: set flag for optionless keywords 1129/head
Victor Julien [Fri, 19 Sep 2014 11:39:37 +0000 (13:39 +0200)] 
rule parser: set flag for optionless keywords

If a keyword doesn't have an argument, it should set the SIGMATCH_NOOPT
flag so the parser knows.

11 years agorule parser: fix crashing on malformed options
Victor Julien [Fri, 19 Sep 2014 11:38:47 +0000 (13:38 +0200)] 
rule parser: fix crashing on malformed options

Fix crashing on malformed rule options like 'rev;1;'.

Bug 1254.

11 years agolua: fix http.request_line 1127/head
Victor Julien [Thu, 18 Sep 2014 15:02:47 +0000 (17:02 +0200)] 
lua: fix http.request_line

The request line scripts were added to the AMATCH list. However, there
is not AppLayerMatch function defined for lua scripts. So scripts
would not run.

This patch adds the request line scripts to the normal 'MATCH' list.

Bug #1273.

11 years agotls: fix a tls.fingerprint issue in debug mode
Victor Julien [Fri, 19 Sep 2014 08:40:20 +0000 (10:40 +0200)] 
tls: fix a tls.fingerprint issue in debug mode

Print proper variable so we don't NULL-deref.

Bug #1279.

11 years agosource-nfq: fix display of next queue
Eric Leblond [Tue, 2 Sep 2014 13:33:34 +0000 (15:33 +0200)] 
source-nfq: fix display of next queue

Suricata was displaying an invalid queue number as the value is
shift at the moment of its assignement.

11 years agoBug fix: IPv6 addresses in negated range and IPv6 string into radix tree.
bmeeks8 [Fri, 5 Sep 2014 13:22:11 +0000 (09:22 -0400)] 
Bug fix: IPv6 addresses in negated range and IPv6 string into radix tree.

I found three somewhat serious IPv6 address bugs within the Suricata 2.0.x source code. Two are in the source module "detect-engine-address.c", and the third is in "util-radix-tree.c".

The first bug occurs within the function DetectAddressParse2(). When parsing an address string and a negated block is encountered (such as when parsing !$HOME_NET, for example), any corresponding IPv6 addresses were not getting added to the Group Heads in the DetectAddressList. Only IPv4 addresses were being added.

I discovered another bug related to IPv6 address ranges in the Signature Match Address Array comparison code for IPv6 addresses. The function DetectAddressMatchIPv6() walks a signature's source or destination match address list comparing each to the current packet's corresponding address value. The match address list consists of value pairs representing a lower and upper IP address range. If the packet's address is within that range (including equal to either the lower or upper bound), then a signature match flag is returned.

The original test of each signature match address to the packet was performed using a set of four compounded AND comparisons looking at each of the four 32-bit blocks that comprise an IPv6 address. The problem with the old comparison is that if ANY of the four 32-bit blocks failed the test, then a "no-match" was returned. This is incorrect. If one or more of the more significant 32-bit blocks met the condition, then it is a match no matter if some of the less significant 32-bit blocks did not meet the condition. Consider this example where Packet represents the packet address being checked, and Target represents the upper bound of a match address pair. We are testing if Packet is less than Target.

Packet -- 2001:0470 : 1f07:00e2 : 1988:01f1 : d468:27ab
Target -- 2001:0470 : 1f07:00e2 : a48c:2e52 : d121:101e

In this example the Packet's address is less than the target and it should give a match. However, the old code would compare each 32-bit block (shown spaced out above for clarity) and logically AND the result with the next least significant block comparison. If any of the four blocks failed the comparison, that kicked out the whole address. The flaw is illustrated above. The first two blocks are 2001:0470 and 1f07:00e2 and yield TRUE; the next less significant block is 1988:01f1 and a48c:2e52, and also yields TRUE (that is, Packet is less than Target); but the last block compare is FALSE (d468:27ab is not less than d121:101e). That last block is the least significant block, though, so its FALSE determination should not invalidate a TRUE from any of the more significant blocks. However, in the previous code using the compound logical AND block, that last least significant block would invalidate the tests done with the more significant blocks.

The other bug I found for IPv6 occurs when trying to parse and insert an IPv6 address into a Radix Tree using the function SCRadixAddKeyIPV6String(). The test for min and max values for an IPv6 CIDR mask incorrectly tests the upper limit as 32 when it should be 128 for an IPv6 address. I think this perhaps is an old copy-paste error if the IPv6 version of this function was initially copied from the corresponding IPv4 version directly above it in the code. Without this patch, the function will return null when you attempt to add an IPv6 network whose CIDR mask is larger than 32 (for example, the popular /64 mask will cause the function to return the NULL error condition).

(amended by Victor Julien)

11 years agoUpdate Changelog for 2.0.3 suricata-2.0.3
Victor Julien [Fri, 8 Aug 2014 07:49:18 +0000 (09:49 +0200)] 
Update Changelog for 2.0.3

11 years agostream: detect and filter out bad window updates 1093/head
Victor Julien [Wed, 16 Jul 2014 22:23:50 +0000 (00:23 +0200)] 
stream: detect and filter out bad window updates

Reported in bug 1238 is an issue where stream reassembly can be
disrupted.

A packet that was in-window, but otherwise unexpected set the
window to a really low value, causing the next *expected* packet
to be considered out of window. This lead to missing data in the
stream reassembly.

The packet was unexpected in various ways:
- it would ack unseen traffic
- it's sequence number would not match the expected next_seq
- set a really low window, while not being a proper window update

Detection however, it greatly hampered by the fact that in case of
packet loss, quite similar packets come in. Alerting in this case
is unwanted. Ignoring/skipping packets in this case as well.

The logic used in this patch is as follows. If:

- the packet is not a window update AND
- packet seq > next_seq AND
- packet acq > next_seq (packet acks unseen data) AND
- packet shrinks window more than it's own data size
THEN set event and skip the packet in the stream engine.

So in case of a segment with no data, any window shrinking is rejected.

Bug #1238.