Commit graph

6667 commits

Author SHA1 Message Date
Robin Sommer
201fc7b25a Merge remote-tracking branch 'origin/topic/bernhard/ssl-analyzer'
* origin/topic/bernhard/ssl-analyzer:
  Fix a few failing tests
  Add very basic ocsp stapling support.
  Add documentation, consts and tests for the new events.
  Support parsing of several TLS extensions.
  Make SSL/TLS version detection less brittle.
  Nicer notices for heartbleed.
  rip out state handline from ssl analyzer.
  enable detection of encrypted heartbleeds.
  also extract payload data in ssl_heartbeat
  add to local.bro, add disclaimer
  make tls heartbeat messages a bit better.
  fix tabs.
  polish script and probably detect encrypted attacks too.
  detect and alert on simple case of heartbleed
  default to TLS when not being able to determine version
  add is_orig to heartbeat event
  Throw new event for heartbeat messages.

BIT-1178 #merged
2014-04-24 17:04:56 -07:00
Robin Sommer
7f9a6f51ca Merge remote-tracking branch 'origin/topic/jsiwek/bit-1156'
I've added a unit test.

* origin/topic/jsiwek/bit-1156:
  BIT-1156: Fix parsing of DNS TXT RRs w/ multiple character-strings.

BIT-1156 #merged
2014-04-24 16:36:47 -07:00
Robin Sommer
de20b4f0fb Merge remote-tracking branch 'origin/topic/jsiwek/faf-perf'
* origin/topic/jsiwek/faf-perf:
  Adapt HTTP partial content to cache file analysis IDs.
  Adapt SSL analyzer to generate file analysis handles itself.
  Adapt more of HTTP analyzer to use cached file analysis IDs.
  Adapt IRC/FTP analyzers to cache file analysis IDs.
  Refactor regex/signature AcceptingSet data structure and usages.
  Enforce data size limit when checking files for MIME matches.
  Refactor file analysis file ID lookup.
2014-04-24 16:16:14 -07:00
Jon Siwek
de0ce6deed BIT-1156: Fix parsing of DNS TXT RRs w/ multiple character-strings.
The "dns_TXT_reply" event now uses a "vector of strings" as the final
parameter instead of just a "string" in order to support DNS TXT
resource records that contain multiple character-strings.

The format in which the TXT answers are logged by default is now changed
to be a list of strings of the form `fmt("TXT %d %s", |str|, str)`, one
for each character-string in the RR and delimited by a space (' ')
character.
2014-04-24 16:20:01 -05:00
Bernhard Amann
c24629abf4 Add very basic ocsp stapling support.
This only allows access to the ocsp stapling response data. No verification
or anything else at the moment.
2014-04-24 12:37:34 -07:00
Bernhard Amann
9b7eb293f1 Add documentation, consts and tests for the new events.
This also fixes the heartbleed detector to work for encrypted attacks in this
branch again. It stopped working, because the SSL analyzer now successfully detects
established connections, and the scripts usually disable analyzing after that.

(The heartbeat branch should not have been affected)
2014-04-24 12:05:30 -07:00
Jon Siwek
d3b27eb0c1 Adapt HTTP partial content to cache file analysis IDs.
The initial file ID I think is still ambiguous and/or depends on
script-layer state tracking enough that it still needs to request a file
ID via an event at first, but once that is assigned to an HTTP (MIME)
entity, it never makes sense that it can change (so re-using a cached ID
works).
2014-04-24 10:47:57 -05:00
Mareq
d3972afa97 Do not repeat hex-code of decoded quoted-printable. 2014-04-24 16:40:57 +01:00
Jon Siwek
58efa09426 Adapt SSL analyzer to generate file analysis handles itself. 2014-04-23 16:59:27 -05:00
Bernhard Amann
4ae52d9e1c Support parsing of several TLS extensions.
At the moment, we have support for:
elliptic_curves: client supported elliptic curves
ec_point_formats: list of client supported EC point formats
application_layer_protocol_negotiation: list of supported application layer protocols (used for spdy/http2 negotiation)
server_name: server name sent by client. This was supported before, but... a bit brittle.
2014-04-23 14:34:06 -07:00
Jon Siwek
de8f8f87b6 Adapt more of HTTP analyzer to use cached file analysis IDs.
Some EndOfFile calls can re-use a cached file ID.
2014-04-23 16:26:18 -05:00
Jon Siwek
0250489730 Adapt IRC/FTP analyzers to cache file analysis IDs. 2014-04-23 16:14:13 -05:00
Jon Siwek
782615e9dd Remove unused Val::attribs member. 2014-04-23 10:44:47 -05:00
Vlad Grigorescu
8744b66b56 Rely on content inspection and not just is_orig to determine client/server. 2014-04-22 20:31:53 -04:00
Vlad Grigorescu
25d7b71c50 Merge remote-tracking branch 'origin/master' into topic/vladg/sip 2014-04-22 18:58:22 -04:00
Vlad Grigorescu
e67c2c53dd Enable SIP in CMakeLists.txt 2014-04-22 18:50:49 -04:00
Vlad Grigorescu
54352204d6 Merge branch 'topic/vladg/sip' of https://github.com/grigorescu/bro into topic/vladg/sip 2014-04-22 18:43:36 -04:00
Vlad Grigorescu
2698fcea8e SSH: Various updates. 2014-04-22 18:26:39 -04:00
Jon Siwek
171c6ce86b Refactor regex/signature AcceptingSet data structure and usages.
Several parts of that code would do membership checks and that's going
to be more efficient with a set instead of a list data structure.
2014-04-21 16:55:51 -05:00
Jon Siwek
8126f06ffb Enforce data size limit when checking files for MIME matches.
The value of *bof_buffer_size* in the *fa_file* record was supposed to
always limit the amount of data used by the signature matching engine,
but some corner cases would cause matching to be performed on data
beyond that.
2014-04-21 16:51:45 -05:00
Bernhard Amann
594975c93d Make SSL/TLS version detection less brittle.
This still cannot deal with v2 hellos that use the long length.
On the other hand - OpenSSL also cannot deal with these and we should
not see many sslv2 connections in any case - so... they probably
would not work in practice in any case.
2014-04-21 11:23:12 -07:00
Bernhard Amann
8ce3cf65f2 Merge branch 'topic/bernhard/heartbeat' into topic/bernhard/ssl-analyzer
Conflicts:
	src/analyzer/protocol/ssl/ssl-analyzer.pac
	src/analyzer/protocol/ssl/ssl-protocol.pac
2014-04-21 10:34:36 -07:00
Bernhard Amann
0b53ff5b92 Merge remote-tracking branch 'origin/master' into topic/bernhard/ssl-analyzer 2014-04-21 10:31:16 -07:00
Jon Siwek
bc5c02cb74 Refactor file analysis file ID lookup.
Now using a dictionary instead of std::map as order doesn't matter and
lookup time shouldn't increase as more files are in process of being
analyzed.
2014-04-18 16:35:43 -05:00
Bernhard Amann
a92ff71e19 Merge remote-tracking branch 'origin/master' into topic/bernhard/heartbeat 2014-04-18 14:26:13 -07:00
Jon Siwek
e8a5ea8844 Refactor various hex escaping code. 2014-04-18 13:19:50 -05:00
Robin Sommer
80d7a1482c Merge remote-tracking branch 'origin/topic/jsiwek/ascii-log-memleak-fix'
* origin/topic/jsiwek/ascii-log-memleak-fix:
  Refactor initialization of ASCII log writer options.
  Fix a memory leak in ASCII log writer.
2014-04-17 18:01:41 -05:00
Robin Sommer
1ef4daf0a7 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Change how input/logging threads set their name.
  Fix bug when clearing Bloom filter contents.
2014-04-17 17:49:52 -05:00
Jon Siwek
c9b40f1ca7 Change how input/logging threads set their name.
Setting the thread name on every heartbeat uses a mild amount of
cycles and there's not much benefit to doing it there to get the
additional info regarding the number of processed messages since thread
names usually get truncated to 16 characters and omit that part anyway.
2014-04-15 16:36:47 -05:00
Jon Siwek
2a5b209f6d Refactor initialization of ASCII log writer options. 2014-04-15 12:50:10 -05:00
Matthias Vallentin
cb4eaf762c Fix bug when clearing Bloom filter contents.
This patch fixes a bug that occurred when calling the BiF bloomfilter_clear,
which used to not only clear the underlying bit vector but also set its size to
zero. As a result, subsequent element access or computations using the bit
vector size caused erroneous behavior.

Reported by @colonelxc.
2014-04-15 12:48:56 +02:00
Jon Siwek
13d8908a8d Fix a memory leak in ASCII log writer. 2014-04-14 16:53:49 -05:00
Bernhard Amann
cc838c6b2e rip out state handline from ssl analyzer.
still seems to work, but basically untested.
2014-04-10 15:12:33 -07:00
Bernhard Amann
4405121fb2 Merge branch 'fastpath' into topic/bernhard/heartbeat 2014-04-10 08:13:29 -07:00
Jon Siwek
c617be6f50 Remove unused data member of SMTP_Analyzer.
To silence a Coverity warning.
2014-04-09 16:39:46 -05:00
Jon Siwek
04344d09eb Update SNMP analyzer's DeliverPacket method signature. 2014-04-09 13:36:44 -05:00
Jon Siwek
f3bb4a455f Merge branch 'master' into topic/jsiwek/bit-348 2014-04-09 13:14:32 -05:00
Jon Siwek
2b3c2bd394 Fix reassembly of data w/ sizes beyond 32-bit capacities (BIT-348).
The main change is that reassembly code (e.g. for TCP) now uses
int64/uint64 (signedness is situational) data types in place of int
types in order to support delivering data to analyzers that pass 2GB
thresholds.  There's also changes in logic that accompany the change in
data types, e.g. to fix TCP sequence space arithmetic inconsistencies.

Another significant change is in the Analyzer API: the *Packet and
*Undelivered methods now use a uint64 in place of an int for the
relative sequence space offset parameter.
2014-04-09 13:03:24 -05:00
Bernhard Amann
2414aaf4bb enable detection of encrypted heartbleeds. 2014-04-08 21:57:37 -07:00
Robin Sommer
cf7e25643e Merge remote-tracking branch 'origin/topic/jsiwek/snmp'
* origin/topic/jsiwek/snmp:
  Add memory leak unit test for SNMP.
  Fix compiler nitpicks from new SNMP code.
  Add SNMP datagram parsing support.

BIT-1142
2014-04-08 15:31:03 -07:00
Bernhard Amann
2942a26280 also extract payload data in ssl_heartbeat 2014-04-08 12:44:51 -07:00
Bernhard Amann
335a30b08f detect and alert on simple case of heartbleed 2014-04-08 11:03:12 -07:00
Bernhard Amann
018735a574 default to TLS when not being able to determine version 2014-04-08 09:49:00 -07:00
Bernhard Amann
902d52e261 add is_orig to heartbeat event 2014-04-08 08:43:38 -07:00
Bernhard Amann
ffd4711a41 Throw new event for heartbeat messages.
Not tested.
2014-04-08 07:42:12 -07:00
Robin Sommer
2dcc631da6 Merge remote-tracking branch 'origin/topic/jsiwek/bif-loader-scripts'
BIT-1175 #merged

* origin/topic/jsiwek/bif-loader-scripts:
  Improve __load__.bro creation for .bif.bro stubs.
2014-04-03 15:53:46 -07:00
Vlad Grigorescu
78b5f6b94b BinPAC SSH analyzer basic functionality. 2014-04-02 23:03:24 -04:00
Robin Sommer
2d170edb1e Merge remote-tracking branch 'origin/topic/bernhard/ticket-1163'
* origin/topic/bernhard/ticket-1163:
  Change #types description of sets to set

BIT-1163 #merged
2014-04-01 16:50:58 -07:00
Bernhard Amann
01d075bf2d Change #types description of sets to set
Addresses BIT-1163
2014-04-01 16:25:47 -07:00
Jon Siwek
e2c71abe9b Improve __load__.bro creation for .bif.bro stubs.
The new loader scripts should not try to @load .bif.bro scripts that
were part of a build of an earlier Bro version, but have since had their
.bif file removed.
2014-04-01 14:23:09 -05:00