NetBSD Problem Report #1030

From gnats  Sun May  7 06:31:03 1995
Received: from ledoux.arbld.unimelb.EDU.AU (ledoux.arbld.unimelb.EDU.AU [128.250.133.13]) by sun-lamp.cs.berkeley.edu (8.6.10/8.6.10) with ESMTP id GAA03686 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Sun, 7 May 1995 06:31:02 -0700
Message-Id: <199505071325.XAA09085@candella.arbld.unimelb.EDU.AU>
Date: Sun, 7 May 1995 23:25:18 +1000
From: Darren Reed <darrenr@vitruvius.arbld.unimelb.EDU.AU>
Reply-To: darrenr@vitruvius.arbld.unimelb.EDU.AU
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: bug in ipintr() in dealing with fragmented IP packets.
X-Send-Pr-Version: 3.2

>Number:         1030
>Category:       kern
>Synopsis:       ipintr() will process too small IP fragments
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 07 06:35:01 +0000 1995
>Closed-Date:    Sun May 14 08:19:18 +0000 1995
>Last-Modified:  
>Originator:     Darren Reed
>Release:        NetBSD-current
>Organization:
University of Melbourne
>Environment:
Sun IPC, NetBSD
System: NetBSD candella.arbld.unimelb.edu.au 1.0A NetBSD 1.0A (1.0A) #4: Mon Feb 20 18:33:28 EST 1995 root@:/usr/src/sys/arch/sparc/compile/1.0A sparc


>Description:
If NetBSD receives an IP packet of length less than 28 which is a fragment
and it isn't the last fragment (IP_MF is set) it will continue to process
this fragment and not generate any errors.  RFC 791, section 2.3, page 8
outlines a description which is discussed further.  Whilst NetBSD won't
generate such fragments (due to a small MTU) easily, a malicious person
can generate them.  Also, NetBSD will, upon receipt of such a small fragment
hold onto it until other fragments arrive and attempt reassembly.  It is an
obscure and most definately rare case, but quite possible.

>How-To-Repeat:

>Fix:
This patch causes ipintr() to discard packets which are fragments but
which are too small to be a valid IP fragment.

*** ip_input.c.orig	Sun May  7 23:02:09 1995
--- ip_input.c	Sun May  7 23:03:07 1995
***************
*** 200,206 ****
  	 * Convert fields to host representation.
  	 */
  	NTOHS(ip->ip_len);
! 	if (ip->ip_len < hlen) {
  		ipstat.ips_badlen++;
  		goto bad;
  	}
--- 200,206 ----
  	 * Convert fields to host representation.
  	 */
  	NTOHS(ip->ip_len);
! 	if (ip->ip_len < hlen || (ip->ip_off & IP_MF && ip->ip_len < 28)) {
  		ipstat.ips_badlen++;
  		goto bad;
  	}
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: cgd 
State-Changed-When: Sun May 14 01:19:18 PDT 1995 
State-Changed-Why:  
fixed (differently) 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.