From nobody Sat Jun 10 10:25:24 2023 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 4QdYxK229yz4bw0Z for ; Sat, 10 Jun 2023 10:25:25 +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 4QdYxJ5YPvz4Gxj for ; Sat, 10 Jun 2023 10:25:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686392724; 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=Ht0oknRnATPIWoysAug726ktSgD9WckBJpYIxG9L0l8=; b=IKxM0V09khEn4Yj7H3nJiQTIY644iNeiAkQhZkG8WdGXi/VkoMf9O5MZecmmwg2jJgK5Tu 2uG17ks+rO12q0RI0lkh4ObwlGk4UUlshO8ocWGhJref+V9HwqoD++174D1JvYbmRoy2cb YNWOyVSX8MvL7Mqp+OsmDv+kRQAlTnSSkl80rZ1TedVVYvOn63zku4cFCcJ4NRZ59P8TYU 5D1bdr/WPUCAyxZsiRyuMK5Zg26y8gCwZ682+UcnrI4OlS92DI/z6dOWJB0g78CQHWFGUX ehJcdqO0hPgc4e/BGJVu8ST0FK0vxwXRR5FK3syXI+HB4i9LotoPXStQP1snLg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686392724; a=rsa-sha256; cv=none; b=J6GNGsNEQD6YBoi80bTRZUTlBpM3HmzpLi6dlkOFGKq/HdHpROe+6cVJZ7lRXOfTRUWKc3 7I/43g+WVAQ/QQwW17SlVho3I70rtRukgKpFaSFcJfRVWz95Jsl6Wg8aSvsuexpQRV+Xkw mx/TguBuDfBrWag6czxDEhruDa6nCYeHopkeovdRElvGqm787669vgYzS9MNSzRrL5BBbM a3ZEkUVMSi7Fgpa3QHaS4a3yybeOPPtgcFbnjkAHrtIlRkyzo0BbO0XSx46RD4xn5fqN/u X2ePkF7JM3VT1hBl3Sy58pr4rHX2Wg+71/mH6F4wbq85gde9m/GIUIjSppXGnw== 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 4QdYxJ4fmhz1Cr9 for ; Sat, 10 Jun 2023 10:25:24 +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 35AAPOwO068101 for ; Sat, 10 Jun 2023 10:25:24 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 35AAPOSf068100 for bugs@FreeBSD.org; Sat, 10 Jun 2023 10:25:24 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 271935] a short PPP LCP Identification packet can cause a wild write in ppp Date: Sat, 10 Jun 2023 10:25:24 +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: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People 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=3D271935 Bug ID: 271935 Summary: a short PPP LCP Identification packet can cause a wild write in ppp Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: rtm@lcs.mit.edu Attachment #242711 text/plain mime type: Created attachment 242711 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D242711&action= =3Dedit send ppp a too-short LCP Identification packet which causes a wild write Once a PPPOE connection is set up, this packet: xx xx xx xx xx xx yy yy yy yy yy yy 88 64 // ethernet header 11 00 00 01 // pppoe header 00 06 // length c0 21 // LCP 0c // CODE_IDENT from rfc-1570 00 // identifier 00 00 // length will cause ppp's FsmRecvIdent() to write a '\0' in a wrong place: u_short len; len =3D ntohs(lhp->length) - sizeof *lhp; if (len >=3D 4) { ...; cp[len] =3D '\0'; In this situation, lhp->length is 0, so len is 65532.=20 I've attached a demo, pppoe13a.c. The problem is likely only visible with something like valgrind, which the demo program runs. A backtrace: #0 0x000000000013dbb2 in FsmRecvIdent (fp=3D0x409ed1e8, lhp=3D,=20 bp=3D0x41245000) at /usr/rtm/symbsd/src/usr.sbin/ppp/fsm.c:1013 #1 0x000000000013c80c in fsm_Input (fp=3D0x409ed1e8, bp=3D0x41245000) at /usr/rtm/symbsd/src/usr.sbin/ppp/fsm.c:1099 #2 0x0000000000145bf8 in lcp_Input (bundle=3D, l=3D0x409ed0= 00,=20 bp=3D0x41245000) at /usr/rtm/symbsd/src/usr.sbin/ppp/lcp.c:1313 #3 0x0000000000147b2e in Despatch (bundle=3D, l=3D,=20 bp=3D, proto=3D) at /usr/rtm/symbsd/src/usr.sbin/ppp/link.c:381 #4 0x00000000001479ce in link_PullPacket (l=3D0x409ed000, buf=3D,=20 len=3D, b=3D0x1691f8 ) at /usr/rtm/symbsd/src/usr.sbin/ppp/link.c:323 #5 0x00000000001295d0 in bundle_DescriptorRead (d=3D,=20 bundle=3D0x1691f8 , fdset=3D0x408a16d0) at /usr/rtm/symbsd/src/usr.sbin/ppp/bundle.c:546 #6 0x000000000014ac30 in DoLoop (bundle=3D0x1691f8 ) at /usr/rtm/symbsd/src/usr.sbin/ppp/main.c:661 #7 0x000000000014a55a in main (argc=3D, argv=3D) at /usr/rtm/symbsd/src/usr.sbin/ppp/main.c:535 --=20 You are receiving this mail because: You are the assignee for the bug.=