Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insecure use of /tmp #16

Closed
carnil opened this issue Feb 6, 2014 · 2 comments
Closed

insecure use of /tmp #16

carnil opened this issue Feb 6, 2014 · 2 comments

Comments

@carnil
Copy link

carnil commented Feb 6, 2014

Hi

On the Debian BTS Jakub Wilk reported an issue of Capture::Tiny insecurely using /tmp. The original report is at [1].

On Thu, Feb 06, 2014 at 12:52:21PM +0100, Jakub Wilk wrote:

$ strace -f -o '| grep -E open.*/tmp' perl test.pl
11181 open("/tmp/8NDe_c4S_N", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE|O_NOFOLLOW, 0600) = 5
11183 open("/tmp/5KKGPDNyy0", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 3

The first temporary file is created securely, but the second open(2)
call lacks the O_EXCL flag. The vulnerable code appears to be:

flag file is used to signal the child is ready

$stash->{flag_files}{$which} = scalar tmpnam();

The File::temp::tmpnam documentation reads: “When called in scalar
context, returns the full name (including path) of a temporary file
(uses mktemp()). The only check is that the file does not already
exist, but there is no guarantee that that condition will continue
to apply.”

[1] http://bugs.debian.org/737835

Regards,
Salvatore

@dagolden
Copy link
Collaborator

dagolden commented Feb 6, 2014

Thanks. Fixed in 635c9ea and will be shipped to CPAN shortly.

@dagolden
Copy link
Collaborator

dagolden commented Feb 6, 2014

Shipped to CPAN as 0.24.

@dagolden dagolden closed this as completed Feb 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant