Created attachment 1295228 [details] 0001-comics-Remove-support-for-tar-and-tar-like-commands.patch From the folks at Project Zero: """ Hi, The comic book backend in evince 3.24.0 is vulnerable to a command injection bug that can be used to execute arbitrary commands when a cbt file is opened: cbt files are simple tar archives containing images. When a cbt file is processed, evince calls "tar -xOf $archive $filename" for every image file in the archive: // backend/comics/comics-document.c: 914 command_line = g_strdup_printf ("%s %s %s", comics_document->extract_command, quoted_archive, quoted_filename); While both the archive name and the filename are quoted to not be interpreted by the shell, the filename is completely attacker controlled an can start with "--" which leads to tar interpreting it as a command line flag. This can be exploited by creating a tar archive with an embedded file named [...] Please credit Felix Wilhelm from the Google Security Team in all releases, patches and advisories related to this issue. Best, Felix """ All current versions of evince in Fedora and RHEL are vulnerable. The attached patch will be applied to all versions of Fedora except Fedora 26 and rawhide for which we will use a backport of the comics archive handling rework (https://bugzilla.gnome.org/show_bug.cgi?id=720742).
I have the repos ready to commit for f24, f25, f26, rawhide, as well as rhel-7.4. rhel-7.3 is also vulnerable, and I don't know how you want that one handled. RHEL 6.x is not vulnerable as the CBT feature did not exist (added in evince 2.29.3).
There is no CVE filed or assigned, and no attempts have been made to contact other distributions.
Acknowledgments: Name: Felix Wilhelm (Google Security Team)
The problem exists in the upstream evince since: commit d68a91467efab8ef8a8f98589dd4c21b993b6e14 Author: Juanjo Marín <juanj.marin> Date: Fri Dec 11 14:40:43 2009 +0100 [comics] Add support for cbt files Fixes bgo#588266. Which was in the tarball for evince 2.29.4. atril, the evince fork from the MATE desktop is vulnerable from the day it forked from evince, and still is today: https://github.com/mate-desktop/atril/blob/master/backend/comics/comics-document.c#L110 Adding Michael Catanzaro from the GNOME security and release teams to the CC:.
Mitigation: - Disabling evince-thumbnailer to render icons will reduce the attack surface (removing /usr/share/thumbnailers/evince.thumbnailer). - SELinux in enforcing mode partially restricts evince-thumbnailer
Created evince tracking bugs for this issue: Affects: fedora-all [bug 1470661]
(In reply to Cedric Buissart from comment #10) > Created evince tracking bugs for this issue: > > Affects: fedora-all [bug 1470661] FWIW, this was created too late, and all the Fedora updates reference this bug instead.
This issue has been addressed in the following products: Red Hat Enterprise Linux 7 Via RHSA-2017:2388 https://access.redhat.com/errata/RHSA-2017:2388