Skip to content

Masscan: Internet-Scale Port Scanning Explained

Masscan explained: the fast port scanner that sweeps huge IP ranges, how it differs from Nmap, what its open-port findings mean, and how to spot it.

Mark KissBy , Founder & CEOUpdated 9 min read

External Network Penetration TestingFrom $4,200Fixed scope, free retest, no hourly billing.

Get my fixed price

Masscan is a free, open-source port scanner written by Robert Graham and built for one thing: speed at scale. It can scan the entire IPv4 internet for a single open port in minutes, and it brings that same speed to a single organization’s address space. Where a traditional scanner walks through hosts methodically, Masscan sprints across enormous ranges to answer one question fast: what is open?

We use it at the start of external engagements. Here is what it does and what it means when it finds an open port you did not know about.

What makes it different from Nmap

All three find open ports, but they are built for different priorities:

Masscan Nmap ZMap
Priority Raw speed, huge ranges Depth and detail Speed, single-port surveys
Scale Millions of IPs, many ports Tens to thousands The whole IPv4 space, usually one port
Output “This port is open” Service, version, OS, scripts “This host answered on this port”
Role Find what is open, fast Investigate what was found Internet-wide research sweeps

Masscan and Nmap are not competitors. They are sequential. Masscan sweeps a large range at speed to find open ports; Nmap then investigates those specific ports in depth. The workflow on any sizeable external engagement is Masscan to find, Nmap to understand. ZMap is the third name you will hear: another stateless, single-packet scanner built for internet-wide research, it typically scans one port across the whole IPv4 space per run and, like Masscan, reports only what answered, leaving service and banner detail to a companion tool. For an assessment, Masscan is the usual pick because it was built to sweep many ports across a defined range in one run.

The speed comes from a design choice: Masscan uses its own TCP/IP stack and transmits SYN probes asynchronously without waiting for each reply (a SYN scan), so it is bounded by how fast it can send packets rather than by round-trip latency. Its README claims the whole internet can be scanned in under five minutes at 10 million packets per second from one machine, but the default rate is a modest 100 packets per second: the speed is something an operator has to choose. Going beyond 2 million packets per second takes an Intel 10-gbps adapter and the PF_RING driver. It can also grab simple service banners, though that detail is still Nmap’s job.

As of November 2026, the latest tagged release is still 1.3.2 (January 2021), and 1.3.0 added IPv6 support. Like most port scanners it changes slowly, because the protocols it probes change slowly.

Masscan and Nmap are two entries in a longer kit. Our guide to penetration testing tools shows where each one fits.

Masscan options explained

Masscan borrows Nmap’s option style, so a command line in a test report is readable once you know a handful of options. These are the ones you are most likely to see, as described in the project’s manual page:

Option What it does What it tells you in a report
-p, --ports Sets the ports to scan. There is no default, so it must be given Which ports were covered. A port outside the list was not checked
--rate Packets sent per second. Default is 100 How hard the scan pushed your links and how visible it was
--exclude, --excludefile Removes an address, a range or a file of ranges from the scan Which addresses were deliberately never probed
--banners Completes the TCP connection and records the service banner Why a result shows a product string and not only “open”
--source-ip Sends from a chosen source address The address to look for in your firewall logs
--ping Adds an ICMP echo request to the scan Which hosts answered a ping, alongside the port results
-oX, -oJ, -oG, -oL, -oB Saves results as XML, JSON, grepable, simple list or binary The format of the raw results file passed to the next tool
--echo Writes out the current configuration without scanning The exact settings used, which can be kept as evidence

Running Masscan on your own network: authorization and safe rates

Scan only address ranges you own or have written permission to test. An address that used to be yours may now belong to someone else, so check the range list against your current allocations before each run, and put anything fragile or out of scope in an exclude file.

Rate is the safety control. The default of 100 packets per second is slow enough for almost any link. Raise it in steps and watch firewalls, VPN concentrators and older network devices for strain.

What it is used for in a test

Masscan answers the very first question of an external assessment: what is actually exposed to the internet?

Organizations are consistently wrong about this. The answer includes not just the intended web and mail servers but the forgotten ones: a database port open to the world, a management interface that should have been firewalled, a service someone stood up for a demo and never took down, an RDP port waiting to be brute-forced.

Masscan finds all of it quickly by sweeping the full external range for open ports, which then become the targets for deeper investigation. This is why external testing starts with breadth: you cannot assess an exposed service you never knew was listening.

Port discovery is one layer of that breadth. Once a web server turns up, a content discovery tool such as Gobuster does the equivalent job for the hidden paths on it.

What its findings mean

An open port is not automatically a vulnerability, but certain findings are consistently serious:

  • Databases exposed to the internet: MySQL (3306), MSSQL (1433), MongoDB (27017), Redis (6379), Elasticsearch (9200). These should almost never be internet-facing, and when they are, they are frequently unauthenticated.
  • Management and remote-access interfaces: RDP (3389), VNC (5900), SSH (22) on unexpected hosts. RDP exposed to the internet is a leading ransomware entry point.
  • Development and staging services: applications running with debug enabled or default credentials, exposed because a firewall rule was never applied.
  • Legacy protocols: Telnet, FTP, SMB open externally, none of which belong on the public internet.

Each of these is an attack path that exists because a service was reachable when it should not have been. The fix is almost always the same: it should not be exposed at all.

How defenders see it

Masscan is fast, but at full speed it is also loud. A burst of connection attempts across many ports in a short window is an obvious signature. Detection and defense:

  • Firewall and IDS logs show a spike of connections across a wide port range from one source.
  • Rate-based rules flag the volume.

But as with most external findings, detection is secondary. The primary control is attack-surface reduction:

  1. Default-deny at the perimeter: expose only the ports that must be public, and firewall everything else. Firewall penetration testing checks the rule set from the outside.
  2. Maintain an external asset inventory: know every IP you own and what runs on it. Our guide to external attack surface management covers how to keep that inventory current.
  3. Run your own scans regularly: attackers scan the whole internet continuously; scanning your own range before they do is the entire point of external testing. If you are not ready for a full test, validated vulnerability scanning is the lower-cost way to do it on a schedule.

How we use it in an engagement

Masscan is a reconnaissance tool, the opening move of external network penetration testing. It defines the target set, the exposed ports and services, that the rest of the engagement investigates and, where warranted, exploits. It makes no judgment about whether a service is vulnerable; it establishes what is reachable, which is the necessary first step to finding out. Our network penetration testing checklist shows where discovery sits among the other steps.

On our external tests the scan covers only the address ranges in the signed scope, at a rate agreed in writing so it does not degrade your links, from fixed source addresses we give you in advance so your team can tell our traffic from a real attacker’s. Every open port it reports is then checked by hand before it becomes a finding. External tests start at $4,200 with a free retest; the tiers are on the external penetration testing price page.

Frequently asked questions

How do I recognize internet-wide scanning in firewall logs? Look for one source address touching many of your IPs and many ports in a short window, most of the connections never completing a full handshake. Stateless scanners like Masscan and ZMap send probes without waiting for replies, so the pattern is a burst of half-open connections rather than a few complete sessions. A single source hitting sequential ports across a range, or the same port across every address you own, is the clearest signature. It is background noise on the public internet; what matters is which of those probes found an open port that should have been closed.

Can Masscan do a ping scan or host discovery? Partly. The --ping option adds an ICMP echo request to a scan, so Masscan can sweep a range for hosts that answer a ping. It does not do Nmap-style host discovery first: it probes every address in the range for every port you list.

Is there an online version of Masscan? No. The project publishes source code that you run from a machine you control, and there is no official hosted scanner. Shodan and Censys publish the results of their own internet-wide scans, which shows what is already known about your addresses without sending a packet.

Is it legal to scan with Masscan? The tool is legal to download and use. What matters is the target: scanning ranges you own or are authorized in writing to test is routine, and scanning other people’s networks without permission can break computer misuse laws and your provider’s terms.

What scan rate is safe on a production network? There is no single number. The default of 100 packets per second is safe on practically any link. Higher rates depend on the bandwidth and the devices in the path, so agree the rate with the network owner in advance and lower it if anything shows strain.

The short version

Masscan finds open ports across huge address ranges at extreme speed, which makes it the first tool in external reconnaissance: it tells you what is actually exposed to the internet, which is reliably more than you think. The dangerous findings (exposed databases, open RDP, forgotten services) are attack paths created by services being reachable when they should not be. The defense is a default-deny perimeter and an accurate inventory, validated by scanning your own footprint before an attacker scans it for you.

Want to know exactly what your organization exposes to the internet right now? Mapping that is where every external penetration test begins. Scope one here.

Mark Kiss

Written by

Mark Kiss, Founder & CEO

15+ years in the field. Focus: Offensive security & strategy. Part of the team that scopes, tests, and reports for our clients. Full profile →

All articlesRed Teaming

Find out what an attacker sees.

Tell us what to test and see your fixed price.

Prefer the full scoping questionnaire? 
Start the conversation

Get a quick proposal

We are online