Skip to content
statance
MenuClose
← All ports

Port 5000: Flask / Docker Registry / AirPlay

Medium risk

Port 5000 is a popular default: the Flask development server, Docker’s self-hosted registry and Synology DSM all use it, and macOS Monterey and later run the AirPlay Receiver on it. It should not be reachable from the public internet.

Port
5000
Protocol
TCP
Service
Flask / Docker Registry / AirPlay
Expose to internet?
No
Also used by
Flask development server, Docker Registry, Synology DSM (HTTP), macOS AirPlay Receiver, UPnP on some routers

Is port 5000 safe to open?

It depends on what is listening. A Flask dev server is not built for public traffic, and with debug mode on it exposes an interactive console that can run code. A registry without authentication lets anyone pull or push images. Synology DSM exposed directly is a common ransomware target.

How to secure Flask / Docker Registry / AirPlay

  • Never run Flask with debug=True on a public interface; use gunicorn or uWSGI behind a proxy.
  • Protect Docker Registry with TLS and authentication (htpasswd or token auth).
  • For Synology, use QuickConnect or a VPN rather than forwarding 5000/5001.
  • Check the owner with sudo ss -ltnp 'sport = :5000' or lsof -i :5000.

Check if port 5000 is open

Linux: what is listening on this port

sudo ss -tlpn | grep ':5000 '

Windows (PowerShell): what is listening

Get-NetTCPConnection -LocalPort 5000 -State Listen | Select-Object LocalAddress, OwningProcess, @{n='Process';e={(Get-Process -Id $_.OwningProcess).Name}}

From another machine: is it reachable

nc -zv HOST 5000 # or nmap -p 5000 HOST # Windows Test-NetConnection HOST -Port 5000

Test the Flask / Docker Registry / AirPlay service itself

curl -sI http://HOST:5000/

Restrict port 5000 in the firewall

Replace 10.0.0.0/8 with the network or address that needs access. Docker publishes container ports through its own iptables rules, which bypass ufw; bind published ports to 127.0.0.1 (-p 127.0.0.1:5000:5000) instead of relying on the host firewall.

ufw: allow only your private network, deny everyone else

sudo ufw allow from 10.0.0.0/8 to any port 5000 proto tcp sudo ufw deny 5000/tcp

firewalld: allow one source network only

sudo firewall-cmd --permanent --remove-port=5000/tcp sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.0/8" port port="5000" protocol="tcp" accept' sudo firewall-cmd --reload

iptables

sudo iptables -A INPUT -p tcp --dport 5000 -s 10.0.0.0/8 -j ACCEPT sudo iptables -A INPUT -p tcp --dport 5000 -j DROP

Windows Firewall (PowerShell, as Administrator)

New-NetFirewallRule -DisplayName "Block 5000 from internet" -Direction Inbound -Protocol TCP -LocalPort 5000 -RemoteAddress Internet -Action Block

Monitor port 5000

Run a TCP port monitor against your public IP on port 5000: here, a failed connection is the healthy result, so you know the firewall is still doing its job. On Linux, the Statance agent also reports every listening port on the server. TCP port monitoring.

Related ports

Port 3000Grafana / Node.js development serversMedium risk
Port 8000HTTP alternate / development serversMedium risk
Port 8080HTTP alternateMedium risk

FAQ

Why is port 5000 already in use on my Mac?

On macOS Monterey and later, the AirPlay Receiver listens on port 5000 (and 7000). Turn it off in System Settings > General > AirDrop & Handoff, or run your app on another port.

What is port 5000 used for?

Port 5000 is a popular default: the Flask development server, Docker’s self-hosted registry and Synology DSM all use it, and macOS Monterey and later run the AirPlay Receiver on it. It is also used by Flask development server, Docker Registry, Synology DSM (HTTP), macOS AirPlay Receiver, UPnP on some routers.

Is it safe to open port 5000?

Not to the public internet. It depends on what is listening. A Flask dev server is not built for public traffic, and with debug mode on it exposes an interactive console that can run code. A registry without authentication lets anyone pull or push images. Synology DSM exposed directly is a common ransomware target.

Is port 5000 TCP or UDP?

Flask / Docker Registry / AirPlay uses TCP on port 5000.

How do I check if port 5000 is open?

On the server, run sudo ss -tulpn | grep ':5000 ' (Linux) or Get-NetTCPConnection -LocalPort 5000 (Windows) to see what is listening. From another machine, run nc -zv HOST 5000 or Test-NetConnection HOST -Port 5000.

All ports →

Know the moment a port stops answering.

TCP, HTTP, DNS and SSL checks from six regions, plus server metrics from a one-line agent.