id: insecure-etc-exports-permissions

info:
  name: macOS Insecure /etc/exports Permissions
  author: geeknik
  severity: high
  description: |
    Identifies insecure permissions on the /etc/exports file used to configure NFS exports on macOS.
  impact: |
    Insecure permissions on /etc/exports could allow unauthorized users to modify the file and gain access to exported filesystems.
  remediation: |
    Ensure that the /etc/exports 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,nfs

self-contained: true

code:
  - engine:
      - sh
      - bash
    source: |
      ls -l /etc/exports 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: 4a0a00473045022100f0a90c14abd2b8151c008c14b461df041bd982ed2afe14cdb307fafb20f8934e0220363866f2cc52ca7b8ac63e881c4352af6b44aadf4571832c3cac632cf8a3fbdb:922c64590222798bb761d5b6d8e72950