Commit Graph

10861 Commits (eec7056f54a230b46e643ba96e5bb990e69ab178)
 

Author SHA1 Message Date
Jason Ish eec7056f54 release: 5.0.7; update changelog; require htp 0.5.38 5 years ago
Philippe Antoine 27902ccad6 swf: right input length for decompression
(cherry picked from commit 4d2f9cc8a0)
5 years ago
Shivani Bhardwaj a1976cdf79 ikev2: remove transforms fields 5 years ago
Philippe Antoine bb73684da2 rust: SCLogDebug is real nop when built as release
Before, even if there were no outputs, all the arguments
were evaluated, which could turn expensive

All variables which are used only in certain build configurations
are now prefixed by underscore to avoid warnings

(cherry picked from commit ef5755338f)
5 years ago
Philippe Antoine d0dc72e4e5 smtp: null terminate before calling strtoul
by copying in a temporary buffer
as is done in ByteExtractString

(cherry picked from commit 33fa7ab596)
5 years ago
Eric Leblond f61ef79781 stream/tcp: avoid evasion linked to ACK handling
Actual code will completely discard TCP analysis of a packet that
don't have the ACK bit set but have a ACK value set. This will be
for example the case of all SYN packets that have a ACK value.

Problem is that these type of packets are legit for the operating
systems and for the RFC. The consequence is that an attacker
sending a SYN packet with a non null ACK value will open succesfully
a TCP session to its target and this session will have no protocol
discovery, no TCP streaming and no application layer analysis.
Result is  a quasi full evasion of the TCP stream that will only
appear in the flow log if this log is enable or alert on tcp-pkt
signature that are uncommon.

The patch is updating the code to only discard packets that do not
have the SYN flag set. This prevents the evasion and complies with the
RFC that states that the ACK bit should always be set once the
TCP session is established.

This addresses CVE-2021-35063.

Fixes: fa692df37 ("stream: reject broken ACK packets")

Bug: #4513.
5 years ago
Victor Julien b4086162e6 detect: track base id for xform buffers
Buffers with transforms are based on the non-transformed "base"
buffer, with a new ID assigned and the transform callbacks added.

This patch stores the id of the original buffer in the new buffer
inspect and prefilter structures. This way the buffers with and
without transforms can share some of the logic are progression
of file and body inspection trackers.

Related tickets: #4361 #4199 #3616

(cherry picked from commit 975062cf40)
5 years ago
Victor Julien 7dca928f06 detect/file.data: fix mixing transforms (file api)
Fix handling of file progress tracking for regular file.data along
with transform combinations for the part of the implementation that
uses the File API.

This is done by implementing the 'base id' logic.

Related tickets: #4361 #4199 #3616

(cherry picked from commit 54ad7de9ce)
5 years ago
Victor Julien 3b1a29e4ba detect: fix multi inspect buffer issue; clean up
Fix multi inspect buffer API causing cleanup logic in the single
inspect buffer paths. This could lead to a buffer overrun in the
"to clear" logic.

Multi buffers now use InspectionBufferSetupMulti instead of
InspectionBuffer. This is enforced by a check in debug validation.

Simplify the multi inspect buffer setup code and update the callers.

(cherry picked from commit 3dc50322db)
5 years ago
Victor Julien fdc93130aa detect: set event if max inspect buffers exceeded
If a parser exceeds 1024 buffers we stop processing them and
set a detect event instead. This is to avoid parser bugs as well as
crafted bad traffic leading to resources starvation due to excessive
loops.

(cherry picked from commit e611adf3dc)
5 years ago
Philippe Antoine bbaca48825 doc: update sphinx api to use add_css_file
instead of deprecated add_stylesheet

(cherry picked from commit 95f225e8fb)
5 years ago
Philippe Antoine fdb5f696c4 modbus: fix memory leak in signature parsing
Bug: #4538.
5 years ago
Corey Thomas 7fcc9a5066 rules/decoder-events: fix duplicate sid 5 years ago
Philippe Antoine 3c987b68f4 ftp: completely parses pasv and epsv responses
(cherry picked from commit ca6e434e0b)
5 years ago
Jason Ish 4bf3f88a42 unix-socket: reset to ready state on startup
As part of commit ea15282f47,
some initialization was moved to happen even in unix socket mode,
however, this initialization does setup some loggers that can only have
one instance enabled (anomaly, drop, file-store).

This will cause these loggers to error out on the first pcap, but work
on subsequent runs of the pcap as some deinitialization is done after
each pcap.

This fix just runs the post pcap-file deinitialization routine to
reset some of the initialization done on startup, like is done after
running each pcap in unix socket mode.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/4225

Additionally this prevents alerts from being logged two times
on the first run of a pcap through the unix socket:

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/4434

(cherry picked from commit 488d5fb342)
5 years ago
Victor Julien 61515d769e detect/prefilter: fix null ptr deref on invalid rule
A bad rule 'icode:<0; prefilter;' would trigger a null ptr deref
in ApplyToU8Hash.

Bug #4375.

(cherry picked from commit 7d6835958b)
5 years ago
Victor Julien 9ccab5b4a4 eve/drop: use highest priority drop
When adding the alert to a drop record make sure the add the highest
priority.

It would until now add all drops from high to low prio, effectively
overwriting the record each time.

Ticket #4397

(cherry picked from commit 398ebf9345)
5 years ago
Victor Julien 60658555ba detect/alert: apply pd only actions to flow
Ticket #4394

(cherry picked from commit 6cf44fc839)
5 years ago
Victor Julien 9305d18589 detect/alert: minor code refactor
Use a simpler reject check and move logic into util func.

(cherry picked from commit 6c594d29db)
5 years ago
Victor Julien a9efda193b detect/iponly: don't check & set flow flags twice
Per flow IP-only flags are checked and set by IP-only engine, so
no need to set/check them per alert.

(cherry picked from commit fbcdd2ec26)
5 years ago
Philippe Antoine 63c77fac2b kerberos: fix probing parser tag condition
according to the comment

(cherry picked from commit cb150e97d0)
5 years ago
Jeff Lucovsky 9c436745f6 general: Typo cleanup
(cherry picked from commit 2893b04ab0)
5 years ago
Jeff Lucovsky e8de11ea08 detect/threshold: Improve threshold.config perf
This commit improves performance when parsing threshold.config by
removing a loop-invariant to create a one-time object with the parsed
address(es).

Then, as needed, copies of this object are made as the suppression
rule(s) are processed.

(cherry picked from commit 02ceac8b8d)
5 years ago
Jeff Lucovsky 0f38bc87d1 detect/threshold: Function to deep-copy thresh obj
This commit adds a function to make a deep copy of a DetectThresholdData
object.

The function is used when parsing threshold.config items to make a
one-time object and then add copies as needed.

(cherry picked from commit e873632a28)
5 years ago
Jeff Lucovsky 619acba806 detect/address: Expose DetectAddressCopy function
(cherry picked from commit 11f9cc6524)
5 years ago
Luke Coughlan 4efbb6c3ff flow/bypass: Properly set the ICMP emergency-bypassed value
Currently the ICMP emergency-bypassed value defined in suricata.conf is
overwriting the UDP value rather than correctly setting it for ICMP.
This commit corrects this bug so that the ICMP value can be set as
expected.

(cherry picked from commit 7fb56a9075)
5 years ago
Philippe Antoine f57dbb800a ftp: fixes leak with duplicate expectation
(cherry picked from commit 68d6922e3c)
5 years ago
Victor Julien b46125a64b release: 5.0.6; update changelog; require htp 0.5.37 5 years ago
Victor Julien 16d00160b9 app-layer: fix transaction cleanup
Fix a 'skipped' transaction early in the list leading to all further
transactions getting skipped, even if they were fully processed and
ready to be cleaned up.

(cherry picked from commit 8baef60d60)
5 years ago
Victor Julien 9f87caf756 detect/prefilter: fix handling of prefilter as fast_pattern alias
(cherry picked from commit 0dd5921bc9)
5 years ago
Victor Julien 2bbfe8ba3a classification: sync and update
Sync to latest ET open and introduce inappropriate as a classification
to replace something some find inappropriate.

(cherry picked from commit f037f6f4ff)
5 years ago
Philippe Antoine 03749d9bcc smb: relax probing parser to handle first NBSS message
cf dcerpc-udp S-V test :
First message is Message Type: Session request (0x81)
Second message is SMB

(cherry picked from commit 8307010255)
5 years ago
Philippe Antoine 24ef92c080 detect: fix overflows in SetupU8Hash
For instance ">255" resulted in overflow

(cherry picked from commit 2d765d6c68)
5 years ago
Philippe Antoine 013117bc63 modbus: stop allocating transactions when flooded
cf #4224

(cherry picked from commit 89030d3e59)
5 years ago
Philippe Antoine ebd94211ad ssl: reset state when breaking out of SSLV3_HANDSHAKE_PROTOCOL
So that we cannot resumt it with corrupted values

(cherry picked from commit eb460cf78d)
5 years ago
Philippe Antoine b71227aa34 detect: forbids unsupported prefilters
(cherry picked from commit b7fd01c86e)
5 years ago
Philippe Antoine 273a06f1e1 decode: limits the number of decoded layers
so as to avoid overrecursion leading to stack exhaustion

(cherry picked from commit 7500c29300)
5 years ago
Jason Ish 0cdbdd597a filestore: fix global counter init in unix socket mode
Move initialization of filestore global counter to PreRunInit,
so they get registered during program initialization, or as
required in unix-socket mode, initialized for each file run.

Fixes Redmine issue:
https://redmine.openinfosecfoundation.org/issues/4216

(cherry picked from commit 0aed5e188b)
5 years ago
Jason Ish e56fa815ad github-ci: use suricata-update master-1.1.x branch
Suricata 5.0.x tracks the Suricata-Update 1.1.x branch.
5 years ago
Ilya Bakhtin 176ba4451a stream/tcp: fix stream side after direction change
(cherry picked from commit 1ecea0f44c)
5 years ago
Philippe Antoine 6b8a0a8ef3 http: makes decompression time limit configurable
(cherry picked from commit a04b5566a6)
5 years ago
Ilya Bakhtin 24eeabfbf9 protodetect: improve midstream handling
Set "done flag" only if parsers for both directions are not found in a
case of midstream parsers from other direction are tried if nothing is found
for the initial one. "done flag" must be set if nothing is found in both
directions. Otherwise processing of incomplete data is terminated at the very
first try.

(cherry picked from commit 5285163d8f)
5 years ago
Philippe Antoine f0beb239fe tcp: remove debug asserts about large windows
Completes 00d7c9034b

(cherry picked from commit 7264f58f2c)
5 years ago
Jeff Lucovsky b0746091b5 detct/pcre: Correct capture group count check
This commit corrects the validation check between the number of
variables used and the number of specified capture groups.

(cherry picked from commit 469d5bb214)
5 years ago
Victor Julien 78a64a0580 alert/syslog: fix minor compile warning
(cherry picked from commit 62cc0c7acf)
5 years ago
Victor Julien d29c40ffaf proto/names: add SCTP if not defined in system
If SCTP is missing from /etc/protocols, add it manually.

(cherry picked from commit bf00285d0a)
5 years ago
Victor Julien 0cb70651aa host: improve compare logic
The old compare macro would compare all bytes of an address, even
when for IPv4 addresses the additional bytes were not in use. This
made the logic vulnerable to mistakes like in issue #4280.

(cherry picked from commit 6bfc5afa23)
5 years ago
Victor Julien efe7a65ead detect/iprep: fix loading of mixed ipv4/ipv6 lists
Improper reuse of the address data structure between loading
different lines in the iprep file would lead to the host using
a malformed address.

(cherry picked from commit 7b03e6837e)
5 years ago
Eric Leblond e573433ed7 suricata: avoid at exit crash in nfq mode
When Suricata was build with ebpf support and when it was started
in NFQ mode, it was crashing at exit because it was trying to free
the device extension.

This patch fixes the issue by only trigger the eBPF related code
when Suricata is running in AFP_PACKET mode.

(cherry picked from commit 85327890f5)
5 years ago
Eric Leblond 404d74df0d dataset: fix dataset string lookup
The data was unlocked but the use_cnt was not decreased resulting
in the data entry not being removable.

(cherry picked from commit 64f994f753)
5 years ago