]> git.ipfire.org Git - thirdparty/qemu.git/commit
usb-mtp: use O_NOFOLLOW and O_CLOEXEC.
authorGerd Hoffmann <kraxel@redhat.com>
Thu, 13 Dec 2018 12:25:11 +0000 (13:25 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 2 Apr 2019 01:36:21 +0000 (20:36 -0500)
commit7347a04da35ec6284ce83e8bcd72dc4177d17b10
tree2f468578b27d1c3f0fedd77010f534e7ced69da6
parent61f87388af0af72ad61dee00ddd267b8047049f2
usb-mtp: use O_NOFOLLOW and O_CLOEXEC.

Open files and directories with O_NOFOLLOW to avoid symlinks attacks.
While being at it also add O_CLOEXEC.

usb-mtp only handles regular files and directories and ignores
everything else, so users should not see a difference.

Because qemu ignores symlinks, carrying out a successful symlink attack
requires swapping an existing file or directory below rootdir for a
symlink and winning the race against the inotify notification to qemu.

Fixes: CVE-2018-16872
Cc: Prasad J Pandit <ppandit@redhat.com>
Cc: Bandan Das <bsd@redhat.com>
Reported-by: Michael Hanselmann <public@hansmi.ch>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael Hanselmann <public@hansmi.ch>
Message-id: 20181213122511.13853-1-kraxel@redhat.com
(cherry picked from commit bab9df35ce73d1c8e19a37e2737717ea1c984dc1)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/usb/dev-mtp.c