-
-
Notifications
You must be signed in to change notification settings - Fork 391
Hardening: verify that we send signals by PID to programs with expected name #2464
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
Conversation
Signed-off-by: Jim Klimov <[email protected]>
…, and helper parseprogbasename() [networkupstools#2463] Signed-off-by: Jim Klimov <[email protected]>
Signed-off-by: Jim Klimov <[email protected]>
❌ Build nut 2.8.2.1787-master failed (commit 29bf7c2ab9 by @jimklimov) |
…ignal*() via old PID only to same progname [networkupstools#2463] Internal API change for common.c/h Signed-off-by: Jim Klimov <[email protected]>
…ne parsing [networkupstools#2463] Signed-off-by: Jim Klimov <[email protected]>
Added
|
✅ Build nut 2.8.2.1788-master completed (commit d1f3d69bd5 by @jimklimov) |
…parsing [networkupstools#2463] Signed-off-by: Jim Klimov <[email protected]>
FreeBSD:
|
OpenBSD (no
UPDATE: FreeBSD has a different set of arguments for |
OmniOS (via
|
OmniOS, staged to use Solaris/illumos native
|
For kicks, also staged a native-Windows process lookup. It is unlikely to fire in real life, as we send "signals" on WIN32 via named pipes. But conceptually, process name lookup works (custom builds to check a
|
…ng without a /proc [networkupstools#2463] Signed-off-by: Jim Klimov <[email protected]>
…ols#2463] Signed-off-by: Jim Klimov <[email protected]>
…o (Solaris/illumos) parsing [networkupstools#2463] Signed-off-by: Jim Klimov <[email protected]>
…ithout a /proc [networkupstools#2463] Signed-off-by: Jim Klimov <[email protected]>
Closes: #2463
Per discussion in the issue above, blind PID signalling is a problem on embedded platforms which do not differentiate user accounts, so a NUT driver can kill some unrelated program assuming it is a stuck driver (just by PID file matching) and not be stopped by permissions to send a signal to a program not owned by a
nut
account.This is a platform-dependent solution, so by default if we can not determine a program name - we do not forbid signal-sending. Likewise, if a name is detected and seems to match expectations (modulo directory prefix, or on some platforms - case-sensitivity or
.exe
suffix) we also consider it a match. Finally, only if we detect a name of the running process with the specified PID and it is not anything like our expectation, the check is failed.With current NUT master (or with the PR in place and
NULL
instead ofprogname
passed to the method), the test command below signals (and kills) the current shell process as$$
- owned by the same user asupsmon
in the test. With the change in the PR, such a name is detected and rejected:There are a few more platform-specific code paths to handle, expected with later commits.
CC @arnaudquette-eaton @ericclappier-eaton : this internal API change for
sendsignal*()
methods may impact or benefit your work too, pinging just in case :)