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

Secure executable permissions #65

Merged
merged 2 commits into from
Jul 25, 2024
Merged

Secure executable permissions #65

merged 2 commits into from
Jul 25, 2024

Conversation

orlitzky
Copy link
Contributor

@orlitzky orlitzky commented Mar 3, 2024

Installing executables as nagios:nagios (the default) is a security issue on a typical system where those executables will wind up in everyone's PATH. In these two commits I simply delete the special handling, letting all executables be installed mode 755 with the owner unchanged. (This would result in root:root ownership for a "normal" /usr/bin install.)

orlitzky added 2 commits March 2, 2024 20:11
In configure.ac we were adding two flags to INSTALL_OPTS that change
the owner:group of all installed files to ndo2db_user:ndo2db_group.
This is often a security vulnerability, since executables (we have a
few) are typically installed into everyone's PATH. If root ever
executes them, the ndo2db_user can take advantage of the situation to
run malicious code as root.

Fortunately the change in ownership is not really needed. We simply
drop the INSTALL_OPTS, which are used for nothing else, allowing our
files to be installed as the user who is doing the installing. When
installing to one of the system PATHs, that will almost always be
root.
Three executables -- file2sock, log2ndo, and sockdebug -- are
currently being installed group-writable but not
world-executable. This is in contrast with the other two executables,
ndo2db and ndomod.o, that are installed mode 0755.

Having recently removed the INSTALL_OPTS that were altering the
owner:group of these files, there is no longer any security risk to
mode 0774. However, 0755 is more consistent with both the rest of our
executables, and with the typical permissions on /usr/bin that arise
from the (extremely common) umask of 0022.

We change these three to 0755 for a little bit of extra peace of mind.

changes. Lines starting # with '#' will be ignored, and an empty
message aborts the commit.  # # Date: Sat Mar 2 19:52:47 2024 -0500 #
src/Makefile.in #
@sawolf
Copy link

sawolf commented Mar 4, 2024

Thanks for the patch! This looks good to me.

@orlitzky
Copy link
Contributor Author

orlitzky commented Mar 4, 2024

Thanks! I thought I had fixed this in nagios-core, too, but now that I look back the issue sort of stalled: NagiosEnterprises/nagioscore#424

@sawolf sawolf merged commit 39d10eb into NagiosEnterprises:master Jul 25, 2024
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

Successfully merging this pull request may close these issues.

2 participants