Connect a fresh, unpatched Windows server to the internet with a public IP address. Don’t advertise it anywhere. Don’t tell a soul. Don’t link it to a single domain name. Within five minutes, it will receive its first probe. Within fifteen minutes, automated bots will attempt brute-force logins using credentials harvested from global data breaches. Within an hour, your machine will likely be conscripted into a botnet—all without any human attacker ever knowing you exist.
This is the reality of automated mass scanning attacks. Defenders often imagine themselves being stalked by a sophisticated adversary—a sniper carefully selecting targets. The truth is far more chaotic. You’re standing in a torrential rain of bullets, and every single one is fired by machines that don’t care who you are. Tools like ZMap and Masscan allow a single attacker to scan the entire IPv4 address space—all 4.3 billion addresses—in under 45 minutes. They aren’t looking for you specifically. They’re looking for anything that answers.
The goal of this guide is straightforward: understand how mass scanning works at a mechanical level, recognize the real-world damage it causes, and implement a technical blueprint to make your infrastructure invisible to automated reconnaissance.
How Mass Scanning Engines Find Their Targets
Before you can defend against mass scanning, you need to understand exactly how the enemy’s reconnaissance pipeline operates. Modern internet scanning has become industrialized. What once required significant resources and weeks of patience now takes minutes and costs almost nothing.
Mass Scanning: The Digital Census
Technical Definition: Mass scanning is the automated process of sending high-speed connection requests—typically TCP SYN packets—to every possible IP address on the internet. The goal is to identify which hosts are online and which ports are accepting connections.
The Analogy: Picture a thief walking down an endless hotel corridor, methodically jiggling the handle of every single door. They don’t care who’s staying in room 4,217. They just want to know which doors are unlocked. That’s mass scanning. The scanner probes billions of “doors” looking for any that will open.
Under the Hood: Traditional network scanners like Nmap are stateful—they track the status of each connection attempt, waiting for responses and managing timeouts. This approach is thorough but slow. Modern mass scanners like ZMap and Masscan take a radically different approach: they’re stateless.
| Scanner | Architecture | Speed (Packets/Second) | Full IPv4 Scan Time | Use Case |
|---|---|---|---|---|
| Nmap | Stateful | ~1,000 | Weeks to months | Deep reconnaissance, service enumeration |
| ZMap | Stateless | 1.4 million | 44 minutes (1 Gbps) | Internet-wide research, vulnerability discovery |
| Masscan | Stateless | 10 million+ | Under 6 minutes | Aggressive reconnaissance, botnet building |
The stateless design works by firing TCP SYN packets as fast as the network interface allows, completely ignoring the traditional three-way handshake until a separate listener process catches the responses. ZMap uses cyclic multiplicative groups to iterate through IP addresses in a pseudorandom order, ensuring that probe traffic doesn’t accidentally concentrate on a single subnet and cause denial-of-service conditions.
According to the University of Michigan researchers who developed ZMap, a single machine with a 10-gigabit connection can complete an internet-wide scan in under five minutes.
Banner Grabbing: The Identification Phase
Technical Definition: Once a scanner identifies an open port, the next step is banner grabbing—reading the “welcome message” that many services automatically send to new connections. This reveals what software is running and, critically, what version.
The Analogy: The thief has found an unlocked door and pushed it open. Now they’re reading the nameplate on the desk to determine if this office belongs to someone worth robbing. A banner that reveals “Apache 2.4.49” tells the attacker exactly which vulnerabilities to try.
Under the Hood: Banner grabbing exploits a fundamental aspect of how network protocols work. When you connect to an SSH server, it announces itself with something like SSH-2.0-OpenSSH_8.2p1. When you connect to an HTTP server, the response headers often include the Server: field revealing the exact software and version.
| Service | Default Port | Typical Banner Content | Exploitation Value |
|---|---|---|---|
| SSH | 22 | OpenSSH version, protocol version | CVE database matching |
| HTTP | 80/443 | Web server software, version | Exploit kit targeting |
| FTP | 21 | Server software, sometimes OS hints | Legacy vulnerability exploitation |
| SMTP | 25 | Mail server version, hostname | Spam relay abuse, credential attacks |
| MySQL | 3306 | Version string, connection parameters | Database exploitation |
Attackers maintain automated pipelines that correlate these version strings against CVE databases. If your Apache server broadcasts a version with known remote code execution vulnerabilities, the attack begins within seconds of discovery.
Internet Background Radiation: The Noise Floor
Technical Definition: Internet background radiation refers to the constant, omnidirectional traffic that hits every public IP address regardless of whether it hosts any services. This includes misconfigured devices, legacy worms still propagating, researcher scans, and botnet recruitment attempts.
The Analogy: Think of the static on an old AM radio. That hiss is always present—annoying, persistent, and occasionally hiding a real signal you need to hear. Every public IP address receives this digital static continuously.
Under the Hood: GreyNoise Intelligence operates a global network of nearly 4,000 sensors across 200+ countries, tracking this background radiation in real-time. Their 2025 Mass Internet Exploitation Report found that mass exploitation has become characterized by relentless automation and the rapid weaponization of new vulnerabilities.
| Metric | 2024 Finding | Implication |
|---|---|---|
| Exploitation speed | Within hours of CVE disclosure | Patching windows have collapsed |
| Legacy CVE targeting | 40% of exploited CVEs were 4+ years old | Old vulnerabilities never die |
| New vulnerability tags created | 573 tags covering 394 CVEs | Attack surface constantly expanding |
| Global sensor coverage | 4,000 sensors in 200+ countries | Comprehensive visibility into scanning patterns |
This background noise isn’t just annoying—it actively degrades your security posture. Every public IP receives several gigabytes of junk traffic annually.
The 2025-2026 Threat Landscape: What’s Changed
The mass scanning ecosystem continues to evolve. Understanding current trends helps you anticipate where attackers are focusing their automated reconnaissance.
AI-Enhanced Scanning Operations
Threat actors have begun integrating large language models into their reconnaissance pipelines. While the scanning itself remains mechanically identical, AI assists with banner analysis, vulnerability correlation, and exploit selection. GreyNoise researchers observed patterns suggesting attackers may use LLMs to help evade detection techniques at the network level, particularly in cryptomining campaigns targeting PHP-based applications.
The IPv6 Reconnaissance Challenge
IPv6’s massive address space (340 undecillion addresses) makes traditional mass scanning impractical. However, attackers have adapted by harvesting IPv6 addresses from DNS records, certificate transparency logs, and HTTP headers. Organizations assuming IPv6 provides “security through obscurity” are discovering that targeted enumeration remains highly effective.
Coordinated Botnet Surges
GreyNoise tracked a coordinated botnet operation in late 2025 involving over 100,000 unique IP addresses from more than 100 countries targeting RDP services in the United States. These coordinated surges represent a shift from random scanning to synchronized campaigns designed to overwhelm detection systems.
Pro-Tip: Configure your SIEM to correlate scanning activity across multiple ports. When the same source IP probes SSH, RDP, and VNC within a short window, it indicates automated reconnaissance rather than legitimate traffic.
The Victim’s Perspective: Real-World Pain Points
Mass scanning doesn’t just exist in abstract threat models. It creates concrete operational problems that security teams deal with every day.
Log Fatigue: When Noise Defeats Signal
Technical Definition: Log fatigue occurs when security analysts become desensitized to alerts due to overwhelming volume, causing them to miss genuine threats buried in automated noise.
The Analogy: Imagine a car alarm that goes off every time the wind blows. After the hundredth false alarm, you stop looking out the window. That’s exactly what happens when your SSH logs show 10,000 failed login attempts daily—you stop reading them carefully.
Under the Hood: The mathematics of alert fatigue work against defenders. A typical internet-facing SSH server receives 10,000+ brute-force attempts per day. Even with a 99.9% true-negative rate on your detection rules, you’d still have 10 alerts requiring investigation—every single day.
| Daily Login Attempts | False Positive Rate | Daily Alerts Requiring Review | Annual Investigation Hours (10 min/alert) |
|---|---|---|---|
| 10,000 | 0.1% | 10 | 608 hours |
| 10,000 | 0.01% | 1 | 61 hours |
| 50 (after port change) | 0.1% | 0.05 | ~3 hours |
This is exactly what sophisticated attackers count on. They launch their real attack knowing it will be lost in a sea of automated garbage.
The Shadow IT Trap: Exposed in Seconds
Technical Definition: Shadow IT refers to information technology systems deployed without explicit organizational approval, often lacking security controls and unknown to the security team.
The Analogy: A developer leaving a test database running is like leaving your house keys under the doormat “just for a minute”—except in this case, thousands of strangers are systematically checking under every doormat on your street, every few minutes, forever.
Under the Hood: The timeline of exposure is terrifyingly short. Shodan, Censys, and malicious scanners continuously index the internet. When a developer spins up an unauthenticated MongoDB instance, the discovery-to-compromise chain can complete before they finish their coffee.
| Event | Typical Timeline | What Happens |
|---|---|---|
| Service exposed | T+0 | Developer starts test database without authentication |
| Shodan indexing | T+15 minutes to T+4 hours | Legitimate scanner discovers and catalogs the service |
| Malicious discovery | T+1 minute to T+24 hours | Botnet scanners identify the open port |
| Data exfiltration/deletion | T+5 minutes to T+48 hours | Meow attack or ransomware wipes the database |
According to Shodan’s database indexing, over 194,000 MongoDB instances have been found exposed without authentication. The Meow attack campaign of 2020-2021 wiped exposed databases, leaving only ransom notes. At its peak, Shodan indexed over 13,000 compromised Elasticsearch instances.
Pro-Tip: Run this command weekly to detect services listening on all interfaces:
netstat -tulpn | grep "0.0.0.0" | grep -v "127.0.0.1"
Bandwidth Drain and Resource Exhaustion
On smaller networks, scanning traffic creates real performance problems. TCP SYN packets consume connection table entries in stateful firewalls. When your firewall’s connection table fills up, legitimate traffic starts getting dropped. Enterprise networks absorb this traffic without noticing, but small businesses with consumer-grade equipment are genuinely impacted.
The Defense Strategy: Becoming Invisible
The goal isn’t to fight every packet or block every scanner. That’s impossible. Instead, the objective is to make your infrastructure “dark” to automated reconnaissance.
Step 1: Relocate Standard Services to Non-Default Ports
Automated scanners overwhelmingly target standard ports: SSH on 22, RDP on 3389, HTTP on 80, HTTPS on 443. Moving SSH to port 45222 or 54983 immediately eliminates 99% of the automated brute-force attempts.
Critical Clarification: This is not security. An attacker who specifically targets your organization will run a full port scan and find your relocated SSH server in minutes. But moving to non-default ports doesn’t protect you from targeted attacks—it eliminates untargeted noise.
| Service | Default Port | Recommended Non-Standard Range | Log Noise Reduction |
|---|---|---|---|
| SSH | 22 | 40000-50000 | 95-99% |
| RDP | 3389 | 50000-60000 | 90-95% |
| Database Ports | 3306, 5432, 27017 | Never expose directly | 100% (if not exposed) |
| Admin Panels | 80, 443 | VPN-only access | 100% |
Step 2: Implement Port Knocking or Single Packet Authorization
Technical Definition: Port knocking is a firewall configuration where all ports appear closed until a specific “secret knock”—a sequence of connection attempts to predetermined ports—is received.
The Analogy: Think of a Prohibition-era speakeasy. The door has no handle, no sign, nothing indicating it opens at all. But if you knock three times fast, pause, then knock twice slow, someone slides open a viewport and lets you in.
Under the Hood: Traditional port knocking monitors for a specific sequence of SYN packets to closed ports. Single Packet Authorization (SPA) represents the modern evolution, using a single encrypted UDP packet containing authentication credentials, a timestamp, and a cryptographic signature.
| Method | Security Level | Complexity | Replay Attack Resistance |
|---|---|---|---|
| Basic Port Knocking | Medium | Low | None (sequence can be captured) |
| Cryptographic Port Knocking | High | Medium | Moderate (time-limited tokens) |
| Single Packet Authorization (SPA) | Very High | Medium-High | Strong (encrypted, timestamped) |
fwknop (FireWall KNock OPerator) is the standard open-source implementation. Here’s a basic implementation:
# Server-side: Install and configure fwknop
sudo apt install fwknop-server
sudo nano /etc/fwknop/access.conf
# Add access stanza:
# SOURCE ANY
# KEY_BASE64 [your-base64-key]
# HMAC_KEY_BASE64 [your-hmac-key]
# OPEN_PORTS tcp/22
# FW_ACCESS_TIMEOUT 30
# Client-side: Send SPA packet
fwknop -A tcp/22 -D your.server.ip --key-base64 [your-key]
With SPA configured, your SSH port appears completely closed to every scanner on the internet.
Step 3: Leverage Anti-Threat Intelligence with GreyNoise
Traditional threat intelligence tells you which IPs are known to be malicious. Anti-threat intelligence flips this concept: it tells you which IPs are scanning everyone, not just you.
The Logic: If an IP address hits your firewall and GreyNoise confirms that same IP is simultaneously scanning 50,000 other organizations, you know with high confidence it’s automated. Block it without further investigation. However, if an IP hits only your infrastructure, that’s potentially a targeted attack requiring deeper analysis.
| GreyNoise Classification | Meaning | Recommended Action |
|---|---|---|
| Benign | Known scanner (academic research, security vendors) | Allow or monitor |
| Malicious | Known attacker infrastructure | Block immediately |
| Unknown (scanning many) | New scanner hitting everyone | Auto-block via threat feed |
| Unknown (scanning you only) | Potentially targeted | Investigate immediately |
The Defensive Toolbelt: Free and Paid Options
Free Tier: Essential Foundations
Fail2Ban monitors log files for repeated failed authentication attempts and dynamically bans offending IP addresses. Basic configuration:
# /etc/fail2ban/jail.local
[sshd]
enabled = true port = ssh filter = sshd logpath = /var/log/auth.log maxretry = 3 bantime = 3600 findtime = 600
CrowdSec adds collaborative threat intelligence to the Fail2Ban concept. When your instance detects an attack, it shares that information with the CrowdSec network. In return, you receive blocklists compiled from attacks detected across all participants.
| Tool | Primary Function | Setup Complexity | Ongoing Maintenance |
|---|---|---|---|
| Fail2Ban | Brute-force prevention | Low | Low |
| CrowdSec | Collaborative threat blocking | Medium | Low |
| Shodan Monitor | External attack surface visibility | Low | None (alerting only) |
| UFW/iptables | Basic packet filtering | Low-Medium | Low |
Paid Tier: Enterprise-Grade Protection
Cloudflare and AWS WAF absorb scanning traffic at their edge before it reaches your servers. Zero Trust Network Access (ZTNA) tunnels, such as Cloudflare Tunnel or Zscaler Private Access, represent the most robust approach. With ZTNA configured, your server has zero open public ports—it initiates an outbound tunnel to the provider’s edge network.
To Masscan, your server doesn’t exist. It has no listening ports, no banners, nothing to discover.
Monitoring Your Attack Surface Exposure
Knowing what attackers can see about your network is half the battle. Regular attack surface audits should be part of your security program.
External Reconnaissance Tools
Shodan.io maintains a searchable database of internet-connected devices and their banners. Search for your IP ranges or domain names to see what Shodan has indexed. If you find exposed services you didn’t know about, you’ve discovered them before attackers did.
Censys.io provides similar capabilities with additional protocol coverage and certificate analysis. It’s particularly useful for identifying services using expired or misconfigured TLS certificates.
Pro-Tip: Set up Shodan Monitor alerts for your IP ranges. You’ll receive notifications whenever Shodan discovers new services—catching Shadow IT deployments before attackers do.
Internal Visibility Commands
Deploy these commands regularly to detect exposure:
# Find all services listening on public interfaces
ss -tulpn | grep -v "127.0.0.1" | grep LISTEN
# Check for databases exposed to the world
netstat -an | grep -E ":(3306|5432|27017|6379|9200)" | grep LISTEN
# Audit firewall rules for overly permissive configurations
sudo iptables -L -n -v | grep -E "ACCEPT.*0.0.0.0/0"
Network flow monitoring reveals communication patterns that indicate compromise. Servers making outbound connections to unusual destinations, especially on IRC ports or known command-and-control infrastructure, warrant immediate investigation.
Workflow Optimization: Solving Common Pain Points
| Problem | Root Cause | The Fix |
|---|---|---|
| Server sluggishness during scan waves | High volume of SYN packets consuming connection table | Configure firewall to drop invalid packets at the kernel level using SYN cookies |
| Log storage filling rapidly | Brute-force bots generating thousands of entries | Switch to SSH key-only authentication; disable password auth entirely |
| Shadow IT data exposure | Developer test databases indexed by Shodan | Deploy automated asset discovery scripts checking for services on 0.0.0.0 |
| Alert fatigue from scanning noise | Too many events requiring human review | Integrate GreyNoise to automatically classify and suppress known scanner traffic |
Legal Boundaries and Ethical Considerations
Port scanning is generally legal in most jurisdictions. It’s analogous to knocking on someone’s door—checking whether a service is present doesn’t constitute unauthorized access. However, some ISPs prohibit scanning in their terms of service.
Do not retaliate. The vast majority of scanning IPs are compromised devices—home routers and IoT cameras whose owners have no idea they’re participating in attacks. Attacking those IPs makes you the criminal.
Research scanning requires disclosure. If you operate legitimate security research scans, register a domain with a clear opt-out mechanism, provide abuse contact information, and respond promptly to complaints.
Conclusion: Silence Is Security
You cannot stop automated mass scanning attacks. They are a fundamental characteristic of the modern internet—as inevitable as weather. Every public IP address will receive probe traffic continuously, forever.
The strategic objective isn’t fighting every packet. It’s making your infrastructure invisible to automated reconnaissance while preserving your ability to detect and respond to targeted attacks. Relocate services to non-default ports. Implement SPA or port knocking. Deploy community-based threat intelligence. Use cloud providers as your frontline filter.
When scanning bots sweep across the IPv4 address space—all 4.3 billion addresses in six minutes—they should find nothing at your location. No open ports. No service banners. No indication that anything valuable exists at your IP range. You become dark, indistinguishable from the empty addresses around you.
Take action today: Go to Shodan.io. Enter your organization’s IP addresses. If you see results showing exposed services, the scanning bots saw those same results weeks ago. Close the ports. Disappear from the census.
Frequently Asked Questions (FAQ)
Is it illegal to scan the entire internet?
Port scanning itself is generally legal in most jurisdictions because it’s analogous to checking if a door is locked rather than opening it. However, exploiting any vulnerabilities discovered crosses into unauthorized access. Some ISPs prohibit scanning in their acceptable use policies, and aggressive scanning can trigger civil liability if it disrupts services.
How quickly can modern tools scan all IPv4 addresses?
Using Masscan on a 10-gigabit connection, the entire IPv4 address space—approximately 4.3 billion addresses—can theoretically be scanned in under 6 minutes. Practical speeds are typically 45-60 minutes to avoid triggering upstream network congestion. ZMap completes single-port scans of the entire internet in 44 minutes on a standard gigabit connection.
Does changing my SSH port actually improve security?
Yes, but not in the way many assume. Moving SSH from port 22 to a high random port provides zero protection against a targeted attacker who will simply run a full port scan. However, it eliminates 95-99% of automated brute-force attempts from bots that only probe default ports. The real benefit is operational: dramatically cleaner logs and improved ability to detect actual targeted attacks.
What distinguishes Shodan from a malicious botnet?
Shodan is a search engine for security researchers that scans politely, respects opt-out requests, and provides legitimate defensive value. Botnets like Mirai scan aggressively to compromise devices, install malware, and launch DDoS attacks. Shodan helps defenders discover their exposed assets; botnets exploit those same exposures for criminal purposes.
What exactly is internet background radiation?
Internet background radiation is the constant stream of unsolicited network traffic that hits every public IP address regardless of what services it hosts. This includes probes from academic researchers, commercial scanners like Shodan and Censys, legacy worms still propagating years after their creation, and botnets continuously recruiting new members.
How do I know if I’m being targeted versus randomly scanned?
Compare the scanning IP against threat intelligence databases like GreyNoise. If the IP is hitting thousands of other organizations simultaneously, it’s automated mass scanning—block it and move on. If the IP appears only in your logs and isn’t part of known scanning campaigns, investigate further. Other indicators of targeted activity include reconnaissance focused on your specific technology stack and probes that follow logical enumeration patterns.
Sources & Further Reading
- SANS Internet Storm Center (isc.sans.edu) – Daily metrics on internet-wide threat activity
- CISA: Reducing Attack Surface (cisa.gov/shields-up) – Federal guidance on minimizing discoverability
- GreyNoise Intelligence (greynoise.io) – Real-time data on internet background noise
- GreyNoise 2025 Mass Internet Exploitation Report (greynoise.io/resources) – Annual analysis of mass exploitation trends
- MITRE ATT&CK T1595: Active Scanning (attack.mitre.org) – Technical framework for reconnaissance techniques
- ZMap Project (zmap.io) – Academic research on internet-wide scanning methodology
- Masscan GitHub Repository (github.com/robertdavidgraham/masscan) – High-speed port scanner documentation
- Shodan.io (shodan.io) – Search engine for internet-connected devices
- fwknop Project (cipherdyne.org/fwknop) – Single Packet Authorization implementation guide
- CrowdSec (crowdsec.net) – Collaborative threat intelligence platform




