NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/61078: libsaslc: gssapi mech passes AUTHCID as authorization id



>Number:         61078
>Category:       lib
>Synopsis:       libsaslc: gssapi mech passes AUTHCID as authorization id
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 25 19:25:00 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current, 11, 10, ...
>Organization:
The NetSASLC Foundation, Inc.
>Environment:
>Description:

	The last step of SASL GSSAPI exchange is to gss_wrap a token
	containing

	1. a one-octet security layer bit mask,
	2. a three-octet message length, and
	3. the _authorization_ id of the SASL exchange.

	See RFC 4752 Sec. 3.1 (relevant language essentially unchanged
	from RFC 2222 Sec. 7.2.1):

>    The client then constructs data, with the first octet containing the
>    bit-mask specifying the selected security layer, the second through
>    fourth octets containing in network byte order the maximum size
>    output_message the client is able to receive (which MUST be 0 if the
>    client does not support any security layer), and the remaining octets
>    containing the UTF-8 [UTF8] encoded authorization identity.

	https://www.rfc-editor.org/info/rfc4752/#section-3.1

	However, libsaslc, which has separate parameters for the
	authentication id (AUTHCID) and authorization id (AUTHZID),
	passes AUTHCID, the authentication id, rather than AUTHZID, the
	authorization parameter:

    552 /**
    553  * @brief construct and wrap up an authentication token and put it in
    554  * outbuf.  The outbuf token data is structured as follows:
    555  * struct {
    556  *   uint8_t qop;	// qop to use
    557  *   uint8_t maxbuf[3]	// maxbuf for client (network byte order)
    558  *   uint8_t authcid[]	// variable length authentication id (username)
    559  * } __packed;
...
    591 	authcid = saslc_sess_getprop(sess, SASLC_GSSAPI_AUTHCID);
    592 
    593 	len = asprintf(&input_value, "qmax%s", authcid ? authcid : "");
    594 	if (len == -1) {
    595 		saslc__error_set_errno(ERR(sess), ERROR_NOMEM);
    596 		return -1;
    597 	}
    598 	be32enc(input_value, ms->imaxbuf);
    599 	input_value[0] = saslc__mech_qop_flag(ms->mech_sess.qop);
    600 
    601 	indesc.value = input_value;
    602 	indesc.length = len;	/* XXX: don't count the '\0' */
    603 
    604 	p = (unsigned char *)input_value;
    605 	saslc__msg_dbg("%s: input_value='%02x %02x %02x %02x %s",
    606 	    __func__, p[0], p[1], p[2], p[3], input_value + 4);
    607 
    608 	maj_s = gss_wrap(&min_s, ms->gss_ctx, 0 /* FALSE - RFC2222 */,
    609 	    GSS_C_QOP_DEFAULT, &indesc, NULL, outbuf);

	https://nxr.netbsd.org/xref/src/crypto/external/bsd/libsaslc/dist/src/mech_gssapi.c?r=1.9#552

>How-To-Repeat:

	code inspection

>Fix:

	s/authcid/authzid/ here




Home | Main Index | Thread Index | Old Index