Commit graph

6667 commits

Author SHA1 Message Date
jamesecorrenti
4b4ccabd70 Update krb-types.pac
KerberosString formatting for principal name to be compliant with RFC 4120 section 5.2.2, which states that there can be a few components (and in practice we have seen 3, more than the 1 or 2 that is typical)
2016-11-22 16:41:56 -05:00
Daniel Thayer
475682ba7f Fix minor typos in documentation
Some of these fixes are for broken links in the auto-generated docs.
2016-11-14 09:50:19 -06:00
Daniel Thayer
462eaefc43 Fix some warnings seen while building the docs
Removed references in the docs to a few identifiers that aren't
defined in any Bro scripts.
2016-11-09 14:16:42 -06:00
Johanna Amann
c92060a8ca Merge remote-tracking branch 'origin/topic/seth/smb-auth-fixes'
* origin/topic/seth/smb-auth-fixes:
  Disable SMB2 error data parsing.
  Removed some files that aren't being used.
  Fix SMB tree connect handling.
  Fix a small issue where DCE_RPC commands were improperly being logged.
  SMB fixes and cleanup.
  Including a test for raw NTLM in SMB
  Updates for SMB auth handling from Martin van Hensbergen.

BIT-1721 #merged
2016-11-02 10:25:33 -07:00
Seth Hall
5e63584b48 Disable SMB2 error data parsing.
It is not implemented correctly and is causing a lot of
parse errors.
2016-11-01 16:03:36 -04:00
Seth Hall
5832b872c2 Removed some files that aren't being used.
- I went ahead and finished implementing smb2 tree_disconnect.
   This made it possible to address an edge case when packet
   loss occurs.
 - Fixes BIT-1721
2016-11-01 15:56:15 -04:00
Seth Hall
bb5c2c94ec Fix SMB tree connect handling.
It was misidentifying share mappings as FILE shares
sometimes when they were actually PIPE shares.
2016-11-01 03:14:15 -04:00
Seth Hall
ff682b8c2c Merge remote-tracking branch 'origin/master' into topic/seth/smb-auth-fixes 2016-10-31 16:17:01 -04:00
Seth Hall
4f3fe047f4 SMB fixes and cleanup.
SMB error handling improved. The analyzer isn't destroyed when a problem
is encoutered anymore.  The flowbuffer in the parser is now flushed and
the analyzer is set to resync against an SMB command.  This was needed
because there is some state about open files that is kept within the
parser itself which was being destroyed and that was causing analysis
after content gaps or parse errors to be faulty.  The new mechanism
doesn't detroy the parser so parsing after gaps is improved.

DCE_RPC handling in SMB is improved in the edge case where a drive
mapping isn't seen. There is a new const named SMB::pipe_filenames
which is used as a heuristic for identifying "files" opened on named
pipe shares.  If the share mapping type isn't known and a filename
in this set is found, the share type will change to "PIPE" by
generating an event named "smb_pipe_connect_heuristic".  Reads and
writes to that file will be sent to the DCE_RPC analyzer instead of
to the files framework.

The concept of "unknown" share types has been removed due to the new
heuristic detection of share types.

Some general clean up of how the SMB cmd log is written and when.
2016-10-31 13:35:47 -04:00
Robin Sommer
ce72a09c0c Merge remote-tracking branch 'origin/topic/johanna/xmpp-ns'
BIT-1743 #merged

* origin/topic/johanna/xmpp-ns:
  XMPP: Fix detection of StartTLS when using namespaces
2016-10-27 08:10:35 -07:00
Robin Sommer
1f36ae61ba Adding one more case to the DCE_RPC defrag logic.
(and fixing a couple of compiler warnings)
2016-10-25 16:45:10 -07:00
Robin Sommer
aab3819c70 Merge remote-tracking branch 'origin/master' into topic/seth/dce_rpc_fixes 2016-10-25 16:31:18 -07:00
Johanna Amann
6aea681832 Merge branch 'patch-2' of https://github.com/balintm/bro
* 'patch-2' of https://github.com/balintm/bro:
  Update smb1-com-open-andx.pac
2016-10-25 09:46:37 -07:00
Johanna Amann
0f29405d6e Merge remote-tracking branch 'origin/topic/robin/sig-fixes'
* origin/topic/robin/sig-fixes:
  Fix a couple of problems with signature matching.

BIT-1737 #merged
2016-10-25 09:42:29 -07:00
Seth Hall
8276c250bd Updates for SMB auth handling from Martin van Hensbergen.
- Raw NTLM (not in GSSAPI) over SMB is now handled correctly.
 - The encrypted NTLM session key is now passed into scriptland
   through the ntlm_authenticate event.
2016-10-25 02:52:09 -04:00
Johanna Amann
89f9315fb0 XMPP: Fix detection of StartTLS when using namespaces
the starttls command will sometimes be issued with a namespace, e.g. as
<ns2:starttls xmlns:ns2='urn:ietf:params:xml:ns:xmpp-tls'/>. The XMPP
analyzer did not handle this scenario correctly.

This is very similar to the following ejabberd bug:
https://support.process-one.net/browse/EJAB-1123
2016-10-24 11:54:47 -07:00
Robin Sommer
c57f83d8bf Merge remote-tracking branch 'origin/topic/johanna/gcc-6.2.1'
BIT-1732 #merged

* origin/topic/johanna/gcc-6.2.1:
  Fix alignment issue of ones_complement_checksum
2016-10-24 11:12:05 -07:00
Seth Hall
36ae5e6662 Make DCE_RPC skip input in strange fragment circumstances.
If there are too many concurrent fragments or too much
data fragmented, skip further input on DCE_RPC.
2016-10-24 13:50:13 -04:00
Seth Hall
c88719472b Stop calling Remove() on DCE_RPC analyzer.
This was crashing Bro when it was called on DCE_RPC traffic
carried over SMB.
2016-10-24 13:44:44 -04:00
Seth Hall
e4b620673b More DCE_RPC improvements.
- The logic for fragment handling has been rewritten and should be correct now.
 - There are now tunables for fragment handling overflow situations.
   - DCE_RPC::max_cmd_reassembly and DCE_RPC::max_frag_data
   - They result in weirds and analyzer removal.
 - Memory leak fixed by unique_ptr auto cleanup.
 - DCE_RPC is now intolerate of content gaps and will stop
   analyzing traffic if content gaps happen (like most other analyzers currently).
2016-10-24 03:22:20 -04:00
Robin Sommer
5cf2320fbc Fix a couple of problems with signature matching.
- IPv4 CIDR specifications didn't work with dst-ip/src-ip.

    - The "payload-size" condition was unreliable with UDP traffic.
2016-10-19 14:23:43 -07:00
Johanna Amann
8ce746cc25 Merge remote-tracking branch 'origin/topic/vladg/bit-1641'
* origin/topic/vladg/bit-1641:
  Logic fix for ssh/main.bro when the auth status is indeterminate, and fix a test. Addresses BIT-1641.
  Clean up the logic for ssh_auth_failed. Addresses BIT-1641
  Update baselines for adding a field to ssh.log as part of BIT-1641
  Script-land changes for BIT-1641.
  Change SSH.cc to use ssh_auth_attempted instead of ssh_auth_failed. Addresses BIT-1641.
  Revert "Fixing duplicate SSH authentication failure events."
  Create new SSH events ssh_auth_attempt and ssh_auth_result. Add auth_attempts to SSH::Info. Address BIT-1641.

I extended the tests a bit and did some small cleanups. I also moved the
SSH events back to the global namespace for backwards compatibility and
for consistency (the way it was at the moment, some of them were global
some SSH::).

Furthermore, I fixed the ssh_auth_result result event, it was only
raised in the success case. ssh_auth_result is now also checked in the
testcases. I also have a suspicion that the intel integration never
really worked before.

BIT-1641 #merged
2016-10-18 21:57:27 -04:00
balintm
303985e7db Update smb1-com-open-andx.pac
# of bytes in reserved field of request is 4 & response is 6B long.
2016-10-17 10:18:09 +01:00
Johanna Amann
24f74cb52e Fix alignment issue of ones_complement_checksum
The ones_complement_checksum function assumes that the bytes passed into
it are aligned on 16 bit boundaries.

When using gcc (GCC) 6.2.1 20160916 (Red Hat 6.2.1-2) with -O2, this
does not seem to hold true anymore; assuming 16 bit alignment will lead
to accesses to uninitialized memory and wrong checksums.

This commit adds a minimally invasive change that does not assume
alignment anymore. This might have a small performance impact for every
single packet we process.

This error occured reproducibly when called from icmp6_checksum.
2016-10-14 15:40:59 -07:00
Vlad Grigorescu
20aef04dc7 Change SSH.cc to use ssh_auth_attempted instead of ssh_auth_failed. Addresses BIT-1641. 2016-10-14 09:14:21 -05:00
Vlad Grigorescu
b1c3f1cd9b Revert "Fixing duplicate SSH authentication failure events."
This reverts commit 176d9f23be.
2016-10-14 09:14:21 -05:00
Vlad Grigorescu
93becb1387 Create new SSH events ssh_auth_attempt and ssh_auth_result. Add auth_attempts to SSH::Info. Address BIT-1641. 2016-10-14 09:14:21 -05:00
Robin Sommer
bd0a374c87 Merge remote-tracking branch 'origin/topic/johanna/freebsd-clang'
BIT-1728 #merged

* origin/topic/johanna/freebsd-clang:
  Fix md5 problem with freebsd 11.0 clang 3.8
2016-10-13 16:30:18 -07:00
Robin Sommer
c9d449e363 Merge remote-tracking branch 'origin/topic/johanna/tls13'
BIT-1727 #merged

* origin/topic/johanna/tls13:
  Better way to deal with overloaded Assign constructors.
  A few tabbing fixes in TLS 1.3 support
  TLS 1.3 support.
2016-10-13 15:48:27 -07:00
Johanna Amann
f135a63c61 Fix md5 problem with freebsd 11.0 clang 3.8
With clang on FreeBSD 11.0-p1, some md5 functions tend to return the
wrong result. This is, e.g., visible when running the bifs/md5 testcase.
In this test, the checks using md5_hash_finish will return an empty
string.

The apparent cause is some confusion in clang when using a static char
inside a static inline function that is refered to several compilation
units.

Exact version of clang showing this issue is:
FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0)
Target: x86_64-unknown-freebsd11.0
Thread model: posix
InstalledDir: /usr/bin

Issue occurs with -O2.

The first person to either find an existing clang bugreport for this, or
to create an minimal testcase and files one will get a drink from me :)
2016-10-13 13:36:40 -07:00
Johanna Amann
eb3a3bc807 Better way to deal with overloaded Assign constructors. 2016-10-13 11:45:13 -07:00
Robin Sommer
4477b8a1ab Merge remote-tracking branch 'origin/topic/seth/dce_rpc_fixes'
* origin/topic/seth/dce_rpc_fixes:
  Fixes for DCE_RPC analyzer
2016-10-10 08:29:14 -07:00
Seth Hall
029d92183e Fixes for DCE_RPC analyzer
- DCE_RPC fragmentation handling returns!
  - Fixed some general parsing issues
  - Fixed an issue with the DCE_RPC signature not working for IPv6 connections.
2016-10-08 10:00:26 -04:00
Johanna Amann
c2612a0ae1 A few tabbing fixes in TLS 1.3 support 2016-10-07 14:09:49 -07:00
Johanna Amann
fdef28ce7c TLS 1.3 support.
Well, at least -draft-16, and we don't quite parse all extensions yet
(not that there is that much left to parse).
2016-10-07 12:51:43 -07:00
Robin Sommer
8479298e04 Merge branch 'master' of git.bro.org:bro 2016-10-06 14:33:36 -07:00
Johanna Amann
3741ddc247 Merge remote-tracking branch 'origin/topic/robin/broxygen-plugin-warnings'
* origin/topic/robin/broxygen-plugin-warnings:
  Tweaking Broxygen indexing of plugin scripts.
  Fixing Broxygen indexing confusion for plugins.

BIT-1693 #merged
2016-10-06 14:17:46 -07:00
Robin Sommer
7a981eff0f Merge remote-tracking branch 'origin/topic/vladg/bit-1671'
Nice, thanks!

BIT-1671 #merged

* origin/topic/vladg/bit-1671:
  Add descriptions for what the SMB1 events do, and references to the specification.
  Add descriptions for what the SMB2 events do, and references to the specification.
  Improve the SMB2 documentation.
  Improve the SMB1 documentation a bit. Clean it up, make it more consistent, and add references to similar events.
  Add DCE-RPC and NTLM abbreviation documentation for their events.
  Remove reference to epm_map_response in RPC documentation. Addresses BIT-1671.
  Rename events referenced in SMB1::Header documentation with new SMB analyzer. Addresses BIT-1671.
2016-10-06 14:02:04 -07:00
Vlad Grigorescu
3e1133f3cf Add descriptions for what the SMB1 events do, and references to the specification. 2016-10-03 17:22:05 -05:00
Vlad Grigorescu
32d03a4a9e Add descriptions for what the SMB2 events do, and references to the specification. 2016-10-03 16:39:27 -05:00
Vlad Grigorescu
03f9a8675f Improve the SMB2 documentation.
* Clean it up, make it more consistent, and add references to similar events.
* Commented out the smb2_set_info_request event, which wasn't being generated.
* Documented the SMB2 record types in init-bare
2016-10-03 16:24:47 -05:00
Vlad Grigorescu
260c985094 Improve the SMB1 documentation a bit. Clean it up, make it more consistent, and add references to similar events. 2016-10-03 14:40:38 -05:00
Vlad Grigorescu
25495e576a Add DCE-RPC and NTLM abbreviation documentation for their events. 2016-10-03 14:23:58 -05:00
Vlad Grigorescu
d320fb2f7c Remove reference to epm_map_response in RPC documentation. Addresses BIT-1671.
epm_map_response was defined but unimplemented in previous versions of Bro.
2016-10-03 14:22:57 -05:00
Robin Sommer
e71aaf45c8 Tweaking Broxygen indexing of plugin scripts.
Instead of indexing, e.g., "Bro::Netmap:scripts/init.bro", Broxygen
now uses "Bro_Netmap/scripts/init.bro".
2016-10-02 17:31:19 -07:00
Robin Sommer
8acf995361 Fixing Broxygen indexing confusion for plugins.
Because plugins register their script directories with the BROPATH,
Broxygen stripped them out from plugin script paths it was indexing.
That then led to multiple plugins ending up with the same script
paths, triggering warnings about duplicates.

I fixed this by checking if a script comes out of a plugin. If so, it
gets an artifcial index prefix "<plugin-name>:", followed by the
script's relative path inside the plugin's top-level directory. For
example, "/opt/bro/lib/bro/plugins/Bro_Netmap/scripts/init.bro" now
turns into "Bro::Netmap:scripts/init.bro" for Broxygen purposes
(whereas it used to be just "init.bro").

Addresses BIT-1663.

(Can't think of a good way to add a test for this unfortunately.)
2016-09-29 16:18:53 -07:00
Johanna Amann
35465aaf30 Add convenient way to access version information to Bro.
With the introduction of the package manager, it will get more common
that applications are able to get information about the currently
running version of Bro. With this commit, scripts can easily compare
which version of Bro they are running.

Commonly, this probably will either look like this (both lines check if
the current Bro version is greater or equal to 2.5)

@if ( Version::num >= 20500 )
or
@if ( Version::greater_equal("2.5") )

Version::info contains detailed information about the running version of
Bro, including beta flags, etc.
2016-09-29 12:45:48 -07:00
Robin Sommer
b6a0802227 Prettifying reporter output in case no epxression is associated with
runtime error.
2016-09-28 18:18:58 -07:00
Robin Sommer
4059d4b4f1 Merge remote-tracking branch 'origin/topic/johanna/bit-1683'
Looks like the right fix. Two tiny tweaks:

     - changed the order of arguments for DeleteVals() for consistency
       with the corresponding Manager function.

     - turned the InternalWarning into a Warning: if I understand
       correctly, this can happen when scripts on nodes diverge; which
       is a user-side problem, not an internal Bro logic issue.

BIT-1683 #merged

* origin/topic/johanna/bit-1683:
  Actually check if the number of fields in a write are equal to the number of fields required.
2016-09-27 12:40:36 -07:00
Johanna Amann
48f505f706 Fix a debugger bug where it would not support statements like print(3).
This is a manual merge of a branch of Vlad Grigorescu.

BIT-1703 #merged
2016-09-26 10:17:12 -07:00