Skip to content

Golang Misconfigured SSH Insecure Ignore HostKey

What does this mean ?

Audit the use of ssh.InsecureIgnoreHostKey.InsecureIgnoreHostKey is used to accept any host key. It should not be used for production code. Go team provided the "knownhosts" subpackage in their crypto SSH package.Using new with a known_hosts file a code can be written more `efficiently and securely.

What can happen ?

Performing a key exchange will preserve the integrity of the information sent between two entities, but this will not guarantee that the entities are who they claim they are. This may enable an attacker to impersonate an actor by modifying traffic between the two entities. Typically, this involves a victim client that contacts a malicious server that is impersonating a trusted server. If the client skips authentication or ignores an authentication failure, the malicious server may request authentication information from the user. The malicious server can then use this authentication information to log in to the trusted server using the victim's credentials, sniff traffic between the victim and trusted server, etc.

Recommendation

Audit the use of ssh.InsecureIgnoreHostKey.

Ensure that proper authentication is included in the system design.

Understand and properly implement all checks necessary to ensure the identity of entities involved in encrypted communications.

Sample Code

Vulnerable :

HostKeyCallback: ssh.InsecureIgnoreHostKey()

References