aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2018-09-19 15:55:43 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-10-09 11:45:58 +0200
commitacd6a1ca8a332a204b616ab6bef413bee5d3409d (patch)
tree472a8f68589fd81c4c9d70d86e0b9da10398baa1
parentddea46f890bd5d87669f23b26d676adedaa5f610 (diff)
downloadlibssh-acd6a1ca8a332a204b616ab6bef413bee5d3409d.tar.gz
libssh-acd6a1ca8a332a204b616ab6bef413bee5d3409d.tar.xz
libssh-acd6a1ca8a332a204b616ab6bef413bee5d3409d.zip
CVE-2018-10933: Introduce SSH_AUTH_STATE_AUTH_NONE_SENT
The introduced auth state allows to identify when a request without authentication information was sent. Fixes T101 Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
-rw-r--r--include/libssh/auth.h2
-rwxr-xr-xsrc/auth.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/include/libssh/auth.h b/include/libssh/auth.h
index 1fc00e20..75bc7546 100644
--- a/include/libssh/auth.h
+++ b/include/libssh/auth.h
@@ -96,6 +96,8 @@ enum ssh_auth_state_e {
SSH_AUTH_STATE_PUBKEY_AUTH_SENT,
/** We have sent a password expecting to be authenticated */
SSH_AUTH_STATE_PASSWORD_AUTH_SENT,
+ /** We have sent a request without auth information (method 'none') */
+ SSH_AUTH_STATE_AUTH_NONE_SENT,
};
/** @internal
diff --git a/src/auth.c b/src/auth.c
index 3719b18a..2bc73760 100755
--- a/src/auth.c
+++ b/src/auth.c
@@ -88,6 +88,7 @@ static int ssh_auth_response_termination(void *user){
case SSH_AUTH_STATE_PUBKEY_AUTH_SENT:
case SSH_AUTH_STATE_PUBKEY_OFFER_SENT:
case SSH_AUTH_STATE_PASSWORD_AUTH_SENT:
+ case SSH_AUTH_STATE_AUTH_NONE_SENT:
return 0;
default:
return 1;
@@ -143,6 +144,7 @@ static int ssh_userauth_get_response(ssh_session session) {
case SSH_AUTH_STATE_PUBKEY_OFFER_SENT:
case SSH_AUTH_STATE_PUBKEY_AUTH_SENT:
case SSH_AUTH_STATE_PASSWORD_AUTH_SENT:
+ case SSH_AUTH_STATE_AUTH_NONE_SENT:
case SSH_AUTH_STATE_NONE:
/* not reached */
rc = SSH_AUTH_ERROR;
@@ -401,7 +403,7 @@ int ssh_userauth_none(ssh_session session, const char *username) {
goto fail;
}
- session->auth_state = SSH_AUTH_STATE_NONE;
+ session->auth_state = SSH_AUTH_STATE_AUTH_NONE_SENT;
session->pending_call_state = SSH_PENDING_CALL_AUTH_NONE;
rc = packet_send(session);
if (rc == SSH_ERROR) {