Commit Graph

12549 Commits (809aebfee183c680ae14e4d58316e477fad0dca0)
 

Author SHA1 Message Date
Shivani Bhardwaj 809aebfee1 release: 6.0.12; update changelog 3 years ago
Victor Julien 145cf4355c github-ci: add windivert build
(cherry picked from commit 74326a43e7)
3 years ago
Jason Ish 57a91d3342 github-ci: add windows build for libpcap
(cherry picked from commit 5037c86b49)
3 years ago
Jason Ish 298f68fd74 configure: fallback to libpcap on Windows
If npcap/wpcap is not found on Windows, try libpcap. This allows
Suricata to build without NPCap on Windows, however live capture won't
be available.

(cherry picked from commit 31ba4fd152)
3 years ago
Victor Julien 18a71913e3 respond/reject: fix IPv6 TCP resets
Fix length and next header field settings.

Bug: #6038.
(cherry picked from commit 235ee36211)
3 years ago
Victor Julien 8acf711667 respond/reject: minor code cleanups
(cherry picked from commit 1f0aed0775)
3 years ago
Victor Julien 2084354426 respond/reject: minor cleanups
(cherry picked from commit adf0bef7f0)
3 years ago
Morris Chan e10cd5618b yaml: grammar fixup
(cherry picked from commit b9aac6dd18)
3 years ago
Victor Julien 017c689078 doc: fix description of iptables rules
(cherry picked from commit a006aef4d0)
3 years ago
Andreas Herz c9bde24756 doc: add note on the hashsize recommendation for datasets
(cherry picked from commit 3045e75ee1)
3 years ago
Victor Julien 653379fb01 doc/install: point to userguide
(cherry picked from commit 4dbdaf8a8e)
3 years ago
Victor Julien b63ea6e584 doc: remove legacy windows install guide
(cherry picked from commit 19cabc9a02)
3 years ago
Victor Julien 8d316f7de5 doc: remove legacy pfring install guide
(cherry picked from commit 01f43604b9)
3 years ago
Victor Julien bf382a6672 prscript: remove as it is obsolete
(cherry picked from commit 9520aac79c)
3 years ago
Wes Hurd e7690edb21 doc: add docutils.conf to disable smart quotes
(cherry picked from commit aee41957e1)
3 years ago
Shivani Bhardwaj e95e9281ca smtp: return on line completion
Problem:
If we receive a long line w/o LF, we cap it to 4k bytes and wait until a
line with LF comes in order to consider the previous line complete. Any
data post the 4k bytes is discarded. Currently, if a line with LF comes
in after a long line, we reset all the parameters used for processing it
like the line.len and line.delim_len but we still make the call to
SMTPProcessRequest fn without even the need to process anything. Since
such a line (with len and delim_len set to 0) should not reach mime
decoder, a debug assertion triggers there in this case.

Fix:
Make sure to return early as the line has to be skipped and not
processed at all.

Bug 6019

(cherry picked from commit c0067a5fff)
3 years ago
tianjinshan 708bdf79fa smb/ntlmssp: fix parsing of negotiate flags
Ticket: #5783
(cherry picked from commit 2c0c6cb0a5)
3 years ago
Jeff Lucovsky cb71800f7b pfring: Packet structure for ts fix
Issue: 5818

This commit addresses the issue with using the address of a packed
member of a structure. The pfring timeval is within a packed structure.

(cherry picked from commit 2d28c09ea1)
3 years ago
Jeff Lucovsky 0730fdcd6b add to doc/pfring: Document additional cluster types
(cherry picked from commit 0ad6d4358f)
3 years ago
Jeff Lucovsky d782647af8 gen: Typo correction
This commit fixes various typos in the pf-ring source modules.

Issue: 5975
(cherry picked from commit e26e7b4f0a)
3 years ago
Jeff Lucovsky 32da57bce3 config/pf-ring: Change default cluster type: cluster_flow
This commit changes the default pf-ring cluster type to cluster-flow.
Round-robin clustering is not recommended for Suricata.

Issue: 5975
(cherry picked from commit 4f7a36ac2e)
3 years ago
Jeff Lucovsky 28026024c3 config/pf-ring: Recognize and set add'l cluster types
This commit extends the pf-ring config parser to recognize the
additional cluster types:
- cluster_inner_flow
- cluster_inner_flow_2_tuple
- cluster_inner_flow_4_tuple
- cluster_inner_flow_5_tuple

Issue: 5975
(cherry picked from commit b21a4ded6e)
3 years ago
Jeff Lucovsky a5752d138e pf-ring: Add add'l cluster types
This commit adds preprocessor values for additional pf-ring
cluster-types:
- CLUSTER_INNER_FLOW
- CLUSTER_INNER_FLOW_2_TUPLE
- CLUSTER_INNER_FLOW_4_TUPLE
- CLUSTER_INNER_FLOW_5_TUPLE

Issue: 5975
(cherry picked from commit 0ac3bee423)
3 years ago
Jeff Lucovsky ae15d3369c config/pfring: Document add'l pf-ring cluster types
This commit adds additional cluster-types for use with the pf-ring
packet source.

Issue: 5975
(cherry picked from commit 62f4049705)
3 years ago
Jeff Lucovsky 581c06bee5 doc/pfring: Document additional cluster types
This commit adds brief discussion for additional cluster types for use
with the pf-ring packet source.

Newly added:
- cluster_inner_flow
- cluster_inner_flow_2_tuple
- cluster_inner_flow_4_tuple
- cluster_inner_flow_5_tuple

Issue: 5975
(cherry picked from commit b1918168f9)
3 years ago
Victor Julien 10d6c8796e stream: check debug check for multi-SYN/ACK in TFO
(cherry picked from commit 89c947129d)
3 years ago
Lukas Sismis a025070cc4 runmodes: introduce unknown engine runmode
To prevent unset values of engine runmode,
this commit introduces unknown runmode which
can detect when engine runmode is being used
uninitialized.

Ticket: #6033
3 years ago
Lukas Sismis 3c4bdf08de runmodes: earlier evaluation of IPS mode
Move evaluation of engine runmode to an earlier
phase so that dependend modules rely on properly
configured engine runmode.

Ticket: #5958
3 years ago
Lukas Sismis f08de8ea2e bpf: refactor the BPF code and postpone querying of the engine mode
BPF codebase queried engine mode earlier than it was determined from
the configuration file/command line. As a result it used the default (IDS)
mode where it could've been configured later on to the IPS mode.
This could lead into an undefined behavior as some Suricata modules behave
according to the engine mode.

PF-Ring, Netmap and AF-Packet all shared almost identical code for
determining the engine mode. It was put into one common function.
Omitted the usage of SCStrdup function in PF-Ring module as it is
uppercased during thread initialization phase.

Ticket: #5958
3 years ago
Jason Ish fe45258fbd detect: fix setting of flag for rule reload
As part of 6d8b50b748, the settings of
THV_CAPTURE_INJECT_PKT ended up in a location unreachable by capture
methods that did not have PktAcqBreakLoop.

Instead, always call TmThreadsCaptureBreakLoop which handles the logic
for how the read loop should be broken.

This fixes the case where read threads won't "break" for rule reloads
until packets are seen.

Ticket: #6021
(cherry picked from commit 1c6644ef4e)
3 years ago
Juliana Fajardini 75e57dde7c flow: make exc policy work w/ simulated flowmemcap
Exception policy wouldn't be applied if we were in the context of a
simulated flow memcap hit.

Bug #5998

(cherry picked from commit 1665f71a68)
3 years ago
Jason Ish 248176caba rust: update nom to 5.1.3
Update nom to 5.1.3 which fixes some future breaking changes in the Rust
compiler.

See https://github.com/rust-bakery/nom/pull/1657 for more info.
3 years ago
Victor Julien 94b36cc4a3 src: fix extern max_pending_packets type 3 years ago
Philippe Antoine 79b89df331 detect: fix possible leak found by coverity
Conditions to create the leak are likely not reachable,
but this is still a bad pattern.

(cherry picked from commit e8060990d1)
3 years ago
Victor Julien 5f1651282d streaming: improve error handling
util-streaming-buffer.c:205:5: warning: Potential leak of memory pointed to by 'sbb2' [unix.Malloc]
    BUG_ON(sbb2->offset < sbb->len);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./suricata-common.h:290:27: note: expanded from macro 'BUG_ON'
        #define BUG_ON(x) assert(!(x))
                          ^~~~~~~~~~~~
/usr/include/assert.h:99:28: note: expanded from macro 'assert'
     ? __ASSERT_VOID_CAST (0)                                           \
                           ^
1 warning generated.
3 years ago
Victor Julien 999bf34257 github: add scan-build workflow
Add scan-build workflow that fails on any warning.

Exclude libhtp as there is still one open issue there.

(cherry picked from commit efeaa6e2c7)
3 years ago
Victor Julien f8cec1e4f5 detect: improve prepare mpms routine
Based on hash table work in:
e624328deb ("detect: split mpm per alproto for file.data & others")

Instead of using a large stack array use a hash table for the intermediate
steps of the mpm build.
3 years ago
Victor Julien 36e07f874f streaming/sbb: propegate allocation errors
(cherry picked from commit d6b4c90225)
3 years ago
Victor Julien 0b8a46de39 scan-build: use simpler aligned alloc wrapper 3 years ago
Victor Julien cc0886d39d stream: fix minor scan-build warning
stream-tcp.c:134:14: warning: Value stored to 'presize' during its initialization is never read [deadcode.DeadStores]
    uint64_t presize = SC_ATOMIC_GET(st_memuse);
             ^~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

(cherry picked from commit 0c15114450)
3 years ago
Victor Julien aaee63bab1 mime: address scan-build warnings
util-decode-mime.c:189:31: warning: Use of memory after it is freed [unix.Malloc]
            lastSibling->next = entity->child;
            ~~~~~~~~~~~~~~~~~ ^
util-decode-mime.c:827:24: warning: Potential leak of memory pointed to by 'val' [unix.Malloc]
        state->hname = NULL;
                       ^~~~
/usr/lib/llvm-16/lib/clang/16/include/stddef.h:89:24: note: expanded from macro 'NULL'
 #  define NULL ((void*)0)
                       ^
2 warnings generated.

Improve error handling and add assert to avoid these warnings.

Bug: #3147.
(cherry picked from commit 9224b3435b)
3 years ago
Victor Julien b802a6241f smtp/mime: no error logging in packet path
(cherry picked from commit 9d3c60bde3)
3 years ago
Victor Julien 07639c96f2 radix: add debug validation to assist scan-build
util-radix-tree.c:595:34: warning: Access to field 'stream' results in a dereference of a null pointer (loaded from field 'prefix') [core.NullDereference]
        if ((temp = (stream[i] ^ bottom_node->prefix->stream[i])) == 0) {
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
util-radix-tree.c:717:30: warning: Access to field 'stream' results in a dereference of a null pointer (loaded from field 'prefix') [core.NullDereference]
        if (SC_RADIX_BITTEST(bottom_node->prefix->stream[differ_bit >> 3],
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
./util-radix-tree.h:27:34: note: expanded from macro 'SC_RADIX_BITTEST'
 #define SC_RADIX_BITTEST(x, y) ((x) & (y))
                                 ^
2 warnings generated.

(cherry picked from commit fa5acc1743)
3 years ago
Victor Julien 88b305b539 detect/sigorder: assist scan-build
Bug: #3152.
(cherry picked from commit b625aa9748)
3 years ago
Victor Julien d2375ee7d2 detect/sigorder: remove unused struct fields
(cherry picked from commit 03e0a60f96)
3 years ago
Victor Julien 47b25329aa detect: fix scan-build warnings
detect-engine-address.c:1140:17: warning: Use of memory after it is freed [unix.Malloc]
            r = DetectAddressCmp(ag, ag2);
                ^~~~~~~~~~~~~~~~~~~~~~~~~
detect-engine-address.c:1169:17: warning: Use of memory after it is freed [unix.Malloc]
            r = DetectAddressCmp(ag, ag2);
                ^~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.

detect-engine-port.c:1161:9: warning: Use of memory after it is freed [unix.Malloc]
        DetectPortPrint(ag2);
        ^~~~~~~~~~~~~~~~~~~~
1 warning generated.

Bug: #3150.
Bug: #3151.
(cherry picked from commit 000064de7d)
3 years ago
Victor Julien 37925fe2bd mpm/ac-bs: work around scan-build warnings
util-mpm-ac-bs.c:482:32: warning: Result of 'malloc' is converted to a pointer of type 'uint16_t[256]', which is incompatible with sizeof operand type 'uint16_t' [unix.MallocSizeof]
        ctx->state_table_u16 = SCMalloc(ctx->state_count *
                               ^~~~~~~~
./util-mem.h:35:18: note: expanded from macro 'SCMalloc'
 #define SCMalloc malloc
                 ^~~~~~
util-mpm-ac-bs.c:524:32: warning: Result of 'malloc' is converted to a pointer of type 'uint32_t[256]', which is incompatible with sizeof operand type 'uint32_t' [unix.MallocSizeof]
        ctx->state_table_u32 = SCMalloc(ctx->state_count *
                               ^~~~~~~~
./util-mem.h:35:18: note: expanded from macro 'SCMalloc'
 #define SCMalloc malloc
                 ^~~~~~
2 warnings generated.

Bug: #3148.
(cherry picked from commit c8694634af)
3 years ago
Victor Julien 763833c217 mpm/ac: work around scan-build warnings
util-mpm-ac.c:531:32: warning: Result of 'malloc' is converted to a pointer of type 'uint16_t[256]', which is incompatible with sizeof operand type 'uint16_t' [unix.MallocSizeof]
        ctx->state_table_u16 = SCMalloc(ctx->state_count *
                               ^~~~~~~~
./util-mem.h:35:18: note: expanded from macro 'SCMalloc'
 #define SCMalloc malloc
                 ^~~~~~
util-mpm-ac.c:575:32: warning: Result of 'malloc' is converted to a pointer of type 'uint32_t[256]', which is incompatible with sizeof operand type 'uint32_t' [unix.MallocSizeof]
        ctx->state_table_u32 = SCMalloc(ctx->state_count *
                               ^~~~~~~~
./util-mem.h:35:18: note: expanded from macro 'SCMalloc'
 #define SCMalloc malloc
                 ^~~~~~
2 warnings generated.

Bug: #3148.
(cherry picked from commit ee683a7074)
3 years ago
Victor Julien 77e60e3368 mpm/hs: fix scan-build warning
util-mpm-hs.c:340:20: warning: Potential leak of memory pointed to by 'p' [unix.Malloc]
        p->sids[0] = sid;
        ~~~~~~~~~~~^~~~~
1 warning generated.

Incorrect error handling could lead to a memory leak.

(cherry picked from commit ec84ba1a3c)
3 years ago
Victor Julien 333021e670 decode: suppress scan-build warning
(cherry picked from commit 59ca5cc655)
3 years ago