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

Security: Pod::POM::parse_file() uses 2-argument open() #8

Open
guimard opened this issue Feb 26, 2019 · 0 comments
Open

Security: Pod::POM::parse_file() uses 2-argument open() #8

guimard opened this issue Feb 26, 2019 · 0 comments

Comments

@guimard
Copy link

guimard commented Feb 26, 2019

Hello,

a Debian user reported a security issue:

The Pod::POM::parse_file function uses 2-argument open().
As a consequence, podlint can't be used securely to check files with untrusted names.

Proof of concept:

  $ touch '; cowsay pwned >&2 |'
  $ podlint ./*
  sh: 1: ./: Permission denied

Below a trivial patch:

--- a/lib/Pod/POM.pm
+++ b/lib/Pod/POM.pm
@@ -138,7 +138,7 @@
        local *FP;
        local $/ = undef;
        $name = ( $file eq '-' ? '<standard input>' : $file );
-       open(FP, $file) || return $self->error("$file: $!");
+       open(FP, '<', $file) || return $self->error("$file: $!");
        $text = <FP>;
        close(FP);
     }
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