This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cannot exec() program outside of /bin if PATH is unset

Eric Blake wrote:
On 09/12/2014 05:03 PM, Eric Blake wrote:
On 09/12/2014 04:50 PM, Christian Franke wrote:
Andrey Repin wrote:
Hmm... is postfix actually broken?
Unsetting PATH is IMO sane (from the POSIX POV) if all exec() calls use
absolute path names.
If all exec() calls are made with full paths, unsetting $PATH does not
security in any way,
Of course. But postfix could be configured to run "unknown" external
programs through its various daemons. In this case, a fixed (here:
empty) PATH improves security. If not convinced, please discuss with the
author of postfix :-)
An empty PATH leaves it up to the implementation what helpers get run
(if it doesn't fall over first), which is LESS secure than a guaranteed
safe PATH of confstr(_CS_PATH).
By the way, passing a _safe_ PATH to your child process IS a good idea
for security-conscious programs, but you have to do it correctly

Agree. The postfix spawn(8) and pipe(8) daemons actually spawn external programs with PATH set to _PATH_DEFPATH.

(by passing an actual safe path, and NOT by completely unsetting PATH).

Disagree. The postfix master(8) spawns all of its daemons with PATH unset. This IMO does not violate POSIX.

Note that setting PATH=/bin on Cygwin does not fix the security problem in the DLL search order. Even with "SafeDllSearchMode" enabled, the current directory is always checked before PATH. Running some Cygwin program from /usr/sbin, /usr/local/bin, /usr/libexec, ... would load a possible malicious cyg*.dll from current directory regardless of PATH setting. Only programs in /bin are safe.

Using SetDllDirectory("c:\\cygwin\\bin") somewhere in cygwin1.dll would fix this also.

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]