4.7.2.4 Home directory configuration files

Information

The user configuration files in each home directory e.g. $HOME/.profile, must not be group or world writable.

Rationale:

Group or world-writable user configuration files may enable malicious users to steal or modify other user's data, or to gain elevated privileges.

Solution

Search and remediate any user configuration files which have group or world writable access:

lsuser -a home ALL |cut -f2 -d= |egrep -v '^/$|/etc|/bin|/var|/usr|/usr/sys' |while read homedir;
do
if [[ -d ${homedir} ]];
then
echo 'Removing 'go-w' from all user confguration files in '${homedir}''
ls -a ${homedir} |egrep '^.[a-z]' |while read file;
do
if [[ -f '${homedir}/${file}' ]];
then
echo 'Running 'chmod go-w' on '${homedir}/${file}''
chmod go-w '${homedir}/${file}'
fi
done
else
echo 'ERROR - no home directory for '${homedir}''
fi
done

NOTE: The permission change is automatically applied

Default Value:

N/A

See Also

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

Item Details

Category: CONFIGURATION MANAGEMENT, SYSTEM AND SERVICES ACQUISITION

References: 800-53|CM-2, 800-53|CM-6, 800-53|CM-7, 800-53|CM-7(1), 800-53|CM-9, 800-53|SA-3, 800-53|SA-8, 800-53|SA-10, CSCv7|5.1

Plugin: Unix

Control ID: dd06295267f01252bb03adbba07d54206fca4daceecab9996dd104031a509a3e