Skip to content

Commit

Permalink
Check if the Data field exists
Browse files Browse the repository at this point in the history
Co-Authored-By: gpotter2 <10530980+gpotter2@users.noreply.github.com>
  • Loading branch information
guedou and gpotter2 committed Jun 22, 2024
1 parent ea7cdaf commit 1e857c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scapy/layers/smb.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ def post_build(self, pkt, pay):
)

def mysummary(self):
if self.DataLen:
if getattr(self, "Data", None) is not None:
return self.sprintf("Tran %Name% ") + self.Data.mysummary()
return self.sprintf("Tran %Name%")

Expand Down
10 changes: 10 additions & 0 deletions test/scapy/layers/smb.uts
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,13 @@ assert pkt[SMBMailslot_Write].Data.OpCode == 1
assert pkt[SMBMailslot_Write].Data.ServerName == b"MACBOOKPRO-122A\x00"
assert pkt[SMBMailslot_Write].Data.Comment == b"Super's MacBook Pro"
assert pkt[SMBMailslot_Write].Data.Signature == 0xAA55

= OSS-Fuzz Findings

# SMBTransaction_Request
from io import BytesIO
# Issue 69637
file = BytesIO(b'M<\xb2\xa1\x02\x00\x04\x00\x00\x00\x02\xff\xa1\x00\x00\x00\xff\xff\x00\x00\x01\x00\x00\x00\r\x82\xe8Y[\xc6P"\xa1\xb2\x00_h\x00\x00\x00\x00\x10\x94\x00\x01\x00\x00\x1d%\xcb(\xce\x08\x00U\xfa\xf7\x8c\x00\x00@\x00?\x11\xa7R\xe0\xa8\x01\xa1d\xb2\xc3\xd4\n_\x00\x8a \x00\x00\x01\x00\x00\x00\x01\xff\x00\x00\x00\x10\x94\x00\x01\x00\x00\x1d%\xcb(\xce\x08\x00U\xfa\xf7\x8c\x00\x00@\x00?\x11\xa7R\xe0\xa8\x01\xa1d\xb2\xc3\xd4\n_\x00\x8a\xb2\x00\xa1a\xffl\xff\xff\xef\x00\xff\x01\x00\x08\xa1\xa1E\xf9\x00\xa1\x00\x00?\x8c\x08?\x11\x00\xc3\x00+\x10M<\x1a\x01\x00\xffSMB%d\x01\x05\x00\x00\x00\x00\x00\x00\x00\xd4\xc3\xb2\xa1\x02\x00\x04\x00\x00\x00\xf7\x8c\x00\x00@\x00?\x11\xa7R\xe0\xa8\x01\xa1d\xb2\xc3\xd4\n_\x00\x8a\xb2\x00\xa1a\xffl\xff\xff\xef\x00\xff\x01\x00\x08\xa1\xa1')

l = rdpcap(file)
assert l[0][NBTDatagram].summary() == "NBTDatagram / SMB_Header / Tran b''"

0 comments on commit 1e857c9

Please sign in to comment.