<div dir="ltr">Hi,<div><br></div><div>In RFC 4252 <a href="http://www.ietf.org/rfc/rfc4252.txt">http://www.ietf.org/rfc/rfc4252.txt</a> for <span style="color:rgb(0,0,0);white-space:pre-wrap">The Secure Shell (SSH) Authentication Protocol at section </span><span style="color:rgb(0,0,0);white-space:pre-wrap">7.  Public Key Authentication Method: &quot;publickey&quot;</span><div>

<br></div><div style>There is the following information about SSH public key signature.</div><div><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap"> The value of &#39;signature&#39; is a signature by the corresponding private key over the following data, in the following order:

      string    session identifier
      byte      SSH_MSG_USERAUTH_REQUEST
      string    user name
      string    service name
      string    &quot;publickey&quot;
      boolean   TRUE
      string    public key algorithm name
      string    public key to be used for authentication

   When the server receives this message, it MUST check whether the supplied key is acceptable for authentication, and if so, it MUST check whether the signature is correct.</pre></div><div style>The current code check that key is accepted for authentication and it also verifies if signature is correct.</div>

<div style><br></div><div style>It does not check that session the format of the signed data, especially if session identifier from signed data is  the same as the session of the the current SSH transport  session.</div>
<div style>
<br></div><div style>-----</div><div style><br></div><div style>I also found this document describing how ssh public key authentication works, but it differes from the current conch.ssh userauth.py implementation... maybe it is for SSH v1 <a href="http://www.unixwiz.net/techtips/ssh-agent-forwarding.html#chal">http://www.unixwiz.net/techtips/ssh-agent-forwarding.html#chal</a></div>

<div style><br></div><div style>------</div><div style><br></div><div style>Shouldn&#39;t twisted.conch.checkers.SSHPublicKeyDatabase also check that session id from signed data match the one from transport session?<br></div>

<div style><br></div><div style>Maybe it does but I am not looking at the right place.</div><div style><br></div><div style>I see that in conch/checkers.py line 167 <a href="https://github.com/tomprince/twisted/blob/trunk/twisted/conch/checkers.py#L167">https://github.com/tomprince/twisted/blob/trunk/twisted/conch/checkers.py#L167</a></div>

<div style>there is this check, which once signature is valid  it just returns avatar_id:</div><div style><br></div><div style><div>                if pubKey.verify(credentials.signature, credentials.sigData):</div><div>
                    return credentials.username</div>
<div><br></div></div><div style>Thanks!</div><div style><br></div>-- <br>Adi Roiban
</div></div>