{"action":"created","issue":{"url":"https://api.github.com/repos/hierynomus/sshj/issues/237","repository_url":"https://api.github.com/repos/hierynomus/sshj","labels_url":"https://api.github.com/repos/hierynomus/sshj/issues/237/labels{/name}","comments_url":"https://api.github.com/repos/hierynomus/sshj/issues/237/comments","events_url":"https://api.github.com/repos/hierynomus/sshj/issues/237/events","html_url":"https://github.com/hierynomus/sshj/issues/237","id":141398973,"number":237,"title":"hostkeys-00@openssh.com unhandled","user":{"login":"TheConstructor","id":437735,"avatar_url":"https://avatars.githubusercontent.com/u/437735?v=3","gravatar_id":"","url":"https://api.github.com/users/TheConstructor","html_url":"https://github.com/TheConstructor","followers_url":"https://api.github.com/users/TheConstructor/followers","following_url":"https://api.github.com/users/TheConstructor/following{/other_user}","gists_url":"https://api.github.com/users/TheConstructor/gists{/gist_id}","starred_url":"https://api.github.com/users/TheConstructor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheConstructor/subscriptions","organizations_url":"https://api.github.com/users/TheConstructor/orgs","repos_url":"https://api.github.com/users/TheConstructor/repos","events_url":"https://api.github.com/users/TheConstructor/events{/privacy}","received_events_url":"https://api.github.com/users/TheConstructor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-03-16T20:50:55Z","updated_at":"2016-03-18T14:29:42Z","closed_at":null,"body":"According to [this mail-thread](http://openssh-unix-dev.mindrot.narkive.com/MDJSYb30/why-hostkeys-00-openssh-com-is-following-user-authentication) clients may receive \"hostkeys-00@openssh.com\" after authentication. While [OpenSSH-6.9-Release-Notes](http://www.openssh.com/txt/release-6.9) already list issues with Terra Term, it seems your software is also affected.\r\n\r\nIf net.schmizz.sshj.userauth.UserAuthImpl#handle is called post-auth with a GLOBAL_REQUEST like hostkeys-00@openssh.com it will simply throw a NullPointerException, if the message is received before ``currentMethod`` is set to null you get the following stack-trace:\r\n\r\n    Caused by: net.schmizz.sshj.userauth.UserAuthException: Exhausted available authentication methods\r\n        at net.schmizz.sshj.SSHClient.auth(SSHClient.java:232) ~[sshj-0.15.0.jar:na]\r\n        at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:331) ~[sshj-0.15.0.jar:na]\r\n        ...\r\n                ... 3 common frames omitted\r\n    Caused by: net.schmizz.sshj.userauth.UserAuthException: Received SSH_MSG_UNIMPLEMENTED while exchanging keys\r\n        at net.schmizz.sshj.userauth.UserAuthException$1.chain(UserAuthException.java:33) ~[sshj-0.15.0.jar:na]\r\n        at net.schmizz.sshj.userauth.UserAuthException$1.chain(UserAuthException.java:26) ~[sshj-0.15.0.jar:na]\r\n        at net.schmizz.concurrent.Promise.deliverError(Promise.java:95) ~[sshj-0.15.0.jar:na]\r\n        at net.schmizz.sshj.userauth.UserAuthImpl.notifyError(UserAuthImpl.java:151) ~[sshj-0.15.0.jar:na]\r\n        at net.schmizz.sshj.transport.TransportImpl.die(TransportImpl.java:597) ~[sshj-0.15.0.jar:na]\r\n        at net.schmizz.sshj.transport.Reader.run(Reader.java:68) ~[sshj-0.15.0.jar:na]\r\n    Caused by: net.schmizz.sshj.transport.TransportException: Received SSH_MSG_UNIMPLEMENTED while exchanging keys\r\n        at net.schmizz.sshj.transport.TransportImpl.gotUnimplemented(TransportImpl.java:574) ~[sshj-0.15.0.jar:na]\r\n        at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:506) ~[sshj-0.15.0.jar:na]\r\n        at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:107) ~[sshj-0.15.0.jar:na]\r\n        at net.schmizz.sshj.transport.Decoder.received(Decoder.java:175) ~[sshj-0.15.0.jar:na]\r\n        at net.schmizz.sshj.transport.Reader.run(Reader.java:60) ~[sshj-0.15.0.jar:na]\r\n\r\nI am connecting against a OpenSSH_7.1p2-hpn14v10, OpenSSL 1.0.2f  28 Jan 2016 server on a raspberry pi. Distribution is Gentoo.\r\n\r\nStrangely this error only occurs once every 5-10 connections. I used the debugger to verify it actually is a `hostkeys-00@openssh.com`-message."},"comment":{"url":"https://api.github.com/repos/hierynomus/sshj/issues/comments/198386278","html_url":"https://github.com/hierynomus/sshj/issues/237#issuecomment-198386278","issue_url":"https://api.github.com/repos/hierynomus/sshj/issues/237","id":198386278,"user":{"login":"hierynomus","id":117667,"avatar_url":"https://avatars.githubusercontent.com/u/117667?v=3","gravatar_id":"","url":"https://api.github.com/users/hierynomus","html_url":"https://github.com/hierynomus","followers_url":"https://api.github.com/users/hierynomus/followers","following_url":"https://api.github.com/users/hierynomus/following{/other_user}","gists_url":"https://api.github.com/users/hierynomus/gists{/gist_id}","starred_url":"https://api.github.com/users/hierynomus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hierynomus/subscriptions","organizations_url":"https://api.github.com/users/hierynomus/orgs","repos_url":"https://api.github.com/users/hierynomus/repos","events_url":"https://api.github.com/users/hierynomus/events{/privacy}","received_events_url":"https://api.github.com/users/hierynomus/received_events","type":"User","site_admin":false},"created_at":"2016-03-18T14:29:42Z","updated_at":"2016-03-18T14:29:42Z","body":"Hi @TheConstructor,\r\n\r\nYes, I was looking at the same piece of code, it seems like a nasty race condition, not the first one I've solved today ;). Thanks for attaching the logs."}}