GHSA-vj8g-x55g-mp3x
Summary imklog reads kernel log lines of the form <d>[ seconds. micros] text
- Scores
- UnknownNo source reports a CVSS or EPSS score yet.
- Exploitation
- UnknownNo source reports exploitation yet.
- Listed fix
- None listedNo source lists a fixed version in its version data.Check the description and references.
Overview
Summary
imklog reads kernel log lines of the form <d>[ seconds.micros] text. After
removing the timestamp (default), Syslog() checks whether the remaining text
starts with a second <NN> and, if NN is a valid PRI of 8 or more, uses it
as the message's facility and severity instead of the kernel's own <d>. This
was added in 2011 for systemd writing <NN>-prefixed records into
/dev/kmsg on kernels that did not yet parse that prefix themselves; current
kernels do.
The text after the kernel prefix is not kernel-controlled in general. The
kernel prints strings chosen by unprivileged processes, most notably the task
name (comm, 15 bytes, set with prctl(PR_SET_NAME) or by the basename of
the executed file). A process that crashes produces, by default on x86 and
arm64, a line that starts with its name:
<6>[213394.693709] <33>forged[2527549]: segfault at 0 ip ... in segv[...]
imklog turns this into auth.alert with tag kernel:. Because /proc/kmsg
starts every line of a record with the record's prefix, a line feed inside
the name gives the attacker the start of a new line inside any kernel message
that prints comm, not only at the start of the segfault line.
Consequences depend on permitnonkernelfacility:
on(Ubuntu's distribution default): the attacker chooses any non-kernel facility and any severity. Forgedauth.*,authpriv.*,mail.*,user.emergetc. records are routed by the facility/severity filters, for example into/var/log/auth.log, to remote collectors, or to*.emergactions.off(upstream default): the line is silently discarded, because its facility is no longerkern. The attacker can suppress its own segfault line and the remainder of any kernel line after an LF in its name.
Only the facility can be chosen freely with a value of 8 or more; kern.*
cannot be forged through this branch. The tag stays kernel:, so a forged
record is visibly attributed to the kernel. Writing to /dev/kmsg is not
part of the attack: it is mode 0644 root:root and not writable by
unprivileged users.
Affected configuration
module(load="imklog")reading/proc/kmsg(Linux default path).- Default
keepkerneltimestamp="off"(or a kernel that prints no printk timestamps). Withkeepkerneltimestamp="on"on a timestamping kernel the branch does not match. - Forgery:
permitnonkernelfacility="on". Ubuntu shipsmodule(load="imklog" permitnonkernelfacility="on")in/etc/rsyslog.conf(verified on Ubuntu 24.04, rsyslog 8.2312.0-3ubuntu9.4) and*.emerg :omusrmsg:*in50-default.conf. - Suppression only: upstream default
permitnonkernelfacility="off". - The kernel must print the attacker's string: the segfault report requires
debug.exception-trace=1(default) and is rate limited by the kernel (printk_ratelimit, by default 10 messages per 5 seconds). - Attacker: any local user who can run a program.
- Note for Ubuntu: rsyslogd drops privileges to user
syslog(groupssyslog,adm, no capabilities). Terminal devices are mode 0620 owner/tty, so:omusrmsg:*cannot open them and the wall broadcast of a forgeduser.emergdoes not reach terminals there. It does where rsyslogd runs as root (upstream default, no privilege drop) andpermitnonkernelfacilityis on. - BSD (
/dev/klog): a related residual exists and is not fixed by the patch for this advisory; see Fix direction point 4 (static analysis only).
Details
Source at a6c1f4023d (main, after 8.2610.0):
plugins/imklog/bsd.c:246-269readklog():read()from/proc/kmsg, split on\n, each line tosubmitSyslog(); an unterminated tail ofmaxMessageSize - 1bytes is submitted on its own and the rest of that line becomes the next "line".bsd.c:85-123submitSyslog(): detects<d>[ secs.usecs]and, unlesskeepkerneltimestampis on,memmoves the text over the timestamp, giving<d> text.plugins/imklog/imklog.c:256-266Syslog(): ifpMsg[3] == '<'orpMsg[3] == ' ' && pMsg[4] == '<',parsePRI()at that position; a value>= 8 && <= 191replacespriority, and the message text starts after it.imklog.c:274: non-kernfacility -> discarded unlesspermitnonkernelfacilityis on.imklog.c:176-183enqMsg(): text, tagkernel:and the chosen PRI go to the message unchanged.
Second path to an attacker-controlled PRI (independent of the branch above):
a line longer than maxMessageSize - 1 is split, and the continuation is
passed through the primary parsePRI() as if it were a new kernel line. Text
<0> at the split offset becomes kern.emerg, also with
permitnonkernelfacility="off". This only applies when maxMessageSize is
smaller than the kernel's per-record size (about 1 KiB on 5.15, 2 KiB on
newer kernels); the default of 8096 is not affected. The attacker controls
long kernel lines mainly through file names (for example the mapping name in
the segfault report).
Reproduction (performed 2026-11-14)
Environment: rsyslog main a6c1f4023d built twice (clang 18 with ASan/UBSan,
and gcc 13 -O2 -D_FORTIFY_SOURCE=2), WSL2 kernel 5.15.167.4.
Kernel output: as an unprivileged user (uid 1000) a small program sets its name with
prctl(PR_SET_NAME)and dereferences NULL. Names used:<33>forged,\n<8>EMERG. The kernel output was captured withklogctl(SYSLOG_ACTION_READ_ALL), which uses the same formatter as/proc/kmsg(reading/proc/kmsgitself needs CAP_SYSLOG, which the test account does not have). Captured lines:<6>[213394.693709] <33>forged[2527549]: segfault at 0 ip ... in segv[...] <6>[213394.698465] <6>[213394.698465] <8>EMERG[2527557]: segfault at 0 ip ... in segv[...] <4>[213394.698495] CPU: 14 PID: 2527557 Comm: <4>[213394.698495] <8>EMERG Not tainted 5.15.167.4-microsoft-standard-WSL2 #1The last two lines show the LF effect inside a register dump line printed by this kernel.
Replay: rsyslogd with
module(load="imklog" logpath="<fifo>"), the captured lines written into the FIFO, output through omfile with templatepri=%syslogfacility-text%.%syslogseverity-text% tag=%syslogtag% msg=%msg%.Results with
permitnonkernelfacility="on":pri=auth.alert tag=kernel: msg=forged[2527549]: segfault at 0 ... pri=user.emerg tag=kernel: msg=EMERG[2527557]: segfault at 0 ... pri=user.emerg tag=kernel: msg=EMERG Not tainted 5.15.167.4-...Both
user.emerglines also matched a*.emergaction (omfile standing in for:omusrmsg:*). With the upstream default the same three lines are absent from the output; the surrounding kernel lines are logged normally. Identical results on both builds.Split continuation:
maxMessageSize="1024", upstream default imklog settings, one line with<0>FORGED kernel emergencyat byte offset 1024: second messagepri=kern.emerg msg=FORGED kernel emergency, matched by*.emerg. This was fed from a file, not from a real kernel record.
Not executed: reading the live /proc/kmsg; the terminal write of
:omusrmsg:*; BSD (/dev/klog), where the same Syslog() code is used.
Impact
Integrity of log records. A local unprivileged user can
- with
permitnonkernelfacility="on": create kernel-tagged records with an arbitrary non-kernel facility and any severity, so that they land in facility-specific files (for example auth.log), trigger severity-based actions (*.emerg, alerting, forwarding rules) or are excluded fromkern.*destinations; - with the upstream default: have kernel lines (its own segfault report, and the part after an LF in its name in other kernel messages) silently dropped.
The text of the forged record is limited by what the kernel prints around
the name; the attacker controls 15 bytes of it. Not new: a local user can
already log with any facility and severity through /dev/log, but those
records carry the user's own tag and pass through the regular parser; the new
part is that kernel-input records, which rulesets often treat as trusted, get
an attacker-chosen PRI. No memory safety impact.
Fix direction
All points in plugins/imklog/:
imklog.cSyslog(): remove the secondary-PRI branch, or make it an opt-in parameter that is off by default and documented as unsafe with/proc/kmsg. Its use case (systemd on kernels older than 3.5 writing<NN>into/dev/kmsg) is obsolete. Covers both shapes<d><NN>and<d> <NN>.bsd.csubmitSyslog(): the timestamp strip creates the<d> <NN>shape; after point 1 it is harmless, but any remaining PRI logic must run before the strip or ignore its result.bsd.creadklog(): never PRI-parse a continuation fragment. When a line is split atmaxMessageSize - 1, or a partial line is flushed on EINTR/EAGAIN/EOF, the following fragment must be submitted with the previous line's PRI (orkern.info) and withoutparsePRI().- BSD (
/dev/klog): points 1 and 3 apply there too, because the BSD shim uses the sameSyslog()andreadklog(). They do not close the whole issue on BSD. On FreeBSD, lines from kernelprintf()(msgbuf priority -1) carry no<N>prefix, so imklog still parses a leading PRI from the text itself. The process name (p_comm, the basename of the executed file) may contain a line feed, so a kernelprintf()that includes it can start a new line with an attacker-chosen<0>:kern.emerg, or a dropped line for a non-kernel facility withpermitnonkernelfacility="off". This is a known residual that the current patch does not fix. It was found by static analysis only and was not tested. - Regression tests: LogPath-based imklog tests (FIFO or file) for
<6> <8>xand<6><8>x(must staykern.info), for a line longer thanmaxMessageSizewith<0>at the split offset (must not becomekern.emerg), with both values ofpermitnonkernelfacility. - Documentation: note in the imklog docs that
/proc/kmsgtext after the kernel prefix may contain user-chosen strings.
Workarounds until a fix: keepkerneltimestamp="on" (closes the branch on
timestamping kernels); keep permitnonkernelfacility="off" (turns forgery
into suppression); keep maxMessageSize at or above 8 KiB.
Affected
Packages 1
| Package | Affected | Fixed |
|---|---|---|
ascender-25Docker Hardened Images:Debian:13 | 25.6.3-0 and later, plus listed versions 25.6.3-125.6.3-1025.6.3-1125.6.3-1225.6.3-2 Show 7 more versionsShow less25.6.3-325.6.3-425.6.3-525.6.3-625.6.3-725.6.3-825.6.3-9 | None listed |
Sources
OSVDHI-42nn-qxvu-d3zs-dobtNo score
## Summary
Summary
imklog reads kernel log lines of the form <d>[ seconds.micros] text. After
removing the timestamp (default), Syslog() checks whether the remaining text
starts with a second <NN> and, if NN is a valid PRI of 8 or more, uses it
as the message's facility and severity instead of the kernel's own <d>. This
was added in 2011 for systemd writing <NN>-prefixed records into
/dev/kmsg on kernels that did not yet parse that prefix themselves; current
kernels do.
The text after the kernel prefix is not kernel-controlled in general. The
kernel prints strings chosen by unprivileged processes, most notably the task
name (comm, 15 bytes, set with prctl(PR_SET_NAME) or by the basename of
the executed file). A process that crashes produces, by default on x86 and
arm64, a line that starts with its name:
<6>[213394.693709] <33>forged[2527549]: segfault at 0 ip ... in segv[...]
imklog turns this into auth.alert with tag kernel:. Because /proc/kmsg
starts every line of a record with the record's prefix, a line feed inside
the name gives the attacker the start of a new line inside any kernel message
that prints comm, not only at the start of the segfault line.
Consequences depend on permitnonkernelfacility:
on(Ubuntu's distribution default): the attacker chooses any non-kernel facility and any severity. Forgedauth.*,authpriv.*,mail.*,user.emergetc. records are routed by the facility/severity filters, for example into/var/log/auth.log, to remote collectors, or to*.emergactions.off(upstream default): the line is silently discarded, because its facility is no longerkern. The attacker can suppress its own segfault line and the remainder of any kernel line after an LF in its name.
Only the facility can be chosen freely with a value of 8 or more; kern.*
cannot be forged through this branch. The tag stays kernel:, so a forged
record is visibly attributed to the kernel. Writing to /dev/kmsg is not
part of the attack: it is mode 0644 root:root and not writable by
unprivileged users.
Affected configuration
module(load="imklog")reading/proc/kmsg(Linux default path).- Default
keepkerneltimestamp="off"(or a kernel that prints no printk timestamps). Withkeepkerneltimestamp="on"on a timestamping kernel the branch does not match. - Forgery:
permitnonkernelfacility="on". Ubuntu shipsmodule(load="imklog" permitnonkernelfacility="on")in/etc/rsyslog.conf(verified on Ubuntu 24.04, rsyslog 8.2312.0-3ubuntu9.4) and*.emerg :omusrmsg:*in50-default.conf. - Suppression only: upstream default
permitnonkernelfacility="off". - The kernel must print the attacker's string: the segfault report requires
debug.exception-trace=1(default) and is rate limited by the kernel (printk_ratelimit, by default 10 messages per 5 seconds). - Attacker: any local user who can run a program.
- Note for Ubuntu: rsyslogd drops privileges to user
syslog(groupssyslog,adm, no capabilities). Terminal devices are mode 0620 owner/tty, so:omusrmsg:*cannot open them and the wall broadcast of a forgeduser.emergdoes not reach terminals there. It does where rsyslogd runs as root (upstream default, no privilege drop) andpermitnonkernelfacilityis on. - BSD (
/dev/klog): a related residual exists and is not fixed by the patch for this advisory; see Fix direction point 4 (static analysis only).
Details
Source at a6c1f4023d (main, after 8.2610.0):
plugins/imklog/bsd.c:246-269readklog():read()from/proc/kmsg, split on\n, each line tosubmitSyslog(); an unterminated tail ofmaxMessageSize - 1bytes is submitted on its own and the rest of that line becomes the next "line".bsd.c:85-123submitSyslog(): detects<d>[ secs.usecs]and, unlesskeepkerneltimestampis on,memmoves the text over the timestamp, giving<d> text.plugins/imklog/imklog.c:256-266Syslog(): if…
- Record
DHI-42nn-qxvu-d3zs-dobt- Updated
- 2026-12-04
The JSON record also has the rest of 1 source description.
History
Recorded by Every CVE
| Day | Changed | Sources |
|---|---|---|
| Affected packages | OSV | |
| First indexed | OSV |
Upstream dates may differ.