qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 18/29] 9pfs: local: lstat: don't follow symlinks


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 18/29] 9pfs: local: lstat: don't follow symlinks
Date: Thu, 23 Feb 2017 14:55:51 +0000
User-agent: Mutt/1.7.1 (2016-10-04)

On Mon, Feb 20, 2017 at 03:41:41PM +0100, Greg Kurz wrote:
> The local_lstat() callback is vulnerable to symlink attacks because it
> calls:
> 
> (1) lstat() which follows symbolic links in all path elements but the
>     rightmost one
> (2) getxattr() which follows symbolic links in all path elements
> (3) local_mapped_file_attr()->local_fopen()->openat(O_NOFOLLOW) which
>     follows symbolic links in all path elements but the rightmost
>     one
> 
> This patch converts local_lstat() to rely on opendir_nofollow() and
> fstatat(AT_SYMLINK_NOFOLLOW) to fix (1), fgetxattrat_nofollow() to
> fix (2).
> 
> A new local_fopenat() helper is introduced as a replacement to
> local_fopen() to fix (3). No effort is made to factor out code
> because local_fopen() will be dropped when all users have been
> converted to call local_fopenat().
> 
> This partly fixes CVE-2016-9602.
> 
> Signed-off-by: Greg Kurz <address@hidden>
> ---
>  hw/9pfs/9p-local.c |   78 
> +++++++++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 61 insertions(+), 17 deletions(-)

Reviewed-by: Stefan Hajnoczi <address@hidden>

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]