Article View: muc.lists.freebsd.bugs
Article #769[Bug 301167] rtsock: routing-socket announcements reach classic jails that cannot read the same routes through the query paths
From: bugzilla-noreply
Date: Thu, 26 Nov 2026 21:43
Date: Thu, 26 Nov 2026 21:43
101 lines
5993 bytes
5993 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301167
Bug ID: 301167
Summary: rtsock: routing-socket announcements reach classic
jails that cannot read the same routes through the
query paths
Product: Base System
Version: 15.1-RELEASE
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: kern
Assignee: bugs@FreeBSD.org
Reporter: laamalif@proton.me
A process inside a classic jail receives routing-socket
announcements for host routes and interface addresses that the
same jail cannot read through the NET_RT_DUMP sysctl. The
routing socket needs no privilege from a jail, so an
unprivileged jailed process sees host route changes as they
happen.
To reproduce, on a host running 15.1-RELEASE-p7, create a
classic jail with one IP address, and inside it build and run
rtsock_jail_probe.c. The probe first reads the route table
through the NET_RT_DUMP sysctl, then opens a PF_ROUTE socket
and prints each announcement. The jail used one address,
10.27.9.20. Run as the jail's root, the baseline and one
announcement were:
$ jexec rtsockdemo /bin/rtsock_jail_probe --inside
caller: uid=0 euid=0 inside=1
visible entry 1: type=RTM_GET
dst af=2 10.27.9.20
sa af=18 len=16
sa af=18 len=56
sa af=2 127.0.0.1
NET_RT_DUMP: 256 bytes, 1 route entries visible to this caller
PF_ROUTE socket open; listening for announcements (30s window)
announcement: type=RTM_ADD len=184
dst af=2 172.16.99.81
gw af=2 10.27.9.1
The sysctl shows the jail one route, its own address. The
host's route add of 172.16.99.81 produced the pasted
announcement, and its removal produced a matching RTM_DELETE
with the same sockaddrs. The same differential
reproduces on 16.0-CURRENT, which showed RTM_ADD and
RTM_DELETE pairs for a host route and a lo0 alias, and it
reproduces unprivileged on the 15.1 jail: run with
the probe's --inside-nobody mode, which drops to uid 65534
before opening the socket, the announcement for the next
route add arrived the same way:
caller: uid=65534 euid=65534 inside=1
NET_RT_DUMP: 256 bytes, 1 route entries visible to this caller
PF_ROUTE socket open; listening for announcements (30s window)
announcement: type=RTM_ADD len=184
dst af=2 172.16.99.82
gw af=2 10.27.9.1
The intent to hide these routes from a jail is old and
explicit. Since January 2009, commit 813dd6ae5e04, the query
paths have filtered jailed callers: RTM_GET refuses non-host
routes and host routes outside the jail, and sysctl_dumpentry
does the same (the check became rt_is_exportable() in 2023).
The announcement writers in sys/net/rtsock.c have no such
filter. They pass their messages to rts_input(), which selects
receiving sockets by address family and FIB only.
prison_check_af() permits AF_ROUTE inside a jail, and
rts_attach() requires no privilege, so any process in the jail
receives what the host's routing changes produce.
The fix applies the same policy at the announcement boundary:
in rts_input(), at fanout, announce to each socket only what
rt_is_exportable() and prison_if() would export to that
socket's credentials, skipping a jailed socket for host
routes it could not query. The non-route messages, RTM_IFINFO
and RTM_IFANNOUNCE, need the same per-recipient decision. I
have not written a patch, so no patched 15.1 kernel was
built or run.
No RTM_IFINFO or RTM_IFANNOUNCE message appeared in any
recorded run, and I did not test the vnet case or the IPv6
family. The probe exits 0 when its listening window closes;
a failed sysctl read prints an error and the program still
exits 0.
--inside selects the jailed mode; --inside-nobody the
unprivileged form.
--
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-301167-227@https.bugs.freebsd.org/bugzilla/>Path:
mbox-mo1.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail From: bugzilla-noreply@freebsd.org Newsgroups: muc.lists.freebsd.bugs Subject: [Bug 301167] rtsock: routing-socket announcements reach classic jails that cannot read the same routes through the query paths Date: Thu, 26 Nov 2026 21:43:15 +0000 Organization: Newsgate at muc.de e.V. Approved: news-admin@muc.de Distribution: world Message-ID: <bug-301167-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="3540"; 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=1795729395; 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=hDL52Kr8AmeXIBaULC6f6bE+OQM6cTgX56t94HfyAEM=; b=KM0dLfcGj8pia+2Ck4KDOjo3BiaVmiR27tUzo0ez/J1Qk/ERUFzD/qDjz+StkUkI/6P3sw 7YL+zC4OUHCVaqKkMVigATT3X4vUfqciSBYheBkiK05y6kZmM9DanVEoJtRJBDhrMungv/ 7vqkKdQ2KUzc7ZDtpPbdFpBvHqCv0jj21Ehrr3U8sbKVUSUe3JFMZZKAKX8UoupX1nIgtj mQeUZVPdMjC7E3LUPQd5FwNFZGYCK2NabVX7M9Outuwk1SNLh+Dv22AOY+vDtHZVUYsJPm uV0IQVyQHFFyf4L5gqCTa1GZ/+JQEtUWVn1XfrJzaIPNr/G4tCETh8W54ZxmiQ== 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