报错
从官网安装 Kali Linux
更新并重新启动后msfconsole 报错
sudo apt update && sudo apt dist-upgrade -y
错误信息:
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/hrr_rb_ssh-0.4.2/lib/hrr_rb_ssh/transport/server_host_key_algorithm/ecdsa_sha2_nistp256.rb:14:in `generate_key!': pkeys are immutable on openssl 3.0 (openssl::pkey::pkeyerror)
.....
from /usr/local/bin/msfconsole:23:in `<main>'
解决方式
https://github.com/rapid7/metasploit-framework/issues/16767#issuecomment-1185395510
步骤
在/usr/share/metasploit-framework/lib/msf/core/handler/reverse_ssh.rb 文件中找到对应位置并增加内容:
def default_version_string
require 'rex/proto/ssh/connection'
Rex::Proto::Ssh::Connection.default_options['local_version']
+ rescue OpenSSL::OpenSSLError => e
+ print_error("ReverseSSH handler did not load with OpenSSL version #{OpenSSL::VERSION}")
+ elog(e)
+ 'SSH-2.0-OpenSSH_5.3p1'
rescue LoadError => e
print_error("This handler requires PTY access not available on all platforms.")
elog(e)
'SSH-2.0-OpenSSH_5.3p1'
end
跳转到目录msfconsole 安装目录并执行命令:
cd /usr/share/metasploit-framework
bundle exec ruby msfconsole