Commit Graph

15229 Commits (5ebae1e8ed85134d2aaf246a80fad7a4380a1229)
 

Author SHA1 Message Date
Jason Ish 5ebae1e8ed clang-format.sh: prefer clang-format-14
Add clang-format-14 as the preferred version, this is the default on
Ubuntu 22.04.
1 year ago
Jeff Lucovsky 40e3514e7a cppcheck: Address cpcheck report of an FP
Issue: 6527

Address the FP raised by cppcheck -- note that although the code
corectly checks to ensure that `to_shift != &sb->reqion`, the logic was
detected as a FP. Rework the code to eliminate the FP.
1 year ago
Jeff Lucovsky 8b2fd434fc cppcheck/detect: Address cppcheck memory leak
Issue: 6527

Ensure that the `map->string` memory isn't leaked following an error
return from `HashListTableAdd`
1 year ago
Philippe Antoine 1b5e04bee3 http2: do not have leading space for response line
Ticket: 6547
1 year ago
Shivani Bhardwaj 75471dd69b detect/flowbits: remove DETECT_FLOWBITS_CMD_NOALERT
DETECT_FLOWBITS_CMD_NOALERT is misleading as it gives an impression that
noalert is a flowbit specific command that'll be used and dealt with at
some point but as soon as noalert is found in the rule lang, signature
flag for noalert is set and control is returned. It never gets added to
cmd of the flowbits object.
1 year ago
Shivani Bhardwaj 34858808c1 detect-engine: use flag SIG_FLAG_MPM_NEG
The flag SIG_FLAG_MPM_NEG is set before whitelisting the rules. Make it
better by checking for the flag in the beginning and return immediately.
1 year ago
Shivani Bhardwaj 47c9a14543 detect-engine: use bool return type 1 year ago
Shivani Bhardwaj bd41b31005 detect: rename SigAddressPrepare fns to SigPrepare
There is nothing Address specific going on in the preparations.
Stage 1: Preprocessing happens. Sigs classified as IP Only, Masks
applied, content specific limits applied, etc and sig array built.
Stage 2: Sigs grouped by IPOnly, ports and protocols.
Stage 3: Decoder Events SGH built.
Stage 4: File flags set, sig grouping done per prefilter, etc.
1 year ago
Shivani Bhardwaj b9540df5ad doc: clarify IP-only with iprep 1 year ago
Victor Julien c82d93490c github/action: fix Debian 12 intermittent failures
Parallel builds caused issues during `cargo vendor`. So do just a single
thread build.

 make[4]: Entering directory '/__w/suricata/suricata/rust'
cbindgen --config /__w/suricata/suricata/rust/cbindgen.toml \
	--quiet --output /__w/suricata/suricata/rust/dist/rust-bindings.h
CARGO_HOME="/github/home/.cargo"  /usr/bin/cargo vendor
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
ERROR: Couldn't execute `cargo metadata` with manifest "/__w/suricata/suricata/rust/Cargo.toml": Metadata(Output { status: ExitStatus(unix_wait_status(25856)), stdout: "", stderr: "    Blocking waiting for file lock on package cache\n    Blocking waiting for file lock on package cache\nerror: failed to download `adler v1.0.2`\n\nCaused by:\n  unable to get packages from source\n\nCaused by:\n  failed to parse manifest at `/github/home/.cargo/registry/src/github.com-1ecc6299db9ec823/adler-1.0.2/Cargo.toml`\n\nCaused by:\n  no targets specified in the manifest\n  either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present\n" })
ERROR: Couldn't generate bindings for /__w/suricata/suricata/rust.
make[4]: *** [Makefile:597: dist/rust-bindings.h] Error 1
make[4]: *** Waiting for unfinished jobs....
1 year ago
Victor Julien 332c2ea470 detect/content-inspect: improve header docs 1 year ago
Victor Julien 06c809573b detect/content-inspect: optimize struct layout
Move members used by DetectEngineContentInspection() to the same cache line.
1 year ago
Victor Julien 0014077a36 detect: optimize struct layout
Move reference count to top of DetectEngineThreadCtx, to move it to the
same cache line as the other members that are checked first in Detect().
1 year ago
Victor Julien 53591702aa detect/bytemath: pass match ctx directly
Adjust includes to enable this.
1 year ago
Victor Julien e2fbcf9654 detect/payload: remove unneeded pointer reset
DetectEngineThreadCtx::replist is managed elsewhere.
1 year ago
Victor Julien 6db02563f1 detect/isdataat: optimize recursion mismatches
Since recursive content matching goes through the buffer from left to
right, it is possible to bail early when isdataat is part of the
recursive checking. If `isdataat:50,relative` fails for offset 10, it
will surely also fail for offset 20. So break inspection in such cases.

The exception is for dynamic isdataat, where the value is determined
by a prior byte_extract that may be updated during the recursion.
1 year ago
Victor Julien c19d11ff0d detect/content-inspect: flatten branches
Flatten else branches after terminating ifs.
1 year ago
Victor Julien 4cce7ba48b detect/content-inspect: localize recursion counting
Use stack local var instead of DetectEngineThreadCtx member. Instead
setup a stack local struct that both counts and holds the limit. Make sure
the limit is a const so we can avoid rereading it.

This is part of an effort to reduce the size of the DetectEngineThreadCtx
structure and reduce the number of memory writes to it. Additionally, it
is part of an effect to reduce the number of places where detection
tracks various forms of state.
1 year ago
Victor Julien 97f78e1b49 detect/content-inspect: reduce scope of internal func 1 year ago
Victor Julien e9b33c48f0 detect/base64: move content inspection logic
Integrate with rest of content inspect code.
1 year ago
Victor Julien 6a01f40d40 detect/krb5.sname: use new content inspect entry 1 year ago
Victor Julien c9ab95cbe2 detect/dns.query: use new content inspect entry 1 year ago
Victor Julien d73cce478c detect/content-inspect: add entry for InspectionBuffer
This is a convinience addition to abstract away the internals of
the InspectionBuffer in keyword specific detection code.
1 year ago
Victor Julien b357532e7e detect/content-inspect: switch type of enum 1 year ago
Victor Julien 1f265d9d79 detect/content-inspect: assist branch prediction
Hitting the recursion limit should be rare.
1 year ago
Victor Julien b1fa975503 detect/content-inspect: remove const casting 1 year ago
Victor Julien 0ba4b297df detect/content-inspect: pass const to inspect func 1 year ago
Victor Julien a7c9028f01 detect/content-inspect: reduce scope of variables 1 year ago
Stephen Donnelly 0850e3d137 util/time: Improve usecs handling in time macros
Fix SCTIME_ADD_SECS zeroing subsecond part

When adding s seconds to SCtime_t ts, don't zero out the ts.usecs field.

Issue: 6584

Fix SCTIME_FROM_TIMESPEC garbage microseconds part

When converting nanosecond to microseconds divide by 1000 instead
of multiplying by 1000.

Issue: 6585
1 year ago
Ilya Bakhtin 417806ca35 napatech: Fix packet timestamps
Initialize both seconds and useconds of packet timestamp from napatech
timestamp format.

This commit uses updated macro definitions from util-utime.h to avoid
zero seconds value.

Issue: 6372
1 year ago
Ilya Bakhtin d3095ac058 util/time: Prevent usecs overflow
This commit takes care of original seconds value and prevents the
useconds field from overflowing pas its maximum value.

Issue: 6372
1 year ago
Juliana Fajardini bdec2d8ea8 pgsql: don't log password msg if password disabled
If the logging of the password is disabled, there isn't much point in
logging the password message itself.
1 year ago
jason taylor fc81c99b58 doc: add file.name information to smtp keyword doc
Signed-off-by: jason taylor <jtfas90@gmail.com>
1 year ago
jason taylor 9d1ad0187e doc: add file.name information to nfs keyword doc
Signed-off-by: jason taylor <jtfas90@gmail.com>
1 year ago
jason taylor 327ba7397a doc: add file.name information to smb keyword doc
Signed-off-by: jason taylor <jtfas90@gmail.com>
1 year ago
jason taylor e4077b8803 doc: update ftp keyword doc example rule format
Signed-off-by: jason taylor <jtfas90@gmail.com>
1 year ago
jason taylor bb1f7575d3 doc: add file.name information to ftp keyword doc
Signed-off-by: jason taylor <jtfas90@gmail.com>
1 year ago
jason taylor bbc17b1c7d doc: add file.name information to http keyword doc
Signed-off-by: jason taylor <jtfas90@gmail.com>
1 year ago
Vincent Li 64d12aacc8 ebpf: Update eBPF map to BTF defined map
legacy map definition is removed from libbpf1.0+.
update the legacy map definition to BTF defined map.

Distros with < libbpf1.0 (0.5, 0.6, 0.7, 0.8) bpf_helpers.h
support BTF map definition, this change does not break
old libbpf and support new libpbf1.0+.

Bug: #6250

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
Co-authored-by: Victor Julien <vjulien@oisf.net>
1 year ago
Juliana Fajardini 9aeeac532e pgsql: remove probe_ts function
With the changes in the probing_ts function, this other one could become
obsolete. Remove it, and directly call `parser::parse_request` when
checking for gaps, instead.
1 year ago
Juliana Fajardini 53d29f652a pgsql: remove unused error handling call 1 year ago
Juliana Fajardini afd6e4dc41 pgsql: don't log unknown message type 1 year ago
Juliana Fajardini 4f85d06192 pgsql: fix probing functions
Some non-pgsql traffic seen by Suricata is mistankenly identified as
pgsql, as the probing function is too generic. Now, if the parser sees
an unknown message type, even if it looks like pgsql, it will fail.

Bug #6080
1 year ago
Juliana Fajardini 1ac5d97259 pgsql: add unknonwn frontend message type
We had unkonwn message type for the backend, but not the frontend
messages. It's important to better identify those to improve pgsql
probing functions.

Related to
Bug #6080
1 year ago
Shivani Bhardwaj c1bf955326 detect-engine: use ports only after edge case handling
Also, add comments to clarify what's happening in the code.
1 year ago
Shivani Bhardwaj 77eb85e224 detect: remove misleading comment
The comment seems to have come from the enum for addresses where IPv4
and IPv6 matters.
1 year ago
Shivani Bhardwaj 8960a86f4f detect/port: remove BUG_ON in favor of PORT_ER
Either the BUG_ON condition would hit or PORT_ER. Prefer to return error
in case of an error as the fn expects that.
1 year ago
Shivani Bhardwaj d8a887e518 detect/engine: defensive check and comment update 1 year ago
Shivani Bhardwaj 945ec4bc0a detect: remove redundant null setting
de_ctx->dport_hash_table is already set to NULL in the fn
DetectPortHashFree which is called right before this setting.
Remove the redundant setting.
1 year ago
Shivani Bhardwaj 6076b9e2f0 detect: use proper names for whitelist score criteria 1 year ago