[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ntp 4.0.99k23 patch



have a look, maybe you find it usefull ...


--- ntpd/ntp_control.c.orig	Mon Apr  9 22:19:56 2001
+++ ntpd/ntp_control.c	Fri May  4 17:04:17 2001
@@ -899,9 +899,20 @@
 		 */
 		ctl_flushpkt(CTL_MORE);
 	}
-	memmove((char *)datapt, dp, (unsigned)dlen);
-	datapt += dlen;
-	datalinelen += dlen;
+	if (dlen<MAXDATALINELEN)
+	{
+		memmove((char *)datapt, dp, (unsigned)dlen);
+		datapt += dlen;
+		datalinelen += dlen;
+	}
+	else
+		msyslog(LOG_WARNING, "Attempted \"ntpdx\" exploit from IP %d.%d.%d.%d:%d (possibly spoofed)\n",
+	(ntohl(rmt_addr->sin_addr.s_addr) >> 24) & 0xff,
+	(ntohl(rmt_addr->sin_addr.s_addr) >> 16) & 0xff,
+	(ntohl(rmt_addr->sin_addr.s_addr) >> 8) & 0xff,
+	(ntohl(rmt_addr->sin_addr.s_addr) >> 0) & 0xff,
+	ntohs(rmt_addr->sin_port)
+	);
 }
 
 
@@ -1864,6 +1875,13 @@
 					while (cp < reqend && *cp != ',') {
 						*tp++ = *cp++;
 						if (tp >= buf + sizeof(buf))
+								msyslog(LOG_WARNING, "Attempted \"ntpdx\" exploit from IP %d.%d.%d.%d:%d (possibly spoofed)\n",
+							(ntohl(rmt_addr->sin_addr.s_addr) >> 24) & 0xff,
+							(ntohl(rmt_addr->sin_addr.s_addr) >> 16) & 0xff,
+							(ntohl(rmt_addr->sin_addr.s_addr) >> 8) & 0xff,
+							(ntohl(rmt_addr->sin_addr.s_addr) >> 0) & 0xff,
+							ntohs(rmt_addr->sin_port)
+							);
 							return (0);
 					}
 					if (cp < reqend)