Nmap Development mailing list archives

Re: Nmap/Nping bug on udp checksum calculation


From: David Fifield <david () bamsoftware com>
Date: Sun, 10 Nov 2013 01:14:51 -0800

On Sun, Nov 03, 2013 at 06:49:19PM +0100, Luis MartinGarcia. wrote:
Hi, David.

Regarding this bug, I believe it also affects osscan2.cc. See below.
What do you think?


--- osscan2.cc    (revision 32492)
+++ osscan2.cc    (working copy)
@@ -2165,6 +2165,12 @@
     /* OK, now we should be able to compute a valid checksum */
     realcheck = ipv4_pseudoheader_cksum(source,
hss->target->v4hostip(), IPPROTO_UDP,
                                         sizeof(struct udp_hdr) +
datalen, (char *) udp);
+
+    /* If the computed checksum has a value of zero, we need to set it
+     * to 0xFFFF (See RFC 768) */
+    if(realcheck==0)
+      realcheck=0xFFFF;
+   
 #if STUPID_SOLARIS_CHECKSUM_BUG
     udp->uh_sum = sizeof(struct udp_hdr) + datalen;
 #else

Good catch. I agree with you.

David Fifield
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: