diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-02-10 23:44:47 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-02-10 23:44:47 +0000 |
commit | aa630def4d868c60e6d90a0f52a7d393fed78132 (patch) | |
tree | 28df0569c7385cb54d80fe4b0dbe8adde2a644ab | |
parent | f7d79c794bc0edb7f0413765c1f6b0206c10dbc9 (diff) |
- 1.47 Thu Feb 8 23:11:42 GMT 2001 by dugsong
[serverloop.c sshconnect1.c]
mitigate SSH1 traffic analysis - from Solar Designer
<solar@openwall.com>, ok provos@
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | serverloop.c | 14 | ||||
-rw-r--r-- | sshconnect1.c | 20 |
3 files changed, 34 insertions, 6 deletions
@@ -92,6 +92,10 @@ | |||
92 | - itojun@cvs.openbsd.org 2001/02/07 18:04:50 | 92 | - itojun@cvs.openbsd.org 2001/02/07 18:04:50 |
93 | [xmalloc.c] | 93 | [xmalloc.c] |
94 | fix size_t -> int cast (use u_long). markus ok | 94 | fix size_t -> int cast (use u_long). markus ok |
95 | - 1.47 Thu Feb 8 23:11:42 GMT 2001 by dugsong | ||
96 | [serverloop.c sshconnect1.c] | ||
97 | mitigate SSH1 traffic analysis - from Solar Designer | ||
98 | <solar@openwall.com>, ok provos@ | ||
95 | - (bal) fixed sftp-client.c. Return 'status' instead of '0' | 99 | - (bal) fixed sftp-client.c. Return 'status' instead of '0' |
96 | (from the OpenBSD tree) | 100 | (from the OpenBSD tree) |
97 | - (bal) Synced ssh.1, ssh-add.1 and sshd.8 w/ OpenBSD | 101 | - (bal) Synced ssh.1, ssh-add.1 and sshd.8 w/ OpenBSD |
@@ -3880,4 +3884,4 @@ | |||
3880 | - Wrote replacements for strlcpy and mkdtemp | 3884 | - Wrote replacements for strlcpy and mkdtemp |
3881 | - Released 1.0pre1 | 3885 | - Released 1.0pre1 |
3882 | 3886 | ||
3883 | $Id: ChangeLog,v 1.736 2001/02/10 23:34:54 mouring Exp $ | 3887 | $Id: ChangeLog,v 1.737 2001/02/10 23:44:47 mouring Exp $ |
diff --git a/serverloop.c b/serverloop.c index c8187ab20..8fc94db45 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$OpenBSD: serverloop.c,v 1.46 2001/02/08 19:30:52 itojun Exp $"); | 38 | RCSID("$OpenBSD: serverloop.c,v 1.47 2001/02/08 23:11:42 dugsong Exp $"); |
39 | 39 | ||
40 | #include "xmalloc.h" | 40 | #include "xmalloc.h" |
41 | #include "packet.h" | 41 | #include "packet.h" |
@@ -317,6 +317,7 @@ process_input(fd_set * readset) | |||
317 | void | 317 | void |
318 | process_output(fd_set * writeset) | 318 | process_output(fd_set * writeset) |
319 | { | 319 | { |
320 | struct termios tio; | ||
320 | int len; | 321 | int len; |
321 | 322 | ||
322 | /* Write buffered data to program stdin. */ | 323 | /* Write buffered data to program stdin. */ |
@@ -336,7 +337,16 @@ process_output(fd_set * writeset) | |||
336 | #endif | 337 | #endif |
337 | fdin = -1; | 338 | fdin = -1; |
338 | } else { | 339 | } else { |
339 | /* Successful write. Consume the data from the buffer. */ | 340 | /* Successful write. */ |
341 | if (tcgetattr(fdin, &tio) == 0 && | ||
342 | !(tio.c_lflag & ECHO)) { | ||
343 | /* Simulate echo to reduce the impact of traffic analysis. */ | ||
344 | packet_start(SSH_MSG_IGNORE); | ||
345 | memset(buffer_ptr(&stdin_buffer), 0, len); | ||
346 | packet_put_string(buffer_ptr(&stdin_buffer), len); | ||
347 | packet_send(); | ||
348 | } | ||
349 | /* Consume the data from the buffer. */ | ||
340 | buffer_consume(&stdin_buffer, len); | 350 | buffer_consume(&stdin_buffer, len); |
341 | /* Update the count of bytes written to the program. */ | 351 | /* Update the count of bytes written to the program. */ |
342 | stdin_bytes += len; | 352 | stdin_bytes += len; |
diff --git a/sshconnect1.c b/sshconnect1.c index c33ac5035..a71d28c27 100644 --- a/sshconnect1.c +++ b/sshconnect1.c | |||
@@ -13,7 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include "includes.h" | 15 | #include "includes.h" |
16 | RCSID("$OpenBSD: sshconnect1.c,v 1.24 2001/02/08 19:30:52 itojun Exp $"); | 16 | RCSID("$OpenBSD: sshconnect1.c,v 1.25 2001/02/08 23:11:43 dugsong Exp $"); |
17 | 17 | ||
18 | #include <openssl/bn.h> | 18 | #include <openssl/bn.h> |
19 | #include <openssl/evp.h> | 19 | #include <openssl/evp.h> |
@@ -51,6 +51,20 @@ u_int supported_authentications = 0; | |||
51 | extern Options options; | 51 | extern Options options; |
52 | extern char *__progname; | 52 | extern char *__progname; |
53 | 53 | ||
54 | void | ||
55 | ssh1_put_password(char *password) | ||
56 | { | ||
57 | int size; | ||
58 | char *padded; | ||
59 | |||
60 | size = roundup(strlen(password), 32); | ||
61 | padded = xmalloc(size); | ||
62 | strlcpy(padded, password, size); | ||
63 | packet_put_string(padded, size); | ||
64 | memset(padded, 0, size); | ||
65 | xfree(padded); | ||
66 | } | ||
67 | |||
54 | /* | 68 | /* |
55 | * Checks if the user has an authentication agent, and if so, tries to | 69 | * Checks if the user has an authentication agent, and if so, tries to |
56 | * authenticate using the agent. | 70 | * authenticate using the agent. |
@@ -658,7 +672,7 @@ try_challenge_reponse_authentication(void) | |||
658 | break; | 672 | break; |
659 | } | 673 | } |
660 | packet_start(SSH_CMSG_AUTH_TIS_RESPONSE); | 674 | packet_start(SSH_CMSG_AUTH_TIS_RESPONSE); |
661 | packet_put_string(response, strlen(response)); | 675 | ssh1_put_password(response); |
662 | memset(response, 0, strlen(response)); | 676 | memset(response, 0, strlen(response)); |
663 | xfree(response); | 677 | xfree(response); |
664 | packet_send(); | 678 | packet_send(); |
@@ -691,7 +705,7 @@ try_password_authentication(char *prompt) | |||
691 | error("Permission denied, please try again."); | 705 | error("Permission denied, please try again."); |
692 | password = read_passphrase(prompt, 0); | 706 | password = read_passphrase(prompt, 0); |
693 | packet_start(SSH_CMSG_AUTH_PASSWORD); | 707 | packet_start(SSH_CMSG_AUTH_PASSWORD); |
694 | packet_put_string(password, strlen(password)); | 708 | ssh1_put_password(password); |
695 | memset(password, 0, strlen(password)); | 709 | memset(password, 0, strlen(password)); |
696 | xfree(password); | 710 | xfree(password); |
697 | packet_send(); | 711 | packet_send(); |