Skip to content

Limit what algorithms or ciphers are used #730

Closed

Description

@rykr

Is there a way to do this? To remove weak ones

Activity

  1. j3zz3r commented on Jan 14, 2021

    @j3zz3r

    Any progress with this ?
    Interested in historic versions specific cipher support lists. Would like to progress hardening, removing weak cipher support.

  2. IgorMilavec commented on Mar 24, 2021

    @IgorMilavec
    Collaborator

    I use a helper function for this purpose:

            public static ConnectionInfo CreateConnectionInfo(string host, ushort port, string userName, AuthenticationMethod[] authenticationMethods)
            {
                ConnectionInfo connectionInfo = new ConnectionInfo(
                    host,
                    port,
                    userName,
                    authenticationMethods);
    
                #region Remove insecure hashes
                connectionInfo.HmacAlgorithms.Remove("hmac-md5");
                connectionInfo.HmacAlgorithms.Remove("hmac-md5-96");
                connectionInfo.HmacAlgorithms.Remove("hmac-sha1-96");
                connectionInfo.HmacAlgorithms.Remove("hmac-sha2-256-96");
                connectionInfo.HmacAlgorithms.Remove("hmac-sha2-512-96");
                connectionInfo.HmacAlgorithms.Remove("hmac-ripemd160");
                connectionInfo.HmacAlgorithms.Remove("[email protected]");
                #endregion
                #region Remove insecure ciphers
                connectionInfo.Encryptions.Remove("blowfish-cbc");
                connectionInfo.Encryptions.Remove("twofish-cbc");
                connectionInfo.Encryptions.Remove("twofish128-cbc");
                connectionInfo.Encryptions.Remove("twofish192-cbc");
                connectionInfo.Encryptions.Remove("twofish256-cbc");
                connectionInfo.Encryptions.Remove("arcfour");
                connectionInfo.Encryptions.Remove("arcfour128");
                connectionInfo.Encryptions.Remove("arcfour256");
                connectionInfo.Encryptions.Remove("3des-cbc");
                connectionInfo.Encryptions.Remove("cast128-cbc");
                connectionInfo.Encryptions.Remove("aes128-cbc");
                connectionInfo.Encryptions.Remove("aes192-cbc");
                #endregion
                #region Remove insecure key exchange algorithms
                connectionInfo.KeyExchangeAlgorithms.Remove("diffie-hellman-group-exchange-sha1");
                connectionInfo.KeyExchangeAlgorithms.Remove("diffie-hellman-group1-sha1");
                #endregion
    
                return connectionInfo;
            }

    I agree that this should be configurable. However with the spread of platforms SSH.NET is targeting, this might be hard to do in a consistent manner.

  3. rykr commented on Mar 24, 2021

    @rykr
    Author
  4. drieseng commented on Feb 12, 2022

    @drieseng
    Member

    @IgorMilavec I have "Add a fluent API to build client" on my bucket list. Something to discuss?

  5. IgorMilavec commented on Feb 12, 2022

    @IgorMilavec
    Collaborator

    @drieseng that would be great. Can you please form your proposal in Discussions? There are quite a few issues related to this and I would like to close them and redirect to the discussion.
    I think what needs to be discussed apart from API design is how to group algorithms (weak/strong, by some standard, ...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions