warning: remote host identification has changed! - SSH

This is a discussion on warning: remote host identification has changed! - SSH ; Hello, I am getting this message occasionally. How big is the chance that it is really a man-in-the-middle attack? The first time I got this error, I have deleted the offending line in the $HOME/.ssh/known_hosts file, and just retried. The ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: warning: remote host identification has changed!

  1. warning: remote host identification has changed!

    Hello,

    I am getting this message occasionally. How big is the chance that it is
    really a man-in-the-middle attack?

    The first time I got this error, I have deleted the offending line in
    the $HOME/.ssh/known_hosts file, and just retried. The authentication
    using the authorized_keys file was also not working, so I entered the
    root password.

    After the same happened again a few minutes later, I became suspicious
    and created a new ssh key and root password.

    But now the same happens again: I get the following message, but not
    always. It happens to work ~10 times or minutes in a row, and then I get
    the error message a few times, without any recognizable pattern, and
    from the same shell.

    It seems to start working again after I try the same from a different
    user on my local machine.

    --------------------8<-------------------------
    rup@sempron:~/cvs/homepages/schachtner> ssh root@www
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@
    @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@
    IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
    Someone could be eavesdropping on you right now (man-in-the-middle attack)!
    It is also possible that the RSA host key has just been changed.
    The fingerprint for the RSA key sent by the remote host is
    89:b8:08:03:f3:02:d0:2f:5a:e3:7c:c3:eb:ef:8d:7e.
    Please contact your system administrator.
    Add correct host key in /localhome/rup/.ssh/known_hosts to get rid of
    this message.
    Offending key in /localhome/rup/.ssh/known_hosts:4
    RSA host key for www has changed and you have requested strict checking.
    Host key verification failed.
    rup@sempron:~/cvs/homepages/schachtner> ssh root@www
    Last login: Wed Mar 19 09:48:45 2008 from wdsl-80-73-127-53.wcli.deg.net
    Have a lot of fun...
    h68390:~ # exit
    logout
    Connection to www closed.
    --------------------8<-------------------------

    What is really surprising is that the key fingerprint displayed in the
    message is identical with the one I got when creating the key.




  2. Re: warning: remote host identification has changed!

    Rupert Eibauer writes:

    > Hello,
    >
    > I am getting this message occasionally. How big is the chance that it is
    > really a man-in-the-middle attack?


    Non zero.

    > The first time I got this error, I have deleted the offending line in
    > the $HOME/.ssh/known_hosts file, and just retried. The authentication
    > using the authorized_keys file was also not working, so I entered the
    > root password.
    >
    > After the same happened again a few minutes later, I became suspicious
    > and created a new ssh key and root password.
    >
    > But now the same happens again: I get the following message, but not
    > always. It happens to work ~10 times or minutes in a row, and then I get
    > the error message a few times, without any recognizable pattern, and
    > from the same shell.
    >
    > It seems to start working again after I try the same from a different
    > user on my local machine.


    Is www a single box, or a load balanced IP of some sort?

    If it's a round robin dns or some other load balanced address, your
    ssh client will be confused as it may be getting a different sshd
    every it hits the www address.

    The antidote in that case is to pick a single static ip to login to
    and not ssh to a load balanced address.

    The right thing to do when a key changes is to find out why, have the
    admin verify the right keys for you by telling you the output of them
    running
    ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub
    ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub
    from a trusted console.


    The key shouldn't legitimately change frequently. If you are the
    admin for the box, it shouldn't ever change without your knowledge.
    Sometimes updates to ssh cause a new key to be generated, or naturally
    when the system is wiped and reinstalled.

    Best Regards,
    --
    Todd H.
    http://www.toddh.net/

  3. Re: warning: remote host identification has changed!

    comphelp@toddh.net (Todd H.) writes:

    > Rupert Eibauer writes:
    >
    >> Hello,
    >>
    >> I am getting this message occasionally. How big is the chance that it is
    >> really a man-in-the-middle attack?

    >
    > Non zero.
    >
    >> The first time I got this error, I have deleted the offending line in
    >> the $HOME/.ssh/known_hosts file, and just retried. The authentication
    >> using the authorized_keys file was also not working, so I entered the
    >> root password.
    >>
    >> After the same happened again a few minutes later, I became suspicious
    >> and created a new ssh key and root password.
    >>
    >> But now the same happens again: I get the following message, but not
    >> always. It happens to work ~10 times or minutes in a row, and then I get
    >> the error message a few times, without any recognizable pattern, and
    >> from the same shell.
    >>
    >> It seems to start working again after I try the same from a different
    >> user on my local machine.

    >
    > Is www a single box, or a load balanced IP of some sort?
    >
    > If it's a round robin dns or some other load balanced address, your
    > ssh client will be confused as it may be getting a different sshd
    > every it hits the www address.
    >
    > The antidote in that case is to pick a single static ip to login to
    > and not ssh to a load balanced address.
    >
    > The right thing to do when a key changes is to find out why, have the
    > admin verify the right keys for you by telling you the output of them
    > running
    > ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub
    > ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub
    > from a trusted console.


    I forgot to add here:

    "BEFORE you accept the new key and connect to the server"


    > The key shouldn't legitimately change frequently. If you are the
    > admin for the box, it shouldn't ever change without your knowledge.
    > Sometimes updates to ssh cause a new key to be generated, or naturally
    > when the system is wiped and reinstalled.
    >
    > Best Regards,
    > --
    > Todd H.
    > http://www.toddh.net/


    --
    Todd H.
    http://www.toddh.net/

  4. Re: warning: remote host identification has changed!

    Todd H. schrieb:
    > comphelp@toddh.net (Todd H.) writes:
    >
    >> Rupert Eibauer writes:
    >>
    >>> Hello,
    >>>
    >>> I am getting this message occasionally. How big is the chance that it is
    >>> really a man-in-the-middle attack?

    >> Non zero.
    >>
    >>> The first time I got this error, I have deleted the offending line in
    >>> the $HOME/.ssh/known_hosts file, and just retried. The authentication
    >>> using the authorized_keys file was also not working, so I entered the
    >>> root password.
    >>>
    >>> After the same happened again a few minutes later, I became suspicious
    >>> and created a new ssh key and root password.
    >>>
    >>> But now the same happens again: I get the following message, but not
    >>> always. It happens to work ~10 times or minutes in a row, and then I get
    >>> the error message a few times, without any recognizable pattern, and
    >>> from the same shell.
    >>>
    >>> It seems to start working again after I try the same from a different
    >>> user on my local machine.

    >> Is www a single box, or a load balanced IP of some sort?
    >>
    >> If it's a round robin dns or some other load balanced address, your
    >> ssh client will be confused as it may be getting a different sshd
    >> every it hits the www address.
    >>
    >> The antidote in that case is to pick a single static ip to login to
    >> and not ssh to a load balanced address.
    >>
    >> The right thing to do when a key changes is to find out why, have the
    >> admin verify the right keys for you by telling you the output of them
    >> running
    >> ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub
    >> ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub
    >> from a trusted console.

    >
    > I forgot to add here:
    >
    > "BEFORE you accept the new key and connect to the server"


    But what about the chance that the forged key has the same fingerprint
    than mine? I am assuming that ssh is storing a different type of
    checksum in the known_hosts file, and thus it shows me the correct
    fingerprint but still thinks that there is a man-in-the-middle.

    And: the server is a single server and I am the admin of it. The ip
    address of "www" is listed in my /etc/hosts to make sure DNS
    outages/forgery do not affect me.

    Thanks, and best regards,
    Rupert Eibauer

    >
    >
    >> The key shouldn't legitimately change frequently. If you are the
    >> admin for the box, it shouldn't ever change without your knowledge.
    >> Sometimes updates to ssh cause a new key to be generated, or naturally
    >> when the system is wiped and reinstalled.
    >>
    >> Best Regards,
    >> --
    >> Todd H.
    >> http://www.toddh.net/

    >


  5. Re: warning: remote host identification has changed!

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Rupert Eibauer wrote:
    | But what about the chance that the forged key has the same fingerprint
    | than mine? I am assuming that ssh is storing a different type of
    | checksum in the known_hosts file, and thus it shows me the correct
    | fingerprint but still thinks that there is a man-in-the-middle.

    I think the entire public key is stored, in this form:

    [hostname,]ip_address contents_of_/etc/ssh/ssh_host_rsa_key.pub
    - --
    Mantas Mikul─Śnas
    PGP/GPG: 0x3AACE738335AF6E7
    ASCII ribbon - against HTML email
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.8 (MingW32)
    Comment: http://www.rootshell.be/~grawity/
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

    iEYEARECAAYFAkfjtgsACgkQOqznODNa9ueY/gCfXXr1YtskoDfL1TJ9zp9vCmBf
    AnAAn0b4gFp/wOLIoInPCkEdcoqlB85u
    =ymzt
    -----END PGP SIGNATURE-----

  6. Re: warning: remote host identification has changed!

    Rupert Eibauer writes:

    > But what about the chance that the forged key has the same fingerprint
    > than mine? I am assuming that ssh is storing a different type of
    > checksum in the known_hosts file, and thus it shows me the correct
    > fingerprint but still thinks that there is a man-in-the-middle.


    If you're that unlucky, or they're that good, you've got bigger
    problems. :-) The likelihood of that is very very very small.

    > And: the server is a single server and I am the admin of it. The ip
    > address of "www" is listed in my /etc/hosts to make sure DNS
    > outages/forgery do not affect me.


    That's VERY weird then.

    --
    Todd H.
    http://www.toddh.net/

+ Reply to Thread