Skip to content
InternetData

Duplicate SSH host keys: 3.9 million hosts share theirs

Of 17.2 million SSH hosts on IPv4, 3.9 million share their host key with another host. Most share it inside one network; 520,867 across six or more.

Published 3 min read

On this page
  1. Two kinds of sharing
  2. The largest keys
  3. What to do about it
  4. How we counted

An SSH host key is how a server proves it's the machine you connected to before: your client remembers the key and warns you when it changes. That only works while each key belongs to one machine. Two hosts with the same key can pass for each other.

The count most pages still cite is from February 2015, when Shodan found one key on more than 250,000 devices, all of them Dropbear on one ISP's networking equipment. We counted again with SSH IP, which holds every host that completed an SSH handshake on TCP port 22, with its host key's fingerprint.

Of the 17,189,095 IPv4 hosts seen in the last week of September, 3,901,805 (22.7%) share their host key with at least one other host. They share 523,559 keys between them, and 777,145 are on keys found on more than 1,000 hosts.

Two kinds of sharing

A shared key means one of two things. The first is one operator's own setup answering on many addresses: a load balancer, one machine answering for a whole range, or a VM image cloned across a fleet. The key stays with that operator, though a break-in on one machine still gives the attacker a key the others use too.

The second is one key built into many devices: firmware on routers and modems, or a public image. Then anyone who owns one device, or downloads the firmware, holds the private key for all of them, and can pass for any of them.

To tell the two apart, we matched every address to the network that announces it with IP ASN and counted how far each key spreads:

Where the key appearsKeysHosts
One /24132,977808,073
One network, several /24s328,8771,988,914
2 to 5 networks59,939583,951
6 or more networks1,766520,867

71.7% of the hosts that share a key share it inside one network. Of those spread over several /24s, 65.9% are in hosting networks, where cloud fleets and cloned images sit.

The 1,766 keys on six or more networks look like the second kind: 65.5% of their 520,867 hosts are in ISP networks.

The largest keys

  • A Dropbear key on 118,124 hosts, in 992 networks and 6,945 /24s, 86% of them in one ISP's network. Dropbear is the small SSH server that routers and other embedded devices run, so this is one firmware image on customer equipment, the pattern Shodan found in 2015.
  • An OpenSSH 5.3 key on 57,319 addresses, all in one university's network, across 852 /24s: one machine answering for a whole range, not 57,000 servers.
  • An ARRIS key on 37,121 hosts in 121 networks, 57% of them in one ISP. ARRIS makes cable modems.
  • A Dropbear 0.50 key on 14,897 hosts in 29 networks, 99.5% of them in one ISP.
  • An OpenSSH 9.2 Debian key on 12,182 addresses across 5,148 /24s of one hosting network: one image cloned across a fleet, or one front end answering for the range.

What to do about it

  • Regenerate the keys on every VM made from an image: delete /etc/ssh/ssh_host_*, run ssh-keygen -A and restart sshd. cloud-init does this on first boot by default, so the images to check are the ones you build and clone yourself.
  • Treat a vendor's built-in key as public, since anyone with the firmware has it. Turn SSH off on the internet-facing side of those devices, or update to firmware that makes a key per device.
  • Look for your own duplicates. runZero's how-to covers your internal network. For your public ranges, group SSH IP's rows by host_key_fp, and look for a key your addresses share with hosts outside your networks.
  • Group by key and network before counting servers. One key across a whole range is usually one machine: the 57,319 addresses of the OpenSSH 5.3 key above are not 57,319 SSH servers.

How we counted

SSH IP has a row for every host that completed an SSH handshake on TCP port 22, with the banner it announced and its host-key fingerprint, host_key_fp. Its rows cover 90 days, and over that long a device that changes address looks like two hosts sharing a key, so we counted only the IPv4 hosts seen in the last week of September.

Each address was matched to its origin network with IP ASN, and each network's type, ISP or hosting, comes from the type column of our free ASN database. A key's spread is the number of distinct origin networks and /24s it was seen on.

SSH IP is a gzipped CSV download. To license it, see pricing or talk to us.

Written by

  • Uman Shahzad

    Founder & CEO

    IP intelligence data expert for over 8 years, former lead engineer at IPinfo, Uman has pioneered many systems and practices used by IP data companies to operate at scale, provide high-quality data and offer the best developer experiences.

Get new posts by email

Or follow along in a feed reader.

RSS feed

Put this data to work.

Everything these posts report on comes from the databases we license, and you can test them first.

00 · Evaluate

Test the real build first.

An evaluation license puts a full current build in your hands, with no sampling, so you can measure it against your own traffic before anyone talks about terms.

01 · License

Then license what you use.

Standard, for detection and decisions inside your own product and operations.
Redistribution, when the data ships onward inside what you sell, priced by scope rather than by seat.
Annual terms, a named contact, and monthly, quarterly or yearly payment.
Duplicate SSH host keys: 3.9 million hosts share theirs | InternetData