NationalSecurityAgency / ghidra

Ghidra is a software reverse engineering (SRE) framework
https://www.nsa.gov/ghidra
Apache License 2.0
49.21k stars 5.67k forks source link

ssh connect will fail with exception if user has ed25519 identities in ssh_config #4006

Open mcr-ksh opened 2 years ago

mcr-ksh commented 2 years ago

Describe the bug cant connect to remote host when having ed25519 keys due to bug in jsch.

To Reproduce

  1. add a ssh ed25519 key and "IdentityFile ~/.ssh/id_ed25519" to your ssh config.
  2. open debugger and "GNU gdb via ssh"
  3. ssh connection will fail will the following exception:

Caused by: com.jcraft.jsch.JSchException: invalid privatekey: [B@e4487af at com.jcraft.jsch.KeyPair.load(KeyPair.java:664) at com.jcraft.jsch.KeyPair.load(KeyPair.java:561) at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:40) at com.jcraft.jsch.JSch.addIdentity(JSch.java:407) at com.jcraft.jsch.JSch.addIdentity(JSch.java:367) at org.eclipse.jgit.transport.JschConfigSessionFactory.getJSch(JschConfigSessionFactory.java:276) at org.eclipse.jgit.transport.JschConfigSessionFactory.createSession(JschConfigSessionFactory.java:220) at org.eclipse.jgit.transport.JschConfigSessionFactory.createSession(JschConfigSessionFactory.java:176) at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:110)

Expected behavior can connect to remote host.

Workaround use /etc/ssh/ssh_config and/or remove ed25519 keys.

Screenshots see attachment. Screenshot 2022-02-17 at 10 40 03

Attachments https://stackoverflow.com/questions/53134212/invalid-privatekey-when-using-jsch

Environment (please complete the following information):

d-millar commented 2 years ago

Apologies for the slow response - is there a version of JSch that supports ed25519? I was under the impression that wasn't supported yet.

5c4lar commented 2 years ago

Apologies for the slow response - is there a version of JSch that supports ed25519? I was under the impression that wasn't supported yet.

One is mentioned here https://github.com/gradle/gradle/issues/19028

d-millar commented 2 years ago

This looks promising - we’re considering it.