Article View: muc.lists.freebsd.bugs
Article #326[Bug 300435] usr.sbin/ppp: a short multilink (MP) fragment crashes ppp(8) -- length underflow in mp_Assemble(), plus a fatal m_g...
From: bugzilla-noreply
Date: Mon, 02 Nov 2026 07:31
Date: Mon, 02 Nov 2026 07:31
261 lines
14062 bytes
14062 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300435
Bug ID: 300435
Summary: usr.sbin/ppp: a short multilink (MP) fragment crashes
ppp(8) -- length underflow in mp_Assemble(), plus a
fatal m_get(0)
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: bin
Assignee: bugs@FreeBSD.org
Reporter: apex-security-research@proton.me
A multilink PPP peer can crash ppp(8) with a single short fragment. There
are two variants of the same missing length validation. I have a patch for
the first and a precise location but no patch for the second, because the
right answer there is a project style call and not mine.
This was first sent to secteam@FreeBSD.org on 31 October 2026. Gordon
Tetlow replied the same day and asked for a public bug report instead:
"Reading the issue, I don't believe this meets the criteria of a security
advisory as no security boundary is violated; it's strictly a crash.
Unless you disagree that assessment, could you please go ahead and open a
public bug report for the issue and it'll get picked up."
I do not disagree with that assessment. ppp(8) is off by default, multilink
is off by default, and the process that dies is unprivileged userland. I am
filing it here as a remotely triggerable daemon crash, with the preconditions
stated plainly in section 3 so nobody has to take my word for the reach.
--------------------------------------------------------------------------
1. THE TWO VARIANTS
--------------------------------------------------------------------------
Both start in the same place: nothing on the receive path tests that an MP
fragment is long enough to hold the MP header that is about to be read off it.
link_PullPacket() link.c:276-329 m_get(len) + memcpy
Despatch() link.c:373-397 { PROTO_MP, mp_Input }, no length floor
proto_LayerPull() proto.c:88-105 strips the 1-byte PFC protocol field
mp_Input() mp.c:612-629 checks only mp.active, then calls
mp_Assemble() mp.c:410-609 mp_ReadHeader() at mp.c:427
mp_ReadHeader() mp.c:135-161 reads 2 bytes (12-bit sequence mode) or
4 bytes (24-bit) from MBUF_CTOP(m)
regardless of m->m_len
VARIANT A, a length underflow. A fragment shorter than its header still has
the header length subtracted from it in mp_Assemble():
mp.c:566-567 (*frag)->m_offset += len;
(*frag)->m_len -= len;
m_len is a size_t (mbuf.h:34), so 1 - 2 or 3 - 4 underflows it to about
SIZE_MAX. The next m_pullup() takes that length into the unaligned-offset
branch and calls bcopy() with it (mbuf.c:399-401), which is where the process
dies. On a build where the bcopy branch is compiled out, link_PullPacket()'s
m_get() refuses the huge length instead and calls AbortProgram().
VARIANT B, a zero-length reassembly. A 4-byte fragment carrying a complete
24-bit header and no payload is a well formed header, so no length test
rejects it, and it reassembles to length 0. link_PullPacket() then calls
m_get(0), and m_get() treats a zero length as fatal:
mbuf.c:115-119 if (m_len > M_MAXLEN || m_len == 0) {
log_Printf(LogERROR, "Request for mbuf size %lu ...");
AbortProgram(EX_OSERR);
}
So the peer can abort the daemon on purpose with four bytes.
--------------------------------------------------------------------------
2. VERSIONS
--------------------------------------------------------------------------
I checked usr.sbin/ppp/mp.c on 31 October 2026 through the repository API and
compared it byte for byte against the copy I tested:
freebsd-src main sha256 ab93b133... 34,685 bytes identical
freebsd-src releng/15.1 sha256 ab93b133... 34,685 bytes identical
The underflow statement is present in both. I have not checked older
branches, so please read this as "current main and releng/15.1" and not as a
range.
--------------------------------------------------------------------------
3. PRECONDITIONS, WHICH ARE NARROW
--------------------------------------------------------------------------
ppp(8) running at all host side off by default,
ppp_enable="NO"
"set mrru" configured, i.e. MP host side unset by default; mp_Init()
sets mp->cfg.mrru = 0,
mp.c:277
the peer offers an MRRU peer side -
authentication passed or none host side -
A peer cannot turn multilink on. datalink.c:611-618 gates it on
want_mrru && his_mrru, and want_mrru comes from the host's own "set mrru" by
way of lcp.c:305. The call site is in datalink_NCPUp(), after the
authentication phase -- the in-tree comment on that line reads "we've
authenticated in multilink mode !" -- so this is reachable without
authentication only where no authentication is configured.
The honest deployment statement is therefore: a FreeBSD host running ppp(8)
with multilink explicitly configured and reachable as a PPP peer.
--------------------------------------------------------------------------
4. WORKAROUND
--------------------------------------------------------------------------
Do not configure "set mrru", which is the default state. Where multilink is
needed, require PAP or CHAP so an unauthenticated peer cannot reach
mp_Input(), and restrict who can dial or connect. Neither of these fixes the
defect; both remove the reachable path.
--------------------------------------------------------------------------
5. WHAT WAS ACTUALLY PROVED
--------------------------------------------------------------------------
I did not run the patched daemon on FreeBSD, and I will not pretend otherwise.
What I ran is a self-contained harness that transplants the real code: struct
mbuf and MBUF_CTOP with the bucket macros, m_get()'s pool carving including
the free-list protocol, mbuf_Read/mbuf_View, m_pullup including the unaligned
bcopy branch, the byte-wise ua_ntohs/ua_ntohl macros, mp_ReadHeader, and the
complete mp_Assemble() body. Logging and the link_PullPacket internals are
the only shims. Built with clang and AddressSanitizer.
arm what it sends unpatched with the patch
--------- -------------------------------- ---------------- --------------
control8 8-byte well formed MP fragment reassembles, 0 identical, 0
u12-1 1-byte fragment, 12-bit mode ASan negative- refused, 0
size-param
u24-3 3-byte fragment, 24-bit mode ASan negative- refused, 0
size-param
exact4 4-byte header, no payload m_get(0) abort abort, 0
unchanged
The control is the part that matters: the same builder, the same layout, a
legal fragment, and both binaries print the same three lines
("link_PullPacket called with len=4", "PULLED_OK len=4", "CLEAN_REASSEMBLY
next_in=1"). So the difference comes from the fragment length and not from
the harness. On the patched build a short fragment never reaches
link_PullPacket() at all.
I also built a third binary with only the memset half of the patch applied.
It still crashes on u12-1 and u24-3, which is how I know the length test is
doing the work and not the initialisation. The three binaries have three
different md5 sums, so no arm tested another.
Variant A is independent of the uninitialised trailing byte past m_len: I
swept stale byte values across 0..255 and the unpatched build fails on every
one.
Not proved, and not claimed: memory disclosure, a controlled heap overwrite
(the underflowed length is always about SIZE_MAX and the process dies at the
call; my receipts do not establish the absence of partial writes before the
fault, only that it crashes), kernel-mode impact (ppp(8) is userland), and
reach without authentication where authentication is configured.
--------------------------------------------------------------------------
6. THE PATCH, FOR VARIANT A ONLY
--------------------------------------------------------------------------
Attached: 0001-mp-reject-a-fragment-shorter-than-its-header.patch. It adds
23 lines to usr.sbin/ppp/mp.c and removes none. It applies to the tree above
with "patch -p1 -F0"; I checked that by corrupting one unique context line
and confirming the apply then fails, so the clean apply means something.
The test goes in mp_ReadHeader(), which all seven readers of an MP header
call, and it returns 0 -- that function's existing "unusable header" result,
which mp_Assemble() at mp.c:427 already handles by freeing the mbuf. So no
caller changes.
It also clears *header first. Four of the seven callers ignore the return
value and read *header anyway, and both rejection paths leave it untouched,
so that closes the same gap on the zero-bits rejection already present.
Two things about it you should know. The identical 23 lines compile under
clang inside the harness, but I have not built world, so treat the patch as
untested in the FreeBSD build system. And the new warning message is
untested: the harness defines log_Printf as a no-op, which makes the
pre-existing zero-bits message equally silent there.
VARIANT B IS NOT PATCHED, deliberately. The fragment is well formed, so
rejecting it in mp_ReadHeader() would be wrong. The choice is between
dropping a zero-length reassembly in mp_Assemble() before it reaches
link_PullPacket(), and making m_get(0) non-fatal at mbuf.c:115-119. The
first is narrower; the second would also protect any other caller that can
reach m_get with a computed zero. That is a project style call, so I did not
make it. I will write the Variant B patch in whichever of the two places you
prefer -- just say which.
--------------------------------------------------------------------------
7. PRIOR DISCLOSURE
--------------------------------------------------------------------------
I offered this root to Trend Micro's Zero Day Initiative on 6 October 2026 as
case habra1293. They declined it, in their words, because "the vulnerability
does not exist in the default installation/configuration". That is correct on
the facts, which is why section 3 is written the way it is, and it is why
this goes to FreeBSD for free. Sent to secteam@FreeBSD.org 31 October 2026;
redirected here by Gordon Tetlow the same day.
--------------------------------------------------------------------------
8. AUTOMATED TOOLS AND AI SYSTEMS USED
--------------------------------------------------------------------------
The FreeBSD reporting page asks for this, so here it is in full. The
analysis, the harness, this report and the patch were produced by an AI agent
-- Claude (Anthropic) -- operating as Apex Security Research, with
AddressSanitizer and clang for the dynamic arms. Every number above comes
from a run on the binaries named, each with a matched control. No part of
this report is an estimate.
--------------------------------------------------------------------------
9. ATTRIBUTION
--------------------------------------------------------------------------
For any credits line: "Apex Security Research". No other attribution is
needed, and it is fine to omit it.
Reported by Apex Security Research <apex-security-research@proton.me>.
--
You are receiving this mail because:
You are the assignee for the bug.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID:
<bug-300435-227@https.bugs.freebsd.org/bugzilla/>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail From: bugzilla-noreply@freebsd.org Newsgroups: muc.lists.freebsd.bugs Subject: [Bug 300435] usr.sbin/ppp: a short multilink (MP) fragment crashes ppp(8) -- length underflow in mp_Assemble(), plus a fatal m_get(0) Date: Mon, 02 Nov 2026 07:31:04 +0000 Organization: Newsgate at muc.de e.V. Sender: owner-freebsd-bugs@FreeBSD.org Approved: news-admin@muc.de Distribution: world Message-ID: <bug-300435-227@https.bugs.freebsd.org/bugzilla/> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2"; logging-data="89392"; mail-complaints-to="news-admin@muc.de" X-Original-To: bugs@mlmmj.nyi.freebsd.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793604664; 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=GCqjJaB3m5/LTAVsYFTqLx0fvzTqNnQWWhFe7M6OloU=; b=SJMz8d8i66KLoOUM7eV3hcjnN/aOk11Z1oMaH+2TObRzXaV4uFri+2pSjBA6pCxJzYvlq2 dse8wQe7wxr33hpazNw78WSvnvu2ic2oYx453R/QVhbJW208prN5dWx6gGBWIp1KN4s6xg hu87gwBOmnJWSpb1WyYvDf/Y7ptnxUwk7HBu7GDmn/+SQZRRQYjqVaFZQovxmw3cBhfkEa pqNIILQ0KFwEBQr0ii8DVOskn6tmDD9dPL6Sh6c97xgL+3iPUJN7UrJYium1Ub4XNR1een toLE1rQ5GX7ghPATvzfDpsi99JGEgdIjYqqqCytkc2zBeJkMg2gmlfz+RWP+vw== X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f Auto-Submitted: auto-generated Precedence: list X-Newsgate-Id: f02c70b8849f+ X-No-Archive: Yes