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";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue