Tool introduction: masscan

When performing a port scan against an IT infrastructure, we must assume that services can be accessed via any IP address. As a result, we must scan every IT system, even if we have received a server list from the client. Documentation can be incomplete, especially if the network has grown historically and was managed by multiple administrators. However, since we usually have limited time for a pentest, the choice of port scanner depends on the size of the network. While Nmap can be used to efficiently identify all services on an IT system, the tool is not optimized for a wide scan of several thousand IP addresses. However, this size is often used for internal IT infrastructures because the three private IPv4 address ranges can be used:

  • 10.0.0.0/8 (16.777.216 IPs)
  • 172.16.0.0/12 (1.048.576 IPs)
  • 192.168.0.0/16 (65.536 IPs)

For such cases, tools like masscan have been developed, which, according to their own statement, can scan the entire Internet for the accessibility of one port in only 3 minutes (see man page). This statement can be quite realistic if one would have an exceptionally good routing and network connection. As an example, web servers on the 192.168.0.0/16 network can be identified within a few minutes using the following command, since 2000 SYN packets are sent per second:

sudo masscan -p80,443 --rate=2000 -e tun0 192.168.0.0/16
-p: specifies the port(s) to be scanned
--rate: specifies the desired rate for transmitting packets per second.
-e: use the named raw network interface, such as "eth0" or "dna1"

However, care must be taken when configuring the rate limit, as we may negatively affect the availability of firewalls or other network devices. With masscan we are basically able to identify common services such as DNS servers, web servers, SSH servers, etc. in large network areas in a foreseeable time, while we can then use Nmap to carry out a complete port scan for the active IP addresses.

Section Navigation

binsec academy GmbH – Advanced Pentest Training Lab

binsec academy GmbH operates the Pentest Training Lab, a highly practical online platform dedicated to real penetration testing. Simulating complex corporate networks and advanced real-world attack scenarios within isolated lab environments, it is engineered to sharpen the skills of aspiring and professional penetration testers. Upon conquering our rigorous, fully practical examination, participants earn the distinguished Binsec Academy Certified Pentest Professional (BACPP) designation — proving their technical capability to methodically uncover and evaluate vulnerabilities in modern IT infrastructures.

Explore the Pentest Training Lab

binsec GmbH – Experts in Penetration Testing

binsec GmbH is a highly specialized penetration testing provider and the operative pentesting core of the binsec group. Since 2013, the company has focused exclusively on high-end, human-led penetration tests (pentests) and advanced red team simulations. Rejecting automated scans, our team of permanently employed, certified senior pentest experts delivers manual deep-dive assessments of critical digital systems: from web applications and APIs to mobile apps, complex network infrastructures, and cloud environments. As a dedicated assessment partner for highly regulated sectors such as Payment, Banking, and Healthcare, binsec GmbH provides clear risk evaluations and actionable reports to effectively secure business-critical systems.

Get Manual Expert Penetration Testing Services

Contact

binsec GmbH
Clemensstraße 6-8
60487 Frankfurt am Main
Germany

Legal notice

Director: Patrick Sauer
Authorized Officer: Dominik Sauer, Florian Zavatzki
Registration: Frankfurt am Main, HRB97277
Turnover Tax Identification No.: DE290966808