Linux kernel: CVE-2017-6074: DCCP double-free vulnerability (local root)
A double-free vulnerability in the Linux kernel's DCCP implementation allows an unprivileged local user to free an skb twice, turning it into a use-after-free that can be exploited for kernel code execution. The bug is triggered when IPV6_RECVPKTINFO is set on a DCCP socket, causing the skb to be freed while still referenced.
seclists.org
Published on seclists.org
This is an announcement about CVE-2017-6074 [1] which is a double-free vulnerability I found in the Linux kernel. It can be exploited to gain kernel code execution from an unprivileged processes.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The kernel forcibly frees an skb in dccp_rcv_state_process even though dccp_v6_conn_request has already incremented its reference count when IPV6_RECVPKTINFO is set, leading to a double-free.
Impact
An attacker could exploit the double-free to gain kernel code execution from an unprivileged process, but the kernel must be built with CONFIG_IP_DCCP enabled.
What the attacker needed
Kernel built with CONFIG_IP_DCCP; unprivileged local access; IPV6_RECVPKTINFO set on socket
The fix
The fix was to call consume_skb, which accounts for skb->users, instead of doing goto discard and therefore calling __kfree_skb.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A double-free happens when a program frees the same memory twice. In this case, the Linux kernel frees a network packet buffer (skb) once, but because a socket option keeps a reference to it, the buffer is still in use. When it is freed again, an attacker can reuse that memory for another object and later overwrite it, potentially running their own code with kernel privileges.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.