mirror of
https://github.com/usnistgov/macos_security.git
synced 2026-02-03 05:53:24 +00:00
os_hibernate_mode_apple_silicon_enable checking is broken #128
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nihil-admirari on GitHub.
Summary
os_hibernate_mode_apple_silicon_enablecheck doesn't run on MacBook Air M2 13 and even if it were to run it would've tested only “Battery Power” profile, allowing other profiles to be misconfigured. Here is the relevant code:Steps to reproduce
Misconfigure all the profiles by running
Run the above code on a MacBook Air M2 13 (I think other devices are no different, but I have access only to this one.)
Operating System version
macOS 14.2.1
Intel or Apple Silicon
Apple Silicon
What is the current bug behavior?
The check with my debugging additions prints
The number of errors is 0, despite all profiles having a long sleep, display sleep that is lower than sleep, and hibernate mode that is not 25.
What is the expected correct behavior?
The first line is just for debugging:
Relevant logs and/or screenshots
/usr/sbin/ioreg -rd1 -c IOPlatformExpertDevicewith everything that looks like a serial numbers removed:The output has no
MacBookstring in it, and thusfails.
Possible fixes
CIS “2.9.1.2 Ensure the OS Is Not Active When Resuming from Sleep and Display Sleep (Apple Silicon) (Automated)” uses a different command to find out whether the device is a MacBook or not:
I'm not actually sure why this check is even needed. If the rule is not supposed to apply to desktop Macs, the fix should use
pmset -b -cinstead ofpmset -a.The following awk script validates the values of all power profiles
Every
displaysleepandsleepline gets its own entry in the arrays; entries at the same index are assumed to come from the same power profile.Also, it looks like sleep and display sleep timers are enforceable with a profile:
Despite CIS “2.9.3 Ensure Wake for Network Access Is Disabled (Automated)” having a note about
com.apple.EnergySaver.*:in my tests, even though
pmsetparameters can be changed, they revert to profile values after a restart (including thewompthat CIS note is talking about (seesystem_settings_wake_network_access_disable)).If the profile approach is adopted, then the awk script should validate only the
hibernatemode. Sleep timers can be checked by grepping the output ofprofiles.@robertgendler commented on GitHub:
CIS has updated their benchmarks and removed this for Apple Silicon. Closing the issue.