id: os_httpd_disable
title: Disable the Built-in Web Server
discussion: |
  The built-in web server which is managed by launchd is a non-essential service built into macOS and _MUST_ be disabled and not running.

  NOTE: The built in web server service is disabled at startup by default macOS.
references:
  nist:
    cce:
      macos_27:
        - CCE-XXXXX-X
      macos_26:
        - CCE-95204-4
      macos_15:
        - CCE-94205-2
      macos_14:
        - CCE-92805-1
    800-53r5:
      - AC-3
      - AC-17
    800-171r3:
      - 03.01.02
      - 03.04.06
  disa:
    cci:
      - CCI-000213
    srg:
      - SRG-OS-000080-GPOS-00048
    disa_stig:
      macos_26:
        - APPL-26-002008
      macos_15:
        - APPL-15-002008
      macos_14:
        - APPL-14-002008
    cmmc:
      - AC.L1-3.1.1
  bzk:
    bio:
      - 8.27
      - 8.27.01
  hhs:
    hicp:
      - 2.L.A
  cis:
    benchmark:
      macos_26:
        - 4.2 (level 1)
      macos_15:
        - 4.2 (level 1)
      macos_14:
        - 4.2 (level 1)
    controls_v8:
      - 4.1
      - 4.8
platforms:
  macOS:
    '27.0': {}
    '26.0':
      benchmarks:
        - name: cis_lvl1
        - name: cis_lvl2
        - name: disa_stig
          severity: medium
        - name: nlmapgov_plus
    '15.0':
      benchmarks:
        - name: cis_lvl1
        - name: cis_lvl2
        - name: disa_stig
          severity: medium
        - name: nlmapgov_plus
    enforcement_info:
      check:
        shell: |-
          result="FAIL"
          enabled=$(/bin/launchctl print-disabled system | /usr/bin/grep '"org.apache.httpd" => enabled')
          running=$(/bin/launchctl print system/org.apache.httpd 2>/dev/null)

          if [[ -z "$running" ]] && [[ -z "$enabled" ]]; then
            result="PASS"
          elif [[ -n "$running" ]]; then
            result="${result}  RUNNING"
          elif [[ -n "$enabled" ]]; then
            result="${result}  ENABLED"
          fi
          echo $result
        result:
          string: PASS
      fix:
        shell: |-
          /usr/sbin/apachectl stop 2>/dev/null
          /bin/launchctl disable system/org.apache.httpd
tags:
  - 800-53r5_low
  - 800-53r5_moderate
  - 800-53r5_high
  - 800-171
  - cisv8
  - cnssi-1253_low
  - cnssi-1253_high
  - cmmc_lvl2
  - cmmc_lvl1
  - cnssi-1253_moderate
  - hicp_lp
