Verify the system-wide library files in directories "/lib", "/lib64", "/usr/lib/" and "/usr/lib64" are group-owned by root.
An XCCDF Rule
Description
System-wide library files are stored in the following directories by default:
/lib /lib64 /usr/lib /usr/lib64All system-wide shared library files should be protected from unauthorised access. If any of these files is not group-owned by root, correct its group-owner with the following command:
$ sudo chgrp root FILE
Rationale
If the operating system were to allow any user to make changes to software libraries, then those changes might be implemented without undergoing the appropriate testing and approvals that are part of a robust change management process. This requirement applies to operating systems with software libraries that are accessible and configurable, as in the case of interpreted languages. Software libraries also include privileged programs which execute with escalated privileges. Only qualified and authorized individuals must be allowed to obtain access to information system components for purposes of initiating changes, including upgrades and modifications.
- ID
- xccdf_org.ssgproject.content_rule_root_permissions_syslibrary_files
- Severity
- Medium
- References
- Updated
Remediation - Ansible
- name: Find /lib/ file(s) matching ^.*$ recursively
command: find -H /lib/ -type f ! -group 0 -regex "^.*$"
register: files_found
changed_when: false
failed_when: false
check_mode: false
Remediation - Shell Script
find /lib/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \;
find /lib64/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \;
find /usr/lib/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \;