diff --git a/changes/10292-optimize-macos-cis-query-5.1.5 b/changes/10292-optimize-macos-cis-query-5.1.5 new file mode 100644 index 0000000000..63ff07e47a --- /dev/null +++ b/changes/10292-optimize-macos-cis-query-5.1.5 @@ -0,0 +1 @@ +* Optimize macOS CIS query "Ensure Appropriate Permissions Are Enabled for System Wide Applications" (5.1.5). diff --git a/ee/cis/macos-13/cis-policy-queries.yml b/ee/cis/macos-13/cis-policy-queries.yml index dab5419f7e..6c340a71c9 100644 --- a/ee/cis/macos-13/cis-policy-queries.yml +++ b/ee/cis/macos-13/cis-policy-queries.yml @@ -2619,11 +2619,12 @@ spec: done query: | SELECT 1 WHERE NOT EXISTS ( - SELECT 1 FROM file WHERE - path LIKE '/Applications/%%' - AND type = 'directory' - AND directory LIKE '%.app' - AND CAST( SUBSTRING( mode ,-1) AS INTEGER) & 0x2 !=0 -- mode last char is others' permissions. bitwise with 0x2 means write permissions. (which we do not want here) + SELECT apps.path FROM apps + LEFT JOIN file on file.path = apps.path + -- file.mode's last character are the permissions for 'other', + -- bitwise && with '0x2' selects the write permission, + -- which we do not want here. + WHERE CAST(SUBSTRING(file.mode, -1) AS INTEGER) & 0x2 != 0 ); purpose: Informational tags: compliance, CIS, CIS_Level1, CIS-macos-13-5.1.5 @@ -2637,7 +2638,9 @@ spec: platform: darwin description: | Software sometimes insists on being installed in the /System/Volumes/Data/System Directory and has inappropriate world-writable permissions. - Macs with writable files in System should be investigated forensically. A file with open writable permissions is a sign of at best a rogue application. It could also be a sign of a computer compromise and a persistent presence on the system. + Macs with writable files in System should be investigated forensically. A file with open writable permissions is a sign of at best a rogue application. + It could also be a sign of a computer compromise and a persistent presence on the system. + The audit check excludes the "Drop Box" folder that is part of Apple's default user template. resolution: | Ask your system administrator to deploy a script that will ensure folders are not world-writable in the /System folder. /usr/bin/sudo IFS=$'\n'