NetBSD Problem Report #60375
From riastradh@netbsd.org Fri Jun 26 19:49:42 2026
Return-Path: <riastradh@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.netbsd.org", Issuer "R13" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 6E7D71A923A
for <gnats-bugs@gnats.NetBSD.org>; Fri, 26 Jun 2026 19:49:42 +0000 (UTC)
Message-Id: <20260626194941.650881A923B@mollari.NetBSD.org>
Date: Fri, 26 Jun 2026 19:49:41 +0000 (UTC)
From: riastradh@netbsd.org
Reply-To: riastradh@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: lua.kmod enables local privilege escalation
X-Send-Pr-Version: 3.95
X-From4GNATS: "riastradh@netbsd.org via gnats" <gnats-admin@NetBSD.org>
>Number: 60375
>Category: misc
>Synopsis: lua.kmod enables local privilege escalation
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: misc-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jun 26 19:50:00 +0000 2026
>Closed-Date: Tue Jun 30 13:35:13 +0000 2026
>Last-Modified: Tue Jun 30 13:35:13 +0000 2026
>Originator: Taylor R Campbell
>Release: current, 11, 10, 9, ...
>Organization:
The NetBSD Security Luau, Inc.
>Environment:
>Description:
Loading lua.kmod allows unrestricted code execution in the
kernel. The default permissions on /dev/lua are 0664, and
read permission is enough to submit code into /dev/lua.
Consequently, although lua.kmod is not loaded by default, the
default permissions on /dev/lua mean that loading lua.kmod
creates a local privilege escalation vulnerability.
Reported by zdi-disclosures@trendmicro.com.
>How-To-Repeat:
modload lua.kmod
use /dev/lua as an unprivileged user
>Fix:
Set default permissions on /dev/lua to me mode 0600.
>Release-Note:
>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60375 CVS commit: src/etc
Date: Sat, 27 Jun 2026 19:58:26 +0000
Module Name: src
Committed By: riastradh
Date: Sat Jun 27 19:58:26 UTC 2026
Modified Files:
src/etc: MAKEDEV.tmpl
Log Message:
MAKEDEV: Set default perms on /dev/lua to 0600.
Otherwise unprivileged users can submit Lua code into the kernel, if
lua.kmod is loaded (which doesn't happen by default, not even
autoloaded on demand).
PR misc/60375: lua.kmod enables local privilege escalation
To generate a diff of this commit:
cvs rdiff -u -r1.238 -r1.239 src/etc/MAKEDEV.tmpl
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60375 CVS commit: src
Date: Sat, 27 Jun 2026 20:05:06 +0000
Module Name: src
Committed By: riastradh
Date: Sat Jun 27 20:05:06 UTC 2026
Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/sys/modules/lua: lua.c
src/sys/sys: lua.h
src/tests/kernel: Makefile
Added Files:
src/tests/kernel: t_lua.c
Log Message:
lua(4): Fix and test some issues.
- Require read permission for LUAINFO.
- Require write permission for all others:
. LUACREATE
. LUADESTROY
. LUALOAD
. LUAREQUIRE
- Don't panic in LUAINFO if there's zero states.
- Add missing sys/stdbool.h in sys/lua.h.
This is not a real test suite for lua.kmod -- it doesn't verify the
module does anything useful; it just verifies that _if_ you go out of
your way to load the experimental kernel module, it doesn't enable
unprivileged users to wreak havoc with /dev/lua.
PR misc/60375: lua.kmod enables local privilege escalation
To generate a diff of this commit:
cvs rdiff -u -r1.513 -r1.514 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1421 -r1.1422 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.28 -r1.29 src/sys/modules/lua/lua.c
cvs rdiff -u -r1.9 -r1.10 src/sys/sys/lua.h
cvs rdiff -u -r1.96 -r1.97 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/kernel/t_lua.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60375 CVS commit: [netbsd-11] src
Date: Mon, 29 Jun 2026 19:52:23 +0000
Module Name: src
Committed By: martin
Date: Mon Jun 29 19:52:23 UTC 2026
Modified Files:
src/distrib/sets/lists/debug [netbsd-11]: mi
src/distrib/sets/lists/tests [netbsd-11]: mi
src/etc [netbsd-11]: MAKEDEV.tmpl
src/sys/modules/lua [netbsd-11]: lua.c
src/sys/sys [netbsd-11]: lua.h
src/tests/kernel [netbsd-11]: Makefile
Added Files:
src/tests/kernel [netbsd-11]: t_lua.c
Log Message:
Pull up following revision(s) (requested by riastradh in ticket #350):
sys/modules/lua/lua.c: revision 1.29
distrib/sets/lists/tests/mi: revision 1.1422
tests/kernel/t_lua.c: revision 1.1
etc/MAKEDEV.tmpl: revision 1.239
distrib/sets/lists/debug/mi: revision 1.514
tests/kernel/Makefile: revision 1.97
sys/sys/lua.h: revision 1.10
MAKEDEV: Set default perms on /dev/lua to 0600.
Otherwise unprivileged users can submit Lua code into the kernel, if
lua.kmod is loaded (which doesn't happen by default, not even
autoloaded on demand).
PR misc/60375: lua.kmod enables local privilege escalation
lua(4): Fix and test some issues.
- Require read permission for LUAINFO.
- Require write permission for all others:
. LUACREATE
. LUADESTROY
. LUALOAD
. LUAREQUIRE
- Don't panic in LUAINFO if there's zero states.
- Add missing sys/stdbool.h in sys/lua.h.
This is not a real test suite for lua.kmod -- it doesn't verify the
module does anything useful; it just verifies that _if_ you go out of
your way to load the experimental kernel module, it doesn't enable
unprivileged users to wreak havoc with /dev/lua.
PR misc/60375: lua.kmod enables local privilege escalation
To generate a diff of this commit:
cvs rdiff -u -r1.485.2.8 -r1.485.2.9 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1387.2.8 -r1.1387.2.9 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.237 -r1.237.2.1 src/etc/MAKEDEV.tmpl
cvs rdiff -u -r1.28 -r1.28.12.1 src/sys/modules/lua/lua.c
cvs rdiff -u -r1.9 -r1.9.8.1 src/sys/sys/lua.h
cvs rdiff -u -r1.96 -r1.96.2.1 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1.2.2 src/tests/kernel/t_lua.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->pending-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 29 Jun 2026 19:57:46 +0000
State-Changed-Why:
fixed in HEAD
pullup-11 #350 https://releng.netbsd.org/cgi-bin/req-11.cgi?show=350
pullup-10 #1294 https://releng.netbsd.org/cgi-bin/req-10.cgi?show=1294
pullup-9 #2024 https://releng.netbsd.org/cgi-bin/req-9.cgi?show=2024
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60375 CVS commit: [netbsd-10] src
Date: Mon, 29 Jun 2026 19:55:53 +0000
Module Name: src
Committed By: martin
Date: Mon Jun 29 19:55:52 UTC 2026
Modified Files:
src/distrib/sets/lists/debug [netbsd-10]: mi
src/distrib/sets/lists/tests [netbsd-10]: mi
src/etc [netbsd-10]: MAKEDEV.tmpl
src/sys/modules/lua [netbsd-10]: lua.c
src/sys/sys [netbsd-10]: lua.h
src/tests/kernel [netbsd-10]: Makefile
Added Files:
src/tests/kernel [netbsd-10]: t_lua.c
Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1294):
sys/modules/lua/lua.c: revision 1.29
distrib/sets/lists/tests/mi: revision 1.1422
tests/kernel/t_lua.c: revision 1.1
etc/MAKEDEV.tmpl: revision 1.239
distrib/sets/lists/debug/mi: revision 1.514
tests/kernel/Makefile: revision 1.97
sys/sys/lua.h: revision 1.10
MAKEDEV: Set default perms on /dev/lua to 0600.
Otherwise unprivileged users can submit Lua code into the kernel, if
lua.kmod is loaded (which doesn't happen by default, not even
autoloaded on demand).
PR misc/60375: lua.kmod enables local privilege escalation
lua(4): Fix and test some issues.
- Require read permission for LUAINFO.
- Require write permission for all others:
. LUACREATE
. LUADESTROY
. LUALOAD
. LUAREQUIRE
- Don't panic in LUAINFO if there's zero states.
- Add missing sys/stdbool.h in sys/lua.h.
This is not a real test suite for lua.kmod -- it doesn't verify the
module does anything useful; it just verifies that _if_ you go out of
your way to load the experimental kernel module, it doesn't enable
unprivileged users to wreak havoc with /dev/lua.
PR misc/60375: lua.kmod enables local privilege escalation
To generate a diff of this commit:
cvs rdiff -u -r1.394.2.18 -r1.394.2.19 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1238.2.22 -r1.1238.2.23 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.232.2.2 -r1.232.2.3 src/etc/MAKEDEV.tmpl
cvs rdiff -u -r1.28 -r1.28.4.1 src/sys/modules/lua/lua.c
cvs rdiff -u -r1.8.48.1 -r1.8.48.2 src/sys/sys/lua.h
cvs rdiff -u -r1.70.2.1 -r1.70.2.2 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1.4.2 src/tests/kernel/t_lua.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60375 CVS commit: [netbsd-9] src
Date: Mon, 29 Jun 2026 20:00:06 +0000
Module Name: src
Committed By: martin
Date: Mon Jun 29 20:00:05 UTC 2026
Modified Files:
src/distrib/sets/lists/debug [netbsd-9]: mi
src/distrib/sets/lists/tests [netbsd-9]: mi
src/etc [netbsd-9]: MAKEDEV.tmpl
src/sys/modules/lua [netbsd-9]: lua.c
src/sys/sys [netbsd-9]: lua.h
src/tests/kernel [netbsd-9]: Makefile
Added Files:
src/tests/kernel [netbsd-9]: t_lua.c
Log Message:
Pull up following revision(s) (requested by riastradh in ticket #2024):
sys/modules/lua/lua.c: revision 1.29
distrib/sets/lists/tests/mi: revision 1.1422
tests/kernel/t_lua.c: revision 1.1
etc/MAKEDEV.tmpl: revision 1.239
distrib/sets/lists/debug/mi: revision 1.514
tests/kernel/Makefile: revision 1.97
sys/sys/lua.h: revision 1.10
MAKEDEV: Set default perms on /dev/lua to 0600.
Otherwise unprivileged users can submit Lua code into the kernel, if
lua.kmod is loaded (which doesn't happen by default, not even
autoloaded on demand).
PR misc/60375: lua.kmod enables local privilege escalation
lua(4): Fix and test some issues.
- Require read permission for LUAINFO.
- Require write permission for all others:
. LUACREATE
. LUADESTROY
. LUALOAD
. LUAREQUIRE
- Don't panic in LUAINFO if there's zero states.
- Add missing sys/stdbool.h in sys/lua.h.
This is not a real test suite for lua.kmod -- it doesn't verify the
module does anything useful; it just verifies that _if_ you go out of
your way to load the experimental kernel module, it doesn't enable
unprivileged users to wreak havoc with /dev/lua.
PR misc/60375: lua.kmod enables local privilege escalation
To generate a diff of this commit:
cvs rdiff -u -r1.285.2.12 -r1.285.2.13 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.818.2.10 -r1.818.2.11 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.205.2.3 -r1.205.2.4 src/etc/MAKEDEV.tmpl
cvs rdiff -u -r1.24 -r1.24.8.1 src/sys/modules/lua/lua.c
cvs rdiff -u -r1.8 -r1.8.22.1 src/sys/sys/lua.h
cvs rdiff -u -r1.60.2.2 -r1.60.2.3 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1.6.2 src/tests/kernel/t_lua.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: pending-pullups->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 30 Jun 2026 13:35:13 +0000
State-Changed-Why:
fixed in HEAD, pulled up to 11, 10, and 9
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.