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]
Message-ID: <32e544a6-575e-a47e-fd8a-647145ac1972@gmail.com>
Date:   Wed, 10 Jul 2019 12:58:43 +0200
From:   Eric Dumazet <eric.dumazet@...il.com>
To:     bsauce <bsauce00@...il.com>, alexander.h.duyck@...el.com
Cc:     vbabka@...e.cz, mgorman@...e.de, l.stach@...gutronix.de,
        vdavydov.dev@...il.com, akpm@...ux-foundation.org, alex@...ti.fr,
        adobriyan@...il.com, mike.kravetz@...cle.com, rientjes@...gle.com,
        rppt@...ux.vnet.ibm.com, mhocko@...e.com, ksspiers@...gle.com,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs/seq_file.c: Fix a UAF vulnerability in seq_release()



On 7/10/19 12:26 PM, bsauce wrote:
> In seq_release(), 'm->buf' points to a chunk. It is freed but not cleared to null right away. It can be reused by seq_read() or srm_env_proc_write().
> For example, /arch/alpha/kernel/srm_env.c provide several interfaces to userspace, like 'single_release', 'seq_read' and 'srm_env_proc_write'.
> Thus in userspace, one can exploit this UAF vulnerability to escape privilege.
> Even if 'm->buf' is cleared by kmem_cache_free(), one can still create several threads to exploit this vulnerability.
> And 'm->buf' should be cleared right after being freed.
> 
> Signed-off-by: bsauce <bsauce00@...il.com>
> ---
>  fs/seq_file.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/seq_file.c b/fs/seq_file.c
> index abe27ec..de5e266 100644
> --- a/fs/seq_file.c
> +++ b/fs/seq_file.c
> @@ -358,6 +358,7 @@ int seq_release(struct inode *inode, struct file *file)
>  {
>  	struct seq_file *m = file->private_data;
>  	kvfree(m->buf);
> +	m->buf = NULL;
>  	kmem_cache_free(seq_file_cache, m);
>  	return 0;
>  }
> 

This makes no sense, since m is freed right away anyway.

So whatever is trying to 'reuse' m is in big trouble.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ