Commit Graph

7009 Commits (suricata-3.1.4)
 

Author SHA1 Message Date
Victor Julien caede94709 changelog: update to 3.1.4 9 years ago
Jason Ish 5c34a87b47 defrag - take protocol into account during re-assembly
The IP protocol was not being used to match fragments with
their packets allowing a carefully constructed packet
with a different protocol to be matched, allowing re-assembly
to complete, creating a packet that would not be re-assembled
by the destination host.
9 years ago
Sascha Steinbiss 4b6e804146 mpm-ac: fix integer overflow on allocation
The size of a memory buffer to be allocated was kept in a signed int
instead of a size_t, leading to an overflow when large lists of long
and diverse patterns cause the amount of AC states to blow up (>2GB).
Fixes Redmine issues #1827 and #1843.

Signed-off-by: Sascha Steinbiss <sascha@steinbiss.name>
9 years ago
Victor Julien d5b01e1825 detect: don't run IP inspection on non-IP packets
The code to get the rule group (sgh) would return the group for
IP proto 0 instead of nothing. This lead to certain types of rules
unintentionally matching (False Positive).

Since the packets weren't actually IP, the logged alert records
were missing the IP header.

Bug #2017.
9 years ago
Eric Leblond 4979d098c5 af-packet: add VLAN header when needed in IPS mode
When packet is coming from a real ethernet card, the kernel is
stripping the vlan header and delivering a modified packet so
we need to insert the VLAN header back before sending the packet
on the wire.

To do so, we pass an option to the raw socket to add a reserve
before the packet data. It will get Suricata some head room to
to move the ethernet addresses before there actual place and
and insert the VLAN header in the correct place.

We get VLAN info from the ring buffer as the call of AFPWrite is
always done in the release function so we still have access to the
memory.
9 years ago
Victor Julien 4033db2fd6 profiling: fix memory leaks 9 years ago
Andreas Herz fb71d4d9bf app-layer-parsing: detect malformed input
If the app-layer-parsing has a very long content it exceeds the maximum
defined in "alproto_name". This adds a check for the too long content
before it will be passed to "strlcpy" and logs an error.
9 years ago
Andreas Herz a068a254f4 configure: prevent combination of unittests and debug-validation 9 years ago
Eric Leblond 8da9258d58 util-file: introduce new functions for file size
This patch introduces the FileDataSize and FileTrackedSize functions.
The first one is just a renaming of the initial FilSize function
whereas the other one is using the newly introduced size field as
value.
9 years ago
Eric Leblond 154ceafb2c output-json-file: use size instead of FileSize
FileSize is not returning the actual value when file store is not
used.
9 years ago
Eric Leblond 6cdfb38569 util-file: change file size computation
The file size returned by FileSize is invalid if file store is not
used so we introduce a new size field in File structure that is used
to store the size.
9 years ago
Victor Julien 8b7313ec13 address parsing: fix memory leak in error path 9 years ago
Victor Julien 78bac4beb2 hyperscan: fix minor coverity issue in error path
*** CID 1398951:  API usage errors  (LOCK)
/src/util-mpm-hs.c: 722 in SCHSPreparePatterns()
716         SCMutexUnlock(&g_db_table_mutex);
717
718         SCHSFreeCompileData(cd);
719         return 0;
720
721     error:
>>>     CID 1398951:  API usage errors  (LOCK)
>>>     "pthread_mutex_unlock" unlocks "g_db_table_mutex" while it is unlocked.
722         SCMutexUnlock(&g_db_table_mutex);
723         if (pd) {
724             PatternDatabaseFree(pd);
725         }
726         if (cd) {
9 years ago
Mats Klepsland a3500ec3fc tls-store: fix bug that causes Suricata to crash
Fix bug that causes Suricata to crash when the tls.store keyword is used.

*** Error in `/usr/bin/suricata': free(): invalid next size (fast):
0x00007fd4b4373180 ***
9 years ago
Victor Julien 899c144799 common: improve BUG_ON
When BUG_ON is a wrapper for assert(), we risk getting rid of certain
code lines. Assert is a no-op when NDEBUG is defined.

This patch defines an alternate path for BUG_ON that exits after
printing an error.

Bug #2003.
9 years ago
Andreas Herz d2b5696273 decode-icmpv6: add missing types
There have been some ICMPv6 types missing within the DecodeICMPV6 that
are added by this commit and the code check is adjusted to always use
the DEFINE.
9 years ago
Eric Leblond b90466fa99 smtp: commands and replies are not case sensitive
RFC states that "Commands and replies are not case sensitive" and
patterns were registered to be case sensitive. So this patch fixes
a trivial evasion of SMTP signatures.
9 years ago
Jason Ish 9b9f1d8653 log-pcap: use a snaplen of 262144 instead of -1.
Newer versions of libpcap will not open pcap files with a
snaplen of -1, instead use the current maximum value of
262144.

Issue:
https://redmine.openinfosecfoundation.org/issues/1987
9 years ago
Victor Julien e8198d4404 hostbits/xbits: free hostbit
Fix memory leak. Hostbits were not actually freed.

Bug #1975.
9 years ago
Victor Julien 09265b70f8 http: allow lower/mixed case in proto detect
In HTTP detection registered patterns were upper case only. Since the
detection is based on both sides this would still work for sessions
where one of the talkers misbehaved. If both sides misbehave this
would fail however, so this patch introduces case insensive matching.
9 years ago
Alexander Gozman 63cc744210 Fix port parsing in config file, added one more corresponding test.
Some examples from wiki caused parsing errors.
For example, "[1:80,![2,4]]" was treated as a mistake.

Also fixed loop detection in variables declaration. For example,
'A: "HOME_NET, !$HOME_NET"' resulted in parsing error.
9 years ago
Jason Ish 4b068be101 issue 1961: depth: fail if numeric value has trailing text
Catches the case where the depth is not terminated with a
semicolon (eg: "depth:17 classtype:trojan-activity") which
is usually a sign the rule has a missing semi-colon.
9 years ago
Victor Julien b802647c98 qa: update url in libhtp script 9 years ago
Victor Julien b903b190ab dns: fix outputs with 0-len A/AAAA records 9 years ago
Victor Julien 2bc5bacd5b dns: fix out of bounds read
On a zero size A or AAAA record, 4 or 16 bytes would still be
read.

Found with AFL+ASAN.
9 years ago
Jason Ish a2e33c0bec dns: accept a data length of 0 without marking as malformed
Addresses issue:
https://redmine.openinfosecfoundation.org/issues/1924
9 years ago
Jason Ish ef5a492e0d dns-events: fix direction of malformed events + typo 9 years ago
Jason Ish 342d74f871 common: define json_boolean when not defined
Older versions of jansson in current use don't have this
macro defined.
9 years ago
Tom DeCanio 9971e67518 util-decode-mime: remove quote from boundary= string.
remove quote from the end of the boundary= string.  This was throwing off
the mime parser so that it wouldn't always catch mime boundaries causing
things like missed attachments.
9 years ago
Victor Julien df926bb437 defrag: small event cleanup 9 years ago
Victor Julien bf10f8a217 decoder-event: BUG_ON on table mismatches
Abort when the event enum and the name<>event table are not matching.
9 years ago
Jason Ish 5391e70292 macOS: thread return value affects newer macOS as well
ALl OS X/macOS versions since 10.10 return EDEADLK here instead
of EBUSY. Assume they will moving forward as well.
9 years ago
Jason Ish 59ad35a936 pcap-log: cleanup allocations at exit
Particularly in multi-mode, allocations made for each thread were
not being cleaned.

ASAN reports no leaks now on exit.
9 years ago
Eric Leblond 914a3135f0 stream: fix depth reached detection
When a segment only partially fit in streaming depth, the stream
depth reached flag was not set resulting in a continuous
inspection of the rest of the session.

By setting the stream depth reached flag when the segment partially
fit we avoid to reenter the code and we don't take anymore a code
path resulting in the flag not to be set.
9 years ago
Victor Julien 253a684fdd Update Changelog for 3.1.3 9 years ago
Victor Julien 8f085e4b8c eve: make payload printing in alerts more robust 9 years ago
fooinha 90276f0fa7 eve: check redis reply in non pipeline mode
We may lose the reply if disconnection happens.
Reconnection is needed.
9 years ago
Jason Ish d35613ff4a fast-pattern: fix tls_sni
Use all 32 arguments in call to SigMatchGetLastSMFromLists

Was preventing fast_pattern from being applied to tls_sni:
https://redmine.openinfosecfoundation.org/issues/1941
9 years ago
Jason Ish 3973dd58ba dns: use new unittest macros 9 years ago
Jason Ish e62b3c632e dns: support back to back requests without a response
Address the issue where a DNS response would not be logged when
the traffic is like:
- Request 1
- Request 2
- Response 1
- Response 2
which can happen on dual stack machines where the request for A
and AAAA are sent out at the same time on the same UDP "session".

A "window" is used to set the maximum number of outstanding
responses before considering the olders lost.
9 years ago
Jason Ish db490228b9 tcp dns: unit test for multi-request buffer 9 years ago
Jason Ish 88559b9d60 tcp dns: fix advancement to next request in buffer
The advancement through the buffer was not taking into account
the size of the length field resulting in the second request
being detected as bad data.
9 years ago
Victor Julien 79cafc548f multi-tenants: fix minor memleak 9 years ago
Victor Julien 3bac252595 detect: suppress debug message for reloads 9 years ago
Victor Julien 8c13d38511 nfq_set_mask: don't set mark on tunnel pkts 9 years ago
Victor Julien 06bdd337e7 tls-rules: install on 'make install-full' 9 years ago
Victor Julien 49ffe2f212 unix-socket: don't try to change permissions on BSD
On BSD using fchmod on a socket is not supported and will result
in EINVAL.
9 years ago
Victor Julien 6e7310e34a bug 1353: don't cut off last char of unix path 9 years ago
Victor Julien f8ded6f473 pcre: disable JIT if RWX pages not supported 9 years ago
Victor Julien 6bbce4fe7f util: add facility to check for RWX page support
Some code won't work well when the OS doesn't allow RWX pages. This
page introduces a check for runtime evaluation of the OS' policy on
this.

Thanks to Shawn Webb from HardenedBSD for suggesting this solution.
9 years ago