NetBSD Problem Report #61078

From www@netbsd.org  Wed Nov 25 19:23:14 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.netbsd.org", Issuer "YR1" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id CEFFA1A923B
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 25 Nov 2026 19:23:14 +0000 (UTC)
Message-Id: <20261125192313.59CD31A923D@mollari.NetBSD.org>
Date: Wed, 25 Nov 2026 19:23:13 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: libsaslc: gssapi mech passes AUTHCID as authorization id
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>

>Number:         61078
>Category:       lib
>Synopsis:       libsaslc: gssapi mech passes AUTHCID as authorization id
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    riastradh
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 25 19:25:00 +0000 2026
>Last-Modified:  Thu Nov 26 01:45:01 +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

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: lib-bug-people->riastradh
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Wed, 25 Nov 2026 19:38:58 +0000
Responsible-Changed-Why:
take


From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/61078 CVS commit: src/crypto/external/bsd/libsaslc/dist/src
Date: Thu, 26 Nov 2026 01:42:22 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Thu Nov 26 01:42:22 UTC 2026

 Modified Files:
 	src/crypto/external/bsd/libsaslc/dist/src: mech_gssapi.c

 Log Message:
 libsaslc: Fix authorization id in GSSAPI exchanges.

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


 To generate a diff of this commit:
 cvs rdiff -u -r1.9 -r1.10 \
     src/crypto/external/bsd/libsaslc/dist/src/mech_gssapi.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.