macOS
TMA-MACOS15-5.4
Ensure the Sudo Timeout Period Is Set to Zero
高级别 1自动化macos
说明
The sudo command allows the user to run programs as the root user. Working as the root user allows the user an extremely high level of configurability within the system. This control, along with the control to use a separate timestamp for each tty, limits the window where an unauthorized user, process, or attacker could utilize legitimate credentials that are valid for longer than required. Audit: Requires a 0.0 minute sudo timestamp timeout and /etc/sudoers.d owned by root:wheel. Run as root.
检查方式
审计方法: Shell 命令
shell
v=$(/usr/bin/sudo -V 2>/dev/null) || exit 1
c=$(printf '%s\n' "$v" | /usr/bin/grep -c "Authentication timestamp timeout: 0.0 minutes")
o=$(/usr/bin/stat -f '%Su:%Sg' /etc/sudoers.d 2>/dev/null)
if [ "$c" -ge 1 ] && [ "$o" = root:wheel ]; then echo compliant; else echo "timeout-zero=$c owner=$o"; fi- 预期输出
compliant
修复方式
修复方法: 操作指南或基础设施补丁
Terminal: sudo /usr/sbin/visudo -f /etc/sudoers.d/<configuration file name> ; sudo /usr/sbin/chown -R root:wheel /etc/sudoers.d/.
属性
- 操作系统
- macos-15
- 标签
- macossystem-access
- 参考
- CIS Apple macOS 15.0 Sequoia Benchmark v2.1.0 - 5.4 Ensure the Sudo Timeout Period Is Set to Zero
检查本机
请在您有权审计的机器上运行此命令。扫描为只读操作。
shell
tmaegis scan --target macos