chiark / gitweb /
slip: Drop packets >mtu (SECURITY)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 13 Apr 2014 14:07:38 +0000 (15:07 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 24 Apr 2014 01:09:51 +0000 (02:09 +0100)
Trying to send them to the kernel crashes userv-ipif.
This is a DoS vulnerability, exposed to internal sites only.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/changelog
slip.c

index e3e57985435efe164ef6fcbea81d0c009dc76f5b..613963e6972339c24a4f32e02ed0d0de3e16da6a 100644 (file)
@@ -6,7 +6,7 @@ secnet (0.3.1~~unstable) unstable; urgency=low
   * Fix netlink SEGV on clientless netlinks (i.e. configuration error).
   * Fix formatting error in p-t-p startup message.
   * Additions to the test-example suite.
-  * Fixes to MTU and fragmentation handling.
+  * SECURITY: Fixes to MTU and fragmentation handling.
 
  --
 
diff --git a/slip.c b/slip.c
index 9e63cb3cd6f3714c37524ca10f1e66f70c6cf9a1..aed2551de70d2d695ec1ef99e04081923227dabf 100644 (file)
--- a/slip.c
+++ b/slip.c
@@ -213,6 +213,14 @@ static void userv_deliver_to_kernel(void *sst, struct buffer_if *buf)
 {
     struct userv *st=sst;
 
+    if (buf->size > st->slip.nl.mtu) {
+       Message(M_ERR,"%s: packet of size %"PRIu32" exceeds mtu %"PRIu32":"
+               " cannot be injected into kernel, dropped\n",
+               st->slip.nl.name, buf->size, st->slip.nl.mtu);
+       BUF_FREE(buf);
+       return;
+    }
+
     slip_stuff(&st->slip,buf,st->txfd);
 }