Skip Menu |

This queue is for tickets about the Clipboard CPAN distribution.

Report information
The Basics
Id: 98435
Status: resolved
Priority: 0/
Queue: Clipboard

Owner: ether [...]
Requestors: carnil [...]

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)

Subject: clipedit: Insecurely uses temporary files
Date: Fri, 29 Aug 2014 18:30:24 +0200
To: bug-Clipboard [...]
From: Salvatore Bonaccorso <carnil [...]>
Download (untitled) / with headers
text/plain 791b
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] Regards, Salvatore
Download (untitled) / with headers
text/plain 199b
Hi, FTR, CVE-2014-5509 was assigned for this issue[1]; Could you reference it in the Changes when fixing this issue? [1] Regards, Salvatore
Download (untitled) / with headers
text/plain 248b
Hi, this module is used by App-Nopaste, which is in the Task::Kensho mega-distribution. Is it possible that this bug will be addressed soon? I am also willing to take on comaintenance of the module and fix/release it myself - my PAUSE id is ETHER.
Here's a patch which uses FIle::Temp instead. Cheers, gregor
Subject: insecure-tempfile.patch
Description: Fix insecure use of temporary files. This is CVE-2014-5509. Origin: vendor Bug: Author: gregor herrmann <> Last-Update: 2016-08-13 --- a/scripts/clipedit +++ b/scripts/clipedit @@ -1,10 +1,11 @@ #!/usr/bin/perl use strict; use Clipboard; +use File::Temp qw( tempfile ); my $orig = Clipboard->paste; -my $tmpfilename = "/tmp/clipedit$$"; +my ($tmpfile, $tmpfilename) = tempfile(); open my $tmpfile, ">$tmpfilename" or die "Failure to open $tmpfilename: $!"; print $tmpfile $orig; close $tmpfile;
Download (untitled) / with headers
text/plain 136b
On Sun Aug 14 09:42:13 2016, GREGOA wrote: Show quoted text
> Here's a patch which uses FIle::Temp instead. > > Cheers, > gregor
Patch applied, thanks!

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to