Check: ANIX-00-001280
Anduril NixOS STIG:
ANIX-00-001280
(in version v1 r1)
Title
NixOS must prevent all software from executing at higher privilege levels than users executing the software. (Cat II impact)
Discussion
In certain situations, software applications/programs need to execute with elevated privileges to perform required functions. However, if the privileges required for execution are at a higher level than the privileges assigned to organizational users invoking such applications/programs, those users are indirectly provided with greater privileges than assigned by the organizations. Some programs and processes are required to operate at a higher privilege level and therefore should be excluded from the organization-defined software list after review.
Check Content
Verify NixOS audits and provides alerts of audit failures by running the following command: $grep A -15 security.auditd /etc/nixos/configuration.nix /etc/nixos/configuration.nix: security.auditd.enable = true; security.audit.enable = true; security.audit.rules = [ '' <audit_rules> '' ]; security.audit.rules = [ "-a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k execpriv" "-a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k execpriv" "-a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k execpriv" "-a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k execpriv" ]; If "security.auditd", "security.audit" and the additional modifications do not equal true, are missing, or are commented out, this is a finding.
Fix Text
Configure the audit service to produce audit records. Install the audit service (if the audit service is not already installed) and ensure the audit service is enabled by adding or updating the following configurations in /etc/nixos/configuration.nix: security.auditd.enable = true; security.audit.enable = true; Additionally, add the following audit rules: security.audit.rules = [ "-a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k execpriv" "-a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k execpriv" "-a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k execpriv" "-a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k execpriv" ]; Then, rebuild the NixOS configuration with the following command: $ sudo nixos-rebuild switch
Additional Identifiers
Rule ID: SV-268148r1039332_rule
Vulnerability ID: V-268148
Group Title: SRG-OS-000326-GPOS-00126
Expert Comments
CCIs
Number | Definition |
---|---|
CCI-002233 |
Prevent the organization-defined software from executing at higher privilege levels than users executing the software. |
Controls
Number | Title |
---|---|
AC-6(8) |
Privilege Levels for Code Execution |