Use our new features to send the CN and SAN fields of certificates to

the intel framework.
This commit is contained in:
Johanna Amann 2015-03-03 17:13:55 -08:00
parent e48c6ccc4a
commit 946f19fb9d
4 changed files with 63 additions and 0 deletions

View file

@ -10,3 +10,16 @@ event ssl_extension_server_name(c: connection, is_orig: bool, names: string_vec)
$conn=c, $conn=c,
$where=SSL::IN_SERVER_NAME]); $where=SSL::IN_SERVER_NAME]);
} }
event ssl_established(c: connection)
{
if ( ! c$ssl?$cert_chain || |c$ssl$cert_chain| == 0 ||
! c$ssl$cert_chain[0]?$x509 )
return;
if ( c$ssl$cert_chain[0]$x509?$certificate && c$ssl$cert_chain[0]$x509$certificate?$cn )
Intel::seen([$indicator=c$ssl$cert_chain[0]$x509$certificate$cn,
$indicator_type=Intel::DOMAIN,
$conn=c,
$where=X509::IN_CERT]);
}

View file

@ -2,6 +2,16 @@
@load base/files/x509 @load base/files/x509
@load ./where-locations @load ./where-locations
event x509_ext_subject_alternative_name(f: fa_file, ext: X509::SubjectAlternativeName)
{
if ( ext?$dns )
for ( i in ext$dns )
Intel::seen([$indicator=ext$dns[i],
$indicator_type=Intel::DOMAIN,
$f=f,
$where=X509::IN_CERT]);
}
event x509_certificate(f: fa_file, cert_ref: opaque of x509, cert: X509::Certificate) event x509_certificate(f: fa_file, cert_ref: opaque of x509, cert: X509::Certificate)
{ {
if ( /emailAddress=/ in cert$subject ) if ( /emailAddress=/ in cert$subject )

View file

@ -0,0 +1,22 @@
#separator \x09
#set_separator ,
#empty_field (empty)
#unset_field -
#path intel
#open 2015-03-04-01-12-47
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p fuid file_mime_type file_desc seen.indicator seen.indicator_type seen.where seen.node sources
#types time string addr port addr port string string string string enum enum string set[string]
1416942644.593119 CXWv6p3arKYeMETxOg 192.168.4.149 49422 23.92.19.75 443 F0txuw2pvrkZOn04a8 - 23.92.19.75:443/tcp www.pantz.org Intel::DOMAIN X509::IN_CERT bro source1
#close 2015-03-04-01-12-47
#separator \x09
#set_separator ,
#empty_field (empty)
#unset_field -
#path intel
#open 2015-03-04-01-12-47
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p fuid file_mime_type file_desc seen.indicator seen.indicator_type seen.where seen.node sources
#types time string addr port addr port string string string string enum enum string set[string]
1170717505.934612 CXWv6p3arKYeMETxOg 192.150.187.164 58868 194.127.84.106 443 - - - www.dresdner-privat.de Intel::DOMAIN X509::IN_CERT bro source1
1170717509.082241 CjhGID4nQcgTWjvg4c 192.150.187.164 58869 194.127.84.106 443 - - - www.dresdner-privat.de Intel::DOMAIN X509::IN_CERT bro source1
1170717512.108799 CCvvfg3TEfuqmmG4bh 192.150.187.164 58870 194.127.84.106 443 - - - www.dresdner-privat.de Intel::DOMAIN X509::IN_CERT bro source1
#close 2015-03-04-01-12-47

View file

@ -0,0 +1,18 @@
# @TEST-EXEC: bro -r $TRACES/tls/ecdsa-cert.pcap %INPUT
# @TEST-EXEC: cat intel.log > intel-all.log
# @TEST-EXEC: bro -r $TRACES/tls/ssl.v3.trace %INPUT
# @TEST-EXEC: cat intel.log >> intel-all.log
# @TEST-EXEC: btest-diff intel-all.log
@TEST-START-FILE intel.dat
#fields indicator indicator_type meta.source meta.desc meta.url
www.pantz.org Intel::DOMAIN source1 test entry http://some-data-distributor.com/100000
www.dresdner-privat.de Intel::DOMAIN source1 test entry http://some-data-distributor.com/100000
@TEST-END-FILE
@load base/frameworks/intel
@load base/protocols/ssl
@load frameworks/intel/seen
redef Intel::read_files += { "intel.dat" };