Commit graph

6667 commits

Author SHA1 Message Date
Johanna Amann
038dfa6273 Actually check if the number of fields in a write are equal to the
number of fields required.

Addresses BIT-1683

I do not think this quite fixes the underlying issue of BIT-1683 - it
should not be possible to get to this state in normal operations.

Also fixes a small memory leak for disabled writers.
2016-09-22 16:43:37 -07:00
Robin Sommer
2bf4c2072c Merging topic/vladg/bit-1681.
(Note this a "manual" merge: I've copied just the two relevant *pac
files over, as there were a bunch of independent commits in the branch
history that I didn't want to pull in.)

BIT-1681 #merged
2016-09-19 17:04:44 -07:00
Daniel Thayer
520ed43eae Added another missing fclose in scan.l
If someone uses an "@unload" directive in a bro script, then Bro
was neglecting to close the file.
2016-08-31 16:30:10 -05:00
Daniel Thayer
b3a7d07e66 Added a missing fclose in scan.l
On OS X, Bro was failing to startup without first using the "ulimit -n"
command to increase the allowed number of open files (OS X has a much
lower default limit than Linux or FreeBSD).
2016-08-31 14:07:44 -05:00
Seth Hall
2cfe2c292d Fix an event from the file extraction analyzer.
The "file_extraction_limit" event was passing a Files::AnalyzerArgs
record as an "any" type.  This is not right at the least and may
have been causing a crash for a user at worst.
2016-08-28 21:30:42 -04:00
Seth Hall
8015e35747 Fix a crash when a user disables DCE_RPC and enabled SMB.
I wasn't accounting for analyzers being disabled and not actually
instantiating when requested.  This includes a test which
verifies there is no crash or problem when a user disables DCE_RPC.
2016-08-28 21:28:57 -04:00
Johanna Amann
2e5e811a9c Merge branch 'patch-2' of https://github.com/moshekaplan/bro
* 'patch-2' of https://github.com/moshekaplan/bro:
  Update events.bif

This slightly clarifies the explanation of the mime_entity_data event.
2016-08-19 07:52:35 -07:00
Moshe Kaplan
c5b82cb9b4 Update events.bif 2016-08-18 12:43:20 -04:00
Seth Hall
eebd896f63 Change failure in utf16_bytestring_to_utf8_val to be a conn weird.
Whenever we saw errors in UTF16->UTF8 conversion before, we would
get a reporter message with no connection information.  Now we
get a weird attached to a connection so that debugging these
problems will hopefully be a bit easier in the future.
2016-08-17 00:57:49 -04:00
Johanna Amann
cf548e9302 Fix test failure caused by uninitialized memory. 2016-08-16 17:05:18 -07:00
Johanna Amann
fd54892da3 SMB: fix rounding error due to value truncation when converting timestamps. 2016-08-16 16:02:44 -07:00
Johanna Amann
5d8da0b182 Address coverity errors. 2016-08-16 11:16:50 -07:00
Johanna Amann
e3e3fdfb9d Merge remote-tracking branch 'origin/bro-config'
* origin/bro-config:
  Add 'bro-config' script.

BIT-1669 #merged
2016-08-15 17:05:25 -07:00
Johanna Amann
ed3447acaa Fix one more format error found by gcc 5.3.1 2016-08-15 16:54:22 -07:00
Johanna Amann
bfdce4d419 Add argument checking to a few more printf-style calls. 2016-08-15 15:34:27 -07:00
Johanna Amann
697b68ab01 One more small serialization format fix to make gcc 4.9 happy. 2016-08-15 15:20:14 -07:00
Jon Siwek
c29cd54618 Add 'bro-config' script. 2016-08-15 14:45:29 -05:00
Seth Hall
5c0d8c649a Tiny SMB cleanup.
Pipe handling is done by derived fields and there was a left
over check in the event generating event.
2016-08-15 11:15:51 -04:00
Seth Hall
c06dca3565 Fixes for NTLM.
- Attempted fix for some NTLM handling fixes that were leading
   to DPD errors.
 - Added some status codes to the list of auth failure status codes.
2016-08-14 01:31:07 -04:00
Johanna Amann
a2c8f8a9b6 More format specifier cleanup 2016-08-12 15:54:39 -07:00
Johanna Amann
c464cf78dd Fix a number of format errors when using debug macros. 2016-08-12 15:42:02 -07:00
Johanna Amann
b11d9b5ccd Add missing include directive. 2016-08-12 06:54:53 -07:00
Johanna Amann
fb3bc05df5 Merge remote-tracking branch 'origin/topic/johanna/component-initialization-order'
* origin/topic/johanna/component-initialization-order:
  Make tags generated during component initialization stable.
2016-08-11 21:50:53 -07:00
Johanna Amann
65d977f278 Make tags generated during component initialization stable.
The order in which the plugin initializers are executed is compiler
dependent. With this change, Tags will always be generated in
alphabetical ordering, not in compiler-dependent order.
2016-08-11 19:48:53 -07:00
Johanna Amann
2756dfe581 Make x509 intel seen script robust against file analyzer ordering.
Now it consistently works, even if the SHA1 file analyzer gets the data
before the X509 file analyzer.
2016-08-11 16:12:08 -07:00
Johanna Amann
19057c663f Input: DisableFrontend was not called upon Init failure.
This was introduced in 5b73345b73 due to a
chance how disable messages are handled.
2016-08-11 12:44:39 -07:00
Seth Hall
c9666086e4 DCE_RPC code simplification attempting to address a crash. 2016-08-11 14:05:50 -04:00
Johanna Amann
abbb01edb9 Update submodules
[nomail]
2016-08-11 07:58:17 -07:00
Johanna Amann
0e44b91cd9 Merge remote-tracking branch 'origin/topic/seth/log-framework-ext'
* origin/topic/seth/log-framework-ext:
  Log extensions: series of small fixes and new tests.
  Change the function for log extension to take a path only and update tests.
  Final changes to log framework ext code.
  Add logging framework metadata mechanism.
  Add unrolling separator & field name map to logging framework.
2016-08-11 07:47:13 -07:00
Johanna Amann
e7611e8521 Fix memory leak in EnumType.
Introduced in ca3f7eadbe.

This took a while to find.
2016-08-10 18:12:26 -07:00
Johanna Amann
6e769db23b Log extensions: series of small fixes and new tests.
The extensions now work with optional types, as well with complex types
(like subrecords). Not returning a record in the ext_func no longer
crashes bro.

The default_ext_func was switched to return void in
cases where no extension revord is defined (was bool).

I also got rid of the offsets in the indices - with the rest of the
implementation, that was not really necessary and made the code more
complex.
2016-08-10 14:14:03 -07:00
Seth Hall
79e49e1ab5 Change the function for log extension to take a path only and update tests.
We were having stack overflow issues creep in with the self-referential
field for the log extension function.
2016-08-10 13:53:27 -04:00
Seth Hall
5f6565d62c Final changes to log framework ext code.
The "metadata" functionality has been renamed to "ext" to
represent that the logs are being extended.  The function that
returns the record which is used to extend the log now receives
a log filter as it's single argument.

The field name "unrolling" is now renamed to "scope" so the variables
names now look like this: "Log::default_scope_sep"
2016-08-10 12:43:32 -04:00
Seth Hall
a60ce35103 Merge remote-tracking branch 'origin/master' into topic/seth/log-framework-ext 2016-08-10 10:28:04 -04:00
Seth Hall
cbde25f1b8 GSSAPI analyzer now forwards authentication blobs more correctly (and other fixes).
Previously, the GSSAPI analyzer blindly forwarded authentication
blobs to the NTLM analyzer (which it instantiated too early). Now
it waits to instantiate sub analyzers until a blob of a particular
type has been seen.  It also makes the distinction between krb and
ntlm and forwards to the correct analyzer.

This required some fixes to the KRB analyzer because KRB over GSSAPI
looks slightly different than raw KRB.

The KRB analyzer also now includes support for the PA_ENCTYPE_INFO2
pre-auth data type.
2016-08-09 10:27:21 -04:00
Seth Hall
4a3dfe69b1 Add an argument to "disable_analyzer" to not do a reporter message by default.
If the analyzer is not found directly attached to the connection,
useless error messages are being output.  There are now several
cases where analyzers are attached within other analyzers so the
connection itself doesn't know about the analyzer.  This hides
these useless messages.
2016-08-09 10:22:31 -04:00
Seth Hall
6ee543220c Small SMB bug fix. 2016-08-08 16:50:35 -04:00
Seth Hall
86665e381b Merge branch 'master' into topic/seth/smb 2016-08-08 15:47:39 -04:00
Seth Hall
520ac8d92c Merge remote-tracking branch 'origin/master' into topic/seth/smb
# Conflicts:
#	scripts/base/protocols/dce-rpc/main.bro
#	scripts/base/protocols/ntlm/main.bro
#	scripts/policy/protocols/smb/smb1-main.bro
#	src/analyzer/protocol/smb/smb-common.pac
#	src/analyzer/protocol/smb/smb-strings.pac
#	src/analyzer/protocol/smb/smb1-com-locking-andx.pac
#	src/analyzer/protocol/smb/smb1-com-logoff-andx.pac
#	src/analyzer/protocol/smb/smb1-com-nt-create-andx.pac
#	src/analyzer/protocol/smb/smb1-com-open-andx.pac
#	src/analyzer/protocol/smb/smb1-com-read-andx.pac
#	src/analyzer/protocol/smb/smb1-com-session-setup-andx.pac
#	src/analyzer/protocol/smb/smb1-com-transaction-secondary.pac
#	src/analyzer/protocol/smb/smb1-com-transaction.pac
#	src/analyzer/protocol/smb/smb1-com-tree-connect-andx.pac
#	src/analyzer/protocol/smb/smb1-com-write-andx.pac
#	src/analyzer/protocol/smb/smb1-protocol.pac
2016-08-08 15:46:49 -04:00
Seth Hall
117b5c3ac7 Lots of SMB1 parsing fixes. 2016-08-08 15:36:07 -04:00
Robin Sommer
982612b66f Merge remote-tracking branch 'origin/topic/johanna/remove-z'
BIT-1663 #merged

* origin/topic/johanna/remove-z:
  Remove -z/--analysis option.
2016-08-05 15:26:48 -07:00
Johanna Amann
3bec30ae93 Remove unused and only partially implemented ConversionSerializer.
Seems like the main use of this was to convert from file to XML
serialization format.
2016-08-05 14:06:46 -07:00
Johanna Amann
39d811ff06 Remove code for XML serialization.
Code was apparently defunct and was not user-accessible for a long time.
2016-08-05 14:02:28 -07:00
Seth Hall
7b3ec047d0 Merge remote-tracking branch 'origin/master' into topic/seth/smb 2016-08-05 11:46:13 -04:00
Johanna Amann
b7ab6a5332 Remove -z/--analysis option.
It was only used for one special case that is not commonly used by
anyone.
2016-08-04 17:44:38 -07:00
Johanna Amann
bac1bd5bdf Merge remote-tracking branch 'origin/topic/robin/bit-1641'
* origin/topic/robin/bit-1641:
  Fixing duplicate SSH authentication failure events.

I changed the test slightly; the output of uniq is not stable between
operating systems (on OS-X, it emits a space, on Linux it apparently
emits a tab). I removed the call to uniq - sort by itself is enough to
create a difference if there are duplicate entries.

Addresses BIT-1641
2016-08-02 15:28:31 -07:00
Johanna Amann
3112e9a343 Merge remote-tracking branch 'origin/topic/robin/bit-1654'
* origin/topic/robin/bit-1654:
  Removing OpenSSL dependency for plugins.
  Revert "Fix some failing plugin tests on OS X 10.11"

BIT-1654 #merged
2016-08-02 15:06:12 -07:00
Robin Sommer
3adad5e19a Fix some Coverity warnings. 2016-08-02 11:38:29 -07:00
Robin Sommer
176d9f23be Fixing duplicate SSH authentication failure events.
We now do not raise more than one failure event per connection.

Addresses BIT-1641.
2016-08-01 12:42:03 -07:00
Robin Sommer
d7c10ca7c3 Removing OpenSSL dependency for plugins.
Compiling a plugin required having access to OpenSSL headers because
they were pulled in by Bro headers that the plugin had to include.
Removinng then OpenSSL dependency from those Bro headers.

I'm also reverting a4e5591e. This is a different fix for the same
problem, and reverting that commit gives us a test case. :-)
2016-08-01 12:32:27 -07:00