The parser wasn't carrying out a bounds check on record length while
in the middle of parsing a handshake. As a result we would step onto the
next record header and consider it a part of the current handshake.
- Contains an unittest to test the issue.
- Disable the duplicate parser unittest registration.
The issue came to light through an irregular ssl record, which was
reported by Sebastian Roschke, via CVE-2013-5919.
Thanks to Sebastian Roschke for reporting this issue.
Content strings that are a duplicate of a pattern from another sig, but
have a fast_pattern chop being applied, would end up being assigned the
same pattern id as the duplicate string. But the string supplied to the
mpm would be the chopped string, which might result in the state_table
output_state content entry being over-riden by the the fuller string at
the final state of the smaller content length, because of which during a
match we might end up inspecting the search buffer against the fuller
content pattern, instead of the chopped pattern, which would end up being
an inspection beyond the buffer bounds.
Content strings that are a duplicate of a pattern from another sig, but
have a fast_pattern chop being applied, would end up being assigned the
same pattern id as the duplicate string. But the string supplied to the
mpm would be the chopped string, which might result in the state_table
output_state content entry being over-riden by the the fuller string at
the final state of the smaller content length, because of which during a
match we might end up inspecting the search buffer against the fuller
content pattern, instead of the chopped pattern, which would end up being
an inspection beyond the buffer bounds.
Content strings that are a duplicate of a pattern from another sig, but
have a fast_pattern chop being applied, would end up being assigned the
same pattern id as the duplicate string. But the string supplied to the
mpm would be the chopped string, which might result in the state_table
output_state content entry being over-riden by the the fuller string at
the final state of the smaller content length, because of which during a
match we might end up inspecting the search buffer against the fuller
content pattern, instead of the chopped pattern, which would end up being
an inspection beyond the buffer bounds.
Anoop Saldanha [Thu, 29 Aug 2013 17:28:04 +0000 (22:58 +0530)]
Modify handling of negated content.
The old behaviour of returning a failure if we found a pattern while
matching on negated content is now changed to continuing searching
for other combinations where we don't find the pattern for the
negated content.
Eric Leblond [Fri, 2 Aug 2013 11:12:37 +0000 (13:12 +0200)]
solaris: fix compilation failure
This patch fixes a compilation failure on Solaris. Compiler does
not support when a function returning void is used in return of
an other function returning void.
Patch obtained thanks to coccinelle and the following semantic
patch:
Eric Leblond [Thu, 11 Jul 2013 09:52:54 +0000 (11:52 +0200)]
use Packet test macro
This patch updates the code to use Packet test macro instead of
direct test on action flag instead Packet structure. This fixes
the issues related to p->root->action being set and not detected
in tests.
Anoop Saldanha [Thu, 13 Jun 2013 14:54:55 +0000 (20:24 +0530)]
Fix the bug specified in the previous commit.
Bug emanates from byte_test, byte_jump and byte_extract keyword being
unable to handle negative offsets when the inspection pointer is at the
end of the buffer.
Anoop Saldanha [Sat, 25 May 2013 05:08:13 +0000 (10:38 +0530)]
fix for #788.
Now depth is kept in mind when we inspect chunks in client/server body.
This takes care of FPs originating from inspecting subsequent chunks that
match with depth, but shouldn't.
Anoop Saldanha [Thu, 9 May 2013 03:22:05 +0000 (08:52 +0530)]
1. Fix assignment of signums, which affected how we used read sigs(priority wise) inside staging.
Previously we would assign signums before sig ordering, and hence the
order didn't actually reflect the order of the sig in the
sig_list(assuming sig reordering changed the sig_list). Staging would
use the old sig_nums to decide the priority of sigs.
2. Fix sig ordering for flowvar, flowbits, flowint, pktvar sigs. We have
introduced a new priority to treat sigs with set + read as lower
priority compared to set only sigs.
3. Previously we treated sigs with a "priority(keyword)" > another sig's
priority, as a sig with greater priority than the later. We have
reversed it. Now the sig priority ordering is 1,2,.etc. Updated
sigordering unittests to reflect the same.
Victor Julien [Tue, 16 Apr 2013 19:47:42 +0000 (21:47 +0200)]
flowvar: fix deadlock with http buffers
Bug #801
Flowvars are set from pcre, and lock the flow when being set. However
when HTTP buffers were inspected, flow was already locked: deadlock.
This patch introduces a post-match list in the detection engine thread
ctx, where store candidates are kept. Then a post-match function is used
to finalize the storing if the rule matches.
Solves the deadlock and brings the handling of flowvars more in line
with flowbits and flowints.
Anoop Saldanha [Wed, 27 Mar 2013 09:25:05 +0000 (14:55 +0530)]
Update the way we handle http_host keywords.
Previously we would have forced all users to use nocase with http_host
keywords(since the hostname buffer is lowercase).
We now error out on sigs that has nocase set with http_host set. Also if
the http_host pattern or http_host pcre has an uppercase character set, we
invalidate such sigs. Unittests also updated to reflect the above change.
Eric Leblond [Tue, 26 Mar 2013 17:24:46 +0000 (18:24 +0100)]
Don't try to sniff 'default' interface
Whan running suricata via 'suricata --af-packet', the list of interfaces
was containing the 'default' interface and sniffing it was attempted.
This was not wanted.
Anoop Saldanha [Wed, 27 Mar 2013 12:27:55 +0000 (17:57 +0530)]
Handle the case of pcre combined with a relative content, where pcre has the set to match from start of line and we discontinue matching on not finding match.
Eric Leblond [Thu, 28 Feb 2013 15:52:43 +0000 (16:52 +0100)]
pcap-file: treat the case of unsupported pcap link
In unix socket mode, Suricata was stopping processing pcap files
when a pcap file with an unsupported datalink was treated. This
patch updates error handling to allow Suricata to treat other
pcap files.
Eric Leblond [Tue, 22 Jan 2013 09:47:29 +0000 (10:47 +0100)]
suricatasc: update python packaging
'make install' install now suricatasc script and Python module to
the system. The suricatasc client module can now be used in other
Python projects by using 'import suricatasc'.
A transformation was needed for distribution of a module and a script.
Module in src directory is now containing most of the code and the
script only handle argument parsing and the creation of a unix socket
client through 'suricatasc' module.
Eric Leblond [Thu, 6 Dec 2012 10:21:57 +0000 (11:21 +0100)]
suricatasc: refactor as a class
The goal of this commit is to be able to use suricatasc has a library
and and program. This is done by putting all active code in class and
adding a Python magic to detect when file is used as a program.
Eric Leblond [Fri, 30 Nov 2012 19:47:47 +0000 (20:47 +0100)]
suricatasc: real cmd line parsing and verbose mode
This patch adds commandline parsing and help to suricatasc. It also
adds a verbose mode (-v) where the send and received JSON object are
shown. This should ease development of unix socket client.