Commit Graph

12092 Commits (6e5b7199cfd04ffbbfce4fa1244b80ed1ef61e2a)
 

Author SHA1 Message Date
Victor Julien 6e5b7199cf doc/smb: add resource limits section
(cherry picked from commit 976748b777)
4 years ago
Victor Julien 65f24b2e84 smb2: validate negotiate read/write max sizes
Raise event if they exceed the configured limit.

(cherry picked from commit fc9b65d8d3)
4 years ago
Victor Julien 8510031e6c smb2: allow limiting in-flight data size/cnt
Allow limiting in-flight out or order data chunks per size or count.

Implemented for read and writes separately:

app-layer.protocols.smb.max-write-queue-size
app-layer.protocols.smb.max-write-queue-cnt
app-layer.protocols.smb.max-read-queue-size
app-layer.protocols.smb.max-read-queue-cnt

(cherry picked from commit 4be8334c9e)
4 years ago
Victor Julien 5b38b97181 filetracker: track total queued data (in_flight)
As well as expose number of chunks.

(cherry picked from commit 2c5ad8858e)
4 years ago
Victor Julien 502db40240 smb2: add options for max read/write size
Add options for the max read/write size accepted by the parser.

(cherry picked from commit 5bcc4162f7)
4 years ago
Victor Julien 9f969e2545 smb2: track max read/write size and enforce its values
(cherry picked from commit f28888513a)
4 years ago
Victor Julien 2ba9ad53eb smb: minor function cleanup
Remove used argument from `filetracker_newchunk()`. We're not
using fill_bytes with smb.

(cherry picked from commit 594acec5dc)
4 years ago
Victor Julien 02c3bd00fa filetracker: make FileChunk private
(cherry picked from commit c7a474c725)
4 years ago
Philippe Antoine f3a6d15034 mqtt: fix consumed bytes computation for truncated msg
Ticket: 5268
(cherry picked from commit 3b13008c1b)
4 years ago
Sascha Steinbiss 084b16a63b mqtt: raise event on parse error 4 years ago
Jason Ish 4c2d543022 mqtt: ensure we do not request extra data after buffering
This is a minimal backport of 5618273ef4
to address ticket 5018.

Uses the "complete" version of take instead of the macro which is thre
streaming variant.

Ticket #5018
4 years ago
Jason Ish b589b05efd github-ci: pin checkout actions plus other fixups
Pin checkout action plus other fixups from master to deal with changes
to the action.
4 years ago
Jason Ish fca9c69bc7 smb: rules for messages in the wrong direction
(cherry picked from commit 1e65324940)
4 years ago
Jason Ish e55fef32d9 smb: handle records in the wrong direction
If an SMB record is seen in the wrong direction, set an event on the PDU
frame and don't process the record in the state.

No error is returned, so the next record will be processed.

(cherry picked from commit 2341f47755)
4 years ago
Jason Ish e63795543f smb: expose smb1 request/reply flags with a method
Adds `.is_request()` and `.is_reply()` to check if a SMB record flags
say the message is a request or a reply.

(cherry picked from commit 09e2d3b216)
4 years ago
Jason Ish 12a8415326 smb: fix smb2 header flag parsing
The bits were being parsed in the order they're displayed in Wireshark,
rather than the order they were being seen on the wire, resulting in
direction and async being 0 more often than they should be.

Instead of bits, take the 4 bytes as an le_u32 and just use bit masks to
extract what we need into a struct, I think its easier to reason about
this way when comparing to the Microsoft documentation.

(cherry picked from commit 7b659489c8)
4 years ago
Philippe Antoine 83490d4e3c tftp: StringToAppProto case
So, fuzz_applayerparserparse_tftp will fuzz tftp

(cherry picked from commit c9d664b0a0)
4 years ago
Jason Ish fd57cf76bf detect-content: error on single char hex pairs
Fix parsing of content like "|aa b cc|" which was parsed as "|aa bc|"
without error or warning. This will now fail out, requiring all hex
values to be 2 chars.

Ticket #5201

(cherry picked from commit 8d1e4a1d0b)
4 years ago
Shivani Bhardwaj 0ddf39344e detect/dataset: cleanup dead code
(cherry picked from commit 7366396011)
4 years ago
Shivani Bhardwaj 5e084d4daa detect/dataset: fix space condition in rule lang
If there is a space following a keyword that does not expect a value,
the rule fails to load due to improper value evaluation.
e.g. Space after "set" command
alert http any any -> any any (http.user_agent; dataset:set  ,ua-seen,type string,save datasets.csv; sid:1;)

gives error
[ERRCODE: SC_ERR_UNKNOWN_VALUE(129)] - dataset action "" is not supported.

Fix this by handling values correctly for such cases.

(cherry picked from commit 6d2a2a0731)
4 years ago
Victor Julien b8305b1108 flow: fix and simplify locking
Since:

9551cd0535 ("threading: don't pass locked flow between threads")

`MoveToWorkQueue()` unconditionally unlocks the flow. This allows simpler
locking handling, including of tcp reuse flows.

The simpler logic also fixes a scenario where TCP reuse flows got "unlocked"
twice, once in `FlowGetFlowFromHash()` and once in `MoveToWorkQueue()`.

Bug: #5248.
Coverity: 1494354.
(cherry picked from commit 57533d3e47)
4 years ago
Jeff Lucovsky e0834b3047 log/stack: Propagate original signal
Issue: 4550

This commit modifies the "stack trace on signal" to propagate the
original signal received instead of always raising SIGABRT.

(cherry picked from commit a3443845fb)
4 years ago
Jeff Lucovsky 0e2d76f836 config: Make libunwind use configurable for 6.0
Issue: 4973

This commit makes stack-trace on fault configurable by
adding "--enable-libunwind" as a configure option.

By default, or if "--enable-libunwind=no" is specified, the libunwind
library will not be configured.

When "--enable-libunwind=yes" is specified, libunwind will be used iff
it can be found in one of the standard library locations.
4 years ago
Jeff Lucovsky 1306dbf268 doc/yaml: Signal-termination option description
(cherry picked from commit 93842aa14a)
4 years ago
Jeff Lucovsky 529e69b27b logging/diag: Enable stacktrace diagnostic if config'd
This commit adds a signal handler for SIGSEGV when configured. The
signal handler emits a one line stack trace using SCLogError. The intent
is to provide diagnostic information in deployments where core files are
not possible.

The diagnostic message is from the offending thread and includes the
stack trace; each frame includes the symbol + offset.

(cherry picked from commit 7f0f463b64)
4 years ago
Jeff Lucovsky c1506ebde4 logging: Stacktrace on signal term setting
This commit adds a configuration setting to enable a stack trace message
if Suricata receives a signal that terminates execution, such as
SIGSEGV, SIGABRT.

(cherry picked from commit 163f70be9d)
4 years ago
Jeff Lucovsky 9f68fc946a error: Add error code for sig-related diagnostics
This commit adds an error code for the diagnostic code used for
diagnostic messages following unexpected termination due to signals..

(cherry picked from commit 501c870a2c)
4 years ago
Jeff Lucovsky 285f57861e configure.ac: Support libunwind configuration
This commit adds support for enabling libunwind -- a library that can be
used to display stack information.

Libunwind is enabled and used by Suricata if present during
configuration.  A diagnostic message is displayed if libunwind
cannot be found.

(cherry picked from commit 303dd29b50)
4 years ago
Victor Julien 866d0872be nss: use 'atexit()' to cleanup
This avoids ASAN to report leaks in case of fatal errors in tests.
4 years ago
Arne Welzel 22c47396fd flow-manager: fix off-by-one in flow_hash row allocation
The current code doesn't cover all rows when more than one flow manager is
used. It leaves a single row between ftd->max and ftd->min of the next
manager orphaned. As an example:

    hash_size=1000
    flowmgr_number=3
    range=333

    instance  ftd->min  ftd->max
    0         0         333
    1         334       666
    2         667       1000

    Rows not covered: 333, 666

(cherry picked from commit 8ef066318d)
5 years ago
Philippe Antoine 16c52db465 ssl: first pass limit when allocating buffer for certificates
With this check, on the first packet of a certificate presenting
a length of 16Mbytes, we only allocate up to 65Kb

When we get to the point where need more than 65Kb, we realloc
to the true size.

With this check, it makes it more expensive for an attacket to use
this allocation as a way to trigger ressource exhaustion...

(cherry picked from commit 862e84877f)
5 years ago
Philippe Antoine 384611da1a fuzz: use fuzzing confyaml for protodetect target
As is done for other targets,
so that all app-layer protocols are enabled,
even the ones disabled by default such as enip

And resets protocol detection every time we try
so that probing_parser_toserver_alproto_masks are fresh.

(cherry picked from commit 09c84d0c26)
5 years ago
Philippe Antoine 5af5b125ee smtp: check if we have a current transaction
Ticket: 4948

This is not the perfect solution, but it prevents to trigger
the assert, and keep the assert.
A better solution would need to create transaction from
the reponse parsing, in case a later command was buffered and
not answered. But this would not be enough as NoNewTx prevents
the creation of a new transaction for RSET...

(cherry picked from commit 4247605d87)
5 years ago
Victor Julien ce69f79f6a smb1: apply close to direction
Instead of closing files in both direction when receiving a close request,
close only toserver files for the request and close toclient on receiving
a response.

(cherry picked from commit b336882008)
5 years ago
Steven Ottenhoff 9b1557b7a7 pppoe: fix protocol field length variation
Detect when protocol field is not a 16 bit field.
Added tests to prove logic

Ticket: 4810
(cherry picked from commit 6bf2117056)
5 years ago
Philippe Antoine e723ecb1ff smtp: check if there is a transaction to close
Ticket: 4948

When parsing the response for starttls

(cherry picked from commit 99b3443369)
5 years ago
Shivani Bhardwaj 0e9f42c744 doc/xbits: clarify noalert usage 5 years ago
Shivani Bhardwaj 2c5eead479 detect/xbits: parse keywords w strtok_r
Ticket: 4820
5 years ago
Jeff Lucovsky d04b32466f detect/ipproto: Use builtin protocol table
Issue 5072

This commit causes the built-in protocol table to be used for protocol
name and number validation.

(cherry picked from commit 4f2f745bed)
5 years ago
Jeff Lucovsky 834dcf65f6 detect/tests: Register protoname tests
Issue: 5072

This commit registers the proto-name unit tests.

(cherry picked from commit 3bd1d258a9)
5 years ago
Jeff Lucovsky d569efda66 detect/ipproto: Add init/release functions
Issue: 5072

This commit insures that the protocol name hashtables are initialized
and released.

(cherry picked from commit b524967257)
5 years ago
Jeff Lucovsky e0426237c2 util/proto: Protocol-name functions
Issue: 5072

This commit adds utility functions handling protocol names.

(cherry picked from commit ff0cf89738)
5 years ago
Jeff Lucovsky 442a859f6e error/hash: Add error code for hash add failures
Issue: 5072
(cherry picked from commit 1e2883602b)
5 years ago
Philippe Antoine 42e47decf9 util: export Djb2 hash string function
(cherry picked from commit 5cb996efcf)
5 years ago
Jeff Lucovsky 3a3840be2b proto: Remove dependency on /etc/protocols
This commit eliminates the dependency on /etc/protocols and equivalent
on other platforms by using a static table of IANA assigned protocol
values (names, description).

(cherry picked from commit e77e8dbe18)
5 years ago
Jeff Lucovsky 4e6a6e6467 threads: Honor per-thread stack size setting
Issue: 4550

This commit adjusts the per-thread stack size if a size has been
configured. If the setting has not been configured, the default
per-thread stack size provided by the runtime mechanisms are used.

(cherry picked from commit 6232c94235)
5 years ago
Jeff Lucovsky 9d66541128 config/thread: Use config'd per-thread stack size
Issue: 4550

This commit checks if there's a config setting for threading.stack-size
and assigns the value to a global variable for use during thread
creation.

(cherry picked from commit e4d60f451b)
5 years ago
Jeff Lucovsky 1b2ab0e8d4 suricata.yaml: Add per-thread stack size setting
Issue: 4550
(cherry picked from commit d79a317cea)
5 years ago
Jeff Lucovsky 9923083039 config/debug: Debug probe for getattr_np
This commit adds a probe for a non-portable function to be used in
diagnostic debug display of a thread's stack size.

(cherry picked from commit deb49862cd)
5 years ago
Jeff Lucovsky 00ab84fd63 doc: Describe per-thread stack size config setting
Issue: 4550

This commit documents the new per-thread stack-size setting. Some
systems have a small default value that is not suitable for Suricata's
multi-threaded architecture and adjustment may be required.

(cherry picked from commit 117e11b0ae)
5 years ago