Commit graph

27 commits

Author SHA1 Message Date
Tim Wojtulewicz
2844d54f67 Fix handling of zero-length SMB2 error responses 2024-07-24 12:44:46 -07:00
Tim Wojtulewicz
bac6ad62b5 Allow SMB_TCP record to contain multiple protocol identifiers/headers 2024-04-22 15:55:25 -07:00
Arne Welzel
96823dab73 Dict: Invalidate iterators during Clear()
If we don't do this, a RobustDictIterator owned by someone else holds
dangling pointers to the Dictionary that is being cleared.

Closes #3523
2024-01-09 09:12:21 +01:00
Arne Welzel
3ac877e20d scripts/smb2-main: Reset script-level state upon smb2_discarded_messages_state()
This is similar to what the external corelight/zeek-smb-clear-state script
does, but leverages the smb2_discarded_messages_state() event instead of
regularly checking on the state of SMB connections.

The pcap was created using the dperson/samba container image and mounting
a share with Linux's CIFS filesystem, then copying the content of a
directory with 100 files. The test uses a BPF filter to imitate mostly
"half-duplex" traffic.
2023-05-03 11:22:01 +02:00
Tim Wojtulewicz
0fd335f7f0 Merge remote-tracking branch 'security/topic/timw/131-smb-fscontrol-overflow'
* security/topic/timw/131-smb-fscontrol-overflow:
  Restore/rename field in SMB2::Fscontrol record type
2023-02-01 10:48:16 -07:00
Tim Wojtulewicz
48a7a6a0fb Update smb1-OSS-fuzz-54883.pcap to have correct snaplen 2023-01-28 08:19:05 -07:00
Tim Wojtulewicz
84ac362c67 Restore/rename field in SMB2::Fscontrol record type
b41a4bf06d removed a field from this record
because it had a duplicate name as another field. The field does need to
exist, but it needs the correct name.
2023-01-27 17:39:10 -07:00
Arne Welzel
8be8c22b3e 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
2023-01-27 19:22:13 +01:00
Arne Welzel
3dae8ab086 smb2: Raise smb2_file_delete for CREATE with FILE_DELETE_ON_CLOSE
When a CREATE request contains the FILE_DELETE_ON_CLOSE option and
the subsequent CREATE response indicates success, we now raise the
smb2_file_delete event to log a delete action in smb_files.log and
also give users a way to handle this scenario.

The provided pcap was generated locally by recording a smbtorture run
of the smb2.delete-on-close-perms test case.

Placed the create_options into the CmdInfo record for potential
exposure in smb_cmd.log (wasn't sure how that would look so left it
for the future).

Fixes #2276.
2022-07-16 17:14:13 +02:00
Vlad Grigorescu
f30ca69402 Add tests for new SMB3 multichannel support 2020-12-07 15:35:04 -06:00
Jon Siwek
9c70bcecbc GH-865: fix parsing of SMB NegotiateContextList
* The compression capability was incorrectly set to 0x0004 instead of 0x0003

* The padding was 4-byte instead of 8-byte aligned and also the spec.
  does not strictly require the padding for the last item in the list.

* Add a default case to handle parsing of unknown context types.
2020-03-16 19:00:01 -07:00
Jon Siwek
7965dcd041 Convert pcapng test suite files to pcap format
The former isn't supported by default on OpenBSD.
2019-11-08 13:08:06 -08:00
Pavel Ershov
de4a83206d Fix for smb3 negotiate context 2019-08-27 12:21:03 +03:00
Jon Siwek
1b76d92e97 Merge branch 'smb3-negotiate-response' of https://github.com/mauropalumbo75/zeek
* 'smb3-negotiate-response' of https://github.com/mauropalumbo75/zeek:
  added test and pcap files for smb 3.1.1 negotiate-response
  smb3.1.1 additions to negotiate-response command

I made several modifications:

  - Code format, style, naming changes

  - For completeness/correctness, I added parsing support for the remaining
    context type structures.

  - Moved the optional padding before the NegotiateContextList field to
    also require the 0x0311 dialect version (some failures in
    pre-existing unit tests pointed this out as an issue)
2019-03-21 14:13:21 -07:00
Jon Siwek
9eb5449ecb Merge branch 'smb3-transform-header' of https://github.com/mauropalumbo75/zeek
* 'smb3-transform-header' of https://github.com/mauropalumbo75/zeek:
  clean up, test and pcap for transform_header added
  added smb2-com-transform-header for smb3.x
2019-03-20 19:30:32 -07:00
mauro
a346b01a85 clean up, test and pcap for transform_header added 2019-02-21 12:01:02 +01:00
mauro
84afafc512 added test and pcap files for smb_files.log fix 2019-02-14 16:51:50 +01:00
mauro
c9cc1a55b9 added test and pcap files for smb 3.1.1 negotiate-response 2019-02-13 17:39:37 +01:00
Jeffrey Bencteux
015eec8c71 add test for smb1_com_transaction_response event changes 2018-01-19 14:29:31 +01:00
Jeffrey Bencteux
4c0b6e0984 add test for smb1_com_transaction2_secondary_request event changes 2018-01-19 14:29:26 +01:00
Jeffrey Bencteux
4807b7d847 add test for smb1_com_transaction2_request event changes 2018-01-19 14:29:20 +01:00
Jeffrey Bencteux
314e992284 add test for smb1_com_transaction_secondary_request event changes 2018-01-19 14:29:09 +01:00
Jeffrey Bencteux
6d497ea8b0 add test for smb1_com_transaction_request event changes 2018-01-12 13:00:05 +01:00
Seth Hall
a836ece4e6 Including a test for raw NTLM in SMB 2016-10-26 10:41:08 -04:00
Seth Hall
5721db4be7 Lots of cleanup and improvement to DCE/RPC analyzer.
- It works with DCE/RPC over SMB1+2 now.
   - Using named pipes in 1+2 and the transaction cmd in SMB1.
 - Base scripts based on work by Josh Liburdi.
 - New dce_rpc.log.  Feedback on how to make this log more compact
   and useful would be appreciated.
2016-04-01 09:38:52 -04:00
Seth Hall
6e842cf4da Fix a problem I introduced with SMB2 file handling.
- Added an SMB2 test that encompasses the problem.
2016-03-07 15:36:25 -05:00
Seth Hall
21d8cab0c0 First SMB test. 2016-03-07 13:50:25 -05:00