]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
15 months agogithub-actions: bump github/codeql-action from 3.24.9 to 3.25.3 11015/head
dependabot[bot] [Wed, 1 May 2024 19:23:45 +0000 (19:23 +0000)] 
github-actions: bump github/codeql-action from 3.24.9 to 3.25.3

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.24.9 to 3.25.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.24.9...v3.25.3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
15 months agogithub-actions: bump actions/download-artifact from 4.1.4 to 4.1.7
dependabot[bot] [Wed, 1 May 2024 19:23:20 +0000 (19:23 +0000)] 
github-actions: bump actions/download-artifact from 4.1.4 to 4.1.7

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.1.4 to 4.1.7.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/c850b930e6ba138125429b7e5c93fc707a7f8427...65a9edc5881444af0b9093a5e628f2fe47ea3b2e)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
15 months agogithub-actions: bump codecov/codecov-action from 4.1.1 to 4.3.1
dependabot[bot] [Wed, 1 May 2024 19:23:17 +0000 (19:23 +0000)] 
github-actions: bump codecov/codecov-action from 4.1.1 to 4.3.1

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.1.1 to 4.3.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/c16abc29c95fcf9174b58eb7e1abf4c866893bc8...5ecb98a3c6b747ed38dc09f787459979aebb39be)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
15 months agogithub-actions: convert dpdk tests to use script
Victor Julien [Wed, 1 May 2024 10:45:09 +0000 (12:45 +0200)] 
github-actions: convert dpdk tests to use script

15 months agogithub-actions: add dpdk ids live test script
Victor Julien [Wed, 1 May 2024 08:51:07 +0000 (10:51 +0200)] 
github-actions: add dpdk ids live test script

15 months agogithub-ci: add af-packet and dpdk codecov builds
Victor Julien [Tue, 23 Apr 2024 15:19:32 +0000 (17:19 +0200)] 
github-ci: add af-packet and dpdk codecov builds

Adds live tests for DPDK and AF_PACKET, with support for code coverage.

15 months agoutil/base64: remove coverity reported dead code
Shivani Bhardwaj [Thu, 25 Apr 2024 14:17:01 +0000 (19:47 +0530)] 
util/base64: remove coverity reported dead code

New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)

** CID 1596621:  Control flow issues  (DEADCODE)
/src/util-base64.c: 238 in DecodeBase64RFC4648()

________________________________________________________________________________________________________
*** CID 1596621:  Control flow issues  (DEADCODE)
/src/util-base64.c: 238 in DecodeBase64RFC4648()
232         DEBUG_VALIDATE_BUG_ON(bbidx == B64_BLOCK);
233
234         /* Handle any leftover bytes by adding padding to them as long as they do not
235          * violate the destination buffer size */
236         if (bbidx > 0) {
237             padding = bbidx > 1 ? B64_BLOCK - bbidx : 2;
>>>     CID 1596621:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach the expression "3U" inside this statement: "numDecoded_blk = 3U - ((pad...".
238             uint32_t numDecoded_blk = ASCII_BLOCK - (padding < B64_BLOCK ? padding : ASCII_BLOCK);
239             if (dest_size < *decoded_bytes + numDecoded_blk) {
240                 SCLogDebug("Destination buffer full");
241                 return BASE64_ECODE_BUF;
242             }
243             /* Decode base-64 block into ascii block and move pointer */

Also, add a comment explaining the padding logic for leftover data.

Bug 6985

15 months agodetect/iprep: update doc about 0 value 11000/head 11013/head
Victor Julien [Thu, 25 Apr 2024 17:34:39 +0000 (19:34 +0200)] 
detect/iprep: update doc about 0 value

A value of 0 was already allowed by the rule parser, but didn't
actually work.

Bug: #6834.

15 months agodetect/iprep: allow 0 as a reputation value
Victor Julien [Thu, 25 Apr 2024 15:07:52 +0000 (17:07 +0200)] 
detect/iprep: allow 0 as a reputation value

Rules would allow checking against value 0, but internally the value
was used to indicate "no value". To address this, the internals now
return negative values for not found. This way value 0 can be fully
supported.

Bug: #6834.

15 months agodetect/iprep: minor code cleanups
Victor Julien [Thu, 25 Apr 2024 12:09:21 +0000 (14:09 +0200)] 
detect/iprep: minor code cleanups

15 months agosdp: fix logging medias 10994/head
Philippe Antoine [Sat, 27 Apr 2024 20:06:09 +0000 (22:06 +0200)] 
sdp: fix logging medias

As introduced by bff790b6ac6f0e5ddf6bd0fe0085881473935c2c

Also handles errors in the caller

Ticket: 6994

15 months agorust/dns: visibility cleanups 10976/head
Jason Ish [Fri, 26 Apr 2024 18:28:25 +0000 (12:28 -0600)] 
rust/dns: visibility cleanups

Remove pub from functions that don't require it.

15 months agorust/dns: ffi naming and visibility cleanups
Jason Ish [Fri, 26 Apr 2024 18:23:44 +0000 (12:23 -0600)] 
rust/dns: ffi naming and visibility cleanups

- Remove no_mangle and pub from FFI functions that are only accessed
  with a function pointer.
- Rename all no_mangle FFI functions to our C naming scheme.

15 months agogithub-ci: remove cocci from fedora 39 build 10971/head
Jason Ish [Fri, 26 Apr 2024 16:13:11 +0000 (10:13 -0600)] 
github-ci: remove cocci from fedora 39 build

Cocci on Fedora 39+ gets stuck for some reason. Cocci has been moved
to a new Ubuntu 24.04 build.

15 months agogithub-ci: add ubuntu 24.04 build with cocci
Jason Ish [Fri, 26 Apr 2024 16:02:26 +0000 (10:02 -0600)] 
github-ci: add ubuntu 24.04 build with cocci

Rather basic 24.04 build for now, but use Cocci as Cocci is working
properly here, but not working in the latest Fedora releases.

15 months agodoc: update flowbits information
jason taylor [Fri, 26 Apr 2024 16:14:22 +0000 (16:14 +0000)] 
doc: update flowbits information

Ticket: #6991

Signed-off-by: jason taylor <jtfas90@gmail.com>
15 months agoci: fix macos build
Philippe Antoine [Tue, 23 Apr 2024 21:29:19 +0000 (23:29 +0200)] 
ci: fix macos build

use brew instead of pip
limit the number of jobs for make
set a prefix where we can install
use brew flags for library finding

15 months agodecode/tcp: improve pointer hygene
Victor Julien [Sat, 20 Apr 2024 10:57:41 +0000 (12:57 +0200)] 
decode/tcp: improve pointer hygene

Avoid NULL pointer calculations.

15 months agodecode/icmpv4: rename ICMPV4_GET_EMB_IPV4 to PacketGetICMPv4EmbIPv4
Victor Julien [Thu, 11 Apr 2024 15:37:15 +0000 (17:37 +0200)] 
decode/icmpv4: rename ICMPV4_GET_EMB_IPV4 to PacketGetICMPv4EmbIPv4

Follows function nameing style.

Ticket: #5517.

15 months agodecode/icmpv6: store embedded ip6h ptr as offset
Victor Julien [Thu, 11 Apr 2024 15:28:12 +0000 (17:28 +0200)] 
decode/icmpv6: store embedded ip6h ptr as offset

Reduces direct pointer usage and reduces Packet size.

Ticket: #6938.

15 months agodecode/icmpv4: store embedded ip4h ptr as offset
Victor Julien [Thu, 11 Apr 2024 15:12:55 +0000 (17:12 +0200)] 
decode/icmpv4: store embedded ip4h ptr as offset

Reduces direct pointer usage and reduces Packet size.

Ticket: #6938.

15 months agodecode/icmpv4: put embedded pointer first
Victor Julien [Thu, 11 Apr 2024 14:51:12 +0000 (16:51 +0200)] 
decode/icmpv4: put embedded pointer first

Reduce gaps in the structure.

Ticket: #6938.

15 months agodecode/tcp: reduce TCPVars by turning bools into bitfields
Victor Julien [Thu, 11 Apr 2024 14:44:16 +0000 (16:44 +0200)] 
decode/tcp: reduce TCPVars by turning bools into bitfields

To reduce Packet size and make similar fields follow the same pattern.

Ticket: #6938.

15 months agoaf-packet: fix eBPF/XDP compilation
Victor Julien [Tue, 9 Apr 2024 13:38:08 +0000 (15:38 +0200)] 
af-packet: fix eBPF/XDP compilation

15 months agodecode/tcp: move tcph into L4 packet data
Victor Julien [Wed, 3 Apr 2024 05:00:53 +0000 (07:00 +0200)] 
decode/tcp: move tcph into L4 packet data

To reduce Packet size.

Ticket: #6938.

15 months agodecode/udp: move udph into L4 packet data
Victor Julien [Tue, 2 Apr 2024 15:47:10 +0000 (17:47 +0200)] 
decode/udp: move udph into L4 packet data

To recude Packet size.

Ticket: #6938.

15 months agodecode/ethernet: move ethh into L2 section
Victor Julien [Tue, 2 Apr 2024 08:18:57 +0000 (10:18 +0200)] 
decode/ethernet: move ethh into L2 section

L2 section similar to L3 and L4 sections.

Ticket: #6938.

15 months agodecode/pppoe: localize pppoedh pointer
Victor Julien [Fri, 29 Mar 2024 18:21:44 +0000 (19:21 +0100)] 
decode/pppoe: localize pppoedh pointer

Remove from Packet struct as there were no users of it.

Ticket: #6938.

15 months agodecode/pppoe: localize pppoesh header pointer
Victor Julien [Fri, 29 Mar 2024 16:05:17 +0000 (17:05 +0100)] 
decode/pppoe: localize pppoesh header pointer

Remove header pointer from Packet as there were no users of it.

Ticket: #6938.

15 months agodecode/icmpv4: move icmpv4h into L4 packet data
Victor Julien [Sat, 30 Mar 2024 12:54:35 +0000 (13:54 +0100)] 
decode/icmpv4: move icmpv4h into L4 packet data

To reduce Packet size.

Ticket: #6938.

15 months agodecode/icmpv6: move icmpv6h into L4 packet data
Victor Julien [Fri, 5 Apr 2024 11:31:41 +0000 (13:31 +0200)] 
decode/icmpv6: move icmpv6h into L4 packet data

Also start vars section in L4 for icmpv6vars.

To reduce Packet size.

Ticket: #6938.

15 months agodecode/esp: move esph into L4 packet data
Victor Julien [Sat, 30 Mar 2024 06:42:05 +0000 (07:42 +0100)] 
decode/esp: move esph into L4 packet data

To reduce Packet size.

Ticket: #6938.

15 months agodecode/gre: move greh into L4 packet data
Victor Julien [Fri, 29 Mar 2024 18:50:52 +0000 (19:50 +0100)] 
decode/gre: move greh into L4 packet data

To reduce Packet size.

Ticket: #6938.

15 months agodecode/sctp: move sctph into L4 packet data
Victor Julien [Fri, 29 Mar 2024 18:42:22 +0000 (19:42 +0100)] 
decode/sctp: move sctph into L4 packet data

Reduces Packet size.

Ticket: #6938.

15 months agodecode/icmpv6: add and use PacketIsICMPv6 inline func
Victor Julien [Thu, 28 Mar 2024 11:23:26 +0000 (12:23 +0100)] 
decode/icmpv6: add and use PacketIsICMPv6 inline func

For better readability and type checking.

Ticket: #5517.

15 months agodecode/icmpv6: switch ptr checks to PKT_IS_ICMPV6
Victor Julien [Thu, 28 Mar 2024 10:55:07 +0000 (11:55 +0100)] 
decode/icmpv6: switch ptr checks to PKT_IS_ICMPV6

For better readability and type checking.

Ticket: #5517.

15 months agodecode/icmpv4: add and use PacketIsICMPv4 inline func
Victor Julien [Thu, 28 Mar 2024 10:39:32 +0000 (11:39 +0100)] 
decode/icmpv4: add and use PacketIsICMPv4 inline func

For better readability and type checking.

Ticket: #5517.

15 months agodecode/udp: add and use PacketIsUDP inline func
Victor Julien [Thu, 28 Mar 2024 10:30:15 +0000 (11:30 +0100)] 
decode/udp: add and use PacketIsUDP inline func

Replace PKT_IS_UDP macro with PacketIsUDP inline function.

For better readability and type checking.

Ticket: #5517.

15 months agodecode/tcp: add and use PacketIsTCP inline func
Victor Julien [Thu, 28 Mar 2024 10:26:36 +0000 (11:26 +0100)] 
decode/tcp: add and use PacketIsTCP inline func

To prepare future changes to the Packet header pointers.

Ticket: #5517.

15 months agodecode: start l4 packet area; convert csum handling
Victor Julien [Fri, 5 Apr 2024 11:28:31 +0000 (13:28 +0200)] 
decode: start l4 packet area; convert csum handling

15 months agodecode/icmpv4: switch ptr checks to PKT_IS_ICMPV4
Victor Julien [Thu, 28 Mar 2024 10:56:23 +0000 (11:56 +0100)] 
decode/icmpv4: switch ptr checks to PKT_IS_ICMPV4

To prepare future changes to the Packet header pointers.

Ticket: #5517.

15 months agodecode: refactor L3 checkum handling
Victor Julien [Fri, 5 Apr 2024 11:25:31 +0000 (13:25 +0200)] 
decode: refactor L3 checkum handling

Use a flag to indicate a calculated csum is available.

Allows packet reset to just use memset.

15 months agodecode: use macro's instead of direct ptr checks
Victor Julien [Thu, 28 Mar 2024 08:41:06 +0000 (09:41 +0100)] 
decode: use macro's instead of direct ptr checks

To prepare future changes to the Packet header pointers.

Ticket: #5517.

15 months agodecode/icmpv6: improve packet vars layout
Victor Julien [Wed, 27 Mar 2024 11:17:15 +0000 (12:17 +0100)] 
decode/icmpv6: improve packet vars layout

Part of effort to make Packet more compact.

Ticket: #6938.

15 months agodecode/icmpv6: remove unused error_ptr field
Victor Julien [Wed, 27 Mar 2024 11:14:06 +0000 (12:14 +0100)] 
decode/icmpv6: remove unused error_ptr field

Was only set, never checked.

Part of effort to make Packet more compact.

Ticket: #6938.

15 months agodecode/icmpv6: remove embedded address storage
Victor Julien [Wed, 27 Mar 2024 11:07:51 +0000 (12:07 +0100)] 
decode/icmpv6: remove embedded address storage

Only used in tests. For the tests, switch to getting headers from embedded IPv6 header.

Part of effort to make Packet more compact.

Ticket: #6938.

15 months agodecode/icmpv6: remove unused L4 header pointers from Packet
Victor Julien [Wed, 27 Mar 2024 10:46:48 +0000 (11:46 +0100)] 
decode/icmpv6: remove unused L4 header pointers from Packet

Not used, so no need to keep them.

Part of effort to make Packet more compact.

Ticket: #6938.

15 months agodecode/icmpv4: shrink icmpv4 packet vars
Victor Julien [Wed, 27 Mar 2024 10:40:46 +0000 (11:40 +0100)] 
decode/icmpv4: shrink icmpv4 packet vars

Remove unused L4 header pointers.

Part of effort to make Packet more compact.

Ticket: #6938.

15 months agodecode/icmpv4: remove unused Packet members
Victor Julien [Wed, 27 Mar 2024 09:56:13 +0000 (10:56 +0100)] 
decode/icmpv4: remove unused Packet members

Addresses are pulled from embedded IPv4 header directly.
Embeded hlen was unused.

Part of effort to make Packet more compact.

Ticket: #6938.

15 months agodecode/tcp: remove unused macro
Victor Julien [Thu, 11 Apr 2024 14:24:51 +0000 (16:24 +0200)] 
decode/tcp: remove unused macro

SET_OPTS is now unused, so remove.

15 months agodecode/tcp: reduce size needed for SACK tracking
Victor Julien [Wed, 27 Mar 2024 09:39:26 +0000 (10:39 +0100)] 
decode/tcp: reduce size needed for SACK tracking

No longer use a pointer, but rather an offset.

Part of effort to make Packet more compact.

Ticket: #6938.

15 months agodecode/tcp: minor struct layout optimization
Victor Julien [Wed, 27 Mar 2024 08:56:16 +0000 (09:56 +0100)] 
decode/tcp: minor struct layout optimization

Part of effort to make Packet more compact.

Ticket: #6938.

15 months agodecode/tcp: reduce size needed for tracking WSCALE
Victor Julien [Wed, 27 Mar 2024 08:43:44 +0000 (09:43 +0100)] 
decode/tcp: reduce size needed for tracking WSCALE

Part of effort to make Packet more compact.

Ticket: #6938.

15 months agodecode/tcp: reduce space needed for tracking TFO
Victor Julien [Wed, 27 Mar 2024 08:31:06 +0000 (09:31 +0100)] 
decode/tcp: reduce space needed for tracking TFO

Part of effort to make Packet more compact.

Ticket: #6938.

15 months agodecode/tcp: reduce space needed for MSS tracking
Victor Julien [Wed, 27 Mar 2024 08:24:39 +0000 (09:24 +0100)] 
decode/tcp: reduce space needed for MSS tracking

Part of effort to make Packet more compact.

Ticket: #6938.

15 months agodecode/tcp: optimize SACKOK storage
Victor Julien [Wed, 27 Mar 2024 08:15:59 +0000 (09:15 +0100)] 
decode/tcp: optimize SACKOK storage

Take less space in the TCPVars for tracking if SACKOK is set.

Reduces size by 16 bytes.

Ticket: #6938.

15 months agodecode/ipv4: minor test cleanups
Victor Julien [Thu, 28 Mar 2024 08:31:11 +0000 (09:31 +0100)] 
decode/ipv4: minor test cleanups

15 months agodecode/ipv6: prep for turning ip4h/ip6h into union
Victor Julien [Tue, 26 Mar 2024 09:21:57 +0000 (10:21 +0100)] 
decode/ipv6: prep for turning ip4h/ip6h into union

Store IPv6 decoder vars in a new Packet::l3 section in the packet.

Use inline functions instead of the often multi-layer macro's for
various IPv6 header getters.

Ticket: #6938.

15 months agodecode/ipv4: prep for turning ip4h/ip6h into union
Victor Julien [Mon, 25 Mar 2024 08:57:06 +0000 (09:57 +0100)] 
decode/ipv4: prep for turning ip4h/ip6h into union

Store IPv4 decoder vars in a new Packet::l3 section in the packet.

Use inline functions instead of the often multi-layer macro's for
various IPv4 header getters.

Ticket: #6938.

15 months agodecode: minor style cleanup in the header ptrs
Victor Julien [Tue, 26 Mar 2024 09:21:31 +0000 (10:21 +0100)] 
decode: minor style cleanup in the header ptrs

15 months agovalidate: remove ip4h/ip6h check
Victor Julien [Mon, 25 Mar 2024 08:34:25 +0000 (09:34 +0100)] 
validate: remove ip4h/ip6h check

In preparation of making them union members.

15 months agodefrag: track ip hdr offset in tracker
Victor Julien [Sun, 24 Mar 2024 06:21:29 +0000 (07:21 +0100)] 
defrag: track ip hdr offset in tracker

In preparation of future Packet structure changes.

Ticket: #6938.

15 months agodecode: reduce macro use in IPv4/IPv6
Victor Julien [Sat, 23 Mar 2024 07:44:38 +0000 (08:44 +0100)] 
decode: reduce macro use in IPv4/IPv6

Improve readability by setting up data/data_len once before
passing on to the other decoders.

Work in preparation of other decoder changes.

Ticket: #5517.

15 months agoflow: avoid direct IP header checks
Victor Julien [Fri, 22 Mar 2024 12:37:35 +0000 (13:37 +0100)] 
flow: avoid direct IP header checks

To prepare future changes to the Packet header pointers.

Ticket: #5517.

15 months agodecode: reduce PKT_IS_IPV4/PKT_IS_IPV6 use
Victor Julien [Fri, 22 Mar 2024 09:34:31 +0000 (10:34 +0100)] 
decode: reduce PKT_IS_IPV4/PKT_IS_IPV6 use

Replace it with inline functions. Adds inline functions to
wrap PKT_IS_IPV4/PKT_IS_IPV6.

This is in preparation of removing the macro's, and cleaning up the
header pointers.

Ticket: #5517.

15 months agodecode: rename IP_GET_IPPROTO to PacketGetIPProto
Victor Julien [Fri, 22 Mar 2024 08:39:11 +0000 (09:39 +0100)] 
decode: rename IP_GET_IPPROTO to PacketGetIPProto

To match function naming style.

Ticket: #5517.

15 months agodecode: implement IP_GET_IPPROTO as inline func
Victor Julien [Fri, 22 Mar 2024 08:36:51 +0000 (09:36 +0100)] 
decode: implement IP_GET_IPPROTO as inline func

For better readability and type checking.

Ticket: #5517.

15 months agotls/random: fix incorrect direction handling
Shivani Bhardwaj [Fri, 26 Apr 2024 07:29:41 +0000 (12:59 +0530)] 
tls/random: fix incorrect direction handling

The connp objects were incorrectly set per direction leading to
incorrect matches on respective directions.

Bug 6989

15 months agopcap: address codeql warning
Victor Julien [Wed, 24 Apr 2024 07:46:11 +0000 (09:46 +0200)] 
pcap: address codeql warning

Use of potentially dangerous function: localtime

Windows localtime is thread safe and no localtime_r is availabe on
Windows, so use separate logic for Windows.

15 months agorohash: fix codeql warnings
Victor Julien [Wed, 24 Apr 2024 07:40:32 +0000 (09:40 +0200)] 
rohash: fix codeql warnings

Suspicious pointer scaling to void

15 months agorohash: minor code cleanups
Victor Julien [Wed, 24 Apr 2024 07:39:07 +0000 (09:39 +0200)] 
rohash: minor code cleanups

15 months agomisc: remove some unused includes 10952/head
Jason Ish [Wed, 24 Apr 2024 17:57:26 +0000 (11:57 -0600)] 
misc: remove some unused includes

Remove unused includes noticed while updating runmode access.

15 months agorun-mode: remove duplicate var; add setter function
Jason Ish [Wed, 24 Apr 2024 17:25:19 +0000 (11:25 -0600)] 
run-mode: remove duplicate var; add setter function

Remove the global "run_mode" var as it was a duplicate of the runmode on
the "instance" struct. For direct access outside of suricata.c, use the
getter function.

Also expose a setter function for unit tests that need to change it.

15 months agoutil/base64: add more tests to increase coverage
Shivani Bhardwaj [Wed, 24 Apr 2024 07:59:39 +0000 (13:29 +0530)] 
util/base64: add more tests to increase coverage

15 months agoutil/mime: check invalidity after final b64 block
Shivani Bhardwaj [Wed, 24 Apr 2024 07:17:34 +0000 (12:47 +0530)] 
util/mime: check invalidity after final b64 block

Since there is code in place that skips over invalid base64 characters
and creates a new array out of the remainder vector, all test must be
made after that final array has been created and against the variable
that holds the actual length of the final array.

15 months agoutil/mime: skipped chars should be marked consumed
Shivani Bhardwaj [Wed, 24 Apr 2024 07:17:01 +0000 (12:47 +0530)] 
util/mime: skipped chars should be marked consumed

15 months agoutil/base64: use real numbers in test vectors
Shivani Bhardwaj [Fri, 19 Apr 2024 12:08:21 +0000 (17:38 +0530)] 
util/base64: use real numbers in test vectors

15 months agoutil/base64: update tests to correct consumed bytes
Shivani Bhardwaj [Fri, 19 Apr 2024 11:52:03 +0000 (17:22 +0530)] 
util/base64: update tests to correct consumed bytes

Also, don't treat a successful decoding that had invalid characters as
errors. The caller does not treat them as errors so it makes sense to
consider it successful if something was decoded.

Bug 6964

15 months agoutil/base64: use decoder fns per RFC
Shivani Bhardwaj [Fri, 19 Apr 2024 11:47:30 +0000 (17:17 +0530)] 
util/base64: use decoder fns per RFC

instead of the common decoder fn.

Bug 6964

15 months agoutil/base64: add base64 decode fns per RFC
Shivani Bhardwaj [Fri, 19 Apr 2024 11:45:46 +0000 (17:15 +0530)] 
util/base64: add base64 decode fns per RFC

Base64 decoder tried to handle several different cases in one fn
including how the data should be decoded and corresponding consumed and
decoded bytes calculated for RFC 2045 and RFC 4648 which are very
different. This left window for mistakes and edge cases that one mode is
not supposed to take care of while the other can.

Separate the decoder per RFC so as to have each variable their own scope
and playground. This also makes it much easier to debug if there are any
issues in decoding w.r.t. different callers.

This also takes care of some known issues like making sure the consumed
bytes are correctly handled.

Bug 6964

15 months agodoc: add sdp update
Giuseppe Longo [Sat, 16 Mar 2024 15:01:05 +0000 (16:01 +0100)] 
doc: add sdp update

15 months agorust/sip: parse and log sdp
Giuseppe Longo [Sat, 16 Mar 2024 14:36:42 +0000 (15:36 +0100)] 
rust/sip: parse and log sdp

If SDP payload is found within a SIP message, it will be parsed and then
logged.

Ticket #6627

15 months agorust/sdp: implement logger
Giuseppe Longo [Sat, 16 Mar 2024 14:34:50 +0000 (15:34 +0100)] 
rust/sdp: implement logger

This implements a logger for the SDP protocol.
Given that SDP is encapsulated within other protocols (such as SIP),
enabling it separately is not necessary.

Ticket #6627

15 months agorust/sdp: implement protocol parser
Giuseppe Longo [Sat, 16 Mar 2024 14:34:21 +0000 (15:34 +0100)] 
rust/sdp: implement protocol parser

This implements a parser for the SDP protocol.
Given that SDP is encapsulated within other protocols (such as SIP),
enabling it separately is not necessary.

Ticket #6627.

15 months agoapp-layer: remove unused C wrappers 10947/head
Philippe Antoine [Sun, 21 Apr 2024 21:40:34 +0000 (23:40 +0200)] 
app-layer: remove unused C wrappers

Ticket: 4083

15 months agogithub-ci: update fedora builds 10934/head
Jason Ish [Tue, 23 Apr 2024 14:52:35 +0000 (08:52 -0600)] 
github-ci: update fedora builds

f39 -> f40
f38 -> f39

15 months agodetect/parse: set limits for pcre2
Philippe Antoine [Sun, 24 Mar 2024 20:12:15 +0000 (21:12 +0100)] 
detect/parse: set limits for pcre2

Ticket: 6889

To avoid regexp dos with too much backtracking.
This is already done on pcre keyword, and pcrexform transform.
We use the same default limits for rules parsing.

15 months agohttp2: do not log duplicate headers
Philippe Antoine [Thu, 28 Mar 2024 10:15:51 +0000 (11:15 +0100)] 
http2: do not log duplicate headers

Ticket: 6900

And thus avoid DOS by logging a request using a compressed
header block repeated many times and having a long value...

15 months agohttp2: use a reference counter for headers
Philippe Antoine [Wed, 27 Mar 2024 13:33:54 +0000 (14:33 +0100)] 
http2: use a reference counter for headers

Ticket: 6892

As HTTP hpack header compression allows one single byte to
express a previously seen arbitrary-size header block (name+value)
we should avoid to copy the vectors data, but just point
to the same data, while reamining memory safe, even in the case
of later headers eviction from the dybnamic table.

Rust std solution is Rc, and the use of clone, so long as the
data is accessed by only one thread.

15 months agoutil/base64: fix buffer overflow
Philippe Antoine [Thu, 28 Mar 2024 13:00:02 +0000 (14:00 +0100)] 
util/base64: fix buffer overflow

Ticket: 6902

In case the caller of DecodeBase64 does not supply a big enough
output buffer.

15 months agodefrag: fix check for complete packet
Jason Ish [Fri, 12 Jan 2024 17:09:59 +0000 (11:09 -0600)] 
defrag: fix check for complete packet

The list of fragments may still contain overlaps, so adding up the
fragment lengths is flawed. Instead track the largest size of
contiguous data that can be re-assembled.

Bug: #6675

15 months agodefrag: fix subsequent overlap of start of original (bsd)
Jason Ish [Thu, 7 Dec 2023 22:44:56 +0000 (16:44 -0600)] 
defrag: fix subsequent overlap of start of original (bsd)

Fix the BSD policy case where a subsequent fragment starts before an
original fragment and overlaps the beginning of the original
fragment. In this case the overlapping data from the new fragment is
preferred.

Suricata was preferring the data from the original fragment, but it
should only do that when the original fragment has an offset <= to the
new fragment.

- Adds tests for this case.

Bug: #6669

15 months agodefrag: check next fragment for overlap before stopping re-assembly
Jason Ish [Tue, 28 Nov 2023 18:35:26 +0000 (12:35 -0600)] 
defrag: check next fragment for overlap before stopping re-assembly

Instead of breaking the loop when the current fragment does not have
any more fragments, set a flag and continue to the next fragment as
the next fragment may have data that occurs before this fragment, but
overlaps it.

Then break if the next fragment does not overlap the previous.

Bug: #6668

15 months agodefrag: use uint8_t in unit tests
Jason Ish [Fri, 12 Jan 2024 15:26:22 +0000 (09:26 -0600)] 
defrag: use uint8_t in unit tests

15 months agodefrag: consistent unit test naming
Jason Ish [Mon, 27 Nov 2023 22:27:27 +0000 (16:27 -0600)] 
defrag: consistent unit test naming

Use a more consistent naming scheme between ipv4 and ipv6.

15 months agodefrag: make tests more readable
Jason Ish [Mon, 27 Nov 2023 21:59:23 +0000 (15:59 -0600)] 
defrag: make tests more readable

Make tests more readable for comparing to the paper "Target-Based
Fragmentation Reassembly".

15 months agodefrag: minor cleanups
Jason Ish [Fri, 8 Dec 2023 22:27:12 +0000 (16:27 -0600)] 
defrag: minor cleanups

- typo in comment
- remove debug function that is not used and no longer valid

15 months agodpdk: increase timeout for DPDK test runs 10921/head
Lukas Sismis [Thu, 18 Apr 2024 07:24:50 +0000 (09:24 +0200)] 
dpdk: increase timeout for DPDK test runs

15 months agoutil/mime: adds safety check
Philippe Antoine [Thu, 18 Apr 2024 11:36:34 +0000 (13:36 +0200)] 
util/mime: adds safety check

Ticket: 6904

Even if there is no problem, just fortify the function,
so that it is future-proof if the caller does not do the check.

15 months agodetect: use direction-based tx for app-layer logging
Philippe Antoine [Thu, 18 Apr 2024 09:54:34 +0000 (11:54 +0200)] 
detect: use direction-based tx for app-layer logging

When we only have stream matches.

Ticket: 6846

This solves the case where another transaction was created
by parsing data in the other direction, before running the
detection.

Like
1. get data in direction 1
2. acked data: parse it, but do not run detection in dir 1
3. other data in direction 2
4. other data acked : parse it and create new tx,
then run detection for direction 1 with data from first packet