Bug 430635 (CVE-2008-1568) - CVE-2008-1568 comix: Command executions via improper shell escaping
Summary: CVE-2008-1568 comix: Command executions via improper shell escaping
Alias: CVE-2008-1568
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2008-01-29 09:05 UTC by Tomas Hoger
Modified: 2019-09-29 12:23 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-04-09 05:45:37 UTC

Attachments (Terms of Use)

Description Tomas Hoger 2008-01-29 09:05:46 UTC
Multiple security issues were reported to Debian BTS affecting comix package:

Insecure temporary file usage:

comix and comicthumb use temporary directories with predictable name.  However,
it only seems to be possible to redirect creation of /tmp/comix/ directory via
symlinks, so that numbered per-session subdirectories are not created in /tmp
but in some other user-writable directory.  As /tmp/comix/ directory is created
with permissions based on user's umask, it's probably not writable to other
random unprivileged users.  By itself, this probably only has limited impact.

However, usage of fixed temporary directory /tmp/comix/ seems bit unlucky, as
this prevents multiple users on the same machine from running comix at the same
time.  Any malicious user can block other users from using comix by creating
/tmp/comix/ directory.

Command executions via improper shell escaping:

comix and comicthumb use popen to execute rar and jpegtran external commands. 
Files used as command arguments with specially crafted file names can be used to
executed arbitrary command.

Additionally, comix seems to use python's tarfile module to extract tar
archives.  This module has known directory traversal issues (CVE-2007-4559),
which were never fixed upstream.  Tar archive with malicious content can be used
to overwrite arbitrary file writable by user running comix.

Comment 1 Mamoru TASAKA 2008-01-29 13:38:30 UTC
From upstream:
Hi Mamoru,

thank you for the bug reports. All problems should now be fixed in the
SVN repository for the upcoming Comix 4.0.

I gave up some time ago to try and fix things in Comix 3.X, and instead
put all efforts toward finishing Comix 4 instead, which is a complete
re-write of the code. Not all features are implemented for Comix 4.0
yet, but hopefully it will not be too long until it is released.


Comment 2 Tomas Hoger 2008-04-01 06:53:14 UTC
Command execution vulnerability got CVE id CVE-2008-1568:

comix 3.6.4 allows attackers to execute arbitrary commands via a
filename containing shell metacharacters that are not properly
sanitized when executing the rar, unrar, or jpegtran programs.

Comment 3 Mamoru TASAKA 2008-04-01 18:51:10 UTC
- For rar/unrar-ing archives, comix seems to search the filename
  with all double quotation or backslash removed so it simply
- Seems to same for jpegtran

Can you confirm that this is "really" security vulnerable?

Comment 4 Tomas Hoger 2008-04-02 07:22:12 UTC
Simple example was provided by Nico Golde here:


So you can reproduce by renaming any valid rar archive to something like this:

  test";echo owned>bla;".rar

and trying to open it in comix.

Comment 5 Tomas Hoger 2008-04-02 11:38:23 UTC
Correction to my initial comment on insecure temporary directories, based on
further investigation performed by Nico Golde:


There are two possibilities where attacker can possibly race against comix -
creation of /tmp/comix directory and creation of /tmp/comix/<num> directory.  In
either case, if an attacker manages to create directory or symlink with proper
name after os.path.exists check, comix will exit with 'File exists' error on
os.makedirs / os.mkdir.  This can be considered as DoS on victim, but there's
lot easier way to achieve that - plain mkdir /tmp/comix; chmod 700 /tmp/comix
performed by an attacker is sufficient.

Possibility of symlink attack exists if user running comix has insecure umask
settings.  An attacker may prepare comix directory, which will be re-used by
victim comix session to create <num> subdirectory with permissions only
influenced by umask and not chmod-ed after (in load_file(), prior to calling
extract_archive()).  Additionally, if attacker can guess file names in archive
to be extracted in comix by victim user and archiver that follows symlinks is
used, arbitrary victim's file can be overwritten with data from archive.

Comment 6 Mamoru TASAKA 2008-04-02 12:44:07 UTC
CVE-2008-1568 part should be fixed by comix-3.6.4-4.fc{7,8,9}.

Comment 7 Mamoru TASAKA 2008-04-02 14:50:37 UTC
tmpdir issue should be fixed in comix-3.6.4-5.fc{7,8,9}

(In reply to comment #6)
> CVE-2008-1568 part should be fixed by comix-3.6.4-4.fc{7,8,9}.
I am not sure how /usr/bin/comicthumb is used..
Anyway I replaced os.popen() to subprocess.Popen() although
currently I have no way to check if my fix is correct.

For tarfile.open() issue, for now I won't fix.

Comment 8 Fedora Update System 2008-04-02 15:03:35 UTC
comix-3.6.4-5.fc7 has been submitted as an update for Fedora 7

Comment 9 Fedora Update System 2008-04-02 15:04:47 UTC
comix-3.6.4-5.fc8 has been submitted as an update for Fedora 8

Comment 10 Fedora Update System 2008-04-09 05:18:46 UTC
comix-3.6.4-6.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2008-04-09 05:19:29 UTC
comix-3.6.4-6.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Mamoru TASAKA 2008-04-09 05:45:37 UTC

Comment 13 Tomas Hoger 2008-04-16 07:32:06 UTC
Mitre has assigned CVE id CVE-2008-1796 to the "DoS other users via temporary
directory" issue:

Comix 3.6.4 creates temporary directories with predictable names,
which allows local users to cause an unspecified denial of service.

Comment 14 Mamoru TASAKA 2008-07-10 13:54:43 UTC
Just a info:
On 2008-07-07 upstream released 3.6.5 with all my patches applied:

Note You need to log in before you can comment on or make changes to this bug.