[30879] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit [krb5-1.18]: Allow gss_unwrap_iov() of unpadded RC4 tokens

daemon@ATHENA.MIT.EDU (Greg Hudson)
Tue Nov 3 13:14:49 2020

Date: Tue, 3 Nov 2020 13:14:39 -0500
From: Greg Hudson <ghudson@mit.edu>
Message-ID: <202011031814.0A3IEdOx007842@drugstore.mit.edu>
To: <cvs-krb5@mit.edu>
MIME-Version: 1.0
Reply-To: krbdev@mit.edu
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/4c51048aee3ac1b6f61734e10aae123346f2549d
commit 4c51048aee3ac1b6f61734e10aae123346f2549d
Author: Greg Hudson <ghudson@mit.edu>
Date:   Sat Jul 11 21:57:30 2020 -0400

    Allow gss_unwrap_iov() of unpadded RC4 tokens
    
    Windows Remote Management, when used with an RC4 session key, appears
    to generate GSS wrap tokens with no padding instead of the expected
    one byte (RFC 4757 section 7.3).  These tokens cannot be decoded with
    gss_unwrap() or a STREAM buffer (even with Microsoft SSPI), but SSPI
    allows them to be decoded using explicit IOVs with either a
    zero-length padding buffer or no padding buffer.  Allow these cases to
    work in kg_fixup_padding_iov().  (It is already possible to make this
    work with HEADER | DATA | DATA, but only by
    accident--kg_fixup_padding_iov() doesn't find a data buffer because
    kg_locate_iov() only looks for singleton buffers, so it exits early.)
    
    (cherry picked from commit 3f204ddd567715ef360b4bb0b32961b6a9877f9d)
    
    ticket: 8926
    version_fixed: 1.18.3

 src/lib/gssapi/krb5/util_crypt.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/lib/gssapi/krb5/util_crypt.c b/src/lib/gssapi/krb5/util_crypt.c
index 80954af..ddb0af8 100644
--- a/src/lib/gssapi/krb5/util_crypt.c
+++ b/src/lib/gssapi/krb5/util_crypt.c
@@ -649,16 +649,13 @@ kg_fixup_padding_iov(OM_uint32 *minor_status, gss_iov_buffer_desc *iov,
     data = kg_locate_iov(iov, iov_count, GSS_IOV_BUFFER_TYPE_DATA);
     padding = kg_locate_iov(iov, iov_count, GSS_IOV_BUFFER_TYPE_PADDING);
 
-    if (data == NULL) {
+    /* Do nothing if padding is absent or empty, to allow unwrapping of WinRM
+     * unpadded RC4 tokens using an explicit IOV array. */
+    if (data == NULL || padding == NULL || padding->buffer.length == 0) {
         *minor_status = 0;
         return GSS_S_COMPLETE;
     }
 
-    if (padding == NULL || padding->buffer.length == 0) {
-        *minor_status = EINVAL;
-        return GSS_S_FAILURE;
-    }
-
     p = (unsigned char *)padding->buffer.value;
     padlength = p[padding->buffer.length - 1];
 
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post