macOS Server Services That Listen Without Warning

macOS Server Services That Listen Without Warning

A Mac mini racked in a colo facility or left on an office desk with a public IP can expose more macOS server services than anyone set up on purpose. This article covers which macOS listeners appear without obvious warning, how to find them from the inside and the outside, and how to shut down the ones you don’t need without breaking build pipelines or remote access. It’s written for sysadmins running Macs as CI runners, file servers or remote workstations who assume the machine has the same small footprint as a laptop.

Why Macs End Up Acting as Servers

Apple discontinued the standalone macOS Server app in 2022. Many people read that as “Macs don’t run server services anymore.” In practice, most of what still matters lives directly in System Settings under General > Sharing, and turning on any of those toggles starts a network listener on the machine.

Mac hosting has grown, too. Mac minis at MacStadium, AWS EC2 Mac instances and in-house racks of M-series machines building iOS apps all treat the Mac as infrastructure. Their attack surface still gets managed as if they were desktops.

Which macOS Server Services Listen by Default or by Accident

A seasoned network security engineer auditing a Mac starts with a short list of usual suspects. These are the ones that show up most often in external scans:

AirPlay Receiver – the ControlCenter process listens on TCP 5000 and 7000, and it’s enabled by default on macOS Monterey and later. Developers often notice it first when a Flask app fails to bind to port 5000.
Screen Sharing and Remote Management – VNC on TCP 5900, plus Apple Remote Desktop on 3283. If “VNC viewers may control screen with password” is enabled, the legacy VNC password scheme comes with it.
Remote Login – SSH on TCP 22, which is often enabled once during setup and then forgotten.
File and Printer Sharing – SMB on 445 and CUPS on 631. AFP on 548 can still appear on older systems.
mDNSResponder and rapportd – Bonjour on UDP 5353, and Continuity services on random high ports in the 49152-65535 range.

Remote Apple Events (TCP 3031) and Media Sharing (DAAP on 3689) are less common. They still turn up on machines that were previously used as personal desktops.

A Familiar Scenario: The Build Mac in the Rack

A team leases two Mac minis with public IPv4 addresses to run Xcode builds for a GitHub Actions self-hosted runner. Setup takes an afternoon: an engineer turns on Screen Sharing to click through the Apple ID and Xcode license prompts, enables Remote Login for the runner and leaves everything else at defaults.

Six months later, an external scan of the range shows 22, 5000, 5900 and 7000 open on both hosts. Nobody had decided to publish VNC to the internet. Within hours of a new IP being announced, Censys and Shodan list port 5900 with a “RFB 003.889” banner that identifies the host as a Mac. After that, brute-force traffic against the VNC password arrives continuously.

The fix took 20 minutes. Finding the problem took half a year, because nobody had checked the machines from the outside.

Myth: “The macOS Firewall Is On, So the Ports Are Closed”

This misconception is the most common one. The macOS Application Firewall (socketfilterfw) filters by application, not by port, and by default it automatically allows built-in signed software to receive incoming connections. Screen Sharing, sshd, ControlCenter and smbd are all Apple-signed, so they get through even when the firewall shows “On.”

Stealth mode doesn’t fix this either. It suppresses ICMP echo replies and responses to closed ports. Open services still complete the TCP handshake, so a scanner still finds 5900.

Real port-level control requires the packet filter (pf) underneath the Application Firewall, a network firewall upstream, or a cloud security group. On EC2 Mac instances, the security group is the actual control. On a colo Mac mini with a raw public IP, there may be no other control at all.

How to Find Listening Services on a Mac, Step by Step

The benefit is a complete inventory you can compare against what the machine is actually supposed to do. An experienced practitioner works from the inside out, then verifies from the outside in:

First, run sudo lsof -iTCP -sTCP:LISTEN -n -P and sudo lsof -iUDP -n -P. These show each listening socket along with its process name and PID. Watch for sockets bound to * or 0.0.0.0 rather than 127.0.0.1.

Second, map each process to its launchd job with sudo launchctl list, and check /Library/LaunchDaemons for third-party additions. Endpoint agents, license servers and VPN clients often install their own listeners there.

Third, check the firewall state with /usr/libexec/ApplicationFirewall/socketfilterfw –getglobalstate and –listapps. This shows which applications are explicitly allowed through.

Fourth, run an external scan from a host outside your network against both the IPv4 address and any global IPv6 address. The external scan shows what an attacker actually sees. The internal list only shows what is listening. If something unexpected appears, follow a structured process like the ones described in runbooks for verifying an unexpected listening service before you kill it.

Shutting Services Down Without Breaking Things

Turn off AirPlay Receiver in System Settings > General > AirDrop & Handoff. A build or file server has no reason to accept AirPlay streams. To disable Remote Management, use the ARD kickstart tool at /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -stop. To turn off Remote Login, use sudo systemsetup -setremotelogin off.

If the services have to stay on, restrict who can reach them. Limit SSH to key authentication in /etc/ssh/sshd_config.d/, restrict the users allowed to use Screen Sharing, and put both behind a VPN or a pf rule that only accepts your management subnet. pf rules belong in a custom anchor rather than directly in /etc/pf.conf, because macOS updates can overwrite that file. After any change, check the result with external scans that validate your firewall rules.

Edge cases matter. A Mac in an MDM-managed fleet using Jamf Pro or Kandji may get Remote Management re-enabled by a configuration profile, so fix it in the MDM, not on the device. On air-gapped lab Macs, Bonjour and rapportd are usually harmless and not worth fighting. Small studios with fewer than 10 Macs behind consumer NAT have less exposure over IPv4, but not necessarily over IPv6.

Common Mistakes with Mac Port Exposure

The first mistake is trusting the NAT. Many ISPs and hosting providers now assign global IPv6 addresses, and a Mac on such a network accepts inbound IPv6 connections unless something filters them. IPv6 addressing changes port exposure in ways that IPv4-only checks miss completely.

The second mistake is auditing once at setup. Major macOS upgrades have re-enabled sharing features and introduced new ones. AirPlay Receiver arriving on Macs with Monterey in 2021 is the clearest example. Re-scan after every major OS update.

The third mistake is treating random high ports as noise. rapportd on a 49xxx port is normal. An unsigned binary on 4444 or 8888 is not. Check which process owns the port before you dismiss it.

FAQ

Is AirPlay Receiver on ports 5000 and 7000 a real security risk?
On a server with a public IP, yes. It’s an unnecessary exposed service with its own parsing code, and turning it off removes that code from your attack surface at no cost.

Does turning on stealth mode hide open ports on macOS?
No. Stealth mode only stops replies to pings and connection attempts on closed ports. Services that are actually listening still answer scanners.

How often should a Mac used as a server be scanned externally?
Continuously or at least daily, plus a manual scan after every macOS update and MDM profile change. Those are the moments when listeners tend to reappear.

Summary: Treat Every Mac with a Public IP as a Server

macOS starts listeners through simple toggles, an Application Firewall that trusts Apple’s own binaries, and OS upgrades that bring new features. None of these changes looks like “opening a port,” which is why they get missed. Inventory with lsof, enforce with pf or an upstream firewall, and confirm with an external scan over both IPv4 and IPv6.

One practical habit pays off quickly: after every macOS update, run the lsof listener check and compare the output against the previous run. A diff of a few lines takes 30 seconds to read and catches most surprises before scanners do.