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

[PATCH] promiscuous mode



Hi,

When a network interface goes into promiscuous mode, its an important security 
issue. The attached patch is intended to capture that action and send an 
event to the audit system.

The patch carves out a new block of numbers for kernel detected anomalies. 
These are events that may indicate suspicious activity. Other examples of 
potential kernel anomalies would be: exceeding disk quota, rlimit violations, 
changes to syscall entry table.

Signed-off-by: Steve Grubb <sgrubb redhat com>

diff -urp linux-2.6.14.orig/include/linux/audit.h linux-2.6.14/include/linux/audit.h
--- linux-2.6.14.orig/include/linux/audit.h	2005-12-02 15:28:34.000000000 -0500
+++ linux-2.6.14/include/linux/audit.h	2005-12-02 15:28:22.000000000 -0500
@@ -35,7 +35,8 @@
  * 1400 - 1499 SE Linux use
  * 1500 - 1599 kernel LSPP events
  * 1600 - 1699 kernel crypto events
- * 1700 - 1999 future kernel use (maybe integrity labels and related events)
+ * 1700 - 1799 kernel anomaly records
+ * 1800 - 1999 future kernel use (maybe integrity labels and related events)
  * 2000 is for otherwise unclassified kernel audit messages (legacy)
  * 2001 - 2099 unused (kernel)
  * 2100 - 2199 user space anomaly records
@@ -87,6 +88,10 @@
 #define AUDIT_MAC_STATUS	1404	/* Changed enforcing,permissive,off */
 #define AUDIT_MAC_CONFIG_CHANGE	1405	/* Changes to booleans */
 
+#define AUDIT_FIRST_KERN_ANOM_MSG   1700
+#define AUDIT_LAST_KERN_ANOM_MSG    1799
+#define AUDIT_ANOM_PROMISCUOUS      1700 /* Device changed promiscuous mode */
+
 #define AUDIT_KERNEL		2000	/* Asynchronous audit record. NOT A REQUEST. */
 
 /* Rule flags */
diff -urp linux-2.6.14.orig/net/core/dev.c linux-2.6.14/net/core/dev.c
--- linux-2.6.14.orig/net/core/dev.c	2005-12-02 14:22:10.000000000 -0500
+++ linux-2.6.14/net/core/dev.c	2005-12-02 15:23:27.000000000 -0500
@@ -114,6 +114,7 @@
 #include <net/iw_handler.h>
 #endif	/* CONFIG_NET_RADIO */
 #include <asm/current.h>
+#include <linux/audit.h>
 
 /*
  *	The list of packet types we will receive (as opposed to discard)
@@ -2121,6 +2122,12 @@ void dev_set_promiscuity(struct net_devi
 		printk(KERN_INFO "device %s %s promiscuous mode\n",
 		       dev->name, (dev->flags & IFF_PROMISC) ? "entered" :
 		       					       "left");
+		audit_log(current->audit_context, GFP_KERNEL,
+			AUDIT_ANOM_PROMISCUOUS,
+			"dev=%s prom=%d old_prom=%d auid=%u",
+			dev->name, (dev->flags & IFF_PROMISC),
+			(old_flags & IFF_PROMISC),
+			audit_get_loginuid(current->audit_context)); 
 	}
 }
 

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