Skip to content

Document that empty PATH components are also insecure. #22625

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

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ Geoffrey T. Dairiki <[email protected]> Geoffrey T. Dairiki <dairiki at dairik
George Greer <[email protected]> George Greer <[email protected]>
Gerard Goossen <[email protected]> Gerard Goossen <[email protected]>
Gerrit P. Haase <[email protected]> <[email protected]>
Gianni Ceccarelli <[email protected]> dakkar <[email protected]>
Gianni Ceccarelli <[email protected]> Gianni Ceccarelli <[email protected]>
Gideon Israel Dsouza <[email protected]> <[email protected]>
Gideon Israel Dsouza <[email protected]> Gideon Israel Dsouza <[email protected]>
Expand Down
5 changes: 3 additions & 2 deletions pod/perldiag.pod
Original file line number Diff line number Diff line change
Expand Up @@ -3123,8 +3123,9 @@ L<perlsec> for more information.

(F) You can't use system(), exec(), or a piped open in a setuid or
setgid script if C<$ENV{PATH}> contains a directory that is writable by
the world. Also, the PATH must not contain any relative directory.
See L<perlsec>.
the world. Also, the PATH must not contain any relative directory or
empty component (so C<''>, C<':'>, and C<'/usr/bin::/usr/local/bin'>
would all trigger this error). See L<perlsec>.

=item Insecure $ENV{%s} while running %s

Expand Down
19 changes: 11 additions & 8 deletions pod/perlsec.pod
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,17 @@ default.

For "Insecure C<$ENV{PATH}>" messages, you need to set C<$ENV{'PATH'}> to
a known value, and each directory in the path must be absolute and
non-writable by others than its owner and group. You may be surprised to
get this message even if the pathname to your executable is fully
qualified. This is I<not> generated because you didn't supply a full path
to the program; instead, it's generated because you never set your PATH
environment variable, or you didn't set it to something that was safe.
Because Perl can't guarantee that the executable in question isn't itself
going to turn around and execute some other program that is dependent on
your PATH, it makes sure you set the PATH.
non-writable by others than its owner and group. Notice that, at least on
Unix-like environments, an empty component of the PATH may be interpreted
as if it were C<.> (the local directory), which will also trigger this
message. You may be surprised to get this message even if the pathname
to your executable is fully qualified. This is I<not> generated because
you didn't supply a full path to the program; instead, it's generated
because you never set your PATH environment variable, or you didn't set
it to something that was safe. Because Perl can't guarantee that the
executable in question isn't itself going to turn around and execute some
other program that is dependent on your PATH, it makes sure you set the
PATH.

The PATH isn't the only environment variable which can cause problems.
Because some shells may use the variables IFS, CDPATH, ENV, and
Expand Down