Avoid operating in insecure directories#455
Open
cgzones wants to merge 1 commit intologrotate:mainfrom
Open
Conversation
Member
|
Why do we need to cache uid and gid of logrotate process? |
Merged
745b42c to
50701b9
Compare
755d9d4 to
5441eb3
Compare
kdudka
reviewed
Jul 29, 2024
kdudka
approved these changes
Aug 2, 2024
Logrotate is known to be affected by race conditions when operating on files in "insecure" directories[1]. Since logrotate is commonly run as root this can lead to privilege escalation[2,3]. Ensure log and olddir directories are "secure"[4], i.e. owned by a foreign non-root user or group-writable and owned by a foreign non-root user or world-writable and sticky-bit not set. Add a new directive 'allownonsecuredir' as last resort to allow rotation in such directories. [1]: https://github.com/whotwagner/logrotten [2]: https://bugzilla.redhat.com/show_bug.cgi?id=1705143 [3]: https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/4380 [4]: https://wiki.sei.cmu.edu/confluence/display/c/FIO15-C.+Ensure+that+file+operations+are+performed+in+a+secure+directory Supersedes: logrotate#237
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Logrotate is known to be affected by race conditions when operating
on files in "insecure" directories1. Since logrotate is commonly run
as root this can lead to privilege escalation[2,3].
Ensure log and olddir directories are "secure"4, i.e. owned by a
foreign non-root user or group-writable and owned by a foreign non-root
user or world-writable and sticky-bit not set.
Add a new directive 'allownonsecuredir' as last resort to allow rotation
in such directories.
Supersedes: #237