id: system_settings_screensaver_ask_for_password_delay_enforce
title: Enforce Session Lock After Screen Saver is Started
discussion: |
  A screen saver _MUST_ be enabled and the system _MUST_ be configured to require a password to unlock once the screensaver has been on for a maximum of $ODV seconds.

  An unattended system with an excessive grace period is vulnerable to a malicious user.
check: |
  /usr/bin/osascript -l JavaScript << EOS
  function run() {
    let delay = ObjC.unwrap($.NSUserDefaults.alloc.initWithSuiteName('com.apple.screensaver')\
  .objectForKey('askForPasswordDelay'))
    if ( delay <= $ODV ) {
      return("true")
    } else {
      return("false")
    }
  }
  EOS
result:
  string: 'true'
fix: |
  This is implemented by a Configuration Profile.
references:
  cce:
    - CCE-94388-6
  cci:
    - CCI-000056
  800-53r5:
    - AC-11
  800-53r4:
    - AC-11
  srg:
    - SRG-OS-000028-GPOS-00009
  disa_stig:
    - APPL-15-000003
  800-171r3:
    - 03.01.10
  cis:
    benchmark:
      - 2.11.2 (level 1)
    controls v8:
      - 4.7
  cmmc:
    - AC.L2-3.1.10
  bio:
    - 5.17.03
macOS:
  - '15.0'
odv:
  hint: Number of seconds.
  recommended: 5
  stig: 5
  cis_lvl1: 5
  cis_lvl2: 5
  nlmapgov_plus: 0
tags:
  - 800-53r5_moderate
  - 800-53r5_high
  - 800-53r4_moderate
  - 800-53r4_high
  - 800-171
  - cis_lvl1
  - cis_lvl2
  - cisv8
  - cnssi-1253_low
  - cnssi-1253_high
  - cmmc_lvl2
  - stig
  - cnssi-1253_moderate
  - nlmapgov_plus
severity: medium
mobileconfig: true
mobileconfig_info:
  com.apple.screensaver:
    askForPasswordDelay: $ODV
