Commit graph

1128 commits

Author SHA1 Message Date
Jon Siwek
f30d3e635e Fix non-deterministic logging of unmatched DNS msgs, addresses BIT-1153
Unmatched DNS messages may fail to be logged sometimes due to a type of
iterator invalidation.
2014-03-10 11:34:57 -05:00
Robin Sommer
69d52feb18 Merge remote-tracking branch 'origin/topic/seth/dns-srv-fix'
* origin/topic/seth/dns-srv-fix:
  No longer accidentally attempting to parse NBSTAT RRs as SRV RRs.
  Fix DNS SRV responses and a small issue with NBNS queries and label length.

BIT-1147 #merged
2014-03-09 08:59:48 -07:00
Seth Hall
bcdffe3212 No longer accidentally attempting to parse NBSTAT RRs as SRV RRs.
The NetBios name service RFC (1002) specified NBSTAT (NetBios Status)
resource records to have identifier 0x0021.  The DNS SRV RFC specified
SRV records to have identifier 33.  Unfortunately those are the
same number. :)

We now check the resp port to handle this situation better so that
we won't be attempting to parse NBSTAT records as SRV (which
causes several weird messages).
2014-03-06 09:06:23 -05:00
Seth Hall
9743959995 Fix DNS SRV responses and a small issue with NBNS queries and label length.
- DNS SRV responses never had the code written to actually
   generate the dns_SRV_reply event.  Adding this required
   extending the event a bit to add extra information.  SRV responses
   now appear in the dns.log file correctly.

 - Fixed an issue where some Microsoft NetBIOS Name Service lookups
   would exceed the max label length for DNS and cause an incorrect
   "DNS_label_too_long" weird.
2014-03-05 16:11:06 -05:00
Bernhard Amann
f140abc629 only call disable_analyzer if the connection is still open. 2014-03-04 15:09:19 -08:00
Bernhard Amann
ea1616bed5 At the moment, SSL connections where the ssl_established event does not fire are not logged.
That means that, for example, connections that are terminated with an alert during the
handshake never appear in the ssl.log.

This patch changes this behavior - now all ssl connections that fire any event are logged.

The protocol confirmation of the ssl analyzer is moved to the client_hello instead to
the server hello. Furthermore, an additional field is added to ssl.log, which indicates
if a connection has been established or not (which probably indicates a handshake problem).
2014-03-04 14:23:49 -08:00
Robin Sommer
d6d26a3ea7 Merge branch 'topic/robin/http-connect'
* topic/robin/http-connect:
  HTTP fix for output handlers.
  Expanding the HTTP methods used in the signature to detect HTTP traffic.
  Updating submodule(s).
  Fixing removal of support analyzers, plus some tweaking and cleanup of CONNECT code.
  HTTP CONNECT proxy support.

BIT-1132 #merged
2014-03-03 16:53:46 -08:00
Robin Sommer
7774af7518 Merge remote-tracking branch 'origin/topic/bernhard/ticket-1144'
* origin/topic/bernhard/ticket-1144:
  Allow iterating over bif functions with result type vector of any.

BIT-1144 #merged
2014-03-03 16:35:00 -08:00
Seth Hall
d0f8edb2a4 Expanding the HTTP methods used in the signature to detect HTTP traffic. 2014-03-02 14:03:59 -08:00
Robin Sommer
02ab000b81 Merge remote-tracking branch 'origin/master' into topic/robin/http-connect
Conflicts:
	scripts/base/protocols/ssl/consts.bro
2014-03-02 13:55:13 -08:00
Robin Sommer
338d521003 Fixing removal of support analyzers, plus some tweaking and cleanup of
CONNECT code.

Removal of support analyzers was broken. The code now actually doesn't
delete them immediately anymore but instead just flags them as
disabled. They'll be destroyed with the parent analyzer later.

Also includes a new leak tests exercising the CONNECT code.

Lines starting # with '#' will be ignored, and an empty message aborts
the commit. # On branch topic/robin/http-connect # Changes to be
committed: # modified: scripts/base/protocols/http/main.bro #
modified: scripts/base/protocols/ssl/consts.bro # modified:
src/analyzer/Analyzer.cc # modified: src/analyzer/Analyzer.h #
modified: src/analyzer/protocol/http/HTTP.cc # new file:
testing/btest/core/leaks/http-connect.bro # modified:
testing/btest/scripts/base/protocols/http/http-connect.bro # #
Untracked files: # .tags # changes.txt # conn.log # debug.log # diff #
mpls-in-vlan.patch # newfile.pcap # packet_filter.log # reporter.log #
src/PktSrc.cc.orig # weird.log #
2014-03-02 13:52:32 -08:00
Robin Sommer
63da66b0cd Merge remote-tracking branch 'origin/topic/bernhard/remove-packetsort'
* origin/topic/bernhard/remove-packetsort:
  Remove packet sorter. Addresses BIT-700

BIT-700 #merged
2014-02-28 14:50:53 -08:00
Bernhard Amann
a1d9150964 Update mozilla root bundle 2014-02-28 03:40:18 -08:00
Bernhard Amann
89bc959cb0 Merge remote-tracking branch 'origin/master' into fastpath 2014-02-26 14:17:11 -08:00
Bernhard Amann
3f584a08fd Remove packet sorter. Addresses BIT-700 2014-02-25 19:20:42 -08:00
Bernhard Amann
b3bd509b3f Allow iterating over bif functions with result type vector of any.
This changes the internal type that is used to signal that a vector
is unspecified from any to void.

I tried to verify that the behavior of Bro is still the same. After
a lot of playing around, I think everything still should worl as before.

However, it might be good for someone to take a look at this.

addresses BIT-1144
2014-02-25 15:30:29 -08:00
Bernhard Amann
bc75988bd9 More google tls extensions that are being actively used. 2014-02-24 12:56:06 -08:00
Robin Sommer
58eb9bbf28 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  new TLS constants from https://tools.ietf.org/html/draft-bmoeller-tls-downgrade-scsv-01
  Revert "Correct return type of topk_get_top, addresses BIT-1144"
  Correct return type of topk_get_top, addresses BIT-1144
2014-02-24 07:28:34 -08:00
Bernhard Amann
ca2cdd8861 new TLS constants from https://tools.ietf.org/html/draft-bmoeller-tls-downgrade-scsv-01 2014-02-21 11:24:03 -08:00
Robin Sommer
48568c9e1f Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  New alert from https://tools.ietf.org/html/draft-ietf-tls-applayerprotoneg-04
  update 3rdparty submodule (new SQLite version)
2014-02-20 17:31:22 -08:00
Bernhard Amann
18d89d6320 New alert from https://tools.ietf.org/html/draft-ietf-tls-applayerprotoneg-04 2014-02-20 14:38:27 -08:00
Robin Sommer
7d0fbcd7b7 Merge remote-tracking branch 'origin/topic/jsiwek/dns-perf'
* origin/topic/jsiwek/dns-perf:
  Refactor DNS script's state management to improve performance.

BIT-1133
2014-02-13 16:42:41 -08:00
Jon Siwek
3c95d1d695 Refactor DNS script's state management to improve performance.
The amount of timers involved in DNS::PendingMessage tables'
expiration attributes have a significant performance hit.  Instead the
script now relies solely on maximum thresholds for pending message
quantities to limit amount of accumulated state.  There's a new option,
"DNS::max_pending_query_ids", to limit the number outstanding messages
across all DNS query IDs ("DNS::max_pending_msgs" still limits number
of outstanding messages for a *given* query ID).
2014-02-13 14:55:45 -06:00
Robin Sommer
eb744fd329 Revert "Expanding the HTTP methods used in the signature to detect HTTP traffic."
This reverts commit 506b26e5ff.

The corresponding patch adding HTTP CONNECT support doesn't work yet
so backing this out until we get that in shape.
2014-02-13 12:49:46 -08:00
Robin Sommer
a57f0ef9a0 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Increase timeouts of some unit tests.
  Fix memory leak in modbus analyzer.
  add channel_id tls extension number.
2014-02-13 12:45:02 -08:00
Seth Hall
dd0856a57f HTTP CONNECT proxy support.
- The HTTP analyzer now supports handling HTTP CONNECT proxies
   same as the SOCKS analyzer handles proxying.
2014-02-12 22:38:59 -05:00
Seth Hall
506b26e5ff Expanding the HTTP methods used in the signature to detect HTTP traffic. 2014-02-11 15:30:22 -05:00
Bernhard Amann
adfe3a0754 add channel_id tls extension number.
This number is not IANA defined, but we see it being
actively used.
2014-02-10 23:56:23 -08:00
Seth Hall
70316a3f14 Merge remote-tracking branch 'origin/topic/jsiwek/dns-improvements'
* origin/topic/jsiwek/dns-improvements:
  Rewrite DNS state tracking which matches queries and replies.
  Change dns.log to include only standard DNS queries.
  Improve DNS analysis.
2014-02-09 23:50:43 -05:00
Robin Sommer
126fbb6ba9 Merge remote-tracking branch 'origin/topic/jsiwek/tcp-improvements'
* origin/topic/jsiwek/tcp-improvements:
  Add script to detect filtered TCP traces, addresses BIT-1119.

BIT-1119 #merged

If we could only disable an event handler dynamically ...
2014-02-04 22:34:35 -08:00
Jon Siwek
ab4508486e Minor unified2 script documentation fix. 2014-02-03 16:55:23 -06:00
Jon Siwek
0cb2a90da4 Add script to detect filtered TCP traces, addresses BIT-1119.
If reading a trace file w/ only TCP control packets, a warning is
emitted to suggest the 'detect_filtered_traces' option if the user
doesn't desire Bro to report missing TCP segments for such a trace file.
2014-01-31 17:04:58 -06:00
Jon Siwek
c61dfb1963 Rewrite DNS state tracking which matches queries and replies.
The previous method of matching queries with replies was still
unreliable in cases where the reply contains no answers.  The new code
also takes extra measures to avoid pending state growing too large in
cases where the condition to match a query with a corresponding reply is
never met, but yet DNS messages continue to be exchanged over the same
connection 5-tuple (preventing cleanup of the pending state).
2014-01-30 17:21:01 -06:00
Robin Sommer
dfcb4938d0 Merge remote-tracking branch 'origin/topic/jsiwek/tcp-improvements'
* origin/topic/jsiwek/tcp-improvements:
  Fix file_over_new_connection event to trigger when entire file is missed.
  Improve TCP connection size reporting for half-open connections.
  Improve gap reporting in TCP connections that never see data.
  Improve TCP FIN retransmission handling.

BIT-1119
2014-01-28 15:24:20 -08:00
Jon Siwek
31866f8f59 Change dns.log to include only standard DNS queries.
The scope of dns.log is now only standard queries (OPCODE == 0).  Other
kinds of queries (e.g. inverse query) were not handled correctly and
could interfere with the state tracking of the default DNS scripts.
2014-01-28 13:56:22 -06:00
Robin Sommer
9d3d31dbac Merge remote-tracking branch 'origin/topic/bernhard/fix-x509-extensions'
* origin/topic/bernhard/fix-x509-extensions:
  Fix x509_extension event.

BIT-1120 #merged
2014-01-28 10:27:39 -08:00
Jon Siwek
0e0e74e49c Improve DNS analysis.
- Fix parsing of empty question sections (when QDCOUNT == 0).  In this
  case, the DNS parser would extract two 2-byte fields for use in either
  "dns_query_reply" or "dns_rejected" events (dependent on value of
  RCODE) as qclass and qtype parameters.  This is not correct, because
  such fields don't actually exist in the DNS message format when
  QDCOUNT is 0.  As a result, these events are no longer raised when
  there's an empty question section.  Scripts that depends on checking
  for an empty question section can do that in the "dns_message" event.

- Add a new "dns_unknown_reply" event, for when Bro does not know how
  to fully parse a particular resource record type.  This helps fix a
  problem in the default DNS scripts where the logic to complete
  request-reply pair matching doesn't work because it's waiting on more
  RR events to complete the reply.  i.e. it expects ANCOUNT number of
  dns_*_reply events and will wait until it gets that many before
  completing a request-reply pair and logging it to dns.log.  This could
  cause bogus replies to match a previous request if they happen to
  share a DNS transaction ID.
2014-01-28 11:04:01 -06:00
Bernhard Amann
6d73b8c57e Fix x509_extension event.
The event now really returns the extension. If openssl supports printing
it, it is converted into the openssl ascii output.

The output does not always look pretty because it can contain newlines.

New event syntax:
event x509_extension(c: connection, is_orig: bool, cert:X509, extension: X509_extension_info)

Example output for extension:
  [name=X509v3 Extended Key Usage,
    short_name=extendedKeyUsage,
    oid=2.5.29.37,
    critical=F,
    value=TLS Web Server Authentication, TLS Web Client Authentication]
  [name=X509v3 Certificate Policies,
   short_name=certificatePolicies,
   oid=2.5.29.32,
   critical=F,
   value=Policy: 1.3.6.1.4.1.6449.1.2.1.3.4^J  CPS: https://secure.comodo.com/CPS^J]
2014-01-27 10:24:57 -08:00
Jon Siwek
9b12967d40 Improve gap reporting in TCP connections that never see data.
The previous behavior was to accomodate SYN/FIN/RST-filtered traces by
not reporting missing data (via the content_gap event) for such
connections.  The new behavior always reports gaps for connections that
are established and terminate normally, but sequence numbers indicate
that all data packets of the connection were missed.  The behavior can
be reverted by redef'ing "detect_filtered_trace".
2014-01-24 16:21:02 -06:00
Robin Sommer
ba9571f9ff Merge remote-tracking branch 'origin/topic/jsiwek/gre'
* origin/topic/jsiwek/gre:
  Simplify FragReassembler memory management.
  BIT-867 - Support GRE tunnel decapsulation.

BIT-867 #merged
2014-01-20 12:27:13 -08:00
Robin Sommer
bd63cf2e36 Merge remote-tracking branch 'origin/topic/jazoff/notice_file_info'
* origin/topic/jazoff/notice_file_info:
  Include file information in notices

BIT-1113 #merged

I'm wondering if there's a way to test creating these emails ... ?
2014-01-20 12:01:44 -08:00
Robin Sommer
04a974f208 Merge remote-tracking branch 'origin/topic/jazoff/ssl-validation-fix'
* origin/topic/jazoff/ssl-validation-fix:
  fix the caching of recently validated certs

BIT-1114 #merged
2014-01-20 11:55:32 -08:00
Jon Siwek
7717a3eb67 BIT-867 - Support GRE tunnel decapsulation.
This includes enhanced GRE headers.  GRE tunnels are treated just like
IP-in-IP tunnels by parsing past the GRE header in between the delivery
and payload IP packets.
2014-01-16 16:03:04 -06:00
Justin Azoff
852af5d02e Include file information in notices
Add file_desc and file_mime_type information to notice output if it
exists in the notice.
2014-01-13 17:01:51 -05:00
Justin Azoff
ec3f684c61 change Notice::suppressing to be a table of times
Instead of storing the entire notice in Notice::suppressing,
just store the time the notice should be suppressed until.

This has the same functionality, except that end_suppression can no
longer be generated.
2013-12-31 10:09:44 -05:00
Justin Azoff
cbe48258f6 fix the caching of recently validated certs
The recently_validated_certs table was being checked for entries, but
missing hashes were not being added to it after validation.
2013-12-10 11:27:19 -05:00
Robin Sommer
5049d68c1b Merge remote-tracking branch 'origin/topic/seth/ie11-software-parsing'
* origin/topic/seth/ie11-software-parsing:
  Updated software framework to support parsing IE11 user-agent strings.
  Fix the irc_reply event for several server message types.

BIT-1104 #merged
2013-12-09 13:21:20 -08:00
Seth Hall
6d782e6834 Updated software framework to support parsing IE11 user-agent strings. 2013-12-05 15:05:11 -05:00
Robin Sommer
d5a48f04ac Tweak to SMTP script to adjust for new string slicing behaviour.
Also updating NEWS with a note.
2013-12-04 13:45:46 -08:00
Robin Sommer
3c6f82ca73 More test updates.
The dump-events.bro generates output that would show in the Broxygen
all-script tests. Suppressing that manually in the test for lack of a
better idea.
2013-12-04 13:45:03 -08:00