DISA STIGS Viewer

Successful/unsuccessful uses of the chown, fchown, fchownat, and lchown system calls in NixOS must generate an audit record.

Overview

Finding ID Version Rule ID IA Controls Severity
V-268099 ANIX-00-000360 SV-268099r1039185_rule   Medium
Description
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
STIG Date
Anduril NixOS Security Technical Implementation Guide 2024-10-25

Details

Check Text (C-72023r1039183_chk)
Verify NixOS generates an audit record upon attempts to use the "chown", "fchown", "fchownat", and "lchown" system calls.

Check the auditing rules currently loaded into the audit daemon with the following command:

$ sudo auditctl -l | grep chown

-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F auid>=1000 -F auid!=-1 -F key=perm_mod
-a always,exit -F arch=b64 -S chown,fchown,lchown,fchownat -F auid>=1000 -F auid!=-1 -F key=perm_mod

If the command does not return an audit rule for "chown", "fchown", "fchownat", and "lchown", this is a finding.

Note: The "-k" allows for specifying an arbitrary identifier. The string following "-k" does not need to match the example output above.
Fix Text (F-71926r1039184_fix)
Configure NixOS to generate audit records for any attempts to use the "chown", "fchown", "fchownat", and "lchown" system calls.

Add or update the "security.audit.rules" configuration in /etc/nixos/configuration.nix to include the following rule:

security.audit.rules = [
"-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod"
"-a always,exit -F arch=b64 -S chown,fchown,lchown,fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod"
];

Rebuild the NixOS configuration with the following command:

$ sudo nixos-rebuild switch