From nobody Fri Jun 10 16:00:49 2022
X-Original-To: standards@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7379585025D
	for <standards@mlmmj.nyi.freebsd.org>; Fri, 10 Jun 2022 16:00:49 +0000 (UTC)
	(envelope-from bugzilla-noreply@freebsd.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4LKQfn0bMjz3wS6
	for <standards@FreeBSD.org>; Fri, 10 Jun 2022 16:00:49 +0000 (UTC)
	(envelope-from bugzilla-noreply@freebsd.org)
Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E86EF1B8C3
	for <standards@FreeBSD.org>; Fri, 10 Jun 2022 16:00:48 +0000 (UTC)
	(envelope-from bugzilla-noreply@freebsd.org)
Received: from kenobi.freebsd.org ([127.0.1.5])
	by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 25AG0mxW007050
	for <standards@FreeBSD.org>; Fri, 10 Jun 2022 16:00:48 GMT
	(envelope-from bugzilla-noreply@freebsd.org)
Received: (from www@localhost)
	by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 25AG0mBn007049
	for standards@FreeBSD.org; Fri, 10 Jun 2022 16:00:48 GMT
	(envelope-from bugzilla-noreply@freebsd.org)
X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f
From: bugzilla-noreply@freebsd.org
To: standards@FreeBSD.org
Subject: [Bug 264598] libradius invalid Message-Authenticator in retransmit
 packet
Date: Fri, 10 Jun 2022 16:00:49 +0000
X-Bugzilla-Reason: AssignedTo
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: Base System
X-Bugzilla-Component: standards
X-Bugzilla-Version: Unspecified
X-Bugzilla-Keywords: 
X-Bugzilla-Severity: Affects Only Me
X-Bugzilla-Who: hwlin1414@cs.nctu.edu.tw
X-Bugzilla-Status: New
X-Bugzilla-Resolution: 
X-Bugzilla-Priority: ---
X-Bugzilla-Assigned-To: standards@FreeBSD.org
X-Bugzilla-Flags: 
X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform
 op_sys bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-264598-99@https.bugs.freebsd.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/
Auto-Submitted: auto-generated
List-Id: Standards compliance <freebsd-standards.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/freebsd-standards
List-Help: <mailto:standards+help@freebsd.org>
List-Post: <mailto:standards@freebsd.org>
List-Subscribe: <mailto:standards+subscribe@freebsd.org>
List-Unsubscribe: <mailto:standards+unsubscribe@freebsd.org>
Sender: owner-freebsd-standards@freebsd.org
X-BeenThere: freebsd-standards@freebsd.org
MIME-Version: 1.0
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1654876849;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=GVuFkcwelmEd/IEH+8GzdCZMZ2tzdkaQUf6ekvQ+QwM=;
	b=PBK18oURDkvEPBiEwz/aF7L2rW0XHHdVUEdavrzKJvjQ1TddfZc/w7On5Kdb5XKOE/My6d
	4hm6xCGR2CpSqFTxxK25shjbDQJwNnGjJf8qDQClXzCbwFn3f7hzzYFRJxFnwE3MAZzhLA
	Crm4KLO+xPukU4T1WGTqVxPidhi10+3lL3QbGnFo9ra7jjED19f5bokE7k2FWD4KLGSBRc
	NQjYQEbYN/3CAkLkXLlk4rm00Z0SsmLNp4pJ62rg01dHMoQuoEDEsB/45irWOQdgHqzCCE
	U0Zzybdaj2SWEb+2Kh1BnSCkW52RLjHS/qftrAFJEdV0GoO/rAwXSYpEfA8AAQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654876849; a=rsa-sha256; cv=none;
	b=d/FBEYxitWhPkaCSrV1TOv3TydLSraHsNJpw08mP1fc6tg4VfYPgPnC3SIX3K2GIyj5V4L
	cmo7RxsBLshS6WV/87I1JvR7fThUcWNAYt6SD7tNvlWnT7aH/yjEKHegPajLyrOFRvLC8j
	qCC729IM9LAijmy34KvqhL3WZgZOu7DtV+exrRuaT63OdtoZEYQOypeE4H8qnctJJhDhz/
	27gh16x7496QVaMUKLTVLQUOw446IQWLkY9kz2s7N15kud6woraHuAJH+ohOm+wGRvZtYT
	KIbuB608j4zNwRoLA7OZ1AKE+mXg4Gr0dTCaiBl0WGRvfJUxPTE3fHe4VrrPQQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
X-ThisMailContainsUnwantedMimeParts: N

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D264598

            Bug ID: 264598
           Summary: libradius invalid Message-Authenticator in retransmit
                    packet
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: standards
          Assignee: standards@FreeBSD.org
          Reporter: hwlin1414@cs.nctu.edu.tw

When libradius retransmit packets, the insert_message_authenticator functio=
n is
called and calculated again with old Message-Authenticator checksum. It cau=
se
the Message-Authenticator set to the wrong checksum in retransmit packet.

According to RFC-2869
https://datatracker.ietf.org/doc/html/rfc2869#section-5.14
> When the checksum is calculated the signature string should be
> considered to be sixteen octets of zero.

A possible fix maybe:
--- a/radlib.c
+++ b/radlib.c
@@ -160,6 +160,8 @@ insert_message_authenticator(struct rad_handle *h, int
resp)
        srvp =3D &h->servers[h->srv];

        if (h->authentic_pos !=3D 0) {
+               memset(&h->out[h->authentic_pos + 2], 0, MD5_DIGEST_LENGTH);
+
                ctx =3D HMAC_CTX_new();
                HMAC_Init_ex(ctx, srvp->secret, strlen(srvp->secret),
EVP_md5(), NULL);
                HMAC_Update(ctx, &h->out[POS_CODE], POS_AUTH - POS_CODE);

--=20
You are receiving this mail because:
You are the assignee for the bug.=