Subject: | clipedit: Insecurely uses temporary files |
Date: | Fri, 29 Aug 2014 18:30:24 +0200 |
To: | bug-Clipboard [...] rt.cpan.org |
From: | Salvatore Bonaccorso <carnil [...] debian.org> |
Hi
While reviewing Clipboard for beeing packaged for Debian I noticed
that script/clipedit uses temporary files insecurely by using the pid
of the process in the temporary file name.
[...]
7 my $tmpfilename = "/tmp/clipedit$$";
8 open my $tmpfile, ">$tmpfilename" or die "Failure to open $tmpfilename: $!";
9 print $tmpfile $orig;
10 close $tmpfile;
[...]
13 system($ed, $tmpfilename);
14
15 open $tmpfile, $tmpfilename or die "Failure to open $tmpfilename: $!";
16 my $edited = join '', <$tmpfile>;
[...]
49 unlink($tmpfilename) or die "Couldn't remove $tmpfilename: $!";
Please use File::Temp to create the temporary file securely. See also
[1] for more details.
[1] http://kurt.seifried.org/2012/03/14/creating-temporary-files-securely/
Regards,
Salvatore