rsyslog imuxsock empty-TAG PID underwrite (local denial of service)

rsyslog has a local denial-of-service vulnerability in imuxsock's PID
rewriting path. When UsePIDFromSystem or SysSock.UsePIDFromSystem is
enabled, a local sender that can write to the affected Unix datagram
socket can submit a message with an empty TAG. The vulnerable fixPID()
implementation searches from an invalid offset and writes before the
TAG buffer. A fortified release build terminated on the demonstrated
input, allowing repeated interruption of rsyslogd.

The path also requires SCM_CREDENTIALS support and imuxsock's special
parser. The PID-rewriting options are disabled by default. No
confidentiality loss, integrity loss, or code execution has been
demonstrated.

Advisory: 
https://github.com/rsyslog/rsyslog/security/advisories/GHSA-6rqh-v5w3-r7h4
CVE: CVE-2026-129832
Severity: Medium, CVSS 3.1 score 5.5
(CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H)
CWE: CWE-124, Buffer Underwrite
Affected versions: rsyslog >= 5.7.1
Introduction commit: c2d36c6894f7c36c2aed23c1e7ee9580c58659a7
Fix commit: 817c4a8587536422b1b9718a94ab28d0146fec76
Fixed version: 2026-11-17 daily stable
Public disclosure: 2026-11-17 at 16:00 UTC / 17:00 CET / 11:00 EST

The fix bounds the backward scan to parsed TAG bytes, appends the PID
safely when the TAG is empty, preserves an existing PID and
trailing-colon behavior, and retains the capacity guard. Focused
regressions cover empty and nonempty TAGs, existing PID, trailing
colon, and near/full capacity.

Temporary mitigation: keep UsePIDFromSystem and
SysSock.UsePIDFromSystem disabled, or restrict access to the affected
imuxsock Unix socket.

Credit: reported and validated by Rainer Gerhards. The original
finding records AI assistance from Claude Code.

The source-only patch follows. Its SHA-256 is
b0c6c98ebea5a56c9890d5b595bc1223dbdca63866055100fbf137f6ebcbb496.
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index e6d1ca73a8fda58c9c780a575283970bd35e221e..90529f0e13ec1fe203bfe0adba877e49d46ab99f 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -816,10 +816,13 @@ static void fixPID(uchar *bufTAG, int *lenTag, struct ucred *cred) {
 
     lenPID = snprintf(bufPID, sizeof(bufPID), "[%lu]:", (unsigned long)cred->pid);
 
-    for (i = *lenTag; i >= 0 && bufTAG[i] != '['; --i) /*JUST SKIP*/
+    for (i = *lenTag - 1; i >= 0 && bufTAG[i] != '['; --i) /*JUST SKIP*/
         ;
 
-    if (i < 0) i = *lenTag - 1; /* go right at end of TAG, pid was not present (-1 for ':') */
+    if (i < 0) {
+        i = *lenTag;
+        if (i > 0 && bufTAG[i - 1] == ':') --i;
+    }
 
     if (i + lenPID > CONF_TAG_MAXSIZE) return; /* do not touch, as things would break */
 

Reply via email to