1.3.1.4 Ensure apparmor_restrict_unprivileged_unconfined is enabled

Information

By making sure the kernel.apparmor_restrict_unprivileged_unconfined sysctl setting is enabled, a process that is unprivileged and unconfined cannot leverage aa-exec to change to a more favourable profile

Unprivileged user namespaces are a feature in the Linux kernel that was introduced in order to provide additional sandboxing functionality for programs such as container runtimes; it enables unprivileged users to gain administrator (root) permissions within a confined environment, without giving them elevated permissions on the host system.However, unconfined profiles that allow the use of user namespaces provide a trivial bypass of the unprivileged user namespace restriction from unconfined processes. All the unconfined application or user has to do is enter the unconfined profile. The unconfined user or application can execute the application associated with the unconfined profile. If the application provides the ability to run arbitrary code or shell access, that is all that needs to be done to bypass the restriction

Solution

- Set the kernel.apparmor_restrict_unprivileged_unconfined = kernel parameter to 1 in /etc/sysctl.conf or a file in /etc/sysctl.d/ ending in .conf :

Example:

# printf \"\n%s\n\" \"kernel.apparmor_restrict_unprivileged_unconfined = 1\" >> /etc/sysctl.d/60-kernel_sysctl.conf
- Run the following command to set the active kernel parameter:

# sysctl -w kernel.apparmor_restrict_unprivileged_unconfined=1
- Run the following command to load all system configuration filles:

# sysctl --system

Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten

See Also

https://workbench.cisecurity.org/benchmarks/24932

Item Details

Category: SYSTEM AND INFORMATION INTEGRITY

References: 800-53|SI-16, CSCv7|8.3

Plugin: Unix

Control ID: 9f3059e1ec1f1fc0341a504912f4a1e897248bad29bd830782342bd9b99362c7