id: insecure-etc-fstab-permissions

info:
  name: macOS Insecure /etc/fstab Permissions
  author: geeknik
  severity: high
  description: |
    Validates permissions on the /etc/fstab file that defines how disk partitions and filesystems are mounted on macOS.
  impact: |
    Insecure permissions on /etc/fstab could allow unauthorized users to modify the file and mount malicious filesystems.
  remediation: |
    Ensure that the /etc/fstab file is owned by root with a system group (wheel, admin, etc.) and has permissions of 0644 or more restrictive.
  tags: macos,audit,local,security

self-contained: true

code:
  - engine:
      - sh
      - bash
    source: |
      ls -l /etc/fstab 2>&1
    matchers-condition: and
    matchers:
      - type: status
        status:
          - 0
      - type: regex
        regex:
          - "^-rw-r--r--\\s+\\d+\\s+root\\s+\\w+"
        negative: true
# digest: 4a0a00473045022100f63b670201e473559afe079d0f0944bd69bb9c3e624727ade721819c25bef59402205cfe065102455e15e4e85727ea9d8d59c11730662b81b8706d5e4cfd710db02f:922c64590222798bb761d5b6d8e72950