Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 108072 - app-cdr/cdrx config insecure temporary file creation
Summary: app-cdr/cdrx config insecure temporary file creation
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo TreeCleaner Project
URL:
Whiteboard: B3 [upstream+ masked] jaervosz PENDIN...
Keywords: PMASKED
Depends on:
Blocks:
 
Reported: 2005-10-04 07:28 UTC by Romang
Modified: 2006-11-29 18:00 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Romang 2005-10-04 07:28:03 UTC
#########################################################

cdrx config insecure temporary file creation

Vendor: http://cdrx.sourceforge.net/
Advisory: http://www.zataz.net/adviso/cdrx-10042005.txt
Vendor informed: yes
Exploit available: yes 
Impact : low
Exploitation : low

#########################################################

The vulnerabilities ared due to insecure temporary files creations.

They are symlink attacks to create arbitrary files with the privileges of the
user running the affected script, sensitive informations disclosure, possible
local or remote arbitrary commands execution. 

##########
Versions:
##########

cdrx <= 0.3.1-r1 

##########
Solution:
##########

* Using File::Temp to create secure temporary files

use File::Temp qw/ :mktemp /;

my (%Config);

my $TempDir = mkdtemp('cdrx.XXXXXXXX');
$Config{'pathtocdrecord'} = "/usr/bin/cdrecord";
$Config{'pathtomkisofs'} = "/usr/bin/mkisofs";
$Config{'pathtomount'} = "/bin/mount";
$Config{'burnerrorfile'} = "cdrx.burn.err";
$Config{'cdrxerrorfile'} = "cdrx.error";
$Config{'mounterrorfile'} = "cdrx.mount.err";

- For the first error : line 442

my $DestFile = $TempDir . $Config{'burnerrorfile'};
my $arguments = "dev=$cdrw_def blank=$option 2> $DestFile";
system("$Config{'pathtocdrecord'} $arguments");

Also need to change : line 443 and 450 (don't know if it's possible)

$no_media = `cat $DestFile | grep cdrecord | grep 'output error'`;

- For the second error : line 608

my $DestFile = $TempDir . $Config{'cdrxerrorfile'};
my $arguments = "-r -o $write_dir_def/$iso_name $burn_string 2> $DestFile";
system("$Config{'pathtomkisofs'} $arguments");

- For the third error : line 773

my $DestFile = $TempDir . $Config{'mounterrorfile'};
my $arguments = "-tiso9660 $read_cdrom_dev /mnt 2> $DestFile";
system("$Config{'pathtomount'} $arguments");

etc etc etc

#########
Timeline:
#########

Discovered : 2005-10-04
Vendor notified : 
Vendor response :  
Vendor fix : 
Vendor Sec report (vendor-sec@lst.de) : 
Disclosure : 

#####################
Technical details :
#####################

Vulnerable code :
-----------------

* In cdrx.pl :

442	system"cdrecord dev=$cdrw_def blank=$option 2>/tmp/cdrx.burn.err";
443	$no_media = `cat /tmp/cdrx.burn.err | grep cdrecord | grep 'output error'`;
450	$no_media = `cat /tmp/cdrx.burn.err | grep cdrecord | grep 'output error'`;

608	system"mkisofs -r -o $write_dir_def/$iso_name $burn_string 2>/tmp/cdrx.error";

767	system"mount -tiso9660 $read_cdrom_dev /mnt 2>/tmp/cdrx.mount.err";

773	system"mount -tiso9660 $read_cdrom_dev /mnt 2>/tmp/cdrx.mount.err";

791	system"cdrecord -v -eject dev=$cdrw_def speed=$write_speed -data
$write_dir_def/$iso_name         2>/tmp/cdrx.burn.err";

860	system"cdrecord -v -eject dev=$cdrw_def speed=$write_speed -data
$iso_list{$iso_image_choice - 1}         2>/tmp/cdrx.burn.err";

877	system"cdrecord -v -eject dev=$cdrw_def speed=$write_speed -data
$write_dir_def/$iso_name 2>/tmp/        cdrx.burn.err";

892	system"cdrecord -v -eject dev=$cdrw_def speed=$write_speed -data
$write_dir_def/$iso_name 2>/tmp/        cdrx.burn.err";

916     system"cdrecord -v -eject dev=$cdrw_def speed=$write_speed -data
$write_dir_def/$iso_name         2>/tmp/cdrx.burn.err";

#########
Related :
#########

Bug report : http://bugs.gentoo.org/show_bug.cgi?id=
CVE : 

#####################
Credits :
#####################

Eric Romang (eromang@zataz.net - ZATAZ Audit) - Gentoo Security Scout
Thxs to Gentoo Security Team.
Comment 1 Thierry Carrez (RETIRED) gentoo-dev 2005-10-25 07:18:57 UTC
Been missing it because it was mis-categorized.
Auditors, please double-check
Comment 2 Tavis Ormandy (RETIRED) gentoo-dev 2005-10-29 05:46:38 UTC
confirmed.
Comment 3 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2005-10-30 00:39:16 UTC
Has upstream been informed? 
Comment 4 Romang 2005-10-30 01:49:15 UTC
Hello,

No i have wait your auditing before.

One thing how is important before sending this to upstream,
is the solution good ?

Regards.
Comment 5 Thierry Carrez (RETIRED) gentoo-dev 2005-11-04 05:29:05 UTC
We could ask the maintainer to test if only there was a maintainer to this.
Comment 6 Thierry Carrez (RETIRED) gentoo-dev 2005-11-10 06:58:03 UTC
Eric: fix looks ok to me... did you contact upstream yet ?
Comment 7 Romang 2005-11-30 03:57:33 UTC
Hello,

Notified today and vendor-sec also.

Regards.
Comment 8 Thierry Carrez (RETIRED) gentoo-dev 2005-12-09 06:51:08 UTC
Upstream is dead, probably better to release this, then fix it.
Eric, whenever you want.
Comment 9 Romang 2006-01-03 01:19:49 UTC
Hello,

Go ;)

Regards and happy new year to all gentoo security staff !
Comment 10 Thierry Carrez (RETIRED) gentoo-dev 2006-01-03 01:30:01 UTC
Opening.
I vote for masking/removal, this is unmaintained both upstream and downstream.
Comment 11 Tim Yamin (RETIRED) gentoo-dev 2006-01-03 05:16:06 UTC
If it's dumped upstream (which it seems to be) I vote removal, should be plenty of alternatives for something like this.
Comment 12 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-01-03 07:59:17 UTC
+1 for removal.
Comment 13 Thierry Carrez (RETIRED) gentoo-dev 2006-01-04 01:01:14 UTC
Last rites warning sent to -dev, tomask in 48 hours.
Comment 14 Luis Medinas (RETIRED) gentoo-dev 2006-01-04 04:20:46 UTC
media-optical doesn't have interest in taking this package since the upstream is dead go ahead remove the package :)
Comment 15 Thierry Carrez (RETIRED) gentoo-dev 2006-01-18 06:07:08 UTC
Masked, prior to complete removal.
Comment 16 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-03-22 12:25:46 UTC
This has been masked long enough.

Solar / Vapier / Tigger / Taviso please do the magic.
Comment 17 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2006-10-24 05:51:50 UTC
Hi treecleaners,

Matt has just told me that this bug is old and the package has been masked for a while... "Last rites" already sent. Who will remove it from the tree ?
Comment 18 Christian Heim (RETIRED) gentoo-dev 2006-11-04 12:42:12 UTC
Guess Alec really needs to follow his own guidelines ...
Comment 19 Steve Dibb (RETIRED) gentoo-dev 2006-11-29 18:00:54 UTC
punted