lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 14 Apr 2007 17:48:36 +0200
From:	Willy Tarreau <w@....eu>
To:	David Miller <davem@...emloft.net>
Cc:	tgraf@...g.ch, netdev@...r.kernel.org
Subject: Re: [IPv4] fib: Fix out of bound access of fib_props[]

On Sat, Apr 14, 2007 at 04:26:55PM +0200, Willy Tarreau wrote:
> On Sat, Mar 24, 2007 at 08:33:39PM -0700, David Miller wrote:
> > From: Thomas Graf <tgraf@...g.ch>
> > Date: Sat, 24 Mar 2007 16:34:36 +0100
> > 
> > > Fixes a typo which caused fib_props[] to have the wrong size
> > > and makes sure the value used to index the array which is
> > > provided by userspace via netlink is checked to avoid out of
> > > bound access.
> > > 
> > > Signed-off-by: Thomas Graf <tgraf@...g.ch>
> > 
> > Applied, thanks.
> 
> Thomas, David, it seems to me that 2.4 needs the same fix for the
> typo, but I see no place where we may add the check for > RTN_MAX.
> Maybe this last one is not needed. If someone could enlighten me,
> or at least provide a means to test if the bug it present, it would
> help me.

Finally, I think I have the correct fix below. Please someone confirm
or tell me I'm nuts.

Thanks in advance,
Willy


>From 230c62b9e7000cfb407a079a21ad0f077f164b21 Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w@....eu>
Date: Sat, 14 Apr 2007 17:44:03 +0200
Subject: [IPv4] fib: Fix out of bound access of fib_props[]

Backported from 2.6. Bug found and fixed by Thomas Graf :

Fixes a typo which caused fib_props[] to have the wrong size
and makes sure the value used to index the array which is
provided by userspace via netlink is checked to avoid out of
bound access.
---
 net/ipv4/fib_semantics.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index afdf4bb..b930371 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -83,7 +83,7 @@ static struct
 {
 	int	error;
 	u8	scope;
-} fib_props[RTA_MAX+1] = {
+} fib_props[RTN_MAX+1] = {
         { 0, RT_SCOPE_NOWHERE},		/* RTN_UNSPEC */
 	{ 0, RT_SCOPE_UNIVERSE},	/* RTN_UNICAST */
 	{ 0, RT_SCOPE_HOST},		/* RTN_LOCAL */
@@ -431,6 +431,11 @@ fib_create_info(const struct rtmsg *r, struct kern_rta *rta,
 	const int nhs = 1;
 #endif
 
+	if (r->rtm_type > RTN_MAX) {
+		err = -EINVAL;
+		goto errout;
+	}
+
 	/* Fast check to catch the most weird cases */
 	if (fib_props[r->rtm_type].scope > r->rtm_scope)
 		goto err_inval;
-- 
1.4.4.4

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ