krb5 commit [krb5-1.13]: Verify decoded kadmin C strings [CVE-2015-8629]

Tom Yu tlyu at mit.edu
Mon Feb 8 18:38:07 EST 2016


https://github.com/krb5/krb5/commit/6e84bedf362f1d7f36d850774bbac6f3dee21ecd
commit 6e84bedf362f1d7f36d850774bbac6f3dee21ecd
Author: Greg Hudson <ghudson at mit.edu>
Date:   Fri Jan 8 12:45:25 2016 -0500

    Verify decoded kadmin C strings [CVE-2015-8629]
    
    In xdr_nullstring(), check that the decoded string is terminated with
    a zero byte and does not contain any internal zero bytes.
    
    CVE-2015-8629:
    
    In all versions of MIT krb5, an authenticated attacker can cause
    kadmind to read beyond the end of allocated memory by sending a string
    without a terminating zero byte.  Information leakage may be possible
    for an attacker with permission to modify the database.
    
        CVSSv2 Vector: AV:N/AC:H/Au:S/C:P/I:N/A:N/E:POC/RL:OF/RC:C
    
    (cherry picked from commit df17a1224a3406f57477bcd372c61e04c0e5a5bb)
    
    ticket: 8341
    version_fixed: 1.13.4
    tags: -pullup
    status: resolved

 src/lib/kadm5/kadm_rpc_xdr.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/lib/kadm5/kadm_rpc_xdr.c b/src/lib/kadm5/kadm_rpc_xdr.c
index 975f94c..6ccfcea 100644
--- a/src/lib/kadm5/kadm_rpc_xdr.c
+++ b/src/lib/kadm5/kadm_rpc_xdr.c
@@ -64,7 +64,14 @@ bool_t xdr_nullstring(XDR *xdrs, char **objp)
 		    return FALSE;
 	       }
 	  }
-	  return (xdr_opaque(xdrs, *objp, size));
+	  if (!xdr_opaque(xdrs, *objp, size))
+		  return FALSE;
+	  /* Check that the unmarshalled bytes are a C string. */
+	  if ((*objp)[size - 1] != '\0')
+		  return FALSE;
+	  if (memchr(*objp, '\0', size - 1) != NULL)
+		  return FALSE;
+	  return TRUE;
 
      case XDR_ENCODE:
 	  if (size != 0)


More information about the cvs-krb5 mailing list