Commit Graph

12774 Commits (suricata-6.0.20)
 

Author SHA1 Message Date
Philippe Antoine 8efaebe293 http1: configurable max number of live tx per flow
Unlike the original commit, this commit just enforces a maximum limit,
but does not expose the configuration of it.

Ticket: #5921

(cherry picked from commit 4175680a8a)
1 year ago
Philippe Antoine 18841a58da http1: remove transactions from their list
instead of keeping a NULL pointer in an array

Ticket: #5921

(cherry picked from commit 8f63a8f3bf)
1 year ago
Philippe Antoine ffed4b35cb http2: handle reassembly for continuation frames
Ticket: 5926

HTTP2 continuation frames are defined in RFC 9113.
They allow header blocks to be split over multiple HTTP2 frames.
For Suricata to process correctly these header blocks, it
must do the reassembly of the payload of these HTTP2 frames.
Otherwise, we get incomplete decoding for headers names and/or
values while decoding a single frame.

Design is to add a field to the HTTP2 state, as the RFC states that
these continuation frames form a discrete unit :
> Field blocks MUST be transmitted as a contiguous sequence of frames,
> with no interleaved frames of any other type or from any other stream.
So, we do not have to duplicate this reassembly field per stream id.

Another design choice is to wait for the reassembly to be complete
before doing any decoding, to avoid quadratic complexity on partially
decoding of the data.

(cherry picked from commit aff54f29f8)
1 year ago
Jason Ish 39570d8d05 rules: use primary default-rule-path if set on command line
When reloading rules, respect `--set default-rule-path=...` from the
command line if set.

Previously the rule reload would always take the default-rule-path from
the configuration file, even if overrided on the command line.

Issue: #1911
(cherry picked from commit 3ea6572e22)
1 year ago
Philippe Antoine a31ff846ec mpm: allocate StateQueue on the heap
So that we can have multi-tenant on MacOS without stack
overflows because of the size of the structure...

Ticket: #6263.
(cherry picked from commit 92fce2fdc0)
2 years ago
Victor Julien 11262a94de detect: fix path creation in Windows
Fixes file loading for rule files and Lua scripts.

Bug: #6095.
(cherry picked from commit 04aee5f099)
2 years ago
Victor Julien 13625cf7cc detect: free all tenant detect engines
Free all tenants registered in the master.

(cherry picked from commit a4d80bc7c4)
2 years ago
Jason Ish d323467c9a requirements: use libhtp 0.5.x
Move to libhtp to the 0.5.x branch instead of 0.5.45.

(cherry picked from commit c3b3c11e30)
2 years ago
Victor Julien f3648413b5 github-ci: only specify major version for alma 2 years ago
Lukas Sismis 02cb2dbe8d github-ci: add eBPF to the builds workflow
Ticket: #6602
2 years ago
Philippe Antoine 47c5d2b0fa doc: fix byte_test examples
As this keyword has 4 mandatory arguments, and some examples
had only three...

Ticket: 6629
(cherry picked from commit 4933b817aa)
2 years ago
Lukas Sismis 78c9722243 doc: update userguide installation instructions
The commit updates obsolete installation instructions
from the userguide and reformats certain parts for
improved clarity.

Ticket: #5988
2 years ago
Eric Leblond 16fbfe1f61 configure: fix llc detection on recent Debian
Where clang --version was returning:

clang version 9.0.1-15+b1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Newer version like clang-10 on Debian are returning:

Debian clang version 10.0.1-8+b1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

As a result the parsing was failing to determine which llc was
available on the system.

Ticket: #6598

(cherry picked from commit 37b1595c20)
2 years ago
Jeff Lucovsky 9602fe60ca detect/analysis: Move globals to engine ctx
Issue: 6239

This commit moves the global variables associated with engine analysis
into the detect engine context. Doing so provides encapsulation of the
analysis components as well as thread-safe operation in a multi-tenant
(context) deployment.

(cherry picked from commit c8615bcd47)
2 years ago
Jason Ish b8cf5ac398 github-ci: cancel previous builds workflow for branch
On a push of the same branch, cancel the previous running builds.yml
workflow.

(cherry picked from commit 2b9603d94d)
2 years ago
Jason Ish e1384734ac github-ci: remove Fedora 36, 37; add Fedora 39
Fedora 36 is EOL and some mirrors have been removed. Fedora 37 security
updates stop in in December 2023.
2 years ago
jason taylor a94254b53b doc: update file.data keyword documentation
Signed-off-by: jason taylor <jtfas90@gmail.com>
2 years ago
Juliana Fajardini 57a7d2830d userguide: update tls not_after/not_before mentions
Our tls fields not_after and not_before are actually logged as
`notafter` and `notbefore`, but were documented with the underscore.

Update the documentation, since updating the log format itself would be
a breaking change.

Task #5494

(cherry picked from commit a649a92afd)
2 years ago
Philippe Antoine 24404135e9 http2: app-layer event for userinfo in uri
Ticket: #6426

as per RFC 9113
":authority" MUST NOT include the deprecated userinfo subcomponent
for "http" or "https" schemed URIs.

(cherry picked from commit e3cd0d073f)
2 years ago
Travis Green d12a544891 doc: add tcp flags documentation
Signed-off-by: jason taylor <jtfas90@gmail.com>
(cherry picked from commit 96a0e7016f)
2 years ago
Victor Julien 0cfe81cc2b host/iprep: run all timeout logic
Run all timeout logic if iprep is in use as well.

Minor code cleanups.

Bug: #6436.
(cherry picked from commit 6307a4d4b9)
2 years ago
Philippe Antoine 595149d1e8 http2: event on mismatch between authority and host
Ticket: #6425
(cherry picked from commit 46a46e5b1f)
2 years ago
Jason Ish b0e8b6fb07 dns/eve: use default formats if formats is empty
If the configuration field "formats" is empty, DNS response records do
not have any relevant information other than that there was a
response, but not much about the response.

I'm pretty sure the intention here was to log the response details if
no formats were provided, which is what happens when the field is
commented out.

So if no formats are specified, use the default of all.

Bug: #6420
(cherry picked from commit a240a93b69)
2 years ago
Jeff Lucovsky 9e0c7c4b54 detect/bytejump: Improve end-of-buffer handling
Issue: 4623

This commit addresses the issues reported in issue 4623 when the jump
value points at the last byte in the buffer.

(cherry picked from commit f363b99fd7)
2 years ago
Juliana Fajardini 6509d201ac docs: adjust readthedocs config to new options
Our documentation was failing to build, seems connected to the new way
of indicating build options (cf
https://readthedocs.org/projects/suricata/builds/22112658/,
https://docs.readthedocs.io/en/stable/config-file/v2.html#build,
and https://docs.readthedocs.io/en/stable/config-file/v2.html#build-os).

Added the build.os required new field, and adjusted the way python
version is passed.

For the new configuration style for read the docs, one of the ways to
pass extra configuration for python is having a requirements file.

(cherry picked from commit 1a132f454a)
2 years ago
Victor Julien 757fa21356 version: start development towards 6.0.16 2 years ago
Shivani Bhardwaj d20c9332ed release: 6.0.15; update changelog 2 years ago
Philippe Antoine 62b3bb0d5e mime: avoid quadratic complexity in MimeDecAddEntity
Ticket: #6306

Keep a reference to last child, consume a bit more RAM to save CPU

(cherry picked from commit 737bc4f219)
2 years ago
Shivani Bhardwaj cc53447b3d output/email: use SCCalloc for OutputJsonEmailCtx
email_ctx->fields only gets populated when smtp.custom setting is on.
The fn EveEmailLogJSONCustom is called when either
1. smtp.extended setting is on or,
2. email_ctx->fields is populated which means smtp.custom setting is on

In case neither of these are set in suricata.yaml, no call should
ideally be made to the fn EveEmailLogJSONCustom.
However, it turns out that email_ctx->fields is unset and then set only
after the smtp config was found. This leads to email_ctx->fields
sometimes contain value even when no config was given to the smtp
section and can lead to unexpected output.

Fix this by using SCCalloc while initializing OutputJsonEmailCtx struct
instead of SCMalloc.

Bug 6380

(cherry picked from commit 7406ac0fa5)
2 years ago
Victor Julien 0ada1d561f detect: inspect all packets in multi-layer tunneling
When the decoders encounter multiple layers of tunneling, multiple tunnel
packets are created. These are then stored in ThreadVars::decode_pq, where
they are processed after the current thread "slot" is done. However, due
to a logic error, the tunnel packets after the first, where not called
for the correct position in the packet pipeline. This would lead to these
packets not going through the FlowWorker module, so skipping everything
from flow tracking, detection and logging.

This would only happen for single and workers, due to how the pipelines
are constructed.

The "slot" holding the decoder, would contain 2 packets in
ThreadVars::decode_pq. Then it would call the pipeline on the first
packet with the next slot of the pipeline through a indirect call to
TmThreadsSlotVarRun(), so it would be called for the FlowWorker.
However when that first (the most inner) packet was done, the call
to TmThreadsSlotVarRun() would again service the ThreadVars::decode_pq
and process it, again moving the slot pointer forward, so past the
FlowWorker.

This patch addresses the issue by making sure only a "decode" thread
slot will service the ThreadVars::decode_pq, thus never moving the
slot past the FlowWorker.

Bug: #6402.
(cherry picked from commit 15947f2173)
2 years ago
Victor Julien 07cc6a2a5f threads: cleanup decode_pq handling
(cherry picked from commit 25396dcd09)
2 years ago
Victor Julien 7989e3c058 flowworker: simplify pseudo packet use
Pseudo packets originating in the flow worker do not need to leave the
flow worker. Putting those in the ThreadVars::decode_pq will make them
be evaluated by the next steps in the pipeline, but those will all
ignore pseudo packets.

Instead, this patch returns them to the packet pool, while still honoring
the IPS verdict logic.

(cherry picked from commit 3247e39f0c)
2 years ago
Philippe Antoine 0f097acd35 rust: tilde version for byteorder
so that we get one compatible with MSRV
2 years ago
Jeff Lucovsky 12d2ae6574 detect/bytejump: Improve negative post_offset handling.
Issue: 4624

Handle negative post_offset values that jump before the buffer as though
they refer to the buffer start.

(cherry picked from commit 2bf9d0fdf9)
2 years ago
Jeff Lucovsky d1bd80fce6 stats: Track stream reassembly drops
Issue: 6235
(cherry picked from commit 904f0ddeee)
2 years ago
Victor Julien eb38c3332d version: start development towards 6.0.15 2 years ago
Juliana Fajardini 7d419c01ef release: 6.0.14; update changelog 2 years ago
Philippe Antoine e9f4834761 smtp: fix null deref with config option body md5
Ticket: #6279

If we have the smtp body beginning without headers, we need to
create the md5 context and right away and supply data to it.
Otherwise, on the next line being processed, md5_ctx will be
NULL but body_begin will have been reset to 0

(cherry picked from commit c6afee64d5)

Adapted to use hash functions from master6
2 years ago
Victor Julien 59c7cc5e08 spm/hs: don't exit on bad patterns
A bad pattern in a rule that hyperscan would fail to compile would
exit Suricata. This could happen during a rule reload as well.

In case of a untrusted ruleset, this could potentially be used to
shut down the sensor.

Commit 7d0851b0c2 already blocks the only know case, but this patch
is more defensive.

Ticket: #6195.
(cherry picked from commit 00e00254ea)
2 years ago
Victor Julien e66c63b2ea bpf: close fp in all error paths 2 years ago
Victor Julien 161aaefb69 path: new funcs to merge paths
Take windows directory separators into account.

Path is not checked or "resolved".

(cherry picked from commit 228caa640b)
2 years ago
Victor Julien 29b460821f stat: add wrappers to isolate OS_WIN32 specifics
(cherry picked from commit 269f751d36)
2 years ago
Victor Julien 3f780e6100 detect/filemagic: fix thread ctx registration; reloads
Make sure thread ctx registration happens and id remains correct
in case of reloads.

To do so, move id var into the detect ctx.

(cherry picked from commit 2cac440f7d)
2 years ago
Victor Julien 125d6ab34c var-names: reimplement var name handling
Implement a new design for handling var name id's. The old logic
was aware of detection engine versions and generally didn't work
well for multi-tenancy cases. Other than memory leaks and crashes,
logging of var names worked or failed based on which tenant was
loaded last.

This patch implements a new approach, where there is a global store
of vars and their id's for the lifetime of the program.

Overall Design:

Base Store: "base"

Used during keyword registration. Operates under lock. Base is shared
between all detect engines, detect engine versions and tenants.
Each variable name is ref counted.

During the freeing of a detect engine / tenant, unregistration decreases
the ref cnt.

Base has both a string to id and a id to string hash table. String to
id is used during parsing/registration. id to string during unregistration.

Active Store Pointer (atomic)

The "active" store atomic pointer points to the active lookup store. The call
to `VarNameStoreActivate` will build a new lookup store and hot swap
the pointer.

Ensuring memory safety. During the hot swap, the pointer is replaced, so
any new call to the lookup functions will automatically use the new store.
This leaves the case of any lookup happening concurrently with the pointer
swap. For this case we add the old store to a free list. It gets a timestamp
before which it cannot be freed.

Free List

The free list contains old stores that are waiting to get removed. They
contain a timestamp that is checked before they are freed.

Bug: #6044.
Bug: #6201.
(cherry picked from commit b130234b26)
2 years ago
Arne Welzel 7408b4560c community-id: Fix IPv6 address sorting not respecting byte order
When comparing IPv6 addresses based on uint32_t chunks, one needs to
apply ntohl() conversion to the individual parts, otherwise on little
endian systems individual bytes are compared in the wrong order.
Avoid this all and leverage memcmp(), it'll short circuit on the first
differing byte and its return values tells us which address sorts lower.

Bug: #6276
(cherry picked from commit 0ddc44f4c1)
2 years ago
Jason Ish 4257725dc0 readthedocs: pin theme to sphinx_rtd_theme
ReadTheDocs changed the default theme.
2 years ago
Haleema Khan 1b01e075c5 dns/eve: add 'HTTPS' type logging
Add a new DNS record type to represent HTTPS
Ticket: #4751

(cherry picked from commit 8d5c5f24a1)
2 years ago
Shivani Bhardwaj b46bccf357 af-packet: terminate on same interface & copyiface
If the interface and copy-iface are same for an af-packet IPS device
setting then fataly exit else it leads to a segfault in later stages.

Bug 5870

(cherry picked from commit d4dd53c95f)
2 years ago
Victor Julien 9c90d01717 detect/file: correct registration for HTTP
Register file.name and file.magic at correct progress values.
In HTTP1, the files are (part of) the body, so make sure the file
detection logic only runs when the parser has started processing
the body.
2 years ago
Victor Julien 21c9874341 detect/file: use util to turn keyword to nocase
This changes the way the pattern is stored by making it lowercase.

(cherry picked from commit c5d83d081e)
2 years ago