Commit graph

6667 commits

Author SHA1 Message Date
Robin Sommer
554e8cc73d Merge remote-tracking branch 'origin/topic/jsiwek/broker-listen-env'
BIT-1935 #merged

* origin/topic/jsiwek/broker-listen-env:
  Allow BRO_DEFAULT_LISTEN_ADDRESS to control broker listen address
2018-06-08 16:38:31 +00:00
Jon Siwek
f50effd364 Fix signed/unsigned comparison compiler warning
The signed int in this case is essentially a constant anyway.
2018-06-07 09:57:55 -05:00
Jon Siwek
9822fc252d Improve Broker performance
Now manually keeps track of peer count instead of querying Broker for
that information (which would result in waiting upon a blocking request
to the core actor).
2018-06-06 16:25:30 -05:00
Jon Siwek
0b4871daf4 BIT-1936: improve Broxygen warnings 2018-06-05 17:33:11 -05:00
Jon Siwek
a43c7d0691 Merge remote-tracking branch 'origin/topic/jsiwek/ncp-fixes'
* origin/topic/jsiwek/ncp-fixes:
  Add NCP::max_frame_size tuning option
  Migrate NCP analyzer to use latest analyzer API
2018-06-05 11:32:38 -05:00
Johanna Amann
a891517762 Fix read at invalid address in X509 extension parser.
When encountering an extension unknown to OpenSSL, we would read from
the wrong memory location. Also added a testcase to prevent this specific
case from happening again.
2018-06-04 12:05:56 -07:00
Jon Siwek
19b893a5bc Make 0 be a valid packet source timestamp
For fuzzed/damaged/corrupted pcaps, a timestamp of 0 could lead to an
infinite loop in Bro as it interprets that as meaning the packet source
is not ready yet.
2018-06-04 13:56:52 -05:00
Johanna Amann
791b24d232 Merge remote-tracking branch 'origin/topic/jsiwek/broker-misc'
* origin/topic/jsiwek/broker-misc:
  Add Broker::publish_and_relay BIF
  Document variable argument list BIFs using ellipsis
  Support unserializing broker data into type 'any'
  Fix a bug in broker data type-casting check
  Remove dead code in broker data/val conversion function
2018-06-04 10:00:49 -07:00
Vlad Grigorescu
fde88fa717 #120: Pull in PR, and make a couple small cleanup tweaks. 2018-06-02 17:29:01 -05:00
Vlad Grigorescu
7e5788bff0 Merge branch 'topic/andrew/ssh-fix' of https://github.com/Andrew-Woodford/bro into topic/vladg/ssh-fix 2018-06-02 16:26:05 -05:00
Johanna Amann
3a9575bf8a Make kerberos initialization static.
There does not seem to be any reason to initialize the members more than
once globally.
2018-06-01 13:49:08 -07:00
Jon Siwek
1b4e0116f4 Allow BRO_DEFAULT_LISTEN_ADDRESS to control broker listen address
This environment variable is now set to listen only on IPv4 loopback
when running unit tests (instead of using the default INADDR_ANY).

This also moves some of the @loads out from init-bare.bro into a new
init-frameworks-and-bifs.bro in order to better support calling BIFs
(like `getenv`) from variable initializations in those particular
frameworks.
2018-06-01 15:38:11 -05:00
Johanna Amann
327acf6555 KRB: do not set keytab by default.
Only enable decryption if a user purposefully sets a keytab.
2018-06-01 12:46:26 -07:00
Johanna Amann
8bb76cd3c1 KRB: do not set authentication info to nouser.
Simply do not set it at all in this case - it is an optional after
all...
2018-06-01 12:32:34 -07:00
Johanna Amann
5d5dd65cab Merge branch 'krb_changes2' of https://github.com/jwallior/bro
I did some cleanup work.
2018-06-01 12:28:45 -07:00
Jon Siwek
55f14c2eb8 Relocate temporary script coverage files
So they don't clutter the top-level of unit test .tmp/ dir.
2018-06-01 11:30:36 -05:00
Jon Siwek
f9e5777e6f BIT-1635: fix make doc warnings
References to Input::Reader and Log::Writer enum types no longer emit
warnings as they are now hardcoded to be documented as part of their
associated framework scripts and so links to them now work.
2018-06-01 10:08:44 -05:00
Johanna Amann
b2dc7ffb26 Merge branch 'smb2-updates' of https://github.com/dtrejod/bro 2018-05-31 21:13:20 -07:00
Jon Siwek
224ee790e2 Add Broker::publish_and_relay BIF
Like Broker::relay, except the relaying-node also calls event handlers.
2018-05-31 15:26:22 -05:00
Jon Siwek
08c64112f0 Document variable argument list BIFs using ellipsis
Instead of a single parameter: "va_args: any".
2018-05-31 13:14:57 -05:00
Jon Siwek
3679b0d963 Teach Option::set to unwrap Broker::Data values 2018-05-31 12:45:44 -05:00
Jon Siwek
d873acc9e3 Support unserializing broker data into type 'any'
The receiver side will wrap the data as a Broker::Data value, which
can then be type-checked/cast via 'is' or 'as' operators to a specific
Bro type.  For example:

Sender:

    Broker::publish("topic", my_event, "hello")

Receiver:

    event my_event(arg: any)
        {
        if ( arg is string )
            print arg as string;
        }
2018-05-31 10:39:40 -05:00
Jon Siwek
bd3c16c6d7 Fix a bug in broker data type-casting check 2018-05-31 10:05:18 -05:00
Jon Siwek
6489b54deb Remove dead code in broker data/val conversion function 2018-05-31 08:58:34 -05:00
Jon Siwek
186d47c762 Fix a typo in docs 2018-05-24 13:23:52 -05:00
Jon Siwek
04eaafd4eb Updating submodule(s).
[nomail]
2018-05-24 09:41:46 -05:00
Jon Siwek
58864c358c Add NCP::max_frame_size tuning option
This helps prevent excessive allocations based on message lengths
taken from NCP headers.
2018-05-22 18:27:52 -05:00
Jon Siwek
e35da5f592 Migrate NCP analyzer to use latest analyzer API
It was possibly never updated for newer Analyzer API changes, as simply
attaching the NCP analyzer to a connection would result in null pointer
derefernces and also support analyzers were not attached.
2018-05-22 16:27:07 -05:00
Jon Siwek
de029dd430 Merge remote-tracking branch 'origin/topic/jsiwek/binpac-fixes'
* origin/topic/jsiwek/binpac-fixes:
  Update test baseline for binpac changes
  Update test baseline for optimized binpac static-size array parsing
  Fixes for MySQL and SMB protocol parsers
  BIT-1829: add unit test for modbus parser issue
2018-05-22 15:06:51 -05:00
Jon Siwek
436a93b38a Make Reassembler::TotalSize a constant time operation 2018-05-22 09:20:44 -05:00
Robin Sommer
eaf5f4a9bb Whitespace changes. 2018-05-21 20:31:29 +00:00
Robin Sommer
593000be57 Updating submodules. 2018-05-21 20:31:29 +00:00
Robin Sommer
87552390e5 Bring Broccoli back for the time being.
It's deprecated and now disabled by default, but can be reenabled by
configuring with --enable-broccoli.
2018-05-21 18:38:25 +00:00
Robin Sommer
fe7e1ee7f0 Merge topic/actor-system throug a squashed commit. 2018-05-18 22:39:23 +00:00
Robin Sommer
7a6f5020f6 Updating submodule(s).
[nomail]
2018-05-18 22:39:22 +00:00
Jon Siwek
954e7980cf Fixes for MySQL and SMB protocol parsers
* MySQL: the parser for this was generally broken (not following
  the specification well) and needed many changes.  One addition is a
  new "mysql_result_row" event that provides access to the results of
  queries.

* SMB: the spec seems to explitly call out the omission of the
  PrimaryDomain field on SMB_COM_SESSION_SETUP_ANDX responses (and I
  don't see that field in pcaps either), so this may have just been a
  typo that used to work fine in the past only due to faulty array
  parsing behavior in binpac.
2018-05-18 10:31:36 -05:00
Pierre LALET
ab73946289 ARP: fix the l2 source address check
ARP_Analyzer::NextPacket() incorrectly assumed that the MAC source
address was at data+6 (which is fine for classical ARP over Ethernet
frames but incorrect for ARP over Wi-Fi for example) and the
destination was at data.

Use pkt->l2_src and pkt->l2_dst instead, set by Packet::ProcessLayer2().
2018-05-16 00:59:29 +02:00
Pierre LALET
30c28da046 Support 802.11 monitor mode 2018-05-15 14:08:48 +02:00
Julien Wallior
54ef1083bc Make linking against libkrb5 optional based on whether it is installed
on the system or not.
2018-05-10 10:15:08 -04:00
Julien Wallior
98a430c1eb Decrypt the krb ticket and send authentication data out. 2018-05-10 10:14:30 -04:00
Jon Siwek
e5d5cf9ff1 Fix case insensitive HTTP/MIME header name comparisons
Since the function was never used to check for anything other than
equality, I've changed it to return a bool, otherwise the changes to
its implementation are based on a patch submitted by Jeffrey Bencteux:

Function was comparing two strings based on the length of a user
provided string which could lead to evasions. Any prefix of the static
string could pass conditions where strcasecmp_n was used. Comparison
is now based on the static string length and lengths are checked
before calling strncasecmp.
2018-05-08 15:29:53 -05:00
jbencteux
ec4a936f66 fix using chunked mode with HTTP/1.0
According to RFC 7230, Transfer-Encoding was added in HTTP/1.1. Such a
header in a HTTP/1.0 message should be ignored. Interpreting it can be
harmful when sending a HTTP/1.0 message because the parser would
indefinitely wait for a chunk size instead of parsing the message's
body as non-chunked, leading to a HTTP content evasion.
2018-05-08 15:29:53 -05:00
Jon Siwek
2e2d086144 Fix previous content-length != content-range patch
In the case where no Content-Length header is seen, the content_length
value still should be set based upon the range (same as it would
have been before the patch).
2018-05-08 15:29:53 -05:00
jbencteux
c0cc4ef192 fix handling of HTTP body length
Partial content bytes range length value and content length value
should not be stored in the same variable. An attacker could override
a given Content-Length or Content-Range with a smaller value to
evade HTTP content.
2018-05-08 15:29:53 -05:00
jbencteux
2a01c70837 fix Content-Encoding: x-gzip
RFC 7230 section 4.2.3 states that:

"A recipient SHOULD consider 'x-gzip' to be equivalent to 'gzip'"

This could lead to evasions as an attacker could use:

Content-Encoding: x-gzip

To bypass Bro's decompression.
2018-05-08 15:29:53 -05:00
Johanna Amann
0f9ff2879d Merge branch 'patch-1' of https://github.com/assafmo/bro
* 'patch-1' of https://github.com/assafmo/bro:
  dump_packet & dump_current_packet better detect which file is being dumped to
  Fix dump_packet & dump_current_packet ignores file_name
2018-05-08 11:21:50 -07:00
Assaf Morami
1953c04581
dump_packet & dump_current_packet better detect which file is being dumped to 2018-05-08 17:36:17 +03:00
Assaf Morami
f35eae2e7e
Fix dump_packet & dump_current_packet ignores file_name
This fixes an issue where `dump_packet` and `dump_current_packet` ignores the `file_name` parameter if `addl_pkt_dumper` is already pointing to some file (doesn't matter which file...)

http://mailman.icsi.berkeley.edu/pipermail/bro/2018-May/013184.html
2018-05-08 15:46:18 +03:00
Vlad Grigorescu
ceab58c17e Make BinPAC exception handling more consistent 2018-05-02 15:39:43 -05:00
Jon Siwek
81133f3116 Merge remote-tracking branch 'origin/topic/seth/dhcp-update'
* origin/topic/seth/dhcp-update:
  Rework to the DHCP analyzer.
  First step of DHCP analyzer rearchitecture.
  Add .btest scripts for dhck_ack and dhcp_discover messages verifying that new options are correctly reported in dhcp.log records.
  Extend DHCP protocol analyzer with new options.

BIT-1924 #merged

Additional changes:

* Removed known-hosts.bro as the only thing populating its table was
  the already-removed known-hosts-and-devices.bro.  So a
  known_devices.log will no longer be generated.

* In dhcp-options.pac, the process_relay_agent_inf_option had a memleak
  and also process_auto_proxy_config_option looked like it accessed one
  byte past the end of the available bytestring, so fixed those.
2018-05-01 18:06:41 -05:00