diff options
| author | Maxim Konovalov <maxim@FreeBSD.org> | 2026-11-12 00:43:06 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2026-11-16 21:17:13 +0000 |
| commit | fffdd6dcb09a91a8b83107f490e4e13d760e874f (patch) | |
| tree | 3a69d9858248fd642c824e9f3307bc24d0257881 | |
| parent | 546bf20b2d1b9777c0567387bf9530cb0b90c6f3 (diff) | |
bsnmp: let an SNMPv3 discovery message elicit only a Report
An SNMPv3 message with no variable bindings is treated as RFC 3414
engineID (or time-window) discovery: snmp_input_start() appends a
single usmStats counter to the request, and snmp_pdu_auth_access()
skips the VACM check because the AUTODISCOVER flag is set. The
request's verb was then still dispatched by type. A genuine discovery
is a GET and simply reads that counter back -- the intended Report --
but a zero-binding GETNEXT or GETBULK instead walks forward from the
appended OID, and with VACM skipped it returns the next registered
object(s): an unauthenticated read of the agent's USM and VACM
configuration (objects at or after 1.3.6.1.6.3.15).
Force the verb of a discovery message to GET, so the appended counter
is read as-is and no walk (or SET) can run under the skipped-VACM
state. Genuine discovery, which already uses GET, is unaffected.
This complements the earlier change that rejects an AUTODISCOVER
message carrying its own bindings; that guard is never reached on this
path, because the offending binding is appended by the agent after the
zero-binding test.
Approved by: so
Security: FreeBSD-SA-26:89.bsnmp
Reviewed by: harti
Fixes: 135f7de5ddb6
| -rw-r--r-- | contrib/bsnmp/snmpd/main.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/contrib/bsnmp/snmpd/main.c b/contrib/bsnmp/snmpd/main.c index d1377756b64e..18e27695cf52 100644 --- a/contrib/bsnmp/snmpd/main.c +++ b/contrib/bsnmp/snmpd/main.c @@ -644,6 +644,15 @@ decoded: pdu->engine.engine_boots = snmpd_engine.engine_boots; pdu->engine.engine_time = snmpd_engine.engine_time; } + /* + * A discovery message may only elicit a Report. Force GET + * so the appended usmStats counter is read back as-is: a + * GETNEXT or GETBULK would otherwise walk forward from it, + * and a SET act on it, all with VACM skipped for the + * AUTODISCOVER flag. + */ + if ((pdu->flags & SNMP_MSG_AUTODISCOVER) != 0) + pdu->type = SNMP_PDU_GET; } else if (pdu->user.auth_proto != SNMP_AUTH_NOAUTH && (pdu->engine.engine_boots == 0 || pdu->engine.engine_time == 0)) { snmpd_usmstats.not_in_time_windows++; |
