]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
smb: ntlmssp domain_blob_offset underflow check
authorPhilippe Antoine <contact@catenacyber.fr>
Mon, 4 Apr 2022 20:51:01 +0000 (22:51 +0200)
committerVictor Julien <vjulien@oisf.net>
Mon, 11 Apr 2022 17:11:01 +0000 (19:11 +0200)
Ticket: 5246

rust/src/smb/ntlmssp_records.rs

index 35ca3196993e2351eb73d108c18a10c7d9f2a2ae..731af8ca9a86eaa9c2c468c48fe23ad4bf6de2cd 100644 (file)
@@ -101,9 +101,9 @@ pub fn parse_ntlm_auth_record(i: &[u8]) -> IResult<&[u8], NTLMSSPAuthRecord> {
 
     // subtrack 12 as idenfier (8) and type (4) are cut before we are called
     // subtract 60 for the len/offset/maxlen fields above
-    let (i, _) = cond(nego_flags.1==1, |b| take(domain_blob_offset - (12 + 60))(b))(i)?;
+    let (i, _) = cond(nego_flags.1==1 && domain_blob_offset > 72, |b| take(domain_blob_offset - (12 + 60))(b))(i)?;
     // or 52 if we have no version
-    let (i, _) = cond(nego_flags.1==0, |b| take(domain_blob_offset - (12 + 52))(b))(i)?;
+    let (i, _) = cond(nego_flags.1==0 && domain_blob_offset > 64, |b| take(domain_blob_offset - (12 + 52))(b))(i)?;
 
     let (i, domain_blob) = take(domain_blob_len)(i)?;
     let (i, user_blob) = take(user_blob_len)(i)?;