Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Be a little more lenient about exceptional circumstances. More clarity around known_hosts wildcards.
Source Link

If you really want to keep CheckHostIP, you can turn it back on and disable it only for hosts with dynamic IPs to skip the warning and known_hosts pollution. Don't dobother doing this, thoughexcept in extreme circumstances. It's not that helpful.

It seems pretty unlikely that CheckHostIP is a meaningfulan underwhelming measure for dealing with a threat actor who can both…

In the face of such a foe, it seems ludicrous that somehow you'll be saved by the "Warning: Permanently added host key""Warning: Permanently added host key" message when connecting to a host, especially when it shows you the warning2 every single time.

In order to cut down on the super-long known_hosts entries, other people simulate IP ranges with wildcards, which may appear clever, but it's actually finicky3 and. This only works because CheckHostIP checks IPs and ignores hostnames. If it did the checks like it does on hostname, you'd be sunk.3

1 For some reason, this post ranks fairly high in search results for real host key leaks.
2 That is to say: "when it cries 'Wolf!'"
3 For example, if you try to allowlist 127.0.0.* in known_hosts for your dynamic-IP SSH server, you technically also match 127.0.0.evilsite.example because IPs and hostnames are not distinguished. You can limit wildcards to single characters with ?, but be careful: 127.0.0.?? will match 127.0.0.cz. Maybe it seems unlikely that .cz would allow 0 as a second-level domain, but we're talking about an adversary who is poisoning your DNS!

If you really want to keep CheckHostIP, you can turn it back on and disable it only for hosts with dynamic IPs to skip the warning and known_hosts pollution. Don't do this, though. It's not that helpful.

It seems pretty unlikely that CheckHostIP is a meaningful measure for dealing with a threat actor who can both…

In the face of such a foe, it seems ludicrous that somehow you'll be saved by the "Warning: Permanently added host key" message when connecting to a host, especially when it shows you the warning2 every single time.

In order to cut down on the super-long known_hosts entries, other people simulate IP ranges with wildcards, which may appear clever, but it's actually finicky3 and only works because CheckHostIP checks IPs and ignores hostnames.

1 For some reason, this post ranks fairly high in search results for real host key leaks.
2 That is to say: "when it cries 'Wolf!'"
3 For example, if you try to allow 127.0.0.* for your dynamic-IP SSH server, you technically also match 127.0.0.evilsite.example because IPs and hostnames are not distinguished. You can limit wildcards to single characters with ?, but be careful: 127.0.0.?? will match 127.0.0.cz. Maybe it seems unlikely that .cz would allow 0 as a second-level domain, but we're talking about an adversary who is poisoning your DNS!

If you want to keep CheckHostIP, you can turn it back on and disable it only for hosts with dynamic IPs to skip the warning and known_hosts pollution. Don't bother doing this, except in extreme circumstances. It's not that helpful. CheckHostIP is an underwhelming measure for dealing with a threat actor who can both…

In the face of such a foe, it seems ludicrous that somehow you'll be saved by the "Warning: Permanently added host key" message when connecting to a host, especially when it shows you the warning2 every single time.

In order to cut down on the super-long known_hosts entries, other people simulate IP ranges with wildcards. This only works because CheckHostIP checks IPs and ignores hostnames. If it did the checks like it does on hostname, you'd be sunk.3

1 For some reason, this post ranks fairly high in search results for real host key leaks.
2 That is to say: "when it cries 'Wolf!'"
3 For example, if you try to list 127.0.0.* in known_hosts for your dynamic-IP SSH server, you technically also match 127.0.0.evilsite.example because IPs and hostnames are not distinguished. You can limit wildcards to single characters with ?, but be careful: 127.0.0.?? will match 127.0.0.cz. Maybe it seems unlikely that .cz would allow 0 as a second-level domain, but we're talking about an adversary who is poisoning your DNS!

Wordsmith some more.
Source Link

It is so improbableseems pretty unlikely that CheckHostIP is a meaningful measure for dealing with a threat actor who can both…

In order to cut down on the super-long known_hosts entries, other people simulate IP ranges with wildcards, which may appear clever, but it's actually finicky3 and it only works because CheckHostIP works againstchecks IPs and ignores hostnames.3

It is so improbable that CheckHostIP is a meaningful measure for dealing with a threat actor who can both…

In order to cut down on the super-long known_hosts entries, other people simulate IP ranges with wildcards, which may appear clever, but it's actually finicky and it only works because CheckHostIP works against IPs and ignores hostnames.3

It seems pretty unlikely that CheckHostIP is a meaningful measure for dealing with a threat actor who can both…

In order to cut down on the super-long known_hosts entries, other people simulate IP ranges with wildcards, which may appear clever, but it's actually finicky3 and only works because CheckHostIP checks IPs and ignores hostnames.

added 159 characters in body
Source Link

In my view, CheckHostIP just reassures you that an attacker who has already compromised yourthe remote server's private key hasn't also poisoned your local DNS.

LeakSide Note: Leak instructions

If you found this post because of a remote server's host key leaking,1 follow the instructions from the service provider to cycle the relevant known_hosts entries. You may also want to remove the matching lines from known_hosts that CheckHostIP has added.

In the face of such a foe, it seems ludicrous that somehow you'll be saved by the "Warning: Permanently added host key" message when connecting to a host, especially when it shows you the warning12 every single time.

Some people proactively dump all the known IPs for a service into a known_hosts line. I think they're doing this, probably just to avoid the warning message. ItThat front-loads all the nonsense into known_hosts that you'd gradually accumulate otherwise. But frankly, but I think it's missing the important part of known_hosts ispoint: notThe important part of known_hosts is not the IP, it'sIP—it's the host key.

In order to cut down on the super-long known_hosts entries, other people simulate IP ranges with wildcards, which may appear clever, but it's actually finicky and it only works because CheckHostIP works against IPs and ignores hostnames.23

1 For some reason, this post ranks fairly high in search results for real host key leaks.
2 That is to say: "when it cries 'Wolf!'"
23 For example, if you try to allow 127.0.0.* for your dynamic-IP SSH server, you technically also match 127.0.0.evilsite.example because IPs and hostnames are not distinguished. You can limit wildcards to single characters with ?, but be careful: 127.0.0.?? will match 127.0.0.cz. Maybe it seems unlikely that .cz would allow 0 as a second-level domain, but we're talking about an adversary who is poisoning your DNS!

In my view, CheckHostIP just reassures you that an attacker who has already compromised your remote server's private key hasn't also poisoned your local DNS.

Leak instructions

If you found this post because of a remote server's host key leaking, follow the instructions from the service provider to cycle the relevant known_hosts entries. You may also want to remove the matching lines from known_hosts that CheckHostIP has added.

In the face of such a foe, it seems ludicrous that somehow you'll be saved by the "Warning: Permanently added host key" message when connecting to a host, especially when it shows you the warning1 every single time.

Some people proactively dump all the known IPs for a service into a known_hosts line. I think they're doing this just to avoid the warning message. It front-loads all the nonsense into known_hosts that you'd gradually accumulate otherwise. But frankly, the important part of known_hosts is not the IP, it's the host key.

In order to cut down on the super-long known_hosts entries, other people simulate IP ranges with wildcards, which may appear clever, but it's actually finicky and it only works because CheckHostIP works against IPs and ignores hostnames.2

1 That is to say: "when it cries 'Wolf!'"
2 For example, if you try to allow 127.0.0.* for your dynamic-IP SSH server, you technically also match 127.0.0.evilsite.example because IPs and hostnames are not distinguished. You can limit wildcards to single characters with ?, but be careful: 127.0.0.?? will match 127.0.0.cz. Maybe it seems unlikely that .cz would allow 0 as a second-level domain, but we're talking about an adversary who is poisoning your DNS!

In my view, CheckHostIP just reassures you that an attacker who has already compromised the remote server's private key hasn't also poisoned your local DNS.

Side Note: Leak instructions

If you found this post because of a remote server's host key leaking,1 follow the instructions from the service provider to cycle the relevant known_hosts entries. You may also want to remove the matching lines from known_hosts that CheckHostIP has added.

In the face of such a foe, it seems ludicrous that somehow you'll be saved by the "Warning: Permanently added host key" message when connecting to a host, especially when it shows you the warning2 every single time.

Some people proactively dump all the known IPs for a service into a known_hosts line, probably just to avoid the warning message. That front-loads all the nonsense into known_hosts that you'd gradually accumulate otherwise, but I think it's missing the point: The important part of known_hosts is not the IP—it's the host key.

In order to cut down on the super-long known_hosts entries, other people simulate IP ranges with wildcards, which may appear clever, but it's actually finicky and it only works because CheckHostIP works against IPs and ignores hostnames.3

1 For some reason, this post ranks fairly high in search results for real host key leaks.
2 That is to say: "when it cries 'Wolf!'"
3 For example, if you try to allow 127.0.0.* for your dynamic-IP SSH server, you technically also match 127.0.0.evilsite.example because IPs and hostnames are not distinguished. You can limit wildcards to single characters with ?, but be careful: 127.0.0.?? will match 127.0.0.cz. Maybe it seems unlikely that .cz would allow 0 as a second-level domain, but we're talking about an adversary who is poisoning your DNS!

I'm on strike, but people should still fix compromised host keys. ~ Michael
Source Link
Loading
Move some incidentals back to a footnote
Source Link
Loading
Current Events {TM}
Source Link
Loading
Link `man` page. The other known_hosts trick.
Source Link
Loading
Wolf!
Source Link
Loading
Link reference.
Source Link
Loading
Pull the subscript into the body.
Source Link
Loading
Slight expansion on wildcards.
Source Link
Loading
added 99 characters in body
Source Link
Loading
Wildcards don't help unless you go to a lot of trouble.
Source Link
Loading
Looks like CheckHostIP got turned off.
Source Link
Loading
added 9 characters in body
Source Link
Loading
Source Link
Loading