Commit Graph

10973 Commits (beb45c564ec3ed8891189c15ec93195b3e3d87d8)
 

Author SHA1 Message Date
Jeff Lucovsky beb45c564e detect/smtp: Refactor command check
This commit refactors the code that matches reply with command.

Bug: #3677
5 years ago
Jeff Lucovsky dc7a991bfb app-layer/smtp: Improve RSET handling
This commit improves how the parser handles the `RSET` command.
Termination of the transaction occurs when the `RSET` ack is seen (reply
code 250).

Bug: #3677
5 years ago
Philippe Antoine a15e503b7d enip: more precise probing parser
Bug: #3615
5 years ago
Victor Julien 049c5fe230 detect/port: limit recursion in port parsing
Bug: #3586
5 years ago
Victor Julien 476b5f21f3 detect/address: limit recursion during parsing
Allow a max depth of 64.

Bug: #3586
5 years ago
Victor Julien b6658e6269 detect/address: minor cleanups 5 years ago
Victor Julien 41d0dcae99 decode: cleanup packet properly on bad packets
In case of bad IPv4, TCP or UDP, the per packet ip4vars/tcpvars/udpvar
structures would not be cleaned up because the cleanup depends on the
'header' pointer being set, but the error handling would unset that.

This could mean these structures were already filled with values before
the error was detected. As packets were recycled, the next packet decoding
would use this unclean structure.

To make things worse these structures are part of unions. IPv4/IPv6 and
TCP/ICMPv4/ICMPv6 share the same memory location.

LibFuzzer+UBSAN found this both locally and in Oss-Fuzz:

decode-ipv6.c:654:9: runtime error: load of value 6, which is not a valid value for type 'bool'
    #0 0x6146f0 in DecodeIPV6 /src/suricata/src/decode-ipv6.c:654:9
    #1 0x617e96 in DecodeNull /src/suricata/src/decode-null.c:70:13
    #2 0x9dd8a4 in DecodePcapFile /src/suricata/src/source-pcap-file.c:412:9
    #3 0x4c8ed2 in LLVMFuzzerTestOneInput /src/suricata/src/tests/fuzz/fuzz_sigpcap.c:158:25
    #4 0x457e51 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:556:15
    #5 0x457575 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:470:3
    #6 0x459917 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:698:19
    #7 0x45a6a5 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:830:5
    #8 0x448728 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:824:6
    #9 0x472552 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:19:10
    #10 0x7ff0d097b82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #11 0x41bde8 in _start (/out/fuzz_sigpcap+0x41bde8)

Bug: #3496
5 years ago
Victor Julien 3ed188e0bc ssl: support multi-frag certificate assembly
Support reassembling multi-frag certificates. For this the cert queuing
code is changed to queue just the cert, not entire tls record.

Improve message tracking. Better track where a message starts and ends
before passing data around.

Add wrapper macros to check for 'impossible' conditions that are activate
in debug validation mode. This helps fuzzers find input that might trigger
these conditions, if they exist.
5 years ago
Victor Julien 4f679fd843 ssl: add asserts for 'impossible' conditions
Wrap in debug validation so that fuzzing can pick them up.
5 years ago
Victor Julien 68d5a9dc2c tls/sni: parsing cleanup
Set proper event on all invalid sni length values.
5 years ago
Victor Julien 61b8c99236 ssl: improve error checking 5 years ago
Victor Julien bb06298102 ssl: unify main parsing routine 5 years ago
Victor Julien 40be9d2219 ssl: improve debug output 5 years ago
Victor Julien f1bf11f716 ssl: record parsing cleanup 5 years ago
Victor Julien ab44b5edac ssl: handshake parsing code cleanup 5 years ago
Victor Julien d1ada2e13c ssl: copy data using a safe memcpy wrapper
To avoid future memcpy issues introduce a wrapper and check the
result of it.

When compiled with --enable-debug-validation the wrapper will abort if
the input is wrong.
5 years ago
Victor Julien cffbdff024 ssl: don't say we consumed bytes if we didn't consume them 5 years ago
Victor Julien 9950ebffe6 ssl: code cleanups 5 years ago
Victor Julien 1578c84605 ssl: bump copyright year 5 years ago
Victor Julien 9a97821c43 ssl: improve 'first cert' check to avoid leaks
In some error conditions, or potentially in case of multiple 'certificate'
records, the extracted subject, issuerdn and serial could be overwritten
without freeing the original memory.
5 years ago
Victor Julien fa2a1385ea ssl: fix handshake cert buffer sizing
'trec' buffer was not grown properly when it was checked as too small.
After this it wasn't checked again so that copying into the buffer could
overflow it.
5 years ago
Victor Julien 26bcc97515 detect/keywords: dynamic version part of doc URL 5 years ago
Victor Julien 8f2df0f938 logging: fix default log format for release mode 5 years ago
Victor Julien eef7760870 datasets: reputation value validation 5 years ago
Philippe Antoine ae102ca096 detect: refactoring parsing of ip range
To optimize first netmask
5 years ago
Philippe Antoine 8ca9c0e8f0 signature: minimizes ip CIDR for ip range
Example leading to over allocation is 41.232.107.2-43.252.37.6
5 years ago
Jeff Lucovsky fa082d04dc decode/erspan: Warn on ERSPAN Type I config
This commit checks whether pre-6.x settings for ERSPAN Type I are
present. ERSPAN Type I is no longer enabled/disabled through a
configuration setting -- it's always enabled.

When a setting exists to enable/disable ERSPAN Type I decoding, a
warning message is logged.

Enabling/disabling ERSPAN Type I decode has been deprecated in 6.x
5 years ago
Jeff Lucovsky 82da71bbc4 decode/erspan: Add warning ERSPAN Type I config
This commit adds a warning value when ERSPAN Type I configuration
settings are detected; specifically, when ERSPAN Type I `enabled` is
specified.

Enabling/disabling ERSPAN Type I decode has been deprecated in 6.x
5 years ago
Jason Ish 0dd1b2a616 doc: typo: http.server_body should be http.response_body
Thanks to Jason Williams for pointing this out.
5 years ago
Victor Julien ad448da3f4 flowbits: fix hang in flowbits 'or' parsing 5 years ago
Victor Julien 07ed0dadae fuzz: suppress too noisy htp errors check 5 years ago
Jeff Lucovsky 2b93898771 napatech: Correct timestamp rounding issue
This commit fixes the conversion of timestamps. Without the extra
parens, the resulting timestamp value for usecs will be 1 or 0 due to
the operator precedence order (+ takes precedence over ?:)
5 years ago
Jeff Lucovsky f12adcc58c napatech: Check for out-of-band control operations
This commit causes the packet source to check for out of band control
operations when there are no packets immediately available.
5 years ago
Jeff Lucovsky 5b13468bfc dag: Check for out-of-band control operations
This commit causes the packet source to check for out of band control
operations when there are no packets immediately available.
5 years ago
Phil Young b48049c51c napatech: Restructure Packet/Hostbuffer release
The end-of-processing has been restructured so that Packet and Hostbuffer
data structures are now released within the NapatechReleasePacket() callback
function.
5 years ago
Shivani Bhardwaj e22b345bb6 af-packet: change type of cluster_id to uint16_t 5 years ago
Shivani Bhardwaj e7c0f0ad91 src: remove multiple uses of atoi
atoi() and related functions lack a mechanism for reporting errors for
invalid values. Replace them with calls to the appropriate
ByteExtractString* functions.

Partially closes redmine ticket #3053.
5 years ago
Shivani Bhardwaj 92bb52f430 Add wrappers for validating range checks 5 years ago
Victor Julien c2d36ed261 fastlog: copyright year bump and remove stale comments 5 years ago
Victor Julien 28837b203e fastlog: fix unlikely memleak
Fix memleak is case of alloc error during startup.
5 years ago
Victor Julien b763885d1b thash: suppress coverity fp's 5 years ago
Victor Julien b0c79c6996 datasets: suppress coverity fp's 5 years ago
frank honza bbe9137f20 rfb: Update incomplete handling in parser.
This commit adds an updated incomplete handling for the RFB-Parser. If
incomplete data is processed, the successfully consumed position and
length of remainder + 1 is returned. If the next packet is not empty
suricata will call the parser again.

This commit is a result of discussion on https://github.com/OISF/suricata/pull/4792.
5 years ago
Jason Ish d955acc01c github-ci: check all commits on pr
On a pull request, attempt to compile all commits from
the base branch to the head of the PR branch.

The job is in a separate workflow file to limit it to
pull-requests only, as the base branch is not available
on push (something to look into).
5 years ago
Philippe Antoine 053c728871 http: adds debug check against too many warnings 5 years ago
Jeff Lucovsky aa3f784d32 detect/ftp: FTP memory accounting fixes
This commit continues the work started by @vanlink and corrects the
accounting of FTP memory usage against the memcap limit.
5 years ago
Victor Julien 7ca94ba0a2 app-layer: fix protocol detection bail conditions for TCP fastopen 5 years ago
Jeff Lucovsky e8ad67fa4f detect/lua: Unregister object during free
This commit removes the registration for the object being freed.
5 years ago
Jeff Lucovsky d3a65fe156 detect: Provide `de_ctx` to free functions
This commit makes sure that the `DetectEngineCtx *` is available
to each detector's "free" function.
5 years ago
Jeff Lucovsky d1151f3f8e detect: Provide function to clear per-thread ctx
This commit provides an interface to free previously allocated
per-thread contextual information on the keyword lists.
5 years ago