| name | cis-gcp-cos-6.2.13 |
| description | Ensure users' .netrc Files are not group or world accessible |
| category | cis-gcp-cos |
| version | 1.2.0 |
| author | cyberstrike-official |
| tags | ["cis","gcp","container-optimized-os","user-accounts","netrc"] |
| cis_id | 6.2.13 |
| cis_benchmark | CIS Google Container-Optimized OS Benchmark v1.2.0 |
| tech_stack | ["gcp","linux"] |
| cwe_ids | [] |
| chains_with | [] |
| prerequisites | [] |
| severity_boost | {} |
6.2.13 Ensure users' .netrc Files are not group or world accessible (Automated)
Description
While the system administrator can establish secure permissions for users' .netrc files, the users can easily override these.
Rationale
.netrc files may contain unencrypted passwords that may be used to attack other systems.
Audit Procedure
Run the following script and verify no results are returned:
#!/bin/bash
grep -E -v '^(root|halt|sync|shutdown)' /etc/passwd | awk -F: '($7 != "'"$(which nologin)"'" && $7 != "/bin/false") { print $1 " " $6 }' | while read user dir; do
if [ ! -d "$dir" ]; then
echo "The home directory ($dir) of user $user does not exist."
else
for file in $dir/.netrc; do
if [ ! -h "$file" -a -f "$file" ]; then
fileperm=$(ls -ld $file | cut -f1 -d" ")
if [ $(echo $fileperm | cut -c5) != "-" ]; then
echo "Group Read set on $file"
fi
[ $( | -c6) != ];
[ $( | -c7) != ];
[ $( | -c8) != ];
[ $( | -c9) != ];
[ $( | -c10) != ];