There are several options available to mitigate the risk of exposure to CVE-2023-48795 for Maverick Legacy Client-enabled applications
In code
Use the code below before making any call to SshConnector.connect
.
SshConnector ssh = SshConnector.createInstance();
Ssh2Context ctx = ssh.getContext();
ctx.supportedCiphersCS().remove(Ssh2Context.CIPHER_CHACHA20_POLY1305);
ctx.supportedCiphersSC().remove(Ssh2Context.CIPHER_CHACHA20_POLY1305);
ctx.supportedMacsCS().remove(Ssh2Context.HMAC_SHA256_ETM);
ctx.supportedMacsCS().remove(Ssh2Context.HMAC_SHA512_ETM);
ctx.supportedMacsCS().remove(Ssh2Context.HMAC_SHA1_ETM);
ctx.supportedMacsCS().remove(Ssh2Context.HMAC_MD5_ETM);
ctx.supportedMacsSC().remove(Ssh2Context.HMAC_SHA256_ETM);
ctx.supportedMacsSC().remove(Ssh2Context.HMAC_SHA512_ETM);
ctx.supportedMacsSC().remove(Ssh2Context.HMAC_SHA1_ETM);
ctx.supportedMacsSC().remove(Ssh2Context.HMAC_MD5_ETM);
Using System Properties
You do not need to make any code changes if you have a sensitive deployment. By adding the JVM arguments below, you can disable the vulnerable algorithms using system properties.
-Ddisable.chacha20-poly1305@openssh.com -Dmaverick.enableETM=false
Using the Adaptive Configuration File
Another option to configure the client without making code changes is to use the Adaptive Configuration file.
With this file, like the OpenSSH ssh_config file, you can configure which algorithms will be used. Therefore, to mitigate against this vulnerability, you should remove the algorithms from the list below from the Cipher and Mac configuration.
Ciphers:
chacha20-poly1305@openssh.com
HMACs:
hmac-sha2-256-etm@openssh.com
hmac-sha2-512-etm@openssh.com
hmac-sha1-etm@openssh.com
hmac-md5-etm@openssh.com
To do this, create a file called maverick.cfg
in the working directory of your application. Add the following lines, ensuring that if you change the algorithms in the example below, you DO NOT use any of the algorithms listed above. Using the file below will mitigate the risk if used unchanged.
Ciphers aes256-ctr,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes192-ctr,aes128-ctr
Compressions none,zlib,zlib@openssh.com
Kex diffie-hellman-group18-sha512,curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group17-sha512,diffie-hellman-group16-sha512,diffie-hellman-group15-sha512,diffie-hellman-group14-sha256,diffie-hellman-group-exchange-sha256,rsa2048-sha256,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256
Macs hmac-sha2-512,hmac-sha2-512-96,hmac-sha2-256,hmac-sha2-256-96
Publickeys ssh-ed25519,rsa-sha2-512,rsa-sha2-256,x509v3-rsa2048-sha256,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256