Commit Graph

8468 Commits (suricata-4.0.6)
 

Author SHA1 Message Date
Victor Julien acd30a4397 detect/filehash: try to open data file from rulefile dir
If the data file can't be found in the default location, which
normally is 'default-rule-path', try to see if it can be found
in the path of the rule file that references it.

This makes QA much easier.
7 years ago
Victor Julien 8f32fad935 flow: flag packets as established for async
If a stream is async we see only on side of the traffic. This would
lead to the flow engine not flagging packets as 'established' even
if the flow state was in fact established. The flow was tagged as
such by the TCP engine.

This patch considers the flow state for setting the packet flag.

Bug #2491.
7 years ago
Victor Julien d036374749 enip: support gaps
Due to a bug in the GAP handling the TCP layer the parser would already
get data after GAPs before.
7 years ago
Victor Julien efaa7f13de stream: improve overlap detection
Improve detection of overlapping different data. Keep some data around
even if it was already ACK'd to check if packets have overlap.
7 years ago
Eric Leblond 778e0d1fa7 stream-tcp: fix stream depth computation
The stream depth computation was partly done with the stream_config
depth instead of using the value in the TCP session. As a result,
some configuration were resulting in abnormal behavior.

In particular, when stream depth was 0 and the file store depth was
not 0, Suricata was stopping the streaming on the flow as soon as
the filestore was started.

Reported-by: Pascal Delalande <pdl35@free.fr>
7 years ago
Victor Julien 076c02a223 stream: expand GAP detection 7 years ago
Victor Julien b6d0a4ee42 stream/app-layer: fix GAP handling issue
Fix case where data after GAP was processed as in order data by app-layer.
This happened even if protocol parser did not register to accept GAPs.
7 years ago
Maurizio Abba 8ec005afd6 detect: fix fileext and filename negated match
fix bug in fileext and filename preventing negated match to work
correctly. Previously, negated fileext (such as !"php") would cause a
match anyway on files that have extension php, as the last if would not
be accessed.

Using the same workflow as detect-filemagic we remove the final
isolated if and set it as a branch of the previous if.
7 years ago
Victor Julien 8771a02989 dcerpc: fix dce_iface not matching 7 years ago
Victor Julien 279d328439 changlog: update for 4.0.5 7 years ago
Victor Julien 186391423e mpm/hs: fix minor coverity warning
CID 1428797 (#1 of 1): Unchecked return value (CHECKED_RETURN)
    check_return: Calling HashTableAdd without checking return value
    (as is done elsewhere 5 out of 6 times).
7 years ago
Victor Julien 7e666c3443 enip: harden byte parsing code
Make sure we never read more than we have.

Reported-by: Henning Perl
7 years ago
Victor Julien 4dc26b3ae8 ssh: fix out of bounds read in banner parsing
Reported-by: Henning Perl
7 years ago
Jason Ish a3e0889ce3 rust/dns - remove extra parantheses
Removes rust compiler warning.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/2521
7 years ago
Victor Julien fbec94b79a detect/debug: suppress noisy info messages 7 years ago
Jason Ish 1b70e6a3ed yaml-loader: fix memory leak on fail include
Redmine issue:
https://redmine.openinfosecfoundation.org/issues/1929

If an include failed to load, either by the file not existing or
a parse error, the file pointer and yaml parser instance were
leaked.
7 years ago
Victor Julien 82fa3bc124 detect: fix memory leak in app-layer-event keyword
Bug #2515.
7 years ago
Victor Julien 0a6ff87761 http: fix setting event on the last tx 7 years ago
Victor Julien 92bc5766f4 http: set events for too many layers of compression
libhtp would already issue warnings, but these were not mapped
to events yet.
7 years ago
Victor Julien 23e93b1264 stream: support RST getting lost/ignored
In case of a valid RST on a SYN, the state is switched to 'TCP_CLOSED'.
However, the target of the RST may not have received it, or may not
have accepted it. Also, the RST may have been injected, so the supposed
sender may not actually be aware of the RST that was sent in it's name.

In this case the previous behavior was to switch the state to CLOSED and
accept no further TCP updates or stream reassembly.

This patch changes this. It still switches the state to CLOSED, as this
is by far the most likely to be correct. However, it will reconsider
the state if the receiver continues to talk.

To do this on each state change the previous state will be recorded in
TcpSession::pstate. If a non-RST packet is received after a RST, this
TcpSession::pstate is used to try to continue the conversation.

If the (supposed) sender of the RST is also continueing the conversation
as normal, it's highly likely it didn't send the RST. In this case
a stream event is generated.

Ticket: #2501

Reported-By: Kirill Shipulin
7 years ago
Victor Julien f4d5af76a8 stream-events: fix mapping 7 years ago
Victor Julien f2ba4864d6 detect/stream_size: code cleanups 7 years ago
Victor Julien 747f042ad6 detect/stream_size: apply rule to packets & stream
The use of stream_size in combination with raw content matches is an
indication that the rule needs to be evaluated per packet, not just
per reassembled stream chunk.
7 years ago
Eric Leblond bff3c662f5 util-random: fix detection of getrandom failure 7 years ago
Eric Leblond 60fc0f9433 util-random: workaround getrandom unavailability
getrandom syscall availability is detected at runtime. So it is
possible that the build is done on a box that supports it but
the run is done on a system with no availability. So a workaround
solution is needed to fix this case.

Also we have seen some issue in docker environment where the build
is detecting getrandom but where it does not work at runtime.

For both reasons, the code is updated to have a call to a fallback
function if ever the getrandom call returns that the syscall is
not available.
7 years ago
Elazar Broad 554ddab330 Fix segfault when the protocol is anything other than HTTP
When a file is transferred over anything other than HTTP, the previously hard-coded HTTP protocol would trigger a non-existent index into htp_list_array_get(), causing a segfault. This patch mimics the logic in detect-lua-extensions.c.
7 years ago
Pierre Chifflier 3f6d488262 Update ntp-parser to 0.2.0 7 years ago
Eric Leblond 96442ab6df util-ioctl: fix a typo in setter message 7 years ago
Eric Leblond b72731652a af-packet: dump counters when timeout occurs
When traffic is becoming null (mainly seen in tests) we reach the
situation where there is timeouts in the poll on the socket and
only that. Existing code is then just looping on the poll and
the result is that the packet iface counters are not updated.

This patch calls the dump counter function to be sure to get
the counter right faster (and not only right at exit).
7 years ago
Victor Julien 4af55a586b hyperscan: don't abort on payloads > 64k
SPM API was recently updated to accept 32 bit length fields instead of
16 bits. This could trigger a BUG_ON in the hyperscan implementation.
7 years ago
Maurizio Abba 578c5bfbdc detect: fix buffer length to uint32
There is a difference in the size of the buffer length as passed from
the content buffers (cfr HttpReassembledBody.buffer_len) and the buflen
variable passed to mpm primitives. This can cause a misdetection
whenever the bufferlen is multiple of 65536 (as uint16(X*65536) == 0).
Increasing the buflen variable type to uint32 solves the issue (this
does not cause any issue with primitives, they all accept uint32).
7 years ago
Victor Julien 10b3c840df mpm/ac-ks: coding style fixes 7 years ago
Victor Julien 31d53a84e2 unified2: address strict aliasing issue 7 years ago
Victor Julien 51691bab10 decode/ipv6: expose addr as 'struct in6_addr' as well 7 years ago
Victor Julien 11b244b399 configure: fix small issue with libevent check 7 years ago
Alexander Gozman b29ddde846 Bug #2466: map SC_LOG_CONFIG level to syslogs LOG_DEBUG 7 years ago
Alexander Gozman 346eff94b0 Print syslog format with SCLogDebug() instead of printf() 7 years ago
Victor Julien 97107a18c1 doc: add by_either to suppress explanation 7 years ago
Victor Julien 1f17d8e5d0 doc: minor fix 7 years ago
Renato Botelho 13d5a5d174 configure: allow to disable libnss and libnspr
Let user chose to disable libnss and libnspr support even if these
libraries are installed in the system. Default remains to enable when
libraries are found and disable parameter were not used
7 years ago
Victor Julien dcea07f8d6 nfs/rpc: fix reponse parsing 7 years ago
Victor Julien 69897af6f6 wirefuzz: add 'quiet' mode
Adds -q commandline option to force quiet operation.
7 years ago
Victor Julien c803656dcf htp: cleanup and fix test 7 years ago
Victor Julien b028207462 http: add tests for header folding
To test for https://github.com/OISF/libhtp/issues/159
7 years ago
Victor Julien 7b3ba37bac http: clean up unittest 7 years ago
Victor Julien 260095a41d pcap-log: don't divide by 0 on no traffic 7 years ago
Victor Julien 2c95f63d2a output: fix logging wrong direction in tls upgrade
When upgrading to TLS from HTTP logging of the final HTTP tx could
have the wrong direction. This was due to the original packet triggering/
finalizing the upgrade would be used as the base for both the toserver
and toclient pseudo packet meaning it was wrong in one direction.

This patch creates a pseudo packet in the same way as the flow timeout
code does, so it no longer takes the raw original packet in.

Bug #2430
7 years ago
Victor Julien 2eadd77e10 changelog: update for 4.0.4 8 years ago
Victor Julien add7b188f4 rust/nfs: fix memory leak 8 years ago
Victor Julien 19af022620 autogen/rust: remove Cargo.lock
Remove Cargo.lock to avoid issues when updating Cargo.toml
8 years ago