Commit Graph

13377 Commits (5c7b5c5fb5f3e8afe6aeafca27b7ab7f88aef232)
 

Author SHA1 Message Date
Victor Julien 7b55f8b2e3 fuzz/sigpcap_aware: set pkt_src to wire
Avoids an assert if DEBUG is compiled in:

fuzz_sigpcap_aware: source-pcap-file.c:420: TmEcode DecodePcapFile(ThreadVars *, Packet *, void *): Assertion `!(p->pkt_src != PKT_SRC_WIRE && p->pkt_src != PKT_SRC_FFR)' failed.
3 years ago
Victor Julien 61df4120da detect/frame: improve assert accuracy
Handle frames of unknown size correctly.

Bug: #5226.
3 years ago
Victor Julien c824804e2b eve: allow /dev/null in threaded mode
Avoids creation of actual files called /dev/null.N which take
up space in /dev/ which lives in memory.
3 years ago
Victor Julien 5deb479f4c flow: cleanup locking debug leftovers 3 years ago
Victor Julien 57533d3e47 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.
3 years ago
Sascha Steinbiss 7eb279ac53 mqtt: remove redundant "where" keyword 3 years ago
Sascha Steinbiss d63e5b8c51 mqtt: make some functions non-public 3 years ago
Sascha Steinbiss 2a3ed9a6ae mqtt: rustfmt 3 years ago
Sascha Steinbiss 1ba62993d5 mqtt: raise event on parse error 3 years ago
Sascha Steinbiss 5618273ef4 mqtt: ensure we do not request extra data after buffering
This addresses Redmine bug #5018 by ensuring that the parser
never requests additional data via the Incomplete error, but to
raise an actual parse error, since it is supposed to have all
the data as specified by the message length in the header already.
3 years ago
Philippe Antoine e3180e3248 output: fix integer warnings
Ticket: 4516
3 years ago
Philippe Antoine acbe6a33a2 ssh: install app-layer events rules 3 years ago
Philippe Antoine 0cba561fec detect: not an iponly signature if it needs app-layer
Ticket: 4972

This may happen with `config` keyword which is postmatch,
but may require a transaction
3 years ago
William Harding f0528afc2d doc/userguide: sphinx syntax correction 3 years ago
Juliana Fajardini a6bda3596b unittests: alloc Packet with PacketGetFromAlloc
Some unittests used SCMalloc for allocating new Packet the unittests.
While this is valid, it leads to segmentation faults when we move to
dynamic allocation of the maximum alerts allowed to be triggered by a
single packet.

This massive patch uses PacketGetFromAlloc, which initializes a Packet
in such a way that any dynamic allocated structures within will also be
initialized.

Related to
Task #4207
3 years ago
Shivani Bhardwaj 6d2a2a0731 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.
3 years ago
Shivani Bhardwaj 7366396011 detect/dataset: cleanup dead code 3 years ago
Victor Julien 2b5eeab7d4 detect/urilen: don't pass null pointer to pcre2 free
Bug #5228.
3 years ago
Victor Julien 087151ddc3 detect/mpm: initialization micro optimization 3 years ago
Victor Julien 54a6dd09dd detect: pattern id assignment through hash table
Only consider active part of the pattern for mpm (so consider chop).

Move data structure to hash list table over the custom array logic.
3 years ago
Victor Julien a14854bce9 detect: keyword list to hash to improve perf
Since the switch to pcre2 this was much more heavily used, which
would lead to measurable time spent in list handling.
3 years ago
Victor Julien 9e6370ae2e detect: optimize mpm-engine setup
Instead of a loop over the rules in a group *per engine* do a single
loop in which all the engines are prepared in parallel.
3 years ago
Victor Julien 3352c0bee4 detect: initialization optimization
A lot of time was spent in `SigMatchListSMBelongsTo` for the `mpm_sm`.

Optimize this by keeping the value at hand during Signature parsing and
detection engine setup.
3 years ago
Victor Julien b804a84c93 hash: constify data input 3 years ago
Victor Julien 4b0e3d79bb detect/analyzer: support frames in pattern dump 3 years ago
Victor Julien 47629b7aeb detect/filemagic: don't pass unused pointer 3 years ago
Arne Welzel 8ef066318d 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
3 years ago
Victor Julien 9537d119b9 http: fix reassembled range file accounting 3 years ago
Victor Julien 6d30f4442c http2: fix file accounting for ranged files
Increment files_opened for tx that 'gets' reassembled ranged file
3 years ago
Victor Julien b336882008 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.
3 years ago
Victor Julien b9cd502249 smb: convert 'close' parser to function 3 years ago
Victor Julien 54d34c96f5 files: open/log debug validation bugon
Meant to find more cases where there is a mismatch.
3 years ago
Juliana Fajardini 55843aee8e devguide: update readme
Use it to explain how to go about the sequence diagram images
(generation, updating, what is mscgen etc).

Also remove portion that referred to Sphinx builds, as these don't make
sense now.
3 years ago
Juliana Fajardini e0c8dba7ac userguide: dynamically determine copyright date
This uses the date of doc generation to determine the copyright date
for the trailing date. Based on Jeff Lucovsky solution.
3 years ago
Juliana Fajardini 67af1504b3 devguide: drop use of mscgen script in builds/make
Currently, it seems easier to upload the diagram images to git than to
try to make the image generation script work with out of the tree builds
and other corner cases.

This means, however, that one must activelly remember to update msc
diagram files, run the script and re-add new png files, if those ever
need to be updated. To raise awareness to that, a watermark was added
to the diagram images.

Also removed configuration steps that added mscgen as dependency
(locally and for workflow builds and readthedocs).
3 years ago
Juliana Fajardini 5d63613c4b devguide: add watermark to sequence diagrams
Make it more evident that the sequence diagrams in the transactions
page are generated with Mscgen
3 years ago
Juliana Fajardini 6f77c722a2 devguide: move into userguide as last chapter
Moved devguide dir into userguide dir.
Since the devguide is now incorporated as the last chapter of the
userguide, removed build and configuration files from the devguide
dir, as these are no longer needed.

Task #4909
3 years ago
Juliana Fajardini 69c6657127 devguide: clarify cargo test usage for modules
The documentation was showing an invalid path for running single tests.
3 years ago
Philippe Antoine cfcade58ad http: move xff logging to alert object
Ticket: 4860

instead of root field
3 years ago
Philippe Antoine 862e84877f 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...
3 years ago
Philippe Antoine 99b3443369 smtp: check if there is a transaction to close
Ticket: 4948

When parsing the response for starttls
3 years ago
Philippe Antoine 68fa080069 tmqh: fix possible null dereference
Coverity ID: 1502953

As we check just on the next line my_pool against NULL, we should
not dereference it, even for debug validation
3 years ago
Philippe Antoine 568ab841d8 detect: remove dead code about xbits keyword 3 years ago
Philippe Antoine 4640b15d8c log: prevents use of uninitialized variable
Even if the code seems unreachable for now
3 years ago
Jason Ish 8d1e4a1d0b 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
3 years ago
Victor Julien 6e90bf4739 streaming: remove unused 'auto slide' support
Add debug validation checks for "impossible" conditions.
3 years ago
Philippe Antoine 00da0d3420 detect: makes config keyword really require a flow
Ticket: 4972

Completes commit c3a220647

DETECT_CONFIG is added as DETECT_SM_LIST_POSTMATCH and not
as DETECT_SM_LIST_MATCH as other keywords handled in SignatureCreateMask
3 years ago
Modupe Falodun 54bc43d3ed detect-pcre: remove unittests
These tests are reimplemented in Suricata-Verify

Task: 4911
3 years ago
Sam Muhammed 3a490fb16c nfs: Implement frames
Feature #4872

Frames:
  - RPC Frames: Generic over TCP/UDP
     - rpc.pdu
     - rpc.hdr
     - rpc.data
     - rpc.creds -- for rpc calls

  - NFSv2, NFSv3
     - nfs.pdu
     - nfs.status -- for nfs responses

  - NFSv4 Only Frames
     - nfs4.pdu
     - nfs4.hdr
     - nfs4.ops -- for compound request/response operations
     - nfs4.status -- for nfs4 responses

RPC tcp/udp frames created with separate registeration functions e.g:
add_rpc_tcp_tc_frames()
add_rpc_udp_tc_frames()
3 years ago
Sam Muhammed d090dcbce9 rpc: Improve rpc_record struct
Add creds_len field to rpc_record
needed for rpc.creds frame length calculation
3 years ago