]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
2 years agoeve: explicit default when setting port 7959/head
Eric Leblond [Sun, 2 Oct 2022 13:00:39 +0000 (15:00 +0200)] 
eve: explicit default when setting port

2 years agoeve: micro simplification
Eric Leblond [Sun, 2 Oct 2022 12:57:28 +0000 (14:57 +0200)] 
eve: micro simplification

2 years agoeve/schema: update following flow changes
Eric Leblond [Sun, 25 Sep 2022 17:56:47 +0000 (19:56 +0200)] 
eve/schema: update following flow changes

2 years agoeve/alert: add direction field to log data way
Eric Leblond [Fri, 16 Apr 2021 21:21:49 +0000 (23:21 +0200)] 
eve/alert: add direction field to log data way

Add a key in the event to specify if the data that did
trigger the alert are in to_client or to_server direction.

2 years agoeve/alert: add src and dest info to flow in alert
Eric Leblond [Sun, 2 Oct 2022 12:42:21 +0000 (14:42 +0200)] 
eve/alert: add src and dest info to flow in alert

When looking at an alert event, it was impossible to determine which
side from src or dest IP in the alert was the client and wich side
was the server with regards to the underlying flow. This was a problem
when you try to known who belongs a metadata property such as a HTTP
hostname or a TLS JA3.

This patch updates the code to add src and dest IP in the flow
subobject as well as src and dst port. This way, we can now which
side is the client and which side is the server.

The result is looking like:

{
  "event_type": "alert",
  "src_ip": "22.47.184.196",
  "src_port": 81,
  "dest_ip": "192.168.1.47",
  "dest_port": 1063,
  "proto": "TCP",
  "tx_id": 0,
  "alert": {
    "signature_id": 2018959,
    "rev": 3,
  },
  "app_proto": "http",
  "flow": {
    "pkts_toserver": 22,
    "pkts_toclient": 35,
    "bytes_toserver": 1370,
    "bytes_toclient": 48852,
    "start": "2009-10-28T10:01:46.755232+0100",
    "src_ip": "192.168.1.47",
    "dest_ip": "22.47.184.196",
    "src_port": 1063,
    "dest_port": 81
  }
}

2 years agounix-socket: add command to get flow stats
Eric Leblond [Thu, 25 Mar 2021 08:16:48 +0000 (09:16 +0100)] 
unix-socket: add command to get flow stats

Add a command to extract the accounting data from a live
flow using the unix socket. It takes the flow_id as param
and return the volume of data seen on the flow as well as
its age.

2 years agoflow: add function to get flow using flow_id
Eric Leblond [Fri, 26 Mar 2021 00:00:31 +0000 (01:00 +0100)] 
flow: add function to get flow using flow_id

2 years agoflow: change flow id computation method
Eric Leblond [Thu, 25 Mar 2021 23:13:43 +0000 (00:13 +0100)] 
flow: change flow id computation method

Previous method was truncating the flow hash value when building
the flow_id. It is interesting not to loose the flow hash value
as it can be used in other tools or to interact with a flow that
is still active.

2 years agojson/flow: log if flow had gap in TCP
Eric Leblond [Tue, 23 Mar 2021 22:45:22 +0000 (23:45 +0100)] 
json/flow: log if flow had gap in TCP

2 years agoflow: add function to say if there is gap
Eric Leblond [Mon, 20 Jun 2022 19:13:31 +0000 (21:13 +0200)] 
flow: add function to say if there is gap

2 years agostream: flag TCP streams with gap
Eric Leblond [Tue, 23 Mar 2021 22:06:41 +0000 (23:06 +0100)] 
stream: flag TCP streams with gap

2 years agorust/smb: avoid allocation in smb status function
Eric Leblond [Sun, 25 Sep 2022 09:51:32 +0000 (11:51 +0200)] 
rust/smb: avoid allocation in smb status function

Avoid an allocation by returning a static string.

2 years agodetect/smb: add smb.ntlmssp_domain keyword
Eric Leblond [Thu, 13 Jan 2022 10:41:49 +0000 (11:41 +0100)] 
detect/smb: add smb.ntlmssp_domain keyword

Feature #5411.

2 years agorust/smb1: add a missing command
Eric Leblond [Thu, 20 Jan 2022 20:43:19 +0000 (21:43 +0100)] 
rust/smb1: add a missing command

2 years agodetect/smb: add smb.ntlmssp_user keyword
Eric Leblond [Thu, 13 Jan 2022 10:28:54 +0000 (11:28 +0100)] 
detect/smb: add smb.ntlmssp_user keyword

Feature #5411.

2 years agorust/smb: import NT status code for Microsoft doc
Eric Leblond [Sun, 19 Dec 2021 13:32:21 +0000 (14:32 +0100)] 
rust/smb: import NT status code for Microsoft doc

This patch updates the NT status code definition to use the status
definition used on Microsoft documentation website. A first python
script is building JSON object with code definition.

```
import json
from bs4 import BeautifulSoup
import requests

ntstatus = requests.get('https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55')

ntstatus_parsed = BeautifulSoup(ntstatus.text, 'html.parser')

ntstatus_parsed = ntstatus_parsed.find('tbody')

ntstatus_dict = {}

for item in ntstatus_parsed.find_all('tr'):
    cell = item.find_all('td')
    if len(cell) == 0:
        continue
    code = cell[0].find_all('p')
    description_ps = cell[1].find_all('p')
    description_list = []
    if len(description_ps):
        for desc in description_ps:
            if not desc.string is None:
                description_list.append(desc.string.replace('\n ', ''))
    else:
        description_list = ['Description not available']
    if not code[0].string.lower() in ntstatus_dict:
        ntstatus_dict[code[0].string.lower()] = {"text": code[1].string, "desc": ' '.join(description_list)}

print(json.dumps(ntstatus_dict))
```

The second one is generating the code that is ready to be inserted into the
source file:

```
import json

ntstatus_file = open('ntstatus.json', 'r')

ntstatus = json.loads(ntstatus_file.read())

declaration_format = 'pub const SMB_NT%s:%su32 = %s;\n'
resolution_format = '        SMB_NT%s%s=> "%s",\n'

declaration = ""
resolution = ""

text_max = len(max([ntstatus[x]['text'] for x in ntstatus.keys()], key=len))

for code in ntstatus.keys():
    text = ntstatus[code]['text']
    text_spaces = ' ' * (4 + text_max - len(text))
    declaration += declaration_format % (text, text_spaces, code)
    resolution += resolution_format % (text, text_spaces, text)

print(declaration)
print('\n')
print('''
pub fn smb_ntstatus_string(c: u32) -> String {
    match c {
''')
print(resolution)
print('''
        _ => { return (c).to_string(); },
    }.to_string()
}
''')
```

Bug #5412.

2 years agodetect: remove unused data struct 7954/head 7957/head
Victor Julien [Thu, 29 Sep 2022 11:09:52 +0000 (13:09 +0200)] 
detect: remove unused data struct

2 years agoeve/schema: flow/stream updates
Victor Julien [Fri, 23 Sep 2022 21:07:04 +0000 (23:07 +0200)] 
eve/schema: flow/stream updates

2 years agoflow/worker: process injected flows more gradually
Victor Julien [Mon, 26 Sep 2022 07:54:37 +0000 (09:54 +0200)] 
flow/worker: process injected flows more gradually

Worker threads are responsible for final processing of timed out flows.
These are selected by the Flow Manager and inserted into a per thread
queue. The Flow Worker then checks this queue after each packet. Due to
the burstiness of this process, the packet threads would sometimes process
a lot of these flows in the context of a single packet, leading to spike
in latency which might cause packet loss.

This patch changes the behavior to only process at max 2 flows per packet.
This way added processing cost is amortized over many packets.

2 years agoflow: count max number of injected flows in workers
Victor Julien [Sun, 25 Sep 2022 09:40:21 +0000 (11:40 +0200)] 
flow: count max number of injected flows in workers

2 years agostream: reduce pool locking overhead
Victor Julien [Fri, 23 Sep 2022 20:54:52 +0000 (22:54 +0200)] 
stream: reduce pool locking overhead

Add thread local cache to avoid locking overhead for ssns and segments.

A thread will return segments/ssns to a local cache first, and if that
is full, to a return queue where the actual return to the pool returns
a batch, to amortize locking overhead.

Adds segment and session pool/cache counters to see where how effective
the cache is.

2 years agostream: minor test cleanup
Victor Julien [Sat, 24 Sep 2022 19:08:30 +0000 (21:08 +0200)] 
stream: minor test cleanup

2 years agococci: fix python issues
Victor Julien [Wed, 21 Sep 2022 08:17:38 +0000 (10:17 +0200)] 
cocci: fix python issues

2 years agofiles: only call loggers is there is work to do
Victor Julien [Wed, 21 Sep 2022 07:34:08 +0000 (09:34 +0200)] 
files: only call loggers is there is work to do

2 years agofilestore: remove obsolete checks
Victor Julien [Wed, 21 Sep 2022 06:48:37 +0000 (08:48 +0200)] 
filestore: remove obsolete checks

2 years agofilestore: fix empty file not opening, but trying to close
Victor Julien [Wed, 21 Sep 2022 06:46:46 +0000 (08:46 +0200)] 
filestore: fix empty file not opening, but trying to close

2 years agoapp-layer: reduce app cleanup and output-tx calls
Victor Julien [Sat, 17 Sep 2022 09:25:22 +0000 (11:25 +0200)] 
app-layer: reduce app cleanup and output-tx calls

Track packets that updated the app-layer, and for those run
the transaction housekeeping and output-tx logging loops.

Do the same of end of flow packets.

This skips needless iterations over the transaction stores.

2 years agooutput/tx: minor cleanups/optimizations
Victor Julien [Sun, 18 Sep 2022 08:10:28 +0000 (10:10 +0200)] 
output/tx: minor cleanups/optimizations

2 years agosrc: includes cleanup
Victor Julien [Fri, 16 Sep 2022 09:08:21 +0000 (11:08 +0200)] 
src: includes cleanup

Work towards making `suricata-common.h` only introduce system headers
and other things that are independent of complex internal Suricata
data structures.

Update files to compile after this.

Remove special DPDK handling for strlcpy and strlcat, as this caused
many compilation failures w/o including DPDK headers for all files.

Remove packet macros from decode.h and move them into their own file,
turn them into functions and rename them to match our function naming
policy.

2 years agodetect: clean up detect-engine-state.h
Victor Julien [Thu, 15 Sep 2022 18:51:54 +0000 (20:51 +0200)] 
detect: clean up detect-engine-state.h

Remove prototypes that are not about purely the data structures.

2 years agodetect: remove wrapper func
Victor Julien [Thu, 15 Sep 2022 18:07:28 +0000 (20:07 +0200)] 
detect: remove wrapper func

2 years agodetect: move DetectTransaction to header its used in
Victor Julien [Thu, 15 Sep 2022 18:04:34 +0000 (20:04 +0200)] 
detect: move DetectTransaction to header its used in

2 years agodetect/files: optimize file.data by skipping non-file txs
Victor Julien [Thu, 15 Sep 2022 08:54:02 +0000 (10:54 +0200)] 
detect/files: optimize file.data by skipping non-file txs

As well as 'file' txs not in our direction.

Implement the same logic for file.name and file.magic prefilter engines.

2 years agofiles/tx: inspection, logging and loop optimizations
Victor Julien [Wed, 14 Sep 2022 13:38:04 +0000 (15:38 +0200)] 
files/tx: inspection, logging and loop optimizations

Introduce AppLayerTxData::file_tx as direction(s) indicator for transactions.
When set to 0, its not a file tx and it will not be considered for file
inspection, logging and housekeeping tasks.

Various tx loop optimizations in housekeeping and output.

Update the "file capable" app-layers to set the fields based on their
directional file support as well as on the traffic.

2 years agodetect/tx: add AppLayerTxData to PrefilterTx
Victor Julien [Thu, 15 Sep 2022 08:45:46 +0000 (10:45 +0200)] 
detect/tx: add AppLayerTxData to PrefilterTx

In preparation of some file inspection optimizations, for which we need the
tx data.

Update all users.

2 years agofiles: remove unused code
Victor Julien [Tue, 23 Aug 2022 15:51:26 +0000 (17:51 +0200)] 
files: remove unused code

2 years agofiles: don't set NOSTORE in 'store all' case
Victor Julien [Mon, 22 Aug 2022 17:16:06 +0000 (19:16 +0200)] 
files: don't set NOSTORE in 'store all' case

2 years agosmtp: remove bad tests
Victor Julien [Sat, 5 Feb 2022 08:31:34 +0000 (09:31 +0100)] 
smtp: remove bad tests

2 years agoapp-layer: move files into transactions
Victor Julien [Sat, 5 Feb 2022 08:20:07 +0000 (09:20 +0100)] 
app-layer: move files into transactions

Update APIs to store files in transactions instead of the per flow state.

Goal is to avoid the overhead of matching up files and transactions in
cases where there are many of both.

Update all protocol implementations to support this.

Update file logging logic to account for having files in transactions. Instead
of it acting separately on file containers, it is now tied into the
transaction logging.

Update the filestore keyword to consider a match if filestore output not
enabled.

2 years agoapp-layer: trunc parser per direction
Victor Julien [Sat, 5 Feb 2022 07:53:58 +0000 (08:53 +0100)] 
app-layer: trunc parser per direction

2 years agoapp-layer: parser flags to u16
Victor Julien [Fri, 19 Aug 2022 08:49:41 +0000 (10:49 +0200)] 
app-layer: parser flags to u16

2 years agoapp-layer: specify direction in tx cleanup
Victor Julien [Fri, 19 Aug 2022 09:08:04 +0000 (11:08 +0200)] 
app-layer: specify direction in tx cleanup

In preparation of per tx files storage.

2 years agoapp-layer: introduce common AppLayerStateData API
Victor Julien [Mon, 26 Apr 2021 12:36:32 +0000 (14:36 +0200)] 
app-layer: introduce common AppLayerStateData API

Add per state structure for storing flags and other variables.

2 years agofile: minor debug updates
Victor Julien [Fri, 10 Jun 2022 06:02:03 +0000 (08:02 +0200)] 
file: minor debug updates

2 years agofile: clean up file flags handling
Victor Julien [Fri, 10 Jun 2022 06:01:15 +0000 (08:01 +0200)] 
file: clean up file flags handling

2 years agofiles: debug log flags
Victor Julien [Thu, 10 Jun 2021 19:06:54 +0000 (21:06 +0200)] 
files: debug log flags

2 years agolua: store id with tx ptr
Victor Julien [Thu, 10 Jun 2021 17:55:38 +0000 (19:55 +0200)] 
lua: store id with tx ptr

2 years agouserguide: Add rule file globbing option details 7948/head
jason taylor [Wed, 21 Sep 2022 20:26:32 +0000 (20:26 +0000)] 
userguide: Add rule file globbing option details

Signed-off-by: jason taylor <jtfas90@gmail.com>
2 years agogithub-actions: bump codecov/codecov-action from 3.1.0 to 3.1.1
dependabot[bot] [Sat, 24 Sep 2022 05:47:57 +0000 (05:47 +0000)] 
github-actions: bump codecov/codecov-action from 3.1.0 to 3.1.1

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/81cd2dc8148241f03f5839d295e000b8f761e378...d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 years agogithub-actions: bump ossf/scorecard-action from 2.0.3 to 2.0.4
dependabot[bot] [Wed, 28 Sep 2022 19:38:15 +0000 (19:38 +0000)] 
github-actions: bump ossf/scorecard-action from 2.0.3 to 2.0.4

Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.0.3 to 2.0.4.
- [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/865b4092859256271290c77adbd10a43f4779972...e363bfca00e752f91de7b7d2a77340e2e523cb18)

---
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>
2 years agodecode-ipv4: adjust validation to RFC
Sascha Steinbiss [Thu, 22 Sep 2022 13:13:05 +0000 (15:13 +0200)] 
decode-ipv4: adjust validation to RFC

RFC1108 only specifies a minimum field length of 3, not
a fixed length of 11.

2 years agodecode-ipv4: implement extended security option
Sascha Steinbiss [Thu, 22 Sep 2022 13:10:47 +0000 (15:10 +0200)] 
decode-ipv4: implement extended security option

IP option 0x85 (extended security) is mentioned in the
documentation for the ipopts keyword but was not implemented.

2 years agoci: build with -Wimplicit-int-conversion
Philippe Antoine [Tue, 27 Sep 2022 14:01:28 +0000 (16:01 +0200)] 
ci: build with -Wimplicit-int-conversion

Seems to have got lost on the way in CFLAGS

2 years agossl: fix compiler warning
Philippe Antoine [Tue, 27 Sep 2022 13:47:06 +0000 (15:47 +0200)] 
ssl: fix compiler warning

implicit conversion loses integer precision: 'int' to 'uint16_t'
because C shifts << translates automatically to signed integers

2 years agorust: lock to time 0.3.13 to avoid MSRV bump to 1.59
Victor Julien [Fri, 26 Aug 2022 12:12:44 +0000 (14:12 +0200)] 
rust: lock to time 0.3.13 to avoid MSRV bump to 1.59

Indirect dependency through x509-parser.

2 years agorust: remove nom 5 dependency
Pierre Chifflier [Wed, 19 Jan 2022 14:56:50 +0000 (15:56 +0100)] 
rust: remove nom 5 dependency

2 years agorust/applayertemplate: convert to nom7
Pierre Chifflier [Wed, 19 Jan 2022 14:06:21 +0000 (15:06 +0100)] 
rust/applayertemplate: convert to nom7

2 years agorust/asn1: convert parsers to nom7
Pierre Chifflier [Wed, 19 Jan 2022 14:06:05 +0000 (15:06 +0100)] 
rust/asn1: convert parsers to nom7

2 years agorust/x509: finish transition to nom7
Pierre Chifflier [Wed, 19 Jan 2022 13:30:54 +0000 (14:30 +0100)] 
rust/x509: finish transition to nom7

2 years agorust/telnet: convert parsers to nom7
Pierre Chifflier [Wed, 19 Jan 2022 13:28:30 +0000 (14:28 +0100)] 
rust/telnet: convert parsers to nom7

2 years agorust/conf: convert parser to nom7
Pierre Chifflier [Wed, 19 Jan 2022 13:26:57 +0000 (14:26 +0100)] 
rust/conf: convert parser to nom7

2 years agorust/ssh: finish transition to nom7
Pierre Chifflier [Wed, 19 Jan 2022 13:21:46 +0000 (14:21 +0100)] 
rust/ssh: finish transition to nom7

2 years agorust/rdp: convert parsers to nom7
Pierre Chifflier [Wed, 19 Jan 2022 13:11:26 +0000 (14:11 +0100)] 
rust/rdp: convert parsers to nom7

2 years agorust/rdp: upgrade dependency on tls-parser
Pierre Chifflier [Wed, 12 Jan 2022 09:56:20 +0000 (10:56 +0100)] 
rust/rdp: upgrade dependency on tls-parser

2 years agorust: upgrade versions of BER/DER, Kerberos and SNMP parsers
Pierre Chifflier [Tue, 11 Jan 2022 14:50:55 +0000 (15:50 +0100)] 
rust: upgrade versions of BER/DER, Kerberos and SNMP parsers

2 years agorust: update x509-parser to 0.14.0
Jason Ish [Mon, 11 Apr 2022 17:22:06 +0000 (11:22 -0600)] 
rust: update x509-parser to 0.14.0

Resolves RustSec issues in time and chrono:
- https://rustsec.org/advisories/RUSTSEC-2020-0071
- https://rustsec.org/advisories/RUSTSEC-2020-0159

Ticket: #5259.

Ammended by Victor Julien to bump to 0.14 instead of 0.13.

2 years agorust/x509: update dependency on x509-parser
Pierre Chifflier [Mon, 1 Nov 2021 13:44:11 +0000 (14:44 +0100)] 
rust/x509: update dependency on x509-parser

2 years agostream: fix reachable assertion 7934/head
Victor Julien [Mon, 26 Sep 2022 15:14:39 +0000 (17:14 +0200)] 
stream: fix reachable assertion

Fix `Flow::thread_id` not always getting properly set up, leading to
a reachable assertion.

Bug #4582.

2 years agouserguide: add section about exception policies 7921/head
Juliana Fajardini [Thu, 15 Sep 2022 23:07:54 +0000 (20:07 -0300)] 
userguide: add section about exception policies

This describes briefly what the exception policies are, what is the
engine's behavior, what options are available and to which parts are
they implemented.

Task #5475
Task #5515

2 years agouserguide: minor rewording and typo fixes
Juliana Fajardini [Fri, 2 Sep 2022 17:27:15 +0000 (14:27 -0300)] 
userguide: minor rewording and typo fixes

Some of these were recently introduced, some were highlited after the
applayer sections got merged. Some paragraphs seem to have been changed
due to trying to respect character limits for lines. Also includes a
typo pointed out by one of our community members via Discord.

2 years agostream/tcp: typo fix
Juliana Fajardini [Fri, 16 Sep 2022 18:12:06 +0000 (15:12 -0300)] 
stream/tcp: typo fix

2 years agodetect: update ttl debug log messages
jason taylor [Wed, 21 Sep 2022 20:46:59 +0000 (20:46 +0000)] 
detect: update ttl debug log messages

Signed-off-by: jason taylor <jtfas90@gmail.com>
2 years agodetect/stream_size: Rename detect.rs to stream_size.rs
Jeff Lucovsky [Thu, 25 Aug 2022 14:44:50 +0000 (10:44 -0400)] 
detect/stream_size: Rename detect.rs to stream_size.rs

This commit renames detect.rs to stream_size.rs to reflect its content.

2 years agodetect/iprep: Move iprep logic into a separate module
Jeff Lucovsky [Thu, 25 Aug 2022 14:39:34 +0000 (10:39 -0400)] 
detect/iprep: Move iprep logic into a separate module

2 years agodetect/uri: Move uri logic into a separate module
Jeff Lucovsky [Thu, 25 Aug 2022 14:32:19 +0000 (10:32 -0400)] 
detect/uri: Move uri logic into a separate module

2 years agodetect/uint: Move uint logic into a separate module
Jeff Lucovsky [Thu, 25 Aug 2022 14:27:00 +0000 (10:27 -0400)] 
detect/uint: Move uint logic into a separate module

This commit moves the uint logic into its own module.

2 years agodoc/byte_math: Add byte_math differences with snort
Jeff Lucovsky [Tue, 2 Aug 2022 15:12:02 +0000 (11:12 -0400)] 
doc/byte_math: Add byte_math differences with snort

Issue: 5077

2 years agodoc: Fixup byte* entries to display tables properly
Jeff Lucovsky [Tue, 2 Aug 2022 15:11:27 +0000 (11:11 -0400)] 
doc: Fixup byte* entries to display tables properly

2 years agorust/detect: Create detect module for rule parsing
Jeff Lucovsky [Sun, 31 Jul 2022 14:45:38 +0000 (10:45 -0400)] 
rust/detect: Create detect module for rule parsing

This commit creates a module named "detect" for rule parsing logic. As
part of this commit, detect.rs is moved from its toplevel position into
the new module. Thus, use crate::detect::detect to refer to items within
detect.rs (instead of create::detect).

Ticket: 5077

2 years agodetect/bytemath: convert parser to Rust
Jeff Lucovsky [Wed, 8 Jun 2022 12:03:44 +0000 (08:03 -0400)] 
detect/bytemath: convert parser to Rust

Issue: 5077

This commit
- Converts the PCRE based parser to Rust.
- Adds unit tests to the new Rust modules
- Removes the PCRE parser from detect-bytemath.c
- Adjusts the C source modules to refer to the Rust definitions
- Includes the multiply operator (missing from the C parser)

2 years agolog: fix coverity warning
Philippe Antoine [Fri, 23 Sep 2022 06:50:43 +0000 (08:50 +0200)] 
log: fix coverity warning

CID 1515529

Checks ftell return value for negative/error

2 years agogithub-ci/codecov: add rust coverage support 7922/head
Victor Julien [Thu, 22 Sep 2022 15:24:38 +0000 (17:24 +0200)] 
github-ci/codecov: add rust coverage support

Based on Rust 1.63 and LLVM 14. Update the jobs to meet those requirements.

Includes the bundled libhtp coverage now, including libhtp tests.

Ticket: #4278.

2 years agotls: handle incomplete header sooner 7902/head
Victor Julien [Wed, 21 Sep 2022 17:56:45 +0000 (19:56 +0200)] 
tls: handle incomplete header sooner

Make sure to exit the parser early on incomplete header data.

Additionally, make sure to not create duplicated tls frames in this
case.

Add a debug validation check for the header parser parsing too much
data, which should never happen.

2 years agossl: add debug validation check for incomplete api
Victor Julien [Wed, 7 Sep 2022 18:51:18 +0000 (20:51 +0200)] 
ssl: add debug validation check for incomplete api

2 years agodebug: add bool string print helper macro
Victor Julien [Wed, 7 Sep 2022 06:38:07 +0000 (08:38 +0200)] 
debug: add bool string print helper macro

2 years agotls: improve record checks
Victor Julien [Wed, 7 Sep 2022 06:32:05 +0000 (08:32 +0200)] 
tls: improve record checks

Improve unknown record handling. Inspired by Wireshark 'unknown record'
handling, we take a best effort approach for records with unknown content
types in TLS versions 1.0, 1.1 and 1.2.

Improve record length check and set 'invalid_record_length' event instead
of 'invalid_tls_header'.

2 years agotls: improve versions extension logic
Victor Julien [Wed, 7 Sep 2022 05:31:38 +0000 (07:31 +0200)] 
tls: improve versions extension logic

Skip over unusable versions like GREASE.

2 years agotls: make version and size checks stricter
Victor Julien [Tue, 6 Sep 2022 12:03:46 +0000 (14:03 +0200)] 
tls: make version and size checks stricter

This way bad records won't buffer lots of stream data.

2 years agoeve/schema: add tls client logging
Victor Julien [Tue, 23 Aug 2022 10:01:18 +0000 (12:01 +0200)] 
eve/schema: add tls client logging

2 years agotls: store cert data in heap buffer
Victor Julien [Mon, 29 Aug 2022 07:25:26 +0000 (09:25 +0200)] 
tls: store cert data in heap buffer

Cert chain is a list of pointers into this buffer, so can't use a
stream slice approach.

2 years agoeve/tls: implement client cert logging
Victor Julien [Tue, 23 Aug 2022 09:35:41 +0000 (11:35 +0200)] 
eve/tls: implement client cert logging

Enable client logging in extended mode.

Add "client", "client_certificate" and "client_chain", where the latter two
depend on "client".

2 years agotls: parse client certificates
Victor Julien [Tue, 23 Aug 2022 09:32:24 +0000 (11:32 +0200)] 
tls: parse client certificates

Parse client cerificates and store them in the state similar to how
this is done for server certificates.

Update "progress" handling to not consider the TLS handshake complete
if the server indicated a client cert was needed.

2 years agotls: prepare for client cert parsing
Victor Julien [Tue, 23 Aug 2022 09:31:08 +0000 (11:31 +0200)] 
tls: prepare for client cert parsing

2 years agoeve/tls: prepare for client cert logging
Victor Julien [Tue, 23 Aug 2022 09:24:41 +0000 (11:24 +0200)] 
eve/tls: prepare for client cert logging

Code cleanups that work on per direction "connp" instead of hard coding
to the server side.

2 years agotls: make cert handling more generic
Victor Julien [Tue, 23 Aug 2022 05:19:38 +0000 (07:19 +0200)] 
tls: make cert handling more generic

In preparation for client cert handling.

2 years agotls: avoid tls.invalid_handshake_message FP
Victor Julien [Mon, 22 Aug 2022 08:49:34 +0000 (10:49 +0200)] 
tls: avoid tls.invalid_handshake_message FP

Don't set TLS_DECODER_EVENT_INVALID_HANDSHAKE_MESSAGE event on encrypted
handshake messages.

2 years agotls: don't set 2 events for a single exception
Victor Julien [Thu, 11 Aug 2022 10:18:28 +0000 (12:18 +0200)] 
tls: don't set 2 events for a single exception

Keep the more specific ones.

2 years agotls: remove incomplete tests
Victor Julien [Thu, 11 Aug 2022 13:25:11 +0000 (15:25 +0200)] 
tls: remove incomplete tests

These tests are incompatible with the incomplete API usage and should
have been pcap based tests in the first place.

2 years agotls: set event if record size exceeds limit
Victor Julien [Mon, 8 Aug 2022 10:02:22 +0000 (12:02 +0200)] 
tls: set event if record size exceeds limit

2 years agotls: support server hello done message
Victor Julien [Wed, 10 Aug 2022 15:44:44 +0000 (17:44 +0200)] 
tls: support server hello done message