diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | PROTOCOL | 33 | ||||
-rw-r--r-- | serverloop.c | 12 | ||||
-rw-r--r-- | ssh.c | 11 |
4 files changed, 60 insertions, 8 deletions
@@ -41,6 +41,16 @@ | |||
41 | - dtucker@cvs.openbsd.org 2008/06/10 18:21:24 | 41 | - dtucker@cvs.openbsd.org 2008/06/10 18:21:24 |
42 | [ssh_config.5] | 42 | [ssh_config.5] |
43 | clarify that Host patterns are space-separated. ok deraadt | 43 | clarify that Host patterns are space-separated. ok deraadt |
44 | - djm@cvs.openbsd.org 2008/06/10 22:15:23 | ||
45 | [PROTOCOL ssh.c serverloop.c] | ||
46 | Add a no-more-sessions@openssh.com global request extension that the | ||
47 | client sends when it knows that it will never request another session | ||
48 | (i.e. when session multiplexing is disabled). This allows a server to | ||
49 | disallow further session requests and terminate the session. | ||
50 | Why would a non-multiplexing client ever issue additional session | ||
51 | requests? It could have been attacked with something like SSH'jack: | ||
52 | http://www.storm.net.nz/projects/7 | ||
53 | feedback & ok markus | ||
44 | - (dtucker) [openbsd-compat/fake-rfc2553.h] Add sin6_scope_id to sockaddr_in6 | 54 | - (dtucker) [openbsd-compat/fake-rfc2553.h] Add sin6_scope_id to sockaddr_in6 |
45 | since the new CIDR code in addmatch.c references it. | 55 | since the new CIDR code in addmatch.c references it. |
46 | - (dtucker) [Makefile.in configure.ac regress/addrmatch.sh] Skip IPv6 | 56 | - (dtucker) [Makefile.in configure.ac regress/addrmatch.sh] Skip IPv6 |
@@ -4133,4 +4143,4 @@ | |||
4133 | OpenServer 6 and add osr5bigcrypt support so when someone migrates | 4143 | OpenServer 6 and add osr5bigcrypt support so when someone migrates |
4134 | passwords between UnixWare and OpenServer they will still work. OK dtucker@ | 4144 | passwords between UnixWare and OpenServer they will still work. OK dtucker@ |
4135 | 4145 | ||
4136 | $Id: ChangeLog,v 1.4961 2008/06/10 23:33:01 dtucker Exp $ | 4146 | $Id: ChangeLog,v 1.4962 2008/06/10 23:34:01 dtucker Exp $ |
@@ -61,7 +61,30 @@ remain open after a "eow@openssh.com" has been sent and more data may | |||
61 | still be sent in the other direction. This message does not consume | 61 | still be sent in the other direction. This message does not consume |
62 | window space and may be sent even if no window space is available. | 62 | window space and may be sent even if no window space is available. |
63 | 63 | ||
64 | 4. sftp: Reversal of arguments to SSH_FXP_SYMLINK | 64 | 4. connection: disallow additional sessions extension |
65 | "no-more-sessions@openssh.com" | ||
66 | |||
67 | Most SSH connections will only ever request a single session, but a | ||
68 | attacker may abuse a running ssh client to surreptitiously open | ||
69 | additional sessions under their control. OpenSSH provides a global | ||
70 | request "no-more-sessions@openssh.com" to mitigate this attack. | ||
71 | |||
72 | When an OpenSSH client expects that it will never open another session | ||
73 | (i.e. it has been started with connection multiplexing disabled), it | ||
74 | will send the following global request: | ||
75 | |||
76 | byte SSH_MSG_GLOBAL_REQUEST | ||
77 | string "no-more-sessions@openssh.com" | ||
78 | char want-reply | ||
79 | |||
80 | On receipt of such a message, an OpenSSH server will refuse to open | ||
81 | future channels of type "session" and instead immediately abort the | ||
82 | connection. | ||
83 | |||
84 | Note that this is not a general defence against compromised clients | ||
85 | (that is impossible), but it thwarts a simple attack. | ||
86 | |||
87 | 5. sftp: Reversal of arguments to SSH_FXP_SYMLINK | ||
65 | 88 | ||
66 | When OpenSSH's sftp-server was implemented, the order of the arguments | 89 | When OpenSSH's sftp-server was implemented, the order of the arguments |
67 | to the SSH_FXP_SYMLINK method was inadvertendly reversed. Unfortunately, | 90 | to the SSH_FXP_SYMLINK method was inadvertendly reversed. Unfortunately, |
@@ -74,7 +97,7 @@ SSH_FXP_SYMLINK as follows: | |||
74 | string targetpath | 97 | string targetpath |
75 | string linkpath | 98 | string linkpath |
76 | 99 | ||
77 | 5. sftp: Server extension announcement in SSH_FXP_VERSION | 100 | 6. sftp: Server extension announcement in SSH_FXP_VERSION |
78 | 101 | ||
79 | OpenSSH's sftp-server lists the extensions it supports using the | 102 | OpenSSH's sftp-server lists the extensions it supports using the |
80 | standard extension announcement mechanism in the SSH_FXP_VERSION server | 103 | standard extension announcement mechanism in the SSH_FXP_VERSION server |
@@ -95,7 +118,7 @@ ever changed in an incompatible way. The server MAY advertise the same | |||
95 | extension with multiple versions (though this is unlikely). Clients MUST | 118 | extension with multiple versions (though this is unlikely). Clients MUST |
96 | check the version number before attemping to use the extension. | 119 | check the version number before attemping to use the extension. |
97 | 120 | ||
98 | 6. sftp: Extension request "posix-rename@openssh.com" | 121 | 7. sftp: Extension request "posix-rename@openssh.com" |
99 | 122 | ||
100 | This operation provides a rename operation with POSIX semantics, which | 123 | This operation provides a rename operation with POSIX semantics, which |
101 | are different to those provided by the standard SSH_FXP_RENAME in | 124 | are different to those provided by the standard SSH_FXP_RENAME in |
@@ -112,7 +135,7 @@ rename(oldpath, newpath) and will respond with a SSH_FXP_STATUS message. | |||
112 | This extension is advertised in the SSH_FXP_VERSION hello with version | 135 | This extension is advertised in the SSH_FXP_VERSION hello with version |
113 | "1". | 136 | "1". |
114 | 137 | ||
115 | 7. sftp: Extension requests "statvfs@openssh.com" and | 138 | 8. sftp: Extension requests "statvfs@openssh.com" and |
116 | "fstatvfs@openssh.com" | 139 | "fstatvfs@openssh.com" |
117 | 140 | ||
118 | These requests correspond to the statvfs and fstatvfs POSIX system | 141 | These requests correspond to the statvfs and fstatvfs POSIX system |
@@ -153,5 +176,5 @@ The values of the f_flag bitmask are as follows: | |||
153 | This extension is advertised in the SSH_FXP_VERSION hello with version | 176 | This extension is advertised in the SSH_FXP_VERSION hello with version |
154 | "2". | 177 | "2". |
155 | 178 | ||
156 | $OpenBSD: PROTOCOL,v 1.5 2008/06/09 13:38:46 dtucker Exp $ | 179 | $OpenBSD: PROTOCOL,v 1.6 2008/06/10 22:15:23 djm Exp $ |
157 | 180 | ||
diff --git a/serverloop.c b/serverloop.c index 6bc140f8b..76d76bab9 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: serverloop.c,v 1.151 2008/05/09 16:21:13 markus Exp $ */ | 1 | /* $OpenBSD: serverloop.c,v 1.152 2008/06/10 22:15:23 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -105,6 +105,7 @@ static int connection_in; /* Connection to client (input). */ | |||
105 | static int connection_out; /* Connection to client (output). */ | 105 | static int connection_out; /* Connection to client (output). */ |
106 | static int connection_closed = 0; /* Connection to client closed. */ | 106 | static int connection_closed = 0; /* Connection to client closed. */ |
107 | static u_int buffer_high; /* "Soft" max buffer size. */ | 107 | static u_int buffer_high; /* "Soft" max buffer size. */ |
108 | static int no_more_sessions = 0; /* Disallow further sessions. */ | ||
108 | 109 | ||
109 | /* | 110 | /* |
110 | * This SIGCHLD kludge is used to detect when the child exits. The server | 111 | * This SIGCHLD kludge is used to detect when the child exits. The server |
@@ -1013,6 +1014,12 @@ server_request_session(void) | |||
1013 | 1014 | ||
1014 | debug("input_session_request"); | 1015 | debug("input_session_request"); |
1015 | packet_check_eom(); | 1016 | packet_check_eom(); |
1017 | |||
1018 | if (no_more_sessions) { | ||
1019 | packet_disconnect("Possible attack: attempt to open a session " | ||
1020 | "after additional sessions disabled"); | ||
1021 | } | ||
1022 | |||
1016 | /* | 1023 | /* |
1017 | * A server session has no fd to read or write until a | 1024 | * A server session has no fd to read or write until a |
1018 | * CHANNEL_REQUEST for a shell is made, so we set the type to | 1025 | * CHANNEL_REQUEST for a shell is made, so we set the type to |
@@ -1133,6 +1140,9 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt) | |||
1133 | success = channel_cancel_rport_listener(cancel_address, | 1140 | success = channel_cancel_rport_listener(cancel_address, |
1134 | cancel_port); | 1141 | cancel_port); |
1135 | xfree(cancel_address); | 1142 | xfree(cancel_address); |
1143 | } else if (strcmp(rtype, "no-more-sessions@openssh.com") == 0) { | ||
1144 | no_more_sessions = 1; | ||
1145 | success = 1; | ||
1136 | } | 1146 | } |
1137 | if (want_reply) { | 1147 | if (want_reply) { |
1138 | packet_start(success ? | 1148 | packet_start(success ? |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh.c,v 1.313 2008/05/09 14:26:08 djm Exp $ */ | 1 | /* $OpenBSD: ssh.c,v 1.314 2008/06/10 22:15:23 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -1151,6 +1151,15 @@ ssh_session2(void) | |||
1151 | if (!no_shell_flag || (datafellows & SSH_BUG_DUMMYCHAN)) | 1151 | if (!no_shell_flag || (datafellows & SSH_BUG_DUMMYCHAN)) |
1152 | id = ssh_session2_open(); | 1152 | id = ssh_session2_open(); |
1153 | 1153 | ||
1154 | /* If we don't expect to open a new session, then disallow it */ | ||
1155 | if (options.control_master == SSHCTL_MASTER_NO) { | ||
1156 | debug("Requesting no-more-sessions@openssh.com"); | ||
1157 | packet_start(SSH2_MSG_GLOBAL_REQUEST); | ||
1158 | packet_put_cstring("no-more-sessions@openssh.com"); | ||
1159 | packet_put_char(0); | ||
1160 | packet_send(); | ||
1161 | } | ||
1162 | |||
1154 | /* Execute a local command */ | 1163 | /* Execute a local command */ |
1155 | if (options.local_command != NULL && | 1164 | if (options.local_command != NULL && |
1156 | options.permit_local_command) | 1165 | options.permit_local_command) |