From nobody Sat Sep 18 10:58:00 2021 X-Original-To: bugs@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 3A8C717C06C9 for ; Sat, 18 Sep 2021 10:58:00 +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 4HBSTh0xxFz3n46 for ; Sat, 18 Sep 2021 10:58:00 +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 F17AD536 for ; Sat, 18 Sep 2021 10:57:59 +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 18IAvxjf063515 for ; Sat, 18 Sep 2021 10:57:59 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 18IAvxKf063514 for bugs@FreeBSD.org; Sat, 18 Sep 2021 10:57:59 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: bugs@FreeBSD.org Subject: [Bug 258570] bsnmpwalk can crash due to bug in snmp_parse_resp() Date: Sat, 18 Sep 2021 10:58:00 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 13.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: rtm@lcs.mit.edu X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@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 attachments.mimetype attachments.created Message-ID: 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: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D258570 Bug ID: 258570 Summary: bsnmpwalk can crash due to bug in snmp_parse_resp() Product: Base System Version: 13.0-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: rtm@lcs.mit.edu Attachment #227978 text/plain mime type: Created attachment 227978 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D227978&action= =3Dedit Fake snmp server to demonstrate bsnmpwalk crash. snmp_parse_resp() in libbsnmptools contains: if (resp->error_status =3D=3D SNMP_ERR_NOSUCHNAME) { warnx("Error - No Such Name"); return (0); } It should be return(-1). If the name is bad, the return 0 will cause bsnmpwalk to continue with an unchecked reply, so (for example) if resp.nbindings is zero or huge, this line will generate a wild pointer: snmpwalk_nextpdu_create(op, &(resp.bindings[resp.nbindings - 1].var), &req); The attached fake snmp server demonstrates the problem: % cc bsnmpwalk1.c % ./a.out & waiting on port 1610 for a request % bsnmpwalk -s localhost:1610 SNMP: ignoring trailing junk in message bsnmpwalk: Error - No Such Name Bus error (core dumped) --=20 You are receiving this mail because: You are the assignee for the bug.=