]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
protodetect/dcerpc: improve DCERPC UDP probing parser
authorIlya Bakhtin <ilya.bakhtin@gmail.com>
Sun, 21 Jul 2024 17:15:00 +0000 (19:15 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 30 Jan 2025 20:52:07 +0000 (21:52 +0100)
Several additional checks are added to the probing parser to avoid false
detection of DNS as DCERPC

Ticket - 7111

rust/src/dcerpc/dcerpc_udp.rs

index 673d1608ae4a1a5ffd499f2b491d8dcf5dbbf249..634e02ad605653731ad78dbe11b63857c8a9cefa 100644 (file)
@@ -300,9 +300,11 @@ pub unsafe extern "C" fn rs_dcerpc_udp_get_tx_cnt(vtx: *mut std::os::raw::c_void
 /// Probe input to see if it looks like DCERPC.
 fn probe(input: &[u8]) -> (bool, bool) {
     match parser::parse_dcerpc_udp_header(input) {
-        Ok((_, hdr)) => {
+        Ok((leftover_bytes, hdr)) => {
             let is_request = hdr.pkt_type == 0x00;
             let is_dcerpc = hdr.rpc_vers == 0x04 &&
+                hdr.fragnum == 0 &&
+                leftover_bytes.len() >= hdr.fraglen as usize &&
                 (hdr.flags2 & 0xfc == 0) &&
                 (hdr.drep[0] & 0xee == 0) &&
                 (hdr.drep[1] <= 3);