summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2018-09-07 17:00:40 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-10-16 09:19:03 +0200
commit459868c4a57d2d11cf7835655a8d1a5cf034ccb4 (patch)
tree498e0952becdb4eb44cca7a41374b444fb3b6b49
parent5d7414467d6dac100a93df761b06de5cd07fc69a (diff)
downloadlibssh-459868c4a57d2d11cf7835655a8d1a5cf034ccb4.tar.gz
libssh-459868c4a57d2d11cf7835655a8d1a5cf034ccb4.tar.xz
libssh-459868c4a57d2d11cf7835655a8d1a5cf034ccb4.zip
CVE-2018-10933: Check channel state when OPEN_CONFIRMATION arrives
When a SSH2_MSG_OPEN_CONFIRMATION arrives, the channel state is checked to be in SSH_CHANNEL_STATE_OPENING. Fixes T101 Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/channels.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/channels.c b/src/channels.c
index 103009a8..b26f6bd4 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -171,6 +171,15 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_open_conf){
"Received a CHANNEL_OPEN_CONFIRMATION for channel %d:%d",
channel->local_channel,
channel->remote_channel);
+
+ if (channel->state != SSH_CHANNEL_STATE_OPENING) {
+ SSH_LOG(SSH_LOG_RARE,
+ "SSH2_MSG_CHANNEL_OPEN_CONFIRMATION received in incorrect "
+ "channel state %d",
+ channel->state);
+ goto error;
+ }
+
SSH_LOG(SSH_LOG_PROTOCOL,
"Remote window : %lu, maxpacket : %lu",
(long unsigned int) channel->remote_window,