Commit Graph

12401 Commits (fa4dedc1d42784d01bedb9e92398eaec460854b4)
 

Author SHA1 Message Date
Philippe Antoine fa4dedc1d4 nfs2: improve READ parsing
Inspired by commit ddf14e51dc

But keeping old nom version
4 years ago
Philippe Antoine 7986919df0 fuzz: specify protocol with fuzz target name
cf https://redmine.openinfosecfoundation.org/issues/4125

This allows fuzz_applayerparser_parse to fuzz one specific
app-layer protocol based on the binary name, as is done
with the environment variable FUZZ_APPLAYER
That is if we rename/copy to fuzz_applayerparser_parse_smb,
it will fuzz only SMB protocol
This way, we can easily produce different fuzz targets for
each protocol in oss-fuzz

(cherry picked from commit e9b76a0e66)
4 years ago
Jeff Lucovsky 2f8f45ff6a netmap: Fixup issues with v14+ backport
This commit reduces the changes associated with adding the v14 api to
6.0.x

During the preparation of this commit, issues in the original backport
were corrected
- Failure to release a lock under error conditions
- Typo in an CPP ifdef
- Incorrect target for goto statement in an error handling case.

Issue: 5744
4 years ago
Philippe Antoine 2c49a268e2 test: do not output non ascii character
The unit test for content |aa bz| transforms in place the string
str to replace the 2 characters aa by one character 0xaa
Then, when z is not recognized as a valid hexadeicmal character,
the whole modified string is printed out, inclusing the non-ascii
0xaa

Ticket: #5558
(cherry picked from commit b281199e9a)
4 years ago
Philippe Antoine ffb2e38ae0 smb/ntlmssp: parse fields independently of order
Instead of relying on the usual ordering...

Ticket: #5258
(cherry picked from commit 1db8685848)

Manual conflict fixes to use nom instead of nom7
4 years ago
Jason Ish 126f06b47e doc/userguide: ubuntu: install software-properties-common
This package likely needs to be installed when starting with an Ubuntu
container or other minimal Ubuntu install.

Ticket: #5616
(cherry picked from commit 0a4e3d0f82)
4 years ago
Victor Julien ba4a533797 smb: fix post-trunc chunk behavior
After a gap in a file transaction, the file tracker is truncated. However
this did not clear any stored out of order chunks from memory or stop more
chunks to be stored, leading to accumulation of a large number of chunks.

This patches fixes this be clearing the stored chunks on trunc. It also
makes sure no more chunks are stored in the tracker after the trunc.

Bug: #5781.
(cherry picked from commit a24d7dc45c)
4 years ago
Victor Julien 26fc02227b streaming/sbb: fix debug message
(cherry picked from commit 989e5c7ba2)
4 years ago
Victor Julien eb03cdea85 stream: remove bug on from packet path
(cherry picked from commit a00db15bd4)
4 years ago
Victor Julien 9664d97129 src: fix deprecated-non-prototype compile warnings
Tested on Fedora 37 with clang 15.

util-strlcatu.c:45:8: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
size_t strlcat(dst, src, siz)
           ^
1 error generated.

(cherry picked from commit 41ca206fdf)
4 years ago
Victor Julien 0a17103ab8 src: fix unused-but-set-variable compile warnings
Tested on Fedora 37 with clang 15.

datasets.c:852:9: error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
    int n = 0;
        ^
1 error generated.

(cherry picked from commit 1bc6976a06)
4 years ago
Victor Julien 9f6862cb50 src: fix strict-prototype warnings
Tested on Fedora 37 with clang 15.

app-layer.c:1055:27: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void AppLayerSetupCounters()
                          ^
                           void
app-layer.c:1176:29: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void AppLayerDeSetupCounters()
                            ^
                             void
2 errors generated.

(cherry picked from commit ebd8728219)
4 years ago
jason taylor 088cc71e6b userguide: update http2 config header syntax
Signed-off-by: jason taylor <jtfas90@gmail.com>
4 years ago
Philippe Antoine 5c0bb7a616 ftp: completely resets port_line
In the case port_line is first allocated and port_line_len is set,
Then a second request reaches memcap and frees port_line,
port_line_len should also be reset, because both will get used
by the response parsing.

Ticket: #5701
(cherry picked from commit 1660172a8b)
4 years ago
Philippe Antoine b5131da355 dcerpc: store consumed_bytes as i32
As it can grow bigger than u16

(cherry picked from commit 704bc878ea)
4 years ago
Jason Ish 6b6709c9d9 rust: fix for loop over option
As of Rust 1.66 with strict mode enabled, a for loop over an option is
now an error. Replace the last occurrence of this pattern with an "if
let" statement.
4 years ago
Philippe Antoine 462366d447 tls: fix off by one in supported versions extension
Ticket: #5663
(cherry picked from commit b5147189ae)
4 years ago
Victor Julien b24ae521a2 ssl: add debug validation checks for recent changes
Make sure the assumptions are correct.

(cherry picked from commit 8f0d820218)
4 years ago
Philippe Antoine 97f97dd72a tls: fix buffer overread
Recently introduced by commit 4bab6e24e5

Ticket: #5564
(cherry picked from commit 3fbcba8ab7)
4 years ago
Philippe Antoine 9305538309 ssl: fix compiler warning
implicit conversion loses integer precision: 'int' to 'uint16_t'
because C shifts << translates automatically to signed integers

(cherry picked from commit ae6abd8ca3)
4 years ago
Victor Julien f0d9cc5a5e 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.

(cherry picked from commit 1701a6b14c)
4 years ago
Victor Julien 541945f4a8 ssl: add debug validation check for incomplete api
(cherry picked from commit 9053c49178)
4 years ago
Victor Julien 29740e1c0c 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'.

(cherry picked from commit 69be41b241)
4 years ago
Victor Julien dfc332fe49 tls: improve versions extension logic
Skip over unusable versions like GREASE.

(cherry picked from commit c028800ae1)
4 years ago
Victor Julien 43a3a7ee39 tls: make version and size checks stricter
This way bad records won't buffer lots of stream data.

(cherry picked from commit 599791fa33)
4 years ago
Victor Julien 5ef12461cf 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.

(cherry picked from commit c73d812026)
4 years ago
Victor Julien 5e834aca0f tls: prepare for client cert parsing
(cherry picked from commit 10f5e6cb66)
4 years ago
Victor Julien 4427809994 tls: make cert handling more generic
In preparation for client cert handling.

(cherry picked from commit 14b2e04b58)
4 years ago
Victor Julien 0f987a99dd tls: avoid tls.invalid_handshake_message FP
Don't set TLS_DECODER_EVENT_INVALID_HANDSHAKE_MESSAGE event on encrypted
handshake messages.

(cherry picked from commit cf4c201acb)
4 years ago
Victor Julien d787558b0f tls: don't set 2 events for a single exception
Keep the more specific ones.

(cherry picked from commit e9d63f3355)
4 years ago
Victor Julien 75a129f124 tls: remove incomplete tests
These tests are incompatible with the incomplete API usage and should
have been pcap based tests in the first place.

(cherry picked from commit 214e466b29)
4 years ago
Victor Julien 2870809f4e tls: set event if record size exceeds limit
(cherry picked from commit 82e03bd8fc)
4 years ago
Victor Julien 5551388d90 tls: support server hello done message
(cherry picked from commit e857c864ca)
4 years ago
Victor Julien 7be7f32a3d tls: support handshake fragmentation
Implement TLS record defrag for handshake messages.

Ticket: #5183.
(cherry picked from commit 4bab6e24e5)
4 years ago
Victor Julien 0489987afd tls: remove certificate buffering code
TCP Buffering is now done in the app-layer using the incomplete API, on
the SSL/TLS record level. TLS level fragmentation will be implemented
separately.

(cherry picked from commit bcaf0f6f7d)
4 years ago
Victor Julien 3785e03426 tls: parse handshake protocol records in single pass
(cherry picked from commit 0839317ea7)
4 years ago
Victor Julien b3bbac5eae sslv2: use version from client hello
Remove streaming code that is now unused.

Incomplete handling makes this record parsing work on full data.

(cherry picked from commit 9f0ea5e70c)
4 years ago
Victor Julien 253cdb9f8a ssl: implement 'incomplete' handling for SSLv2
(cherry picked from commit c8d79fb81f)
4 years ago
Victor Julien ba70d7b91a tls: streaming mode for application records
To avoid overhead of stream buffering for records we don't do
much with anyway, pass through application records instead of
buffering the entire record in the stream engine.

(cherry picked from commit 6076a51511)
4 years ago
Victor Julien 2651110e0a tls: use incomplete API to get full TLS records
The TLS record header is parsed in streaming mode still, but once the
record size is known we tell the app-layer API to give us the full
record.

Ticket: #5481

(cherry picked from commit 129fcb5c72)
4 years ago
Jeff Lucovsky ad8147a8c1 detect/tls: Improve tls.fingerprint rule handling
Issue: 4581

This commit improves the runtime performance of rules with
tls.fingerprint by using the inspection logic from tls.cert_fingerprint.

(cherry picked from commit 63745a7879)
4 years ago
Jeff Lucovsky 2ca1b7f39a detect/uri: Remove unnecessary include
This commit removes an unnecessary #include for detect-uricontent.h

(cherry picked from commit 6bccd5aa30)
4 years ago
Victor Julien 4d5041f82f detect/pcre: don't use JIT if disabled
If we determined not to use JIT at start up, really don't use
JIT.

Bug: #5762.
4 years ago
Sascha Steinbiss 5ccdded6ca ebpf: update deprecated API calls
This fixes build errors when libbpf 1.0 is used. It removes previously
deprecated API functions that were still in use in Suricata's eBPF
code.
4 years ago
Philippe Antoine 938597691c nfs4: fix write record handling
Ticket: #5280
(cherry picked from commit 95f0424423)
4 years ago
Victor Julien 44a2e59cb2 radix: fix ipv6 address parsing warning
The check meant to see if the ip address part of the ip/cidr combo
was more specific than needed wasn't fully implemented, leading to
warnings being issued on completely valid and correct input.

This patch implements the same logic as in IPv4. If the ip address
as specified is different from the ip after the mask has been applied,
a warning is displayed.

Bug: #5747.
(cherry picked from commit 991f9fde32)
4 years ago
Philippe Antoine fb6f1b184c mime: do not skip empty lines for quoted-printable
As these lines are in the file...

Ticket: #5725
(cherry picked from commit 0e054af1ac)
4 years ago
Victor Julien 453366ccb9 mime/base64: unify space handling
(cherry picked from commit 7bfb63210e)
4 years ago
Philippe Antoine 1be913d49c eve: add common options to loggers missing it
So that we get community id for RFB for instance

Ticket: #5723
4 years ago
Victor Julien d607c9295b smb: fix file reopening issue
Fuzzing highlighted an issue where a command sequence on the same file
id triggered a logging issue:

file data for id N
close id N
file data for id N

If this happened in a single blob of data passed to the parser, the
existing file tx would be reused, the file "reopened", confusing the
file logging logic. This would trigger a debug assert.

This patch makes sure a new file tx is created for the file data
coming in after the first file tx is closed.

Bug: #5567.
(cherry picked from commit 45eb038e63)
4 years ago