Hi, attached is an updated patch which I will upload as a 0-day NMU with permission of the maintainer. Many thanks to Frank for his input!
Kind regards Nico -- Nico Golde - http://www.ngolde.de - [EMAIL PROTECTED] - GPG: 0x73647CFF For security reasons, all text in this mail is double-rot13 encrypted.
diff -u wml-2.0.11/debian/changelog wml-2.0.11/debian/changelog
--- wml-2.0.11/debian/changelog
+++ wml-2.0.11/debian/changelog
@@ -1,3 +1,13 @@
+wml (2.0.11-3.1) unstable; urgency=high
+
+ * Non-maintainer upload by security team.
+ * Fix insecure temporary file creations in eperl and ipp
+ backends and a similar issue in the wmg.cgi contrib file
+ leading to possible symlink attacks.
+ If you already use wmg.cgi please update your copy (Closes: #463907).
+
+ -- Nico Golde <[EMAIL PROTECTED]> Thu, 07 Feb 2008 12:01:43 +0100
+
wml (2.0.11-3) unstable; urgency=low
[ Luk Claes ]
diff -u wml-2.0.11/wml_contrib/wmg.cgi wml-2.0.11/wml_contrib/wmg.cgi
--- wml-2.0.11/wml_contrib/wmg.cgi
+++ wml-2.0.11/wml_contrib/wmg.cgi
@@ -366,14 +366,7 @@
($w, $h, $t) = Image::Size::imgsize(\$contents);
if ($w*$h == 1) {
# read image into GD
- $tmpfile = "/tmp/pe.tmp.$$";
- unlink($tmpfile);
- open(TMP, ">$tmpfile");
- print TMP $contents;
- close(TMP);
- open(TMP, "<$tmpfile");
- $tmpimg = newFromGif GD::Image(TMP);
- close(TMP);
+ $tmpimg = newFromGif GD::Image($contents);
unlink($tmpfile);
if ($tmpimg->transparent != -1) {
my $im = new GD::Image($w, $h);
diff -u wml-2.0.11/wml_backend/p1_ipp/ipp.src wml-2.0.11/wml_backend/p1_ipp/ipp.src
--- wml-2.0.11/wml_backend/p1_ipp/ipp.src
+++ wml-2.0.11/wml_backend/p1_ipp/ipp.src
@@ -566,6 +566,8 @@
# process the pre-loaded include files
#
$tmpdir = $ENV{'TMPDIR'} || '/tmp';
+my $tmpldir = ($ENV{'TMPDIR'} || '/tmp') . '/ipp.XXXXXX';
+$tmpdir = mkdtemp($tmpldir) or die "Unable to create temporary directory: $!\n";
$tmpfile = $tmpdir . "/ipp.$$.tmp";
unlink($tmpfile);
$tmp = new IO::File;
only in patch2:
unchanged:
--- wml-2.0.11.orig/wml_backend/p3_eperl/eperl_sys.c
+++ wml-2.0.11/wml_backend/p3_eperl/eperl_sys.c
@@ -211,13 +211,20 @@
{
char ca[1024];
char *cp, *tmpdir;
+ char tmpfile[]="eperl_sourceXXXXXX";
int i;
+ int fd=-1;
tmpdir = getenv ("TMPDIR");
if (tmpdir == (char *) NULL)
tmpdir="/tmp";
- snprintf(ca, sizeof(ca), "%s/%s.%d.tmp%d", tmpdir, id, (int)getpid(), mytmpfilecnt++);
+ snprintf(ca, sizeof(ca), "%s/%s", tmpdir, tmpfile);
+ if((fd = mkstemp(tmpfile)) == -1){
+ perror("can not create tmpfile");
+ return NULL;
+ }
+ close(fd);
ca[sizeof(ca)-1] = NUL;
cp = strdup(ca);
for (i = 0; mytmpfiles[i] != NULL; i++)
pgpLbALUiRCOp.pgp
Description: PGP signature

