Commit Graph

5216 Commits (suricata-2.0.9)
 

Author SHA1 Message Date
Victor Julien 727274da0c changelog: update for 2.0.9 10 years ago
Victor Julien d7b0ec8c91 Fix two more potential issues like bug 1550 10 years ago
Alessandro Guido 7ab5fc34b3 Segfault fix 10 years ago
Victor Julien 83e6f924fb defrag tests: fix compiler warnings
defrag.c:2423:9: error: variable 'p' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2460:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2423:5: note: remove the 'if' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2423:9: error: variable 'p' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2460:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2423:9: note: remove the '||' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2423:9: error: variable 'p' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~
defrag.c:2460:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2423:9: note: remove the '||' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~
defrag.c:2427:5: note: variable 'p' is declared here
    Packet *p = Defrag(NULL, NULL, p1, NULL);
    ^
defrag.c:2486:9: error: variable 'p' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2523:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2486:5: note: remove the 'if' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2486:9: error: variable 'p' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2523:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2486:9: note: remove the '||' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2486:9: error: variable 'p' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~
defrag.c:2523:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2486:9: note: remove the '||' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~
defrag.c:2490:5: note: variable 'p' is declared here
    Packet *p = Defrag(NULL, NULL, p1, NULL);
    ^
6 errors generated.
make[3]: *** [defrag.o] Error 1
10 years ago
Jason Ish f9a6bcc611 defrag: stop reassembly at the first packet with more flags not set 10 years ago
Jason Ish d778b83d40 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.
10 years ago
Jason Ish 963f30b114 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.
10 years ago
Jason Ish 162887cfbf defrag: unit test for tracker reuse (current fails)
Will be fixed in subsequent commits as tracker reuse is fixed.
10 years ago
Victor Julien 21689eec93 compiler warning: array subscript has type char
util-rule-vars.c: In function ‘SCRuleVarsGetConfVar’:
util-rule-vars.c:77:5: error: array subscript has type ‘char’ [-Werror=char-subscripts]
     while (conf_var_name[0] != '\0' && isspace(conf_var_name[0])) {
     ^
cc1: all warnings being treated as errors
10 years ago
Victor Julien 58a321f857 stream: improve retransmission detection
Consider packets starting before last_ack and ending after it also
to be retransmissions. This way we can see if they are having
different data.
10 years ago
Jason Ish 0bcb24a03d detect-pcre: allow upper cases metachars for host (/W).
Redmine issue 1490.
10 years ago
Zopieux aaf0c18c30 stream_size operator comparison (fix issue #1488)
`DetectStreamSizeParse` was first checking if mode[0] is '<', which is true for both '<' and '<=', thus '<=' (and resp. '>=') is never matched. This patch does the `strcmp` to '<=' (resp. '>=') within the if block of '<' (resp. '>') to fix #1488.
10 years ago
Victor Julien f2d0ee98f2 stream: next_seq handling improvements
Allow next_seq updating to recover from cases where last_ack has been
moved beyond it. This can happen if ACK's have been accepted for missing
data that is later retransmitted.

This undoes some of the previous last_ack update changes
10 years ago
Victor Julien 74dda9f8f0 stream: fix bad last_ack update leading to gaps
A bad last_ack update where it would be set beyond next_seq could
lead to rejection of valid segments and thus stream gaps.

Update tests to reflect new last_ack/next_seq behaviour.
10 years ago
Jason Ish af14c08cbf rule vars: strip leading white space before looking up var. 10 years ago
Jason Ish 6e91906e3a logging: integrate rotation into SCConfLogOpenGeneric.
Addresses issue 1492, and will make it harder to omit
rotation on new outputs.
10 years ago
Jason Ish ffcce40658 flowbits: strip leading and trailing spaces in name
Redmine bug 1481. Strip leading and trailing white space. Factor
out parsing from setup while in here.
10 years ago
Victor Julien 15dd771fdc Update changelog for 2.0.8 release 10 years ago
Victor Julien 54870be2e5 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 ago
Pierre Chifflier 5f26824a4b Fix possible wrap in uint32_t addition in DER parser
Signed-off-by: Pierre Chifflier <pierre.chifflier@ssi.gouv.fr>
10 years ago
Victor Julien c0bdac7c5c 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 ago
Victor Julien 62c96ae312 tls: force 'raw' reassembly after each record
Trigger raw reassembly after each record and after the handshake.
10 years ago
Alexander Gozman e97b347df4 DetectAddressParseString(): fix IPv6 address handling 10 years ago
Victor Julien 66eb569eb6 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 ago
Victor Julien 8ba5d28813 threading: add missing locks to threading storage
Lock threading root lock when walking or updating the threading
storage for 'ThreadVars' objects.
10 years ago
Jason Ish 94795615a0 spelling - dubbed -> duped (for duplicate) 10 years ago
Jason Ish 46e9beffeb 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 ago
Jason Ish 4f614defe2 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 ago
Jason Ish 4ff85ba2e6 ParseSizeString - don't abort on unknown unit type. 10 years ago
Jason Ish 20e5c96934 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 ago
Jason Ish f92568b847 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 ago
Victor Julien f76e5de349 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.
11 years ago
Victor Julien 004248f699 detect-state: remove DeStateResetFileInspection
It was effectively unused.
11 years ago
Victor Julien 34fa7766f2 detect-state: remove redundant code 11 years ago
Victor Julien e3d2c5660a 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.
11 years ago
Victor Julien bb4d2de62a detect-state: add helper to indicate last tx
Add little helper to indicate current tx is that last we have.
11 years ago
Victor Julien b0d93bf8c5 detect-state: cleanup ContinueDetection
Only lock f->de_state->m when we start to access it. So after
declaration and initialization of local vars.
11 years ago
Victor Julien f2ae3f88dd detect-state: cleanup retvals
Use DETECT_ENGINE_INSPECT_SIG_* instead of 0, 1, 2 and 3.
11 years ago
Victor Julien 288a68b148 file: don't 'close' file if we need to track it 11 years ago
Victor Julien 0d7a319552 http: fix stat_msg and stat_code state tracking 11 years ago
Victor Julien eeb873b3a8 Update changelog for 2.0.7 11 years ago
Victor Julien ce5dee886a http: add event for suspicious method delimeter
Add event and rule for suspicious delim(s) between method and uri.

Add unittests as well.
11 years ago
Victor Julien 194debf5ff http: add libhtp uri warning event
Add event for libhtp warning added 0.5.17 for URI's with suspicious
delimeters.
11 years ago
Victor Julien acaae20958 stream: init global config after flow engine
Stream depends on flow engine.
11 years ago
Victor Julien b6714cdcf6 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
11 years ago
Victor Julien 89017d0b03 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.
11 years ago
Victor Julien 56196ace51 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
11 years ago
Victor Julien ff0b6b50a4 Fix make distcheck on CentOS 5.11
datarootdir was undefined. Define it.
11 years ago
Victor Julien 9622ddc731 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.
11 years ago
Victor Julien 0eb1273f57 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
11 years ago