id: insecure-etc-hostconfig-permissions

info:
  name: macOS Insecure /etc/hostconfig Permissions
  author: geeknik
  severity: high
  description: |
    Evaluates permissions on the /etc/hostconfig file used to configure system services on macOS.
  impact: |
    Insecure permissions on /etc/hostconfig could allow unauthorized users to modify the file and reconfigure system services.
  remediation: |
    Ensure that the /etc/hostconfig 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/hostconfig 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: 4b0a00483046022100d47f5829d759ebef3fbef226cb5a917a07bfff78791407217fd529a265a81876022100cb5bff86e6fa1eaf80f0f189250c9e59236c5c3f074d0499c96d642e6be6e1eb:922c64590222798bb761d5b6d8e72950