Alessandro Guido [Fri, 19 Jun 2015 14:57:48 +0000 (16:57 +0200)]
Add option to omit payload in unified2 output
Add a boolean option named "payload" to the unified2-alert output type.
Such options makes suricata omit the payload in the resulting unified2
file. The default value is true in order to preserve the current behaviour.
Jason Ish [Mon, 15 Jun 2015 17:14:16 +0000 (11:14 -0600)]
defrag: tracker initialization cleanup
Remove the old tracker reset macro which is no longer being used.
Clear last_seen and remove flags on initialization.
Remove extra call to DefragTrackerInit as it was being called 2x
for each new tracker.
Now that DefragTrackerNew is just a wrapper for DefragTrackerAlloc,
remove it and just call DefragTrackerAlloc directly.
Jason Ish [Mon, 15 Jun 2015 17:06:50 +0000 (11:06 -0600)]
defrag: don't use trackers marked for removal
These trackers are likely for completed fragments, but have
not been cleaned up. If a packet on the same flow with an
already seen IP ID is seen, it could be reused prior to
being properly reinitialized.
Eric Leblond [Fri, 2 Oct 2015 21:40:54 +0000 (23:40 +0200)]
decode-mime: fix body md5 computation
Previous code was wrongly supposing the lines are ending with CRLF.
But this is not the case so we must propagate the length of end of
line delimiter to be able to compute the md5 of the mail body.
Eric Leblond [Tue, 15 Sep 2015 14:34:44 +0000 (16:34 +0200)]
output-json: add create header with tx function
To be able to correlate between events, it is better to have the
tx_id information in the root object. This function adds a new
function to automate the addition of the field.
Eric Leblond [Tue, 5 May 2015 09:55:46 +0000 (11:55 +0200)]
email-json: add capa to display subject md5
To be able to identify mails with identical subjects without
using the subject itself as a key, it is possible to use the md5
hash of the subjet string. This allows to limit the privacy impact.
Eric Leblond [Mon, 4 May 2015 16:11:37 +0000 (18:11 +0200)]
email-json: delete leading white spaces
Some mail clients are using tabulation and/or space for comma
separated list. This patch removes them so the event will contain
only significative characters.
Eric Leblond [Tue, 5 May 2015 12:33:50 +0000 (14:33 +0200)]
email-json: add custom fields support
This patch adds a way to specify which MIME fields to log via
the custom keyword in the EVE configuration. it also adds an
extended logging where some fields are added. The logging support
mono value fields as well as multivalue fields via the use of
JSON array.
Eric Leblond [Tue, 5 May 2015 12:31:55 +0000 (14:31 +0200)]
decode-mime: introduce MimeDecFindFieldsForEach
This patch introduces a new function that can be used to handle
multivalued MIME fields. A callback function can be called for
each corresponding field value.
Eric Leblond [Wed, 29 Apr 2015 16:25:05 +0000 (18:25 +0200)]
email-json: output MIME parsing status
If the status is not PARSE_DONE then in that case we may have
imcomplete information. Increasing the stream reassemly depth
in that case would be a good idea.
Eric Leblond [Fri, 24 Apr 2015 14:17:19 +0000 (16:17 +0200)]
decode-mime: compute body md5
This patch is computing the md5 sum of the body of the MIME message.
This will allow to detect messages with same content and sent to
different people.
Eric Leblond [Fri, 17 Apr 2015 14:13:23 +0000 (16:13 +0200)]
email-json: move email fields to email section
This patch changes the way smtp message are written. It is using
the "email" key to store the email related fields. This will
allow to do the same search through SMTP and IMAP if we implement
this last one.
Victor Julien [Sat, 19 Sep 2015 18:53:26 +0000 (20:53 +0200)]
mpm: redo uri maxlen logic
The mpm_uricontent_maxlen logic was meant to track the shortest
possible pattern in the MPM of a SGH. So a minlen more than a maxlen.
This patch replaces the complicated tracking logic by a simpler
scheme. When the SGH's are finalize, the minlen is calculated.
It also fixes a small corner case where the calculated "maxlen" could
be wrong. This would require a smaller pattern in a rule to be forced
as fast pattern.
Victor Julien [Thu, 27 Aug 2015 20:58:32 +0000 (22:58 +0200)]
proto detect: more bypass conditions
More exceptional cases for protocol detection. In very unbalanced flows,
where just a few bytes are sent toserver and many toclient, proto detect
might not complete in time on the toserver direction. This can lead to
queuing up many segments in the toclient direction.
Another case is that in come cases the stream is flagged as proto detect
done, but the flows proto detect flags are not set. This is now handled
by the ProtoDetectDone() check.
Victor Julien [Thu, 27 Aug 2015 16:57:48 +0000 (18:57 +0200)]
detect: fix issue with smsg and seq wraps
Due to a broken sequence number check, detect could fail to process
smsgs in case of a sequence wrap. This could lead to excessive use
of smsg's but also of segments, since these aren't cleared until the
smsg containing them is.
Victor Julien [Mon, 31 Aug 2015 16:50:06 +0000 (18:50 +0200)]
stream: use reassembly fast path after proto detect
Use the reassembly fast paths only after protocol detection has completed.
In some corner cases the sending of smaller segments lead to protocol
detection failing.
Victor Julien [Wed, 26 Aug 2015 14:15:07 +0000 (16:15 +0200)]
stream: fix protocol detection issue for GAPs
If the protocol required TOSERVER data first, but the SSN started with
a GAP, then the TOCLIENT side would get stuck in an expensive path:
1. it would run detection on TOCLIENT
2. it would try to force reassembly for TOSERVER
3. it would reset the detected protocol as TOSERVER failed
4. it would not evict any segment
This had 2 consequences:
1. on long running sessions this could lead to using lots of memory
on segments, denying other sessions resources
2. wasted cycles on protocol detection and segment list management
This patch introduces a fix. It checks in the (2) stage above, whether
the opposing stream (that we depend on) it is a NOREASSEMBLY state. If
so, it gives up on this side of the session as well.
Victor Julien [Wed, 26 Aug 2015 12:25:16 +0000 (14:25 +0200)]
stream: optimize proto detect segment handling
In case of protocol detection not yet being complete, the segment
list was walked unconditionally to unset the app layer processed
flag. Optimize this to bail on the first segment that doesn't have
the flag set.
Eric Leblond [Mon, 14 Sep 2015 08:55:04 +0000 (10:55 +0200)]
configure: use pkg_config for libhtp
It was not possible to simply specify PKG_CONFIG_PATH to build
with an non bundled libhtp. With this patch we don't need anymore
the htp lib and include configure options.