mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
smb1: Prevent accessing uninitialized referenced_tree
The added pcap was created from an OSS Fuzz test case and is borderline valid SMB traffic, but it triggered a scripting error. Closes #2726
This commit is contained in:
parent
589e042e26
commit
8be8c22b3e
5 changed files with 31 additions and 0 deletions
|
@ -206,6 +206,7 @@ export {
|
|||
["SMB_parsing_error"] = ACTION_LOG,
|
||||
["no_smb_session_using_parsesambamsg"] = ACTION_LOG,
|
||||
["smb_andx_command_failed_to_parse"] = ACTION_LOG,
|
||||
["smb_tree_connect_andx_response_without_tree"] = ACTION_LOG_PER_CONN,
|
||||
["transaction_subcmd_missing"] = ACTION_LOG,
|
||||
["successful_RPC_reply_to_invalid_request"] = ACTION_NOTICE_PER_ORIG,
|
||||
["SYN_after_close"] = ACTION_LOG,
|
||||
|
|
|
@ -107,6 +107,15 @@ event smb1_tree_connect_andx_request(c: connection, hdr: SMB1::Header, path: str
|
|||
|
||||
event smb1_tree_connect_andx_response(c: connection, hdr: SMB1::Header, service: string, native_file_system: string) &priority=5
|
||||
{
|
||||
# If the current_cmd does not have a referenced tree, then likely we
|
||||
# missed the SMB_COM_TREE_CONNECT_ANDX. Report a weird and stop.
|
||||
if ( ! c$smb_state$current_cmd?$referenced_tree )
|
||||
{
|
||||
local addl = fmt("current_cmd=%s", c$smb_state$current_cmd$command);
|
||||
Reporter::conn_weird("smb_tree_connect_andx_response_without_tree", c, addl);
|
||||
return;
|
||||
}
|
||||
|
||||
c$smb_state$current_cmd$referenced_tree$service = service;
|
||||
if ( service == "IPC" )
|
||||
c$smb_state$current_cmd$referenced_tree$share_type = "PIPE";
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
#separator \x09
|
||||
#set_separator ,
|
||||
#empty_field (empty)
|
||||
#unset_field -
|
||||
#path weird
|
||||
#open XXXX-XX-XX-XX-XX-XX
|
||||
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p name addl notice peer source
|
||||
#types time string addr port addr port string string bool string string
|
||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 10.0.0.1 38511 10.0.0.2 139 smb_tree_connect_andx_response_without_tree current_cmd=WRITE_ANDX F zeek -
|
||||
#close XXXX-XX-XX-XX-XX-XX
|
BIN
testing/btest/Traces/smb/smb1-OSS-fuzz-54883.pcap
Normal file
BIN
testing/btest/Traces/smb/smb1-OSS-fuzz-54883.pcap
Normal file
Binary file not shown.
|
@ -0,0 +1,10 @@
|
|||
#@TEST-EXEC: zeek -b -C -r $TRACES/smb/smb1-OSS-fuzz-54883.pcap %INPUT
|
||||
#@TEST-EXEC: btest-diff weird.log
|
||||
#@TEST-EXEC: ! test -f reporter.log
|
||||
|
||||
@load base/protocols/smb
|
||||
@load base/frameworks/notice/weird
|
||||
|
||||
# The traffic generated by OSS Fuzz is broken to the extreme, ensure
|
||||
# the analyzer isn't disabled so the original scripting issue triggers.
|
||||
redef DPD::ignore_violations += { Analyzer::ANALYZER_SMB };
|
Loading…
Add table
Add a link
Reference in a new issue