Linux Kernel net/fib fib6_add potential NULL pointer dereference

2013-12-08 / 2013-12-10
Credit: PJP
Risk: Medium
Local: No
Remote: Yes
CWE: CWE-264


CVSS Base Score: 4.7/10
Impact Subscore: 6.9/10
Exploitability Subscore: 3.4/10
Exploit range: Local
Attack complexity: Medium
Authentication: No required
Confidentiality impact: None
Integrity impact: None
Availability impact: Complete

Hello, Linux kernel built with the IPv6 protocol(CONFIG_IPv6) along with the IPv6 source address based routing support(CONFIG_IPV6_SUBTREE) is vulnerable to a NULL pointer dereference flaw. It could occur while doing an ioctl(SIOCADDRT) call on an IPv6 socket. User would need to have CAP_NET_ADMIN privileges to perform such a call. When the kernel is compiled with CONFIG_IPV6_SUBTREES, and we return with an error in fn = fib6_add_1(), then error codes are encoded into the return pointer e.g. ERR_PTR(-ENOENT). In such an error case, we write the error code into err and jump to out, hence enter the if(err) condition. Now, if CONFIG_IPV6_SUBTREES is enabled, we check for: if (pn != fn && pn->leaf == rt) ... if (pn != fn && !pn->leaf && !(pn->fn_flags & RTN_RTINFO)) ... Since pn is NULL and fn is f.e. ERR_PTR(-ENOENT), then pn != fn evaluates to true and causes a NULL-pointer dereference on further checks on pn. Fix it, by setting both NULL in error case, so that pn != fn already evaluates to false and no further dereference takes place. This was first correctly implemented in 4a287eba2 ("IPv6 routing, NLM_F_* flag support: REPLACE and EXCL flags support, warn about missing CREATE flag"), but the bug got later on introduced by 188c517a0 ("ipv6: return errno pointers consistently for fib6_add_1()"). A user/program with CAP_NET_ADMIN privileges could use this flaw to crash a system resulting in DoS. Upstream fix: ------------- -> https://git.kernel.org/linus/ae7b4e1f213aa659aedf9c6ecad0bf5f0476e1e2 -rw-r--r-- net/ipv6/ip6_fib.c 2 1 files changed, 1 insertions, 1 deletions diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 73db48e..5bec666 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -825,9 +825,9 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info) fn = fib6_add_1(root, &rt->rt6i_dst.addr, rt->rt6i_dst.plen, offsetof(struct rt6_info, rt6i_dst), allow_create, replace_required); - if (IS_ERR(fn)) { err = PTR_ERR(fn); + fn = NULL; goto out; } Reference: ---------- -> https://bugzilla.redhat.com/show_bug.cgi?id=1039054 Thank you. -- Prasad J Pandit / Red Hat Security Response Team

References:

https://git.kernel.org/linus/ae7b4e1f213aa659aedf9c6ecad0bf5f0476e1e2
https://bugzilla.redhat.com/show_bug.cgi?id=1039054


Vote for this issue:
50%
50%


 

Thanks for you vote!


 

Thanks for you comment!
Your message is in quarantine 48 hours.

Comment it here.


(*) - required fields.  
{{ x.nick }} | Date: {{ x.ux * 1000 | date:'yyyy-MM-dd' }} {{ x.ux * 1000 | date:'HH:mm' }} CET+1
{{ x.comment }}

Copyright 2017, cxsecurity.com

 

Back to Top