mirror of
https://github.com/usnistgov/macos_security.git
synced 2026-02-03 05:53:24 +00:00
Incorrect logic in system_settings_softwareupdate_current #31
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 @phaninder-scalefusion on GitHub.
Summary
The
system_settings_softwareupdate_currentrule usesLastFullSuccessfulDateto determine if the device is up-to-date. This is unreliable because the value changes even when runningsoftwareupdate -l, without confirming update status.Steps to reproduce
LastFullSuccessfulDate.softwareupdate -l.Operating System version
(macOS 13 / 14 / 15 – reproducible across builds)
Intel or Apple Silicon
Both
Current behavior
Reports device as compliant when updates are still available.
Expected behavior
Compliance should only report
up-to-datewhen no new software updates are available.Relevant logs
Possible fixes
softwareupdate -l 2>&1 | grep -q "No new software available." && echo "0" || echo "1"@brodjieski commented on GitHub:
The suggested fix may not correctly report the status if a system is running macOS Sonoma or Sequoia and is offered macOS Tahoe. I think the intent of this rule is to make sure that there are no security updates available for the currently running OS.
That being said, the current way the check is written is flawed (as you discovered), so we may need a new approach.
Another suggestion would be to parse the output of:
and make sure there are no available updates that contain
_minorin the identifier or product key.Maybe we do
and ensure the result is not greater than 0?
Curious your thoughts on this approach.
@rs1278 commented on GitHub:
Adding my $0.02 FWIF
The approach of
/usr/bin/defaults read /Library/Preferences/com.apple.SoftwareUpdate.plist RecommendedUpdates | grep -c "_minor"seems valid.
Returning 0 as compliant.
Returning nonzero as a finding.
Apple has planned to remove the softwareupdate binary from macOS 27, so
softwareupdate -l 2>&1 | grep -q "No new software available." && echo "0" || echo "1"will be deprecated.