]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
3 years agogithub/codeowners: update 7594/head
Victor Julien [Thu, 30 Jun 2022 15:13:09 +0000 (17:13 +0200)] 
github/codeowners: update

3 years agoftp: optimized tx iterator
Philippe Antoine [Fri, 29 Apr 2022 11:12:56 +0000 (13:12 +0200)] 
ftp: optimized tx iterator

To be more efficient with larger number of transactions.

Ticket: #5314

3 years agomime: remove unused length fields 7586/head
Victor Julien [Wed, 29 Jun 2022 09:16:43 +0000 (11:16 +0200)] 
mime: remove unused length fields

3 years agofuzz/mime: fix call conditions and args
Victor Julien [Tue, 28 Jun 2022 18:20:37 +0000 (20:20 +0200)] 
fuzz/mime: fix call conditions and args

The SMTP parser should not supply lines w/o EOL chars to the mime
parser unless its in the BODY parsing stage. Mimic this in the fuzz
target by testing the state for inputs that have no EOL.

Additionally, make sure the delim cnt reflects the missing EOL.

3 years agomime: fix corner case
Victor Julien [Tue, 28 Jun 2022 13:29:25 +0000 (15:29 +0200)] 
mime: fix corner case

Fix a corner case where a base64 sequence including a space was followed
by a newline in the input data.

3 years agomime: add base64 related debug messages
Victor Julien [Tue, 28 Jun 2022 13:29:11 +0000 (15:29 +0200)] 
mime: add base64 related debug messages

3 years agomime: improved empty line handling
Victor Julien [Tue, 28 Jun 2022 11:07:37 +0000 (13:07 +0200)] 
mime: improved empty line handling

Make sure a new body is not set up on empty lines unless it is
a body that is not encoded as base64/quoted printable.

3 years agomime: fix and cleanup tests
Victor Julien [Tue, 28 Jun 2022 05:46:54 +0000 (07:46 +0200)] 
mime: fix and cleanup tests

Line count check was failing after recent delim handling updates.

3 years agosmtp: fix passing a wrong delim len around
Victor Julien [Mon, 27 Jun 2022 18:51:53 +0000 (20:51 +0200)] 
smtp: fix passing a wrong delim len around

3 years agomime: properly pass full lines to non-decoded body
Victor Julien [Mon, 27 Jun 2022 18:15:16 +0000 (20:15 +0200)] 
mime: properly pass full lines to non-decoded body

Use actual delim count and make sure we also pass on empty lines
(so delim(s) only).

3 years agomime/base64: fix final data not getting processed
Victor Julien [Mon, 27 Jun 2022 14:20:02 +0000 (16:20 +0200)] 
mime/base64: fix final data not getting processed

If the last data of the body was not a multple of 4 and not padded
to be a multiple of 4, it would not be processed.

3 years agostream: fix GAP check
Victor Julien [Mon, 27 Jun 2022 09:34:14 +0000 (11:34 +0200)] 
stream: fix GAP check

Gap check would consider a GAP when the current data was in fact
exactly not a gap, but next segment(s) were already available.

3 years agomime: minor code cleanup
Victor Julien [Sun, 26 Jun 2022 20:43:38 +0000 (22:43 +0200)] 
mime: minor code cleanup

3 years agomime: remove unused 'linerem' logic
Victor Julien [Sun, 26 Jun 2022 14:25:36 +0000 (16:25 +0200)] 
mime: remove unused 'linerem' logic

3 years agosmtp/mime: fix parsing edge case
Victor Julien [Sun, 26 Jun 2022 00:29:34 +0000 (02:29 +0200)] 
smtp/mime: fix parsing edge case

Correctly track "remaining" bytes after partial base64 decoding.

Add comment clarifications and debug validation checks.

3 years agosmtp: skip preprocessing for mime headers
Victor Julien [Sat, 25 Jun 2022 11:01:37 +0000 (13:01 +0200)] 
smtp: skip preprocessing for mime headers

Mime parser doesn't expect partial lines, which preprocessing can
provide. Add a check to let mime headers be handled by regular line
parsing.

3 years agoeve/schema: add drop.udplen, email fields
Victor Julien [Fri, 17 Jun 2022 11:23:26 +0000 (13:23 +0200)] 
eve/schema: add drop.udplen, email fields

3 years agosource/pcap: fix infinite loop if interface goes down
Juliana Fajardini [Tue, 28 Jun 2022 20:06:50 +0000 (17:06 -0300)] 
source/pcap: fix infinite loop if interface goes down

When in live-pcap mode, if the sniffed interface went down and up again,
Suri would enter an infinite and keep running, while not registering new
events. This fixes that behavior by allowing Suri to retry to open the
pcap in case of a retry on an already activated capture
('PCAP_ERROR_ACTIVATED').

This change is based on Zhiyuan Liao's work.

Bug #3846

3 years agogithub-actions: bump ossf/scorecard-action from 1.1.1 to 1.1.2
dependabot[bot] [Tue, 28 Jun 2022 19:39:06 +0000 (19:39 +0000)] 
github-actions: bump ossf/scorecard-action from 1.1.1 to 1.1.2

Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](https://github.com/ossf/scorecard-action/compare/3e15ea8318eee9b333819ec77a36aca8d39df13e...ce330fde6b1a5c9c75b417e7efc510b822a35564)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
3 years agodetect: impose limits on pcrexform
Philippe Antoine [Mon, 27 Jun 2022 14:10:51 +0000 (16:10 +0200)] 
detect: impose limits on pcrexform

As is done for pcre keyword

Ticket: #5409

3 years agodevguide: incorporate contribution process page
Juliana Fajardini [Wed, 22 Dec 2021 12:47:24 +0000 (12:47 +0000)] 
devguide: incorporate contribution process page

That page existed only in our redmine. Updated and added a few things,
like a paragraph about our expectations for feature contributors.

Also updated links, contacts and some other processes that may have
changed since last edition.

Added some section labels in related documents, for ease of referencing.

Task #4929

3 years agodetect: set drop reason for rule based drops 7553/head
Victor Julien [Thu, 16 Jun 2022 15:27:35 +0000 (17:27 +0200)] 
detect: set drop reason for rule based drops

Call `PacketDrop` with drop reason for drops, keep old logic
in place for the rest.

3 years agostream: suppress exception policy debug message
Victor Julien [Thu, 16 Jun 2022 15:07:49 +0000 (17:07 +0200)] 
stream: suppress exception policy debug message

3 years agodetect/filestore: clean up stream flag handling
Victor Julien [Fri, 10 Jun 2022 08:34:47 +0000 (10:34 +0200)] 
detect/filestore: clean up stream flag handling

3 years agogithub/workflows: add cargo for all Ubuntu jobs 7534/head
Victor Julien [Mon, 13 Jun 2022 15:21:51 +0000 (17:21 +0200)] 
github/workflows: add cargo for all Ubuntu jobs

3 years agoeve/schema: add pcap_filename field
Victor Julien [Mon, 13 Jun 2022 12:31:39 +0000 (14:31 +0200)] 
eve/schema: add pcap_filename field

3 years agofile: consistently track size of gaps
Victor Julien [Mon, 13 Jun 2022 10:55:52 +0000 (12:55 +0200)] 
file: consistently track size of gaps

Until now only the size of gaps counted in the regular append, not
close and open.

Bug: #5392.

3 years agoeve/schema: add new flow fields
Victor Julien [Fri, 10 Jun 2022 12:59:55 +0000 (14:59 +0200)] 
eve/schema: add new flow fields

3 years agostream: remove unused TCP_LISTEN
Victor Julien [Fri, 10 Jun 2022 14:24:15 +0000 (16:24 +0200)] 
stream: remove unused TCP_LISTEN

Keep the values the same so we might be able to bring it back
w/o issues.

3 years agocounter: tcp liberal counter
Victor Julien [Sun, 28 Nov 2021 19:11:54 +0000 (20:11 +0100)] 
counter: tcp liberal counter

3 years agostream: after missing segments, be liberal on RST
Victor Julien [Sun, 28 Nov 2021 18:20:58 +0000 (19:20 +0100)] 
stream: after missing segments, be liberal on RST

This avoids long lasting inactive flows because in the most likely
case the RST did in fact end the connection. However Suricata may
still consider it to be "established".

3 years agoflow: add various flow counters
Victor Julien [Thu, 25 Nov 2021 06:53:10 +0000 (07:53 +0100)] 
flow: add various flow counters

Add flow.end state counters

Add active TCP sessions counter

Add flow.active counter

Add flow.total counter

Ticket: #1478.

3 years agocounters: add StatsDecr
Victor Julien [Fri, 26 Nov 2021 20:01:08 +0000 (21:01 +0100)] 
counters: add StatsDecr

3 years agoflow/manager: add flow.mgr.rows_sec counter
Victor Julien [Thu, 11 Nov 2021 12:30:46 +0000 (13:30 +0100)] 
flow/manager: add flow.mgr.rows_sec counter

3 years agoflow/recycler: bring back pthread_cond_t sleep
Victor Julien [Thu, 11 Nov 2021 07:34:43 +0000 (08:34 +0100)] 
flow/recycler: bring back pthread_cond_t sleep

Bug #4379.

3 years agoflow/recycler: minor code cleanups
Victor Julien [Thu, 11 Nov 2021 07:17:44 +0000 (08:17 +0100)] 
flow/recycler: minor code cleanups

3 years agoflow/manager: move counters into util func
Victor Julien [Thu, 11 Nov 2021 07:14:51 +0000 (08:14 +0100)] 
flow/manager: move counters into util func

3 years agoflow/manager: minor code cleanups
Victor Julien [Thu, 11 Nov 2021 06:50:26 +0000 (07:50 +0100)] 
flow/manager: minor code cleanups

3 years agoflow/manager: remove debug and dead code
Victor Julien [Thu, 11 Nov 2021 06:43:02 +0000 (07:43 +0100)] 
flow/manager: remove debug and dead code

3 years agoflow/manager: sleep handled by pthread_cond_t again
Victor Julien [Tue, 9 Nov 2021 16:53:18 +0000 (17:53 +0100)] 
flow/manager: sleep handled by pthread_cond_t again

Use only in live mode to allow FM to respond quickly to time
increases in offline mode.

Bug #4379.

3 years agotime: add timeradd implementation
Victor Julien [Wed, 10 Nov 2021 14:40:26 +0000 (15:40 +0100)] 
time: add timeradd implementation

timeradd isn't available on MinGW.

3 years agoflow/manager: adaptive hash eviction timing
Victor Julien [Sat, 6 Nov 2021 19:29:01 +0000 (20:29 +0100)] 
flow/manager: adaptive hash eviction timing

The flow manager scans the hash table in chunks based on the flow timeout
settings. In the default config this will lead to a full hash pass every
240 seconds. Under pressure, this will lead to a large amount of memory
still in use by flows waiting to be evicted, or evicted flows waiting to
be freed.

This patch implements a new adaptive logic to the timing and amount of
work that is done by the flow manager. It takes the memcap budgets and
calculates the proportion of the memcap budgets in use. It takes the max
in-use percentage, and adapts the flow manager behavior based on that.

The memcaps considered are:
    flow, stream, stream-reassembly and app-layer-http

The percentage in use, is inversely applies to the time the flow manager
takes for a full hash pass. In addition, it is also applied to the chunk
size and the sleep time.

Example: tcp.reassembly_memuse is at 90% of the memcap and normal flow
hash pass is 240s. Hash pass time will be:

    240 * (100 - 90) / 100 = 24s

Chunk size and sleep time will automatically be updated for this.

Adds various counters.

Bug: #4650.
Bug: #4808.

3 years agostream: tcp: Handle retransmitted SYN with TSval 7531/head
Michael Tremer [Fri, 11 Mar 2022 11:08:10 +0000 (11:08 +0000)] 
stream: tcp: Handle retransmitted SYN with TSval

For connections that use TCP timestamps for which the first SYN packet
does not reach the server, any replies to retransmitted SYNs will be
tropped.

This is happening in StateSynSentValidateTimestamp, where the timestamp
value in a SYN-ACK packet must match the one from the SYN packet.
However, since the server never received the first SYN packet, it will
respond with an updated timestamp from any of the following SYN packets.

The timestamp value inside suricata is not being updated at any time
which should happen. This patch fixes that problem.

Bug: #4376.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodetect/dcerpc: simplify keyword validation
Victor Julien [Fri, 10 Jun 2022 09:05:40 +0000 (11:05 +0200)] 
detect/dcerpc: simplify keyword validation

Now that the engine understands the relation between SMB and DCERPC better
we can get rid of some of the special case handling in keywords.

3 years agodetect/content: fix FNs due to bad depth calc
Victor Julien [Thu, 9 Jun 2022 20:25:44 +0000 (22:25 +0200)] 
detect/content: fix FNs due to bad depth calc

When trying to propegate the depth/offset, within/distance chains
a logic error would set too a restrictive depth on a pattern that
followed more than one "unchained" patterns.

Bug: #5162.

3 years agodetect/content: simplify int bounds checking
Victor Julien [Thu, 9 Jun 2022 20:25:08 +0000 (22:25 +0200)] 
detect/content: simplify int bounds checking

Use a macro to validate the ranges for overflows. This removes
the clutter of all the checks and warnings, and also no longer
puts the state machine in an undefined state when hitting such
a condition.

3 years agodetect/dcerpc: apply dcerpc to smb as well
Victor Julien [Thu, 9 Jun 2022 11:53:20 +0000 (13:53 +0200)] 
detect/dcerpc: apply dcerpc to smb as well

So 'alert dcerpc' also matches if the DCERPC is over SMB.

Explicitly refuse smb keywords for the 'dcerpc' app proto setting:
`alert dceprc ... smb.share; ...` is rejected.

Remove a now useless special case in the stateless rule processing
matching for dcerpc/smb.

Bug: #5208.

3 years agoevent: only sets APPLAYER_UNEXPECTED_PROTOCOL once
Philippe Antoine [Wed, 1 Jun 2022 13:04:34 +0000 (15:04 +0200)] 
event: only sets APPLAYER_UNEXPECTED_PROTOCOL once

If f->alproto == ALPROTO_UNKNOWN, we do not know the new protocol
yet, so we do not set the event yet.

3 years agoevents: reset logged event
Philippe Antoine [Tue, 31 May 2022 13:49:38 +0000 (15:49 +0200)] 
events: reset logged event

Otherwise, if we log a first app_layer_event, then reset
with AppLayerDecoderEventsResetEvents for a new packet,
then get another event, it does not get logged

Ticket: #5391

3 years agosmb: use default stream-depth 0 by default
Philippe Antoine [Tue, 7 Jun 2022 12:27:56 +0000 (14:27 +0200)] 
smb: use default stream-depth 0 by default

As broken by commit e5c948df87

Ticket: #5390

3 years agoeve/schema: add missing magic from files array 7514/head
Victor Julien [Thu, 9 Jun 2022 08:21:09 +0000 (10:21 +0200)] 
eve/schema: add missing magic from files array

3 years agogithub-actions: bump actions/cache from 3.0.3 to 3.0.4
dependabot[bot] [Tue, 7 Jun 2022 19:41:08 +0000 (19:41 +0000)] 
github-actions: bump actions/cache from 3.0.3 to 3.0.4

Bumps [actions/cache](https://github.com/actions/cache) from 3.0.3 to 3.0.4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/30f413bfed0a2bc738fdfd409e5a9e96b24545fd...c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d)

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

Signed-off-by: dependabot[bot] <support@github.com>
3 years agonfs: fix arbitrary allocation 7511/head
Philippe Antoine [Wed, 8 Jun 2022 12:40:49 +0000 (14:40 +0200)] 
nfs: fix arbitrary allocation

Bug introduced by https://github.com/OISF/suricata/pull/7111

Nom's count begins by allocating a Vector, which leads to arbitrary
allocation due to flavors_cnt coming from network, and not even
being checked against i.len()

Ticket: #5237

3 years agoutil: fix integer warnings in mime decoding
Philippe Antoine [Wed, 8 Jun 2022 15:07:45 +0000 (17:07 +0200)] 
util: fix integer warnings in mime decoding

Ticket: #4516

3 years agodefrag: do not cast pkt len to u16
Philippe Antoine [Wed, 8 Jun 2022 15:02:41 +0000 (17:02 +0200)] 
defrag: do not cast pkt len to u16

as it can overflow

3 years agodetect: change InspectEngineFuncPtr2 to return uint8_t
Philippe Antoine [Fri, 3 Jun 2022 14:08:34 +0000 (16:08 +0200)] 
detect: change InspectEngineFuncPtr2 to return uint8_t

3 years agoci: adds warning flag about integer conversions
Philippe Antoine [Wed, 19 Jan 2022 21:18:57 +0000 (22:18 +0100)] 
ci: adds warning flag about integer conversions

3 years agodetect: fix integer warnings
Philippe Antoine [Tue, 18 Jan 2022 15:11:37 +0000 (16:11 +0100)] 
detect: fix integer warnings

Ticket: #4516

3 years agodetect: fix integer warnings for content
Philippe Antoine [Fri, 3 Jun 2022 13:45:01 +0000 (15:45 +0200)] 
detect: fix integer warnings for content

Ticket: #4516

3 years agodetect: fix integer warnings for app-layer-event
Philippe Antoine [Fri, 3 Jun 2022 13:42:27 +0000 (15:42 +0200)] 
detect: fix integer warnings for app-layer-event

Ticket: #4516

3 years agoftp: fix integer warning
Philippe Antoine [Fri, 3 Jun 2022 07:20:40 +0000 (09:20 +0200)] 
ftp: fix integer warning

Ticket: #4516

3 years agodns: remove unused events field from state
Philippe Antoine [Wed, 8 Jun 2022 12:31:24 +0000 (14:31 +0200)] 
dns: remove unused events field from state

found overflowing by oss-fuzz

3 years agodetect/threshold: fix offline time handling issue
Victor Julien [Tue, 7 Jun 2022 20:57:39 +0000 (22:57 +0200)] 
detect/threshold: fix offline time handling issue

Due to the TIMEVAL_DIFF_SEC calculating the delta into an unsigned
integer, it would underflow to a high positive value leading to
and incorrect result if the packet timestamp was below the timestamp
for the threshold entry. In normal conditions this shouldn't happen,
but in offline mode each thread has its own concept of time which
might differ significantly based on the pcap. In this case the
overflow would be very common.

Changing it to a signed value calculation triggered fuzz undefined
behavior if the packet timeval was very high, so this patch takes a
new approach where it no longer calculates a diff but sets up the
"seconds" value we compare against as a timeval itself, and uses
that to compare.

Fixes: 9fafc1031c0c ("time: Add TIMEVAL_EARLIER and TIMEVAL_DIFF_SEC macros.")
Fixes: 82dc61f4c3e3 ("detect/threshold: Refactor threshold calculation to handle by_rule and by_both.")
Uses add `timeradd` specific version where available.

Bug: #5386.

3 years agostream/midstream: fix double flow reverse case
Victor Julien [Wed, 8 Jun 2022 11:11:55 +0000 (13:11 +0200)] 
stream/midstream: fix double flow reverse case

In the case of midstream SYN/ACK pickup, we reverse the flow based on
the SYN/ACK. If we then later get traffic that appears to be in the
reverse direction based on the app-layer, we would reverse it again.
This isn't correct. When we have the SYN/ACK we know the flow's real
direction.

3 years agoeve/schema: add missing capture_file field
Victor Julien [Tue, 7 Jun 2022 20:31:56 +0000 (22:31 +0200)] 
eve/schema: add missing capture_file field

3 years agoeve/schema: add missing http fields
Victor Julien [Tue, 7 Jun 2022 19:12:46 +0000 (21:12 +0200)] 
eve/schema: add missing http fields

3 years agoeve/schema: add missing alert fields
Victor Julien [Tue, 7 Jun 2022 19:12:33 +0000 (21:12 +0200)] 
eve/schema: add missing alert fields

3 years agoeve/schema: add missing smb fields
Victor Julien [Tue, 7 Jun 2022 12:19:59 +0000 (14:19 +0200)] 
eve/schema: add missing smb fields

3 years agoeve/schema: add missing drop fields for ipv6
Victor Julien [Tue, 7 Jun 2022 12:00:27 +0000 (14:00 +0200)] 
eve/schema: add missing drop fields for ipv6

3 years agoeve/schema: add profiling detect fields
Victor Julien [Tue, 7 Jun 2022 11:55:16 +0000 (13:55 +0200)] 
eve/schema: add profiling detect fields

3 years agobypass: af-packet: fix memory leak - reassign of EBPFBypassData
Lukas Sismis [Sat, 21 May 2022 06:30:06 +0000 (08:30 +0200)] 
bypass: af-packet: fix memory leak - reassign of EBPFBypassData

AF-Packet bypass function in some situations allocates EBPF bypass data
for an already bypassed flow and assigns it to the flow without any checks

Issue: #5368

3 years agobypass: fix memory leak - reassign of FlowBypassInfo
Lukas Sismis [Fri, 20 May 2022 19:33:38 +0000 (21:33 +0200)] 
bypass: fix memory leak - reassign of FlowBypassInfo

In some situations bypass callback is called on already bypassed
flow. This allocates FlowBypassInfo structure for the flow but
does not check if the flow already has one.

Issue: #5368

3 years agonapatech: fix conf API call
Victor Julien [Tue, 7 Jun 2022 08:40:31 +0000 (10:40 +0200)] 
napatech: fix conf API call

3 years agoexceptions: initial exception-policy implementation
Victor Julien [Mon, 14 Mar 2022 06:20:11 +0000 (07:20 +0100)] 
exceptions: initial exception-policy implementation

Adds a framework for setting exception policies. These would be called
when the engine reaches some kind of exception condition, like hitting
a memcap or some traffic processing error.

The policy gives control over what should happen next: drop the packet,
drop the packet and flow, bypass, etc.

Implements the policy for:

    stream: If stream session or reassembly memcaps are hit call the
    memcap policy on the packet and flow.

    flow: Apply policy when memcap is reached and no flow could be
    freed up.

    defrag: Apply policy when no tracker could be picked up.

    app-layer: Apply ppolicy if a parser reaches an error state.

All options default to 'ignore', which means the default behavior
is unchanged.

Adds commandline options: add simulation options for exceptions. These
are only exposed if compiled with `--enable-debug`.

Ticket: #5214.
Ticket: #5215.
Ticket: #5216.
Ticket: #5218.
Ticket: #5194.

3 years agodecode: add pass action wrapper
Victor Julien [Mon, 2 May 2022 19:42:27 +0000 (21:42 +0200)] 
decode: add pass action wrapper

3 years agodecode: turn no payload/packet inspect macros into funcs
Victor Julien [Mon, 2 May 2022 19:27:43 +0000 (21:27 +0200)] 
decode: turn no payload/packet inspect macros into funcs

Remove unused unset macros.

3 years agoeve/drop: log drop reason
Victor Julien [Mon, 21 Mar 2022 20:57:04 +0000 (21:57 +0100)] 
eve/drop: log drop reason

Ticket: #5202.

3 years agostream/tests: remove bad test; update failing test to new behavior
Victor Julien [Tue, 22 Mar 2022 16:06:18 +0000 (17:06 +0100)] 
stream/tests: remove bad test; update failing test to new behavior

3 years agostream: clarify error handling comment
Victor Julien [Wed, 1 Jun 2022 12:49:27 +0000 (14:49 +0200)] 
stream: clarify error handling comment

3 years agostream/reassemble: clarify error handling
Victor Julien [Tue, 22 Mar 2022 16:05:50 +0000 (17:05 +0100)] 
stream/reassemble: clarify error handling

3 years agostream: remove now unused tcp.insert_list_fail counter
Victor Julien [Tue, 22 Mar 2022 16:03:09 +0000 (17:03 +0100)] 
stream: remove now unused tcp.insert_list_fail counter

3 years agostream/segtree: simplify error handling
Victor Julien [Tue, 22 Mar 2022 16:01:03 +0000 (17:01 +0100)] 
stream/segtree: simplify error handling

Now that spurious retransmissions don't propegate into the reassembly
code, error handling can be simplified.

3 years agostream/rules: add example rule for pkt_spurious_retransmission
Victor Julien [Wed, 1 Jun 2022 12:57:52 +0000 (14:57 +0200)] 
stream/rules: add example rule for pkt_spurious_retransmission

3 years agostream: detect spurious retransmissions early
Victor Julien [Tue, 22 Mar 2022 16:00:29 +0000 (17:00 +0100)] 
stream: detect spurious retransmissions early

3 years agogithub-actions: bump github/codeql-action from 1 to 2 7489/head
dependabot[bot] [Fri, 3 Jun 2022 19:40:52 +0000 (19:40 +0000)] 
github-actions: bump github/codeql-action from 1 to 2

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1 to 2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v1...v2)

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

Signed-off-by: dependabot[bot] <support@github.com>
3 years agoconfig: update commented value to default status
jason taylor [Fri, 3 Jun 2022 21:53:05 +0000 (21:53 +0000)] 
config: update commented value to default status

Signed-off-by: jason taylor <jtfas90@gmail.com>
3 years agotests: remove unnecessary flow locks
Victor Julien [Mon, 6 Jun 2022 07:59:15 +0000 (09:59 +0200)] 
tests: remove unnecessary flow locks

Added once to satisfy debug validation, but we don't mix unittests
and debug validation anymore.

    sed -i -E '/.*FLOWLOCK_.*LOCK/d' *.c

3 years agosmtp: minor line loop cleanup 7488/head
Victor Julien [Sun, 5 Jun 2022 18:05:23 +0000 (20:05 +0200)] 
smtp: minor line loop cleanup

3 years agosmtp: remove defunct check for line with single LF
Victor Julien [Sun, 5 Jun 2022 16:23:55 +0000 (18:23 +0200)] 
smtp: remove defunct check for line with single LF

Don't fix it as DATA processing needs all the bytes.

3 years agosmtp: constify line arguments where possible
Victor Julien [Sun, 5 Jun 2022 16:24:05 +0000 (18:24 +0200)] 
smtp: constify line arguments where possible

3 years agosmtp: move current line out of state
Victor Julien [Sun, 5 Jun 2022 15:20:40 +0000 (17:20 +0200)] 
smtp: move current line out of state

3 years agosmtp: move input out of state
Victor Julien [Sun, 5 Jun 2022 13:01:18 +0000 (15:01 +0200)] 
smtp: move input out of state

3 years agosmtp: turn assertions in to debug asserts
Victor Julien [Sat, 4 Jun 2022 06:49:41 +0000 (08:49 +0200)] 
smtp: turn assertions in to debug asserts

3 years agosmtp: simplify preprocess loop
Victor Julien [Sat, 4 Jun 2022 06:49:25 +0000 (08:49 +0200)] 
smtp: simplify preprocess loop

3 years agomime/base64: decode cleanups and simplification
Victor Julien [Fri, 3 Jun 2022 15:10:59 +0000 (17:10 +0200)] 
mime/base64: decode cleanups and simplification

Addresses edge case: > 4 bytes at the end of the input with 2 or more
spaces.

Changes length type for remainder processing to allow for much longer
lines, which can happen in practice.

Adds a series of debug validation checks with real error handling
as well, to assist the fuzzer to find more edge cases.

3 years agobase64: no special case for nul char
Victor Julien [Sat, 4 Jun 2022 05:09:27 +0000 (07:09 +0200)] 
base64: no special case for nul char

Let it be handled like other invalid input.

3 years agobase64: make decoder handle decoded data space constraints
Shivani Bhardwaj [Thu, 2 Jun 2022 15:20:07 +0000 (20:50 +0530)] 
base64: make decoder handle decoded data space constraints

So far, it was the job of caller to send the bae64 decoder a perfect
block of data and take care of the destination buffer (decoded data)
size. Now, make it the decoder's job to take care of any space
constraints that the destination buffer may have and return accordingly.

Also, handle space characters in base64 encoded data as per RFC 2045.

Update MIME parser accordingly to handle the base64 data.

Ticket: 5315

3 years agobase64: add Base64Ecode enum
Shivani Bhardwaj [Fri, 3 Jun 2022 10:26:36 +0000 (15:56 +0530)] 
base64: add Base64Ecode enum

3 years agobase64: add Base64Mode enum
Shivani Bhardwaj [Thu, 12 May 2022 18:00:00 +0000 (23:30 +0530)] 
base64: add Base64Mode enum

3 years agosmtp: treat CR as a line terminator
Shivani Bhardwaj [Fri, 29 Apr 2022 08:51:40 +0000 (14:21 +0530)] 
smtp: treat CR as a line terminator

The ideal line terminator for an SMTP line is <CRLF>. But, given that
bare LF is still allowed by many systems despite the prohibition by
standards, we have to consider that. In order to simplify things, we
consider bare CR as line terminators as well while updating the
delimiter parameter correctly if they were to be followed by a LF
immediately or as a part of next fragment.

This takes care of some edge cases that made base64 decoder error out
because unexpected data was sent to it at times.

Ticket: 5316