diff --git a/src/analyzer/protocol/CMakeLists.txt b/src/analyzer/protocol/CMakeLists.txt index 945d68fa09..dd6541580c 100644 --- a/src/analyzer/protocol/CMakeLists.txt +++ b/src/analyzer/protocol/CMakeLists.txt @@ -37,7 +37,7 @@ add_subdirectory(smtp) add_subdirectory(snmp) add_subdirectory(socks) add_subdirectory(ssh) -#add_subdirectory(ssl) +add_subdirectory(ssl) add_subdirectory(syslog) add_subdirectory(tcp) add_subdirectory(tls) diff --git a/src/analyzer/protocol/rdp/RDP.cc b/src/analyzer/protocol/rdp/RDP.cc index 77288947c7..17061b98d4 100644 --- a/src/analyzer/protocol/rdp/RDP.cc +++ b/src/analyzer/protocol/rdp/RDP.cc @@ -13,7 +13,6 @@ RDP_Analyzer::RDP_Analyzer(Connection* c) : analyzer::tcp::TCP_ApplicationAnalyz interp = new binpac::RDP::RDP_Conn(this); had_gap = false; - ssl = nullptr; } RDP_Analyzer::~RDP_Analyzer() @@ -54,18 +53,18 @@ void RDP_Analyzer::DeliverStream(int len, const u_char* data, bool orig) // 0x03-0x04 is CredSSP which is effectively SSL/TLS if ( interp->encryption_method() > 0x00 ) { - if ( ! ssl ) - { - ssl = new analyzer::ssl::SSL_Analyzer(Conn()); - if ( ! AddChildAnalyzer(ssl) ) - { - reporter->AnalyzerError(this, "failed to add TCP child analyzer " - "to RDP analyzer: already exists"); - return; - } - } + /* if ( ! ssl ) + { + ssl = new analyzer::ssl::SSL_Analyzer(Conn()); + if ( ! AddChildAnalyzer(ssl) ) + { + reporter->AnalyzerError(this, "failed to add TCP child analyzer " + "to RDP analyzer: already exists"); + return; + } + } - ForwardStream(len, data, orig); + ForwardStream(len, data, orig); */ } else { diff --git a/src/analyzer/protocol/rdp/RDP.h b/src/analyzer/protocol/rdp/RDP.h index 816d10720b..254761b375 100644 --- a/src/analyzer/protocol/rdp/RDP.h +++ b/src/analyzer/protocol/rdp/RDP.h @@ -3,7 +3,6 @@ #include "zeek/analyzer/protocol/pia/PIA.h" #include "zeek/analyzer/protocol/rdp/events.bif.h" #include "zeek/analyzer/protocol/rdp/rdp_pac.h" -#include "zeek/analyzer/protocol/ssl/SSL.h" #include "zeek/analyzer/protocol/tcp/TCP.h" namespace zeek::analyzer::rdp @@ -31,7 +30,7 @@ protected: binpac::RDP::RDP_Conn* interp; bool had_gap; - analyzer::ssl::SSL_Analyzer* ssl; + // analyzer::ssl::SSL_Analyzer* ssl; }; } // namespace zeek::analyzer::rdp diff --git a/src/analyzer/protocol/ssl/CMakeLists.txt b/src/analyzer/protocol/ssl/CMakeLists.txt index 3cc3fc5649..6431a31876 100644 --- a/src/analyzer/protocol/ssl/CMakeLists.txt +++ b/src/analyzer/protocol/ssl/CMakeLists.txt @@ -2,34 +2,34 @@ zeek_add_plugin( Zeek SSL SOURCES - SSL.cc - DTLS.cc +# SSL.cc +# DTLS.cc Plugin.cc BIFS - types.bif - events.bif +# types.bif +# events.bif functions.bif - consts.bif - PAC - tls-handshake.pac - tls-handshake-protocol.pac - tls-handshake-analyzer.pac - ssl-defs.pac - proc-certificate.pac - tls-handshake-signed_certificate_timestamp.pac - PAC - ssl.pac - ssl-dtls-analyzer.pac - ssl-analyzer.pac - ssl-dtls-protocol.pac - ssl-protocol.pac - ssl-defs.pac - proc-certificate.pac - PAC - dtls.pac - ssl-dtls-analyzer.pac - dtls-analyzer.pac - ssl-dtls-protocol.pac - dtls-protocol.pac - ssl-defs.pac +# consts.bif +# PAC +# tls-handshake.pac +# tls-handshake-protocol.pac +# tls-handshake-analyzer.pac +# ssl-defs.pac +# proc-certificate.pac +# tls-handshake-signed_certificate_timestamp.pac +# PAC +# ssl.pac +# ssl-dtls-analyzer.pac +# ssl-analyzer.pac +# ssl-dtls-protocol.pac +# ssl-protocol.pac +# ssl-defs.pac +# proc-certificate.pac +# PAC +# dtls.pac +# ssl-dtls-analyzer.pac +# dtls-analyzer.pac +# ssl-dtls-protocol.pac +# dtls-protocol.pac +# ssl-defs.pac ) diff --git a/src/analyzer/protocol/ssl/Plugin.cc b/src/analyzer/protocol/ssl/Plugin.cc index 2042a6d2ce..655f057e98 100644 --- a/src/analyzer/protocol/ssl/Plugin.cc +++ b/src/analyzer/protocol/ssl/Plugin.cc @@ -2,9 +2,9 @@ #include "zeek/plugin/Plugin.h" -#include "zeek/analyzer/Component.h" -#include "zeek/analyzer/protocol/ssl/DTLS.h" -#include "zeek/analyzer/protocol/ssl/SSL.h" +// #include "zeek/analyzer/Component.h" +//#include "zeek/analyzer/protocol/ssl/DTLS.h" +// #include "zeek/analyzer/protocol/ssl/SSL.h" namespace zeek::plugin::detail::Zeek_SSL { @@ -14,10 +14,10 @@ class Plugin : public zeek::plugin::Plugin public: zeek::plugin::Configuration Configure() override { - AddComponent( - new zeek::analyzer::Component("SSL", zeek::analyzer::ssl::SSL_Analyzer::Instantiate)); - AddComponent(new zeek::analyzer::Component( - "DTLS", zeek::analyzer::dtls::DTLS_Analyzer::Instantiate)); + // AddComponent( + // new zeek::analyzer::Component("SSL", zeek::analyzer::ssl::SSL_Analyzer::Instantiate)); + // AddComponent(new zeek::analyzer::Component( + // "DTLS", zeek::analyzer::dtls::DTLS_Analyzer::Instantiate)); zeek::plugin::Configuration config; config.name = "Zeek::SSL"; diff --git a/src/analyzer/protocol/ssl/functions.bif b/src/analyzer/protocol/ssl/functions.bif index 2e91190b73..a3b1697ea7 100644 --- a/src/analyzer/protocol/ssl/functions.bif +++ b/src/analyzer/protocol/ssl/functions.bif @@ -1,70 +1,70 @@ %%{ #include -#include "zeek/analyzer/protocol/ssl/SSL.h" +// #include "zeek/analyzer/protocol/ssl/SSL.h" #include "zeek/Reporter.h" %%} -## Sets if the SSL analyzer should consider the connection established (handshake -## finished successfully). -## -## c: The SSL connection. -## -## Returns: T on success, F on failure. -function set_ssl_established%(c: connection%): bool - %{ - zeek::analyzer::Analyzer* sa = c->FindAnalyzer("SSL"); - - if ( sa ) - { - static_cast(sa)->StartEncryption(); - return zeek::val_mgr->True(); - } - - return zeek::val_mgr->False(); - %} - -## Set the secret that should be used to derive keys for the connection. -## (For TLS 1.2 this is the pre-master secret). -## -## c: The affected connection -## -## secret: secret to set -## -## Returns: T on success, F on failure. -function set_secret%(c: connection, secret: string%): bool - %{ - analyzer::Analyzer* sa = c->FindAnalyzer("SSL"); - - if ( sa ) - { - static_cast(sa)->SetSecret(*secret); - return zeek::val_mgr->True(); - } - - return zeek::val_mgr->False(); - %} - -## Set the decryption keys that should be used to decrypt -## TLS application data in the connection. -## -## c: The affected connection -## -## keys: The key buffer as derived via TLS PRF. -## -## Returns: T on success, F on failure. -function set_keys%(c: connection, keys: string%): bool - %{ - analyzer::Analyzer* sa = c->FindAnalyzer("SSL"); - - if ( sa ) - { - static_cast(sa)->SetKeys(*keys); - return zeek::val_mgr->True(); - } - - return zeek::val_mgr->False(); - %} +# ## Sets if the SSL analyzer should consider the connection established (handshake +# ## finished successfully). +# ## +# ## c: The SSL connection. +# ## +# ## Returns: T on success, F on failure. +# function set_ssl_established%(c: connection%): bool +# %{ +# zeek::analyzer::Analyzer* sa = c->FindAnalyzer("SSL"); +# +# if ( sa ) +# { +# static_cast(sa)->StartEncryption(); +# return zeek::val_mgr->True(); +# } +# +# return zeek::val_mgr->False(); +# %} +# +# ## Set the secret that should be used to derive keys for the connection. +# ## (For TLS 1.2 this is the pre-master secret). +# ## +# ## c: The affected connection +# ## +# ## secret: secret to set +# ## +# ## Returns: T on success, F on failure. +# function set_secret%(c: connection, secret: string%): bool +# %{ +# analyzer::Analyzer* sa = c->FindAnalyzer("SSL"); +# +# if ( sa ) +# { +# static_cast(sa)->SetSecret(*secret); +# return zeek::val_mgr->True(); +# } +# +# return zeek::val_mgr->False(); +# %} +# +# ## Set the decryption keys that should be used to decrypt +# ## TLS application data in the connection. +# ## +# ## c: The affected connection +# ## +# ## keys: The key buffer as derived via TLS PRF. +# ## +# ## Returns: T on success, F on failure. +# function set_keys%(c: connection, keys: string%): bool +# %{ +# analyzer::Analyzer* sa = c->FindAnalyzer("SSL"); +# +# if ( sa ) +# { +# static_cast(sa)->SetKeys(*keys); +# return zeek::val_mgr->True(); +# } +# +# return zeek::val_mgr->False(); +# %} ## Decodes a DER-encoded distinguished name into an ASCII string, ## using the RFC2253 representation diff --git a/src/analyzer/protocol/tls/TLS.evt b/src/analyzer/protocol/tls/TLS.evt index a0012006a2..e469bfced9 100644 --- a/src/analyzer/protocol/tls/TLS.evt +++ b/src/analyzer/protocol/tls/TLS.evt @@ -2,13 +2,17 @@ protocol analyzer TLS over TCP: parse with TLS::Message, port 443/tcp; +# protocol analyzer DTLS over UDP: +# parse with TLS::DTLSMessage, +# port 443/udp; + import TLS; import zeek; import spicy; on TLS::ClientHello -> event ssl_client_hello($conn, self.client_version, msg.record_version, cast