Merge remote-tracking branch 'origin/topic/vladg/mysql_nul_string_fix'

* origin/topic/vladg/mysql_nul_string_fix:
  Add a test with an encrypted MySQL connection
  Fix parsing of MySQL NUL Strings, where we now require it to have a NUL value at the end.
This commit is contained in:
Jon Siwek 2018-10-30 09:59:44 -05:00
commit 8c02aa5211
7 changed files with 32 additions and 18 deletions

View file

@ -1,4 +1,10 @@
2.6-beta2-55 | 2018-10-30 09:59:44 -0500
* Add a test with an encrypted MySQL connection (Vlad Grigorescu)
* Fix parsing of MySQL NUL Strings (Vlad Grigorescu)
2.6-beta2-51 | 2018-10-26 10:41:42 -0500
* Add missing record field comment (Jon Siwek, Corelight)

View file

@ -1 +1 @@
2.6-beta2-51
2.6-beta2-55

View file

@ -8,11 +8,11 @@ refine flow MySQL_Flow += {
if ( ${msg.version} == 10 )
BifEvent::generate_mysql_server_version(connection()->bro_analyzer(),
connection()->bro_analyzer()->Conn(),
bytestring_to_val(${msg.handshake10.server_version}));
new StringVal(c_str(${msg.handshake10.server_version})));
if ( ${msg.version} == 9 )
BifEvent::generate_mysql_server_version(connection()->bro_analyzer(),
connection()->bro_analyzer()->Conn(),
bytestring_to_val(${msg.handshake9.server_version}));
new StringVal(c_str(${msg.handshake9.server_version})));
}
return true;
%}
@ -27,11 +27,11 @@ refine flow MySQL_Flow += {
if ( ${msg.version} == 10 )
BifEvent::generate_mysql_handshake(connection()->bro_analyzer(),
connection()->bro_analyzer()->Conn(),
bytestring_to_val(${msg.v10_response.username}));
new StringVal(c_str(${msg.v10_response.username})));
if ( ${msg.version} == 9 )
BifEvent::generate_mysql_handshake(connection()->bro_analyzer(),
connection()->bro_analyzer()->Conn(),
bytestring_to_val(${msg.v9_response.username}));
new StringVal(c_str(${msg.v9_response.username})));
}
return true;
%}

View file

@ -151,7 +151,7 @@ enum Expected {
EXPECT_AUTH_SWITCH,
};
type NUL_String = RE/[^\0]*/;
type NUL_String = RE/[^\0]*\0/;
# MySQL PDU

Binary file not shown.

View file

@ -0,0 +1,8 @@
# This tests how Bro deals with encrypted connections. Right now, it doesn't log them as it
# can't parse much of value. We're testing for an empty mysql.log file.
# @TEST-EXEC: touch mysql.log
# @TEST-EXEC: bro -b -r $TRACES/mysql/encrypted.trace %INPUT
# @TEST-EXEC: btest-diff mysql.log
@load base/protocols/mysql