From nobody Tue Nov 17 17:09:53 2026 X-Original-To: dev-commits-src-all@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 4jTWSK3pWrz71Sld for ; Tue, 17 Nov 2026 17:09:53 +0000 (UTC) (envelope-from git@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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jTWSK1nvnz4Qc4 for ; Tue, 17 Nov 2026 17:09:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794935393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yhedp1Ym3K4gfcgduQiLOcn6KgppHKWrCErp3T9WQb8=; b=UIzxaYaG3wX0chVeiwzHcP9IBpnVKo2PLTK6FTTeiHExysN/hdCVJlH3xabNs38S8VAKiv 07AiMI98okBAqcyXCs1fOUuReF8/5t/iE/72GC/Txcd9WfMJj0B++9Ez+1br/8eFHtdzUw JhXbYJfmrBkFeQnh0hCVd3dbxJWipGyZRXvcCjTkH8b2cG/hg4YjMFxqRl3lUrGsmEnE+8 5FoVogROcMZUWWdZ3Dw/siuMr5t8I2zVCRU28v01z93vNc22AtGPj9wpoY9O+v+GQGNAfg t9SF7U80z30vfdJnZe9vs2V8PIdHjRonaOC2QqSAhthV3qe2YZCDMzPgTiH6xQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794935393; b=yu+p1FwsJO0ZPALknz4ZI9Ofgp9xwbGkPqc2HL2z/61FnfuzBb903RwnVww//0r6IQA2+l ikhLfAS1+TXdsI/v2I1iUO+m1beiDbE2B3zcJXsv+tgzfbHokYh/XwyHWVOAKq9qvCxJs9 6moUCzEitpRamMlwCaYP67FZ1Tfmi6DWmwMslKYzPPMuy7Q+LDY803sxUh6u/3dPEYLf0J 5ZkyQc6has+8/CIHFEaSWxryTm7q1icKOkjpTVAmgJdGMNN6DxQqvRAv3Xvo5scRr5xfh7 fefp78/TnyEsbKAAvgy76v17J8Pl3kq3BmnrWzOqHphrnSPkgVbT1wh5rUnVMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794935393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yhedp1Ym3K4gfcgduQiLOcn6KgppHKWrCErp3T9WQb8=; b=IwR8QcSKEBqE6vO6kBwgy1VGHEjLokpJ5d9SGTed6085H6We7bkbmd/V3cn9RvinLvB6N8 oiBeMeAbZ6fPck5rAagARXG/eH4bwXtw4cex2VbZMOJ6YkF06Q5DFfDa3+dHTy/2e6WvGj M52H3a3oYfeKVxKaGrnhNpXYIKl6NP7XepA9Aiw90AeufDTLZvtU15HAiuRKp7aICvgwrG 0bKddbRD7QpSIh/yBMP52uVCRyKTweZ4wm7tfPZLSgsAPAYcf8IgUXkCW0wHDTim7Ffhqz P9ZBeD7ni9kyQZsPaQ4T4Fr1H43Ua2QjlU+myM9+a/RNdqzI7IYX+0lEBdcvuw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jTWSK1Rnyzrsr for ; Tue, 17 Nov 2026 17:09:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 845 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 17 Nov 2026 17:09:53 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Maxim Konovalov From: Mark Johnston Subject: git: b3d95934d868 - releng/15.2 - bsnmp: mask reserved SNMPv3 msgFlags bits on input List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/15.2 X-Git-Reftype: branch X-Git-Commit: b3d95934d8686f667be09332dd7c151ac6a557a8 Auto-Submitted: auto-generated Date: Tue, 17 Nov 2026 17:09:53 +0000 Message-Id: <6afc8a61.845.577c6672@gitrepo.freebsd.org> The branch releng/15.2 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b3d95934d8686f667be09332dd7c151ac6a557a8 commit b3d95934d8686f667be09332dd7c151ac6a557a8 Author: Maxim Konovalov AuthorDate: 2026-11-12 00:43:05 +0000 Commit: Mark Johnston CommitDate: 2026-11-17 13:36:23 +0000 bsnmp: mask reserved SNMPv3 msgFlags bits on input snmp_pdu_decode_header() reads the msgFlags octet straight into pdu->flags and never sanitises it. Only bits 0..2 are defined on the wire (authFlag, privFlag, reportableFlag). Bit 7 (0x80) is bsnmp's internal SNMP_MSG_AUTODISCOVER marker: it shares the same field and is tested later as "this is discovery, skip USM and VACM". Because the byte is taken verbatim from an unauthenticated peer, a client that sets bit 7 of msgFlags has (pdu->flags & SNMP_MSG_AUTODISCOVER) read true straight after header decode, forging the discovery state. A noAuthNoPriv user -- which has no digest to verify -- can thus mark an ordinary request as discovery and have it bypass the VACM access check, operating outside its configured views. Keep only the three defined wire bits when decoding msgFlags, so the internal marker can never be set from the network. Approved by: re (cperciva) Approved by: so Security: FreeBSD-SA-26:89.bsnmp Reviewed by: harti Fixes: 135f7de5ddb6 --- contrib/bsnmp/lib/snmp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/bsnmp/lib/snmp.c b/contrib/bsnmp/lib/snmp.c index d1dabc8884a0..acdf5df0c683 100644 --- a/contrib/bsnmp/lib/snmp.c +++ b/contrib/bsnmp/lib/snmp.c @@ -523,6 +523,13 @@ snmp_pdu_decode_header(struct asn_buf *b, struct snmp_pdu *pdu) snmp_error("cannot decode msg flags"); return (SNMP_CODE_FAILED); } + /* + * msgFlags is attacker-controlled. Keep only the three + * defined wire bits, so a client cannot forge an internal + * marker that shares this byte (SNMP_MSG_AUTODISCOVER). + */ + pdu->flags &= (SNMP_MSG_AUTH_FLAG | SNMP_MSG_PRIV_FLAG | + SNMP_MSG_REPORT_FLAG); if (asn_get_integer(b, &pdu->security_model) != ASN_ERR_OK) { snmp_error("cannot decode msg size");