Open SoraTakai opened 1 month ago
I'm somewhat tempted to argue that this isn't really a problem because users should be in control of their Hammerspoon config, but I think your proposed fix is more correct in terms of the shell commands being executed the way people will expect.
Thanks for the detailed report!
hs.execute
is vulnerable to shell injection attacks due to the lack of input escaping.The most problematic line is
when
with_user_env
is set to true.If, e.g., someone sent a request to execute the following to Hammerspoon:
It would result in the command execution of:
(Assuming $SHELL envvar is set to /bin/bash.)
Here is the proposed fix: