Skip to content

Verify that Shared Library Directories Have Restrictive Permissions

An XCCDF Rule

Description

System-wide shared library directories, which contain are linked to executables during process load time or run time, are stored in the following directories by default:

/lib
/lib64
/usr/lib
/usr/lib64
Kernel modules, which can be added to the kernel during runtime, are stored in /lib/modules. All sub-directories in these directories should not be group-writable or world-writable. If any file in these directories is found to be group-writable or world-writable, correct its permission with the following command:
$ sudo chmod go-w DIR

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_dir_permissions_library_dirs
Severity
Medium
References
Updated



Remediation - Ansible

- name: Find /lib/ file(s) recursively
  command: 'find -H /lib/  -perm /g+w,o+w  -type d '
  register: files_found
  changed_when: false
  failed_when: false
  check_mode: false

Remediation - Shell Script






find -H /lib/  -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \;