Commit graph

9997 commits

Author SHA1 Message Date
Max Kellermann
c6ffec02fc broker: include cleanup 2020-02-13 10:12:03 +01:00
Max Kellermann
0cf5799ca6 file_analysis: include cleanup 2020-02-13 10:12:03 +01:00
Max Kellermann
653b3f43e0 file_analysis/Analyzer: eliminate duplicate constructor 2020-02-13 10:12:03 +01:00
Max Kellermann
ace11e74d2 probabilistic/Topk: include cleanup 2020-02-13 10:12:03 +01:00
Max Kellermann
cceb8a1b0c RE: make the RE_Matcher destructor non-virtual
Nobody overrides it.
2020-02-13 09:17:30 +01:00
Max Kellermann
8a74ebf2a9 analyzer/protocol/smtp: remove unnecessary nullptr check 2020-02-13 09:17:08 +01:00
Max Kellermann
87d3192d9b analyzer/Manager: remove unnecessary clear() calls from destructor 2020-02-13 09:16:33 +01:00
Max Kellermann
a8da8cb8e2 analyzer/protocol/http: remove unnecessary empty destructor 2020-02-13 09:16:25 +01:00
Max Kellermann
d1dc70c90f iosource/pcap/Source: remove unused fields last_hdr, last_data 2020-02-13 09:16:15 +01:00
Max Kellermann
4b8b6ec559 iosource/Manager: eliminate two std::string copies 2020-02-13 09:16:00 +01:00
Max Kellermann
5215f4756b digest: eliminate the "Reporter.h" include 2020-02-13 09:13:59 +01:00
Max Kellermann
c78fa4bcf9 Val: eliminate the "RE.h" include 2020-02-13 09:13:59 +01:00
Max Kellermann
e98cf0a4a0 Val: eliminate the "BroString.h" include 2020-02-13 09:13:59 +01:00
Max Kellermann
728184ea93 Val: eliminate the "CompHash.h" include 2020-02-13 09:13:59 +01:00
Tim Wojtulewicz
12230ceb83 Check for failure when registering event manager with iosource manager (Coverity 1419398) 2020-02-12 16:39:00 -08:00
Max Kellermann
4aac78cf29 Val: forward-declare class PDict, reduce includes 2020-02-12 10:10:26 +01:00
Max Kellermann
dfac4572e7 Val: eliminate the "Scope.h" include 2020-02-12 10:10:26 +01:00
Jon Siwek
20eb0e15c7 Updating CHANGES and VERSION. 2020-02-12 00:20:08 -08:00
Jon Siwek
05d7f26b85 Merge branch 'ssh_kex' of https://github.com/MaxKellermann/zeek
* 'ssh_kex' of https://github.com/MaxKellermann/zeek:
  analyzer/protocol/ssh: fix crash vulnerability after duplicate KEX packet
2020-02-12 00:04:40 -08:00
Jon Siwek
2fb9753cc5 Merge remote-tracking branch 'origin/topic/timw/clang-tidy'
* origin/topic/timw/clang-tidy:
  fixup! Use string_view for a couple of Dbg methods
  Add a couple of missing #includes that clang-tidy complains about (clang-diagnostic-error)
  Fix missing namespace that was causing a build error
  Remove unnecessary const from return value (readability-const-return-type)
  Give real variable names to SegmentProfiler objects when defining them (bugprone-unused-raii)
  Mark a few clang-tidy findings as false-positive
  Use std::move in a few places instead of copying a pass-by-value argument (performance-unnecessary-value-param)
  Use const-references in lots of places (preformance-unnecessary-value-param)
  Use string_view for a couple of Dbg methods
  Use const references over copying variables (performance-unnecessary-copy-initialization, performance-for-range-copy)
  Use single-character version of string find() (performance-faster-string-find)
  Move constructors/operators should be marked noexcept to avoid the compiler picking the copy constructor instead (performance-noexcept-move-constructor)
2020-02-11 23:51:40 -08:00
Tim Wojtulewicz
1e499b0831 Reset the number of entries in a dict when calling Clear() 2020-02-11 20:29:06 -05:00
Tim Wojtulewicz
a69463ac46 Code cleanup in Dict.h 2020-02-11 20:28:49 -05:00
Tim Wojtulewicz
817eb2fd87 Add unit testing for the public Dictionary API 2020-02-11 20:16:42 -05:00
Tim Wojtulewicz
d69d0da62e fixup! Use string_view for a couple of Dbg methods 2020-02-11 14:11:22 -08:00
Tim Wojtulewicz
da7749fc43 Add a couple of missing #includes that clang-tidy complains about (clang-diagnostic-error) 2020-02-11 14:11:22 -08:00
Tim Wojtulewicz
9bfe162cad Fix missing namespace that was causing a build error 2020-02-11 14:11:22 -08:00
Tim Wojtulewicz
66c4a93383 Remove unnecessary const from return value (readability-const-return-type) 2020-02-11 14:11:22 -08:00
Tim Wojtulewicz
c5748e4494 Give real variable names to SegmentProfiler objects when defining them (bugprone-unused-raii)
The reason behind this one is that without a real variable name, the profile objects are immediately desctructed and the profiling only happens for the small window when they were valid. If the intention is to profile the method where they were defined, this doesn't actually happen.
2020-02-11 14:11:22 -08:00
Tim Wojtulewicz
3572e38ec2 Mark a few clang-tidy findings as false-positive 2020-02-11 14:11:22 -08:00
Tim Wojtulewicz
d23b15c08f Use std::move in a few places instead of copying a pass-by-value argument (performance-unnecessary-value-param) 2020-02-11 14:11:22 -08:00
Tim Wojtulewicz
5a237d3a3f Use const-references in lots of places (preformance-unnecessary-value-param) 2020-02-11 14:11:18 -08:00
Tim Wojtulewicz
92afe64525 Use string_view for a couple of Dbg methods 2020-02-11 11:02:08 -08:00
Tim Wojtulewicz
eda1b4a23e Use const references over copying variables (performance-unnecessary-copy-initialization, performance-for-range-copy) 2020-02-11 11:02:08 -08:00
Tim Wojtulewicz
c32566420a Use single-character version of string find() (performance-faster-string-find) 2020-02-11 11:02:08 -08:00
Tim Wojtulewicz
95d2af4501 Move constructors/operators should be marked noexcept to avoid the compiler picking the copy constructor instead (performance-noexcept-move-constructor) 2020-02-11 11:02:08 -08:00
Max Kellermann
98c50531bc analyzer/protocol/ssh: fix crash vulnerability after duplicate KEX packet
An attacker can make Zeek crash by posting the KEX packet twice, which
will result in an assertion failure in binpac::datastring::init():

 #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
 #1  0x00007ffff5196535 in __GI_abort () at abort.c:79
 #2  0x00007ffff519640f in __assert_fail_base (fmt=0x7ffff52f86e0 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x1d33530 "!data_",
     file=0x1d33537 "aux/binpac/lib/binpac_bytestring.h", line=108, function=<optimized out>) at assert.c:92
 #3  0x00007ffff51a3b92 in __GI___assert_fail (assertion=0x1d33530 "!data_", file=0x1d33537 "aux/binpac/lib/binpac_bytestring.h",
     line=108, function=0x1d3356c "void binpac::datastring<unsigned char>::init(const T *, int) [T = unsigned char]") at assert.c:101
 #4  0x0000000000c1e970 in binpac::datastring<unsigned char>::init (this=0x608000d609d0, begin=0x603001bdd1d0 "diffie-hellman-group16-sha512", length=29)
     at aux/binpac/lib/binpac_bytestring.h:108
 #5  0x0000000000e9ab60 in binpac::SSH::SSH_Conn::update_kex (this=0x608000d609a0, algs=..., orig=true) at src/analyzer/protocol/ssh/ssh_pac.cc:205
 #6  0x0000000000ea0d06 in binpac::SSH::SSH2_KEXINIT::Parse (this=0x60b000734680,
     t_begin_of_data=0x621000004753 "\200\275\a%\223\023Y8\204t\235\363!\031I.", t_end_of_data=0x621000004b85 "ޭ\276", <incomplete sequence \357>,
     t_context=0x603001bdcc90, t_byteorder=0) at src/analyzer/protocol/ssh/ssh_pac.cc:1598
 #7  0x0000000000e9f8f4 in binpac::SSH::SSH2_Message::Parse (this=0x608000d60ea0,
     t_begin_of_data=0x621000004753 "\200\275\a%\223\023Y8\204t\235\363!\031I.", t_end_of_data=0x621000004b85 "ޭ\276", <incomplete sequence \357>,
     t_context=0x603001bdcc90, t_byteorder=0) at src/analyzer/protocol/ssh/ssh_pac.cc:1326
 #8  0x0000000000e9d7e1 in binpac::SSH::SSH2_Key_Exchange::Parse (this=0x604001779850,
     t_begin_of_data=0x621000004751 "\006\024\200\275\a%\223\023Y8\204t\235\363!\031I.", t_end_of_data=0x621000004b85 "ޭ\276", <incomplete sequence \357>,
     t_context=0x603001bdcc90, t_byteorder=0) at src/analyzer/protocol/ssh/ssh_pac.cc:1210
 #9  0x0000000000e9c981 in binpac::SSH::SSH_Key_Exchange::ParseBuffer (this=0x603001bdccc0, t_flow_buffer=0x608000d60a20, t_context=0x603001bdcc90,
     t_byteorder=0) at src/analyzer/protocol/ssh/ssh_pac.cc:628
 #10 0x0000000000e9c26c in binpac::SSH::SSH_PDU::ParseBuffer (this=0x604001779810, t_flow_buffer=0x608000d60a20, t_context=0x603001bdcc90)
     at src/analyzer/protocol/ssh/ssh_pac.cc:446
 #11 0x0000000000ea6f04 in binpac::SSH::SSH_Flow::NewData (this=0x604001774690, t_begin_of_data=0x62100000474d "",
     t_end_of_data=0x621000004b85 "ޭ\276", <incomplete sequence \357>) at src/analyzer/protocol/ssh/ssh_pac.cc:3071
 #12 0x0000000000e9a38f in binpac::SSH::SSH_Conn::NewData (this=0x608000d609a0, is_orig=true, begin=0x62100000474d "",
     end=0x621000004b85 "ޭ\276", <incomplete sequence \357>) at src/analyzer/protocol/ssh/ssh_pac.cc:63
 #13 0x0000000000e98335 in analyzer::SSH::SSH_Analyzer::DeliverStream (this=0x7fffffffdd40, len=1080, data=0x62100000474d "", orig=true)
     at src/analyzer/protocol/ssh/SSH.cc:68

With assertions turned off, this would "only" be a memory leak.

This commit fixes the vulnerability by freeing and clearing the
`binpac::datastring` before assigning a new value.
2020-02-11 11:27:17 +01:00
Jon Siwek
38333aac91 Updating submodule(s).
[nomail]
2020-02-10 12:12:02 -08:00
Jon Siwek
2efd580bd8 Updating submodule(s).
[nomail]
2020-02-10 12:00:59 -08:00
Jon Siwek
da34c94ae3 Update Broker submodule 2020-02-08 16:20:44 -08:00
Jon Siwek
996b3d523a Update to start of 3.2.0 development 2020-02-08 16:08:01 -08:00
Jon Siwek
0c771ea123 Fix broken links in documentation 2020-02-08 15:48:11 -08:00
Jon Siwek
bb876623af Update submodules to release versions 2020-02-08 12:44:57 -08:00
Jon Siwek
b268b57194 Update embedded CAF to 0.17.4 2020-02-08 09:40:48 -08:00
Jon Siwek
6c72b09bf5 Note new CMake 3.0+ and C++17 requirements in NEWS 2020-02-07 21:11:35 -08:00
Jon Siwek
e50a8848ae Improve an input framework test
A race condition could cause unstable output: if the thread reading the
file is fast, often you see both "pred" functions execute and then both
"line" events execute with both entries already in the table, but if the
thread reading the file is slow, you see pred, event, pred, event, with
only one entry available in the first event.
2020-02-07 20:03:10 -08:00
Jon Siwek
a3b1d202a5 Improve stability of a &expire_func btest
The order in which &expire_func's get called isn't well-defined, so
separate the output from either to ensure diffs against the Baseline are
always consistent.
2020-02-07 15:11:06 -08:00
Tim Wojtulewicz
9754c2c09f Merge remote-tracking branch 'max/optimize'
* max/optimize:
  plugin/Manager: migrate to std::string_view
  util: optimize the normal_path() common case
  util: pass string_view to without_bropath_component()
  module_util: make GLOBAL_MODULE_NAME constexpr
  Scope: convert Scope::Lookup() and others to template
  Scope: Vars() returns const reference
  Anon: remove unnecessary {map,vector}::clear() calls
  Dict: make the destructor non-virtual
  Obj: make the Location constructors `constexpr`
  Obj: remove unused fields Location::{timestamp,text}
  Obj: remove Location::delete_data, nobody ever sets it
  Obj: make the Location destructor non-virtual
2020-02-07 15:26:30 -07:00
Johanna Amann
febfc30c70 Merge remote-tracking branch 'origin/topic/jsiwek/krb-addrs-and-leak'
* origin/topic/jsiwek/krb-addrs-and-leak:
  Improve kerberos analyzer address and event handling
2020-02-07 14:15:44 -08:00
Johanna Amann
56dda98512 Merge remote-tracking branch 'origin/topic/jsiwek/stabilize-ci'
* origin/topic/jsiwek/stabilize-ci:
  Add environment variable to disable supervisor SIGKILL
  Fix a btest's race condition by handling Pcap::file_done
  Add Pcap::file_done event
  Improve btest timeouts
2020-02-07 09:52:57 -08:00
Johanna Amann
a0fea11247 Merge remote-tracking branch 'origin/topic/jsiwek/use-btest-retries'
* origin/topic/jsiwek/use-btest-retries:
  Use 2 btest retries for CI
2020-02-07 09:44:24 -08:00