Commit Graph

12092 Commits (6e5b7199cfd04ffbbfce4fa1244b80ed1ef61e2a)
 

Author SHA1 Message Date
Philippe Antoine a422acb3c0 http2: null check during upgrade
(cherry picked from commit fa4c7626bd)
5 years ago
Philippe Antoine ad68030b9e dnp3: regenerate object decoding code
Ticket: #4558
So as to avoid intra-structure overflow

(cherry picked from commit 44bd3169eb)
5 years ago
Philippe Antoine 550e8708b0 dnp3: adds bounds check for prefix chararray
Ticket: #4558
Avoids intra structure overflow

(cherry picked from commit 126a7dcb4f)
5 years ago
Philippe Antoine d19649b493 dnp3: use base64 macro in gen script
As is done already in C
cf commit ea0936199d

(cherry picked from commit 5ec9688f03)
5 years ago
Shivani Bhardwaj 2616afa625 ssh: fix match on ssh banner
Default detection handling of SSH should not be to pass in case the
direction was not a match but to treat it like it was meant to server.
5 years ago
Victor Julien 227d1d967a detect: suppress error message for pcre only rules
(cherry picked from commit 9dd1444f44)
5 years ago
Philippe Antoine e5ca0f7abb http2: better rust lifetimes
so that borrow check gets happy

(cherry picked from commit 56fae072b2)
5 years ago
Philippe Antoine 2b4be3187e http2: better rust style
(cherry picked from commit 596a4a9d6e)
5 years ago
Philippe Antoine 4f15d53f1f http2: concatenate one headers multiple values
For detection, as is done with HTTP1

(cherry picked from commit 48ed874dda)
5 years ago
Philippe Antoine ff698f522f http2: generic http2_header_blocks
so as not to forget continuation and push promise
when iterating over headers

(cherry picked from commit e3ff0e7731)
5 years ago
Philippe Antoine 9556b376f9 http2: http.header keyword now works for HTTP2
As well as http.header.raw

(cherry picked from commit 0b0649d98e)
5 years ago
Philippe Antoine 240f779b99 http2: http.header_names keyword now works for HTTP2
(cherry picked from commit 9b9f909d7d)
5 years ago
Philippe Antoine 629a8226a0 http2: http.host normalized keyword now works for HTTP2
(cherry picked from commit 547e9f4ab4)
5 years ago
Philippe Antoine 59a109c049 http2: turn Host header into authority during upgrade
HTTP1 uses Host, but HTTP2 uses rather :authority cf HPACK

(cherry picked from commit 75f75e1eb0)
5 years ago
Jason Ish b8a5479b06 github-ci: pin macos build to 10.15
There is currently a build failure with macos-latest (recently updated)
to 11 in the libhtp test suite code. Not sure if there are other
build issues in libhtp or Suricata at this time.

(cherry picked from commit 8b9721b265)
5 years ago
Philippe Antoine aace45adee http2: do not try to upgrade if http2 is disabled in config
(cherry picked from commit 8536048443)
5 years ago
Philippe Antoine 0c49232e8f http2: flatten code style
(cherry picked from commit 42ba421ca9)
5 years ago
Philippe Antoine 69a70dee4c protodetect: handle all gaps, even when depth is reached
(cherry picked from commit 527415dba0)
5 years ago
Philippe Antoine 8df3ae5529 app-layer/pd: review bailout conditions
To take TCP window into account
And to actually bail out if we received too much data
where the limit is configured by stream.reassembly.depth

(cherry picked from commit f77b027ada)
5 years ago
Victor Julien b13117991a app-layer/pd: only consider actual available data
For size limit checks consider only available data at the stream start
and before any GAPS.

The old check would consider too much data if there were temporary gaps,
like when a data packet was in-window but (far) ahead of the expected
segment.

(cherry picked from commit 7a114e506a)
5 years ago
Victor Julien 1c6e36abb5 streaming/buffer: account sbb data size
When tracking data track the size of the blocks so that in case
of gaps we can still know how much data we hold.

(cherry picked from commit be1baa8cab)
5 years ago
Philippe Antoine 3c8587393d ipv6: simpler generic overlap condition
This also changes the behavior, as the condition is checked in
every case cf ipv6-malformed-fragments-8

(cherry picked from commit 3a230c2208)
5 years ago
Victor Julien d127dc7c52 flow: free spare pool more aggressively
The flows exceeding the spare pools config setting would be freed
per at max 100 flows a second. After a high speed test this would
lead to excessive memory use for a long time.

This patch updates the logic to free 10% of the excess flows per
run, freeing multiple blocks of flows as needed.

Bug: #4731.
(cherry picked from commit fa72a5add8)
5 years ago
Victor Julien 84696a348f threading: force break loop on flow inject
Track availability of break loop callback to avoid overhead.

(cherry picked from commit ff97d7c15d)
5 years ago
Victor Julien 73c7550455 flow: process evicted flows on low/no traffic
In a scenario where there was suddenly no more traffic flowing, flows
in a threads `flow_queue` would not be processed. The easiest way to
see this would be in a traffic replay scenario. After the replay is done
no more packets come in and these evicted flows got stuck.

In workers mode, the capture part handles timeout this was updated to
take the `ThreadVars::flow_queue` into account.

The autofp mode the logic that puts a flow into a threads `flow_queue`
would already wake a thread up, but the `flow_queue` was then ignored.
This has been updated to take the `flow_queue` into account.

In both cases a "capture timeout" packet is pushed through the pipeline
to "flush" the queues.

Bug: #4722.
(cherry picked from commit b788d3345c)
5 years ago
Victor Julien e36ded8275 threading: minor cleanups
(cherry picked from commit 31977170a8)
5 years ago
Victor Julien d5e80ca45a detect: track prefilter by progress, not engine
Fix FNs in case of too many prefilter engines. A transaction was tracking
which engines have run using a u64 bit array. The engines 'local_id' was
used to set and check this bit. However the bit checking code didn't
handle int types correctly, leading to an incorrect left shift result of
a u32 to a u64 bit value.

This commit addresses that by fixing the int handling, but also by
changing how the engines are tracked.

To avoid wasting prefilter engine tracking bit space, track what
ran by the progress they are registered at, instead of the individual
engine id's. While we can have many engines, the protocols use far
fewer unique progress values. So instead of tracking for dozens of
prefilter id's, we track for the handful of progress values.

To allow for this the engine array is sorted by tx_min_progress, then
app_proto and finally local_id. A new field is added to "know" when
the last relevant engine for a progress value is reached, so that we
can set the prefilter bit then.

A consquence is that the progress values have a ceiling now that
needs to fit in a 64 bit bitarray. The values used by parsers currently
does not exceed 5, so that seems to be ok.

Bug: #4685.
(cherry picked from commit 932cf0b6a6)
5 years ago
Victor Julien cd81d899dc detect: unify alert handling; fix bugs
Unify handling of signature matches between various rule types and
between noalert and regular rules.

"noalert" sigs are added to the alert queue initially, but removed
from it after handling their actions. This way all actions are applied
from a single place.

Make sure flow drop and pass are mutually exclusive.

The above addresses issue with pass and drops not getting applied
correctly in various cases.

Bug: #4663
Bug: #4670

(cherry picked from commit aa93984b7e)
5 years ago
Victor Julien 44723bf19e detect: remove dead code
(cherry picked from commit ae89874b06)
5 years ago
Philippe Antoine cf04608992 dns: improve probing parser
Checks opcode is valid
Checks additional_rr do not exceed message length
Better logic for incomplete cases

(cherry picked from commit 9e7ea631b2)
5 years ago
Philippe Antoine c42b81b769 nfs: improve probing parser
Checks credentials flavor is known

(cherry picked from commit b3c1f2ab48)
5 years ago
Philippe Antoine 209feffcda enip: improve probing parser
Strict length for register sessions
NOP command must have options=0

(cherry picked from commit 0c948142b9)
5 years ago
Juliana Fajardini 86175149cc util/lua-common: use lua_pushnumber for SCFileInfo
(cherry picked from commit b3f447a0df)
5 years ago
Juliana Fajardini 2d36eefe86 util/lua-common: use pushinteger w/ byte & pkt cnt
LuaCallbackStatsPushToStackFromFlow tuple is composed of integer values
not all of them had been converted to lua_pushinteger yet.

(cherry picked from commit 8b53468d32)
5 years ago
Juliana Fajardini c7b1c7aa57 util/lua-common: update copyright year
(cherry picked from commit 82cd125c62)
5 years ago
Juliana Fajardini 79a8c90178 util-lua-common: use lua_pushinteger w/ int values
replace lua_pushnumber with lua_pushinteger for SCFlowStats and
SCRuleIds.

(cherry picked from commit 9b6ce27487)
5 years ago
Juliana Fajardini 660d64236d lua/output: fix typo
(cherry picked from commit 00d7a152eb)
5 years ago
Juliana Fajardini d0d0d03a8a lua: use pushinteger for int in flow/packet tuples
(cherry picked from commit 7592a9be43)
5 years ago
Juliana Fajardini 30b1e221ce doc/lua-functions: add sha items to SCFileInfo doc
(cherry picked from commit 751906b71d)
5 years ago
Juliana Fajardini 0a0bce9bba util/lua-common: fix SCFileInfo bug & doc comment
The callback for FileInfo was returning the wrong value, resulting
in loss of some tuple values for one calling SCFileInfo in a script.

The documentation comment wasn't mentioning the sha items that are
pushed.

(cherry picked from commit 1315cb793b)
5 years ago
Philippe Antoine 8704057df0 http2: better file tracking
If an HTTP2 file was within only ont DATA frame, the filetracker
would open it and close it in the same call, preventing the
firther call to incr_files_opened

Also includes rustfmt again for all HTTP2 files

(cherry picked from commit bb98a18b3d)
5 years ago
Victor Julien 8d1c318852 ftp: support per-tx file accounting
(cherry picked from commit 04ba6dc138)
5 years ago
Victor Julien 12e71ed090 smb: add debug validation on file counts
(cherry picked from commit c9cee7af49)
5 years ago
Victor Julien c7da7215db smb: count files in tx
(cherry picked from commit 114d3ba730)
5 years ago
Victor Julien f8a50a66ca http2: support per-tx file accounting
(cherry picked from commit c1dfb619c4)
5 years ago
Victor Julien bed74c7fbc nfs: add debug validation on file counts
(cherry picked from commit 1b3c3225cd)
5 years ago
Victor Julien e9ff5e2c6e nfs: support per-tx file accounting
(cherry picked from commit 1d48601c25)
5 years ago
Victor Julien 8f2f2b55ee nfs: don't reuse file transactions
After a file has been closed (CLOSE, COMMIT command or EOF/SYNC part of
READ/WRITE data block) mark it as such so that new file commands on that
file do not reuse the transaction.

When a file transfer is completed it will be flagged as such and not be
found anymore by the NFSState::get_file_tx_by_handle() method. This forces
a new transaction to be created.

(cherry picked from commit 67759795c6)
5 years ago
Victor Julien 70b3069d4e http: support per-tx file accounting
(cherry picked from commit d74c18ee28)
5 years ago
Victor Julien 00e6f881e4 filestore: store chunks in packet direction
Storing too early can lead to files being considered TRUNCATED if the
TCP state is not yet CLOSED when logging is triggered. This has been
observed with FTP-DATA and might also be an issue with simple HTTP.

(cherry picked from commit ca124b033e)
5 years ago