Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 13 Aug 2017 18:21:55 +0200
From: Andrey Konovalov <>
Cc:, Dmitry Vyukov <>, 
	Kostya Serebryany <>
Subject: Re: Linux kernel: CVE-2017-1000112: Exploitable memory corruption due
 to UFO to non-UFO path switch

On Thu, Aug 10, 2017 at 10:55 PM, Andrey Konovalov <> wrote:
> Hi!
> syzkaller found an exploitable memory corruption in UFO code in the
> Linux kernel, the details are below.
> ### Bug details
> When building a UFO packet with MSG_MORE __ip_append_data() calls
> ip_ufo_append_data() to append. However in between two send() calls,
> the append path can be switched from UFO to non-UFO one, which leads
> to a memory corruption.
> In case UFO packet lengths exceeds MTU, copy = maxfraglen - skb->len
> becomes negative on the non-UFO path and the branch to allocate new
> skb is taken. This triggers fragmentation and computation of fraggap =
> skb_prev->len - maxfraglen. Fraggap can exceed MTU, causing copy =
> datalen - transhdrlen - fraggap to become negative. Subsequently
> skb_copy_and_csum_bits() writes out-of-bounds.
> A similar issue is present in IPv6 code.
> The bug was introduced in e89e9cf539a2 ("[IPv4/IPv6]: UFO
> Scatter-gather approach") on Oct 18 2005.
> The fix has been submitted to netdev [1] and should be committed to
> mainline and to stable kernels soon. David has also sent an RFC series
> to remove UFO completely [2], which should be merged in 4.14.
> If unprivileged user namespaces are available, this bug can be
> exploited to gain root privileges. I'll share the details and the
> exploit in a few days.
> Thanks!
> ### Timeline
> 2017.08.03 - Bug reported to
> 2017.08.04 - Bug reported to linux-distros@
> 2017.08.10 - Patch submitted to netdev
> 2017.08.10 - Announcement on oss-security@
> ### Links
> [1]
> [2]

### Exploitation

The bug can be exploited by an unprivileged user if:

1. User can set up an interface with UFO enabled and MTU < 65535 or
such interface is already present in the system. The former is
possible from inside a user namespace.

2. User can disable the NETIF_F_UFO interface feature or set the
SO_NO_CHECK socket option. The former requires CAP_NET_ADMIN. The
latter is only possible after 40ba330227ad ("udp: disallow UFO for
sockets with SO_NO_CHECK option") from Jan 11 2016. Both are possible
from inside a user namespace.

In particular, the bug can be exploited by an unprivileged user if
unprivileged user namespaces are available.

Below is a link to a proof-of-concept exploit, that gets root on a
range of Ubuntu kernels. The exploit triggers an out-of-bounds write
on a socket buffer and overwrites
skb_shared_info.destructor_arg->callback with a pointer to shellcode.
The exploit includes a SMEP and KASLR bypasses, but no SMAP bypass.


Powered by blists - more mailing lists

Your e-mail address:

Please check out the Open Source Software Security Wiki, which is counterpart to this mailing list.

Powered by Openwall GNU/*/Linux - Powered by OpenVZ