diff mbox series

[meta-oe,wrynose,2/2] rsyslog: Fix CVE-2026-61548

Message ID 20261124065638.3724216-2-asparmar@cisco.com
State New
Headers show
Series [meta-oe,wrynose,1/2] rsyslog: Fix CVE-2026-55556 | expand

Commit Message

From: Ashishkumar Parmar <asparmar@cisco.com>

Backport the targeted mmpstrucdata parameter-buffer correction
recommended by the rsyslog maintainer for stable branches. Replace the
fixed stack buffer with an allocation bounded by the input length and
free it on all exit paths, preserving rsyslog 8.2512.0 APIs.

Keep the cached structured-data length wide enough for messages above
64 KiB so buffer sizing uses the complete input length.

mmpstrucdata is not enabled by the stock recipe. This source correction
also covers downstream builds that explicitly enable the module and
configure it to parse large structured-data messages.

Upstream fix:
https://github.com/rsyslog/rsyslog/commit/bcda60a3692efdf0c8e44102528f5a0ebe0dec6d
Stable-branch backport guidance:
https://www.openwall.com/lists/oss-security/2026/07/20/1

Signed-off-by: Ashishkumar Parmar <asparmar@cisco.com>
---
 .../rsyslog/rsyslog/CVE-2026-61548.patch      | 101 ++++++++++++++++++
 .../rsyslog/rsyslog_8.2512.0.bb               |   1 +
 2 files changed, 102 insertions(+)
 create mode 100644 meta-oe/recipes-extended/rsyslog/rsyslog/CVE-2026-61548.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-extended/rsyslog/rsyslog/CVE-2026-61548.patch b/meta-oe/recipes-extended/rsyslog/rsyslog/CVE-2026-61548.patch
new file mode 100644
index 0000000000..edd31769b3
--- /dev/null
+++ b/meta-oe/recipes-extended/rsyslog/rsyslog/CVE-2026-61548.patch
@@ -0,0 +1,101 @@ 
+From d68f0cb23e368c3609e9aa67c877ac0395d5d6a3 Mon Sep 17 00:00:00 2001
+From: Rainer Gerhards <rgerhards@adiscon.com>
+Date: Tue, 2 Jun 2026 12:00:15 +0000
+Subject: [PATCH] mmpstrucdata: support custom SD containers
+
+Why:
+Operators need parsed RFC5424 structured data below a predictable
+JSON object name, and old large structured-data messages could exceed
+module-local assumptions.
+
+Impact:
+Adds two action parameters, expands structured-data length storage,
+and enables mmpstrucdata in the Ubuntu 26.04 TSAN lane.
+
+Before/After:
+Before, mmpstrucdata always wrote `rfc5424-sd` and could fail on very
+large SD. After, the container is configurable and SD size is bounded.
+
+Technical Overview:
+- Add `container` with default `rfc5424-sd`.
+- Add `maxStructuredDataSize`, defaulting to global max message size.
+- Store message structured-data length as `rs_size_t` instead of 16 bit.
+- Allocate parameter-value parse buffers from the actual SD length.
+- Preserve RFC3164/no-SD skip behavior and represent RFC5424 NILVALUE
+  as JSON null under the configured container.
+- Document RainerScript and YAML usage and add parameter reference pages.
+- Add focused regression tests for custom containers, NILVALUE, large SD,
+  oversized SD, and RFC3164 skip behavior.
+- Remove the old mmpstrucdata TSAN suppression and codify container
+  clean/rebuild guidance for local validation.
+
+Special credits:
+Bogoslovskii Fedor provided good analysis that facilitated parts of the
+implementation.
+
+Closes https://github.com/rsyslog/rsyslog/issues/3297
+Closes https://github.com/rsyslog/rsyslog/issues/1891
+
+With the help of AI-Agents: Codex
+
+Co-authored-by: Bogoslovskii Fedor <Fedorasta@gmail.com>
+
+CVE: CVE-2026-61548
+Upstream-Status: Backport [https://github.com/rsyslog/rsyslog/commit/bcda60a3692efdf0c8e44102528f5a0ebe0dec6d]
+
+Backport Changes:
+- Limit this backport to parameter-buffer allocation and cleanup plus
+  cached structured-data length widening, which keeps the allocation
+  length valid for messages above 64 KiB.
+- Omit custom containers, the new structured-data size setting and
+  unrelated module changes from the broader feature commit, together
+  with its documentation, CI and test changes.
+
+Signed-off-by: Ashishkumar Parmar <asparmar@cisco.com>
+---
+ plugins/mmpstrucdata/mmpstrucdata.c | 4 +++-
+ runtime/msg.h                       | 2 +-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/plugins/mmpstrucdata/mmpstrucdata.c b/plugins/mmpstrucdata/mmpstrucdata.c
+index 5228424..445fb8f 100644
+--- a/plugins/mmpstrucdata/mmpstrucdata.c
++++ b/plugins/mmpstrucdata/mmpstrucdata.c
+@@ -240,7 +240,7 @@ static rsRetVal ATTR_NONNULL()
+     parseSD_PARAM(instanceData *const pData, uchar *sdbuf, int lenbuf, int *curridx, struct json_object *jroot) {
+     int i;
+     uchar pName[33];
+-    uchar pVal[32 * 1024];
++    uchar *pVal = NULL;
+     struct json_object *jval;
+     DEFiRet;
+ 
+@@ -254,6 +254,7 @@ static rsRetVal ATTR_NONNULL()
+         ABORT_FINALIZE(RS_RET_STRUC_DATA_INVLD);
+     }
+     ++i;
++    CHKmalloc(pVal = malloc(lenbuf - i + 1));
+     CHKiRet(parsePARAM_VALUE(sdbuf, lenbuf, &i, pVal));
+     if (sdbuf[i] != '"') {
+         ABORT_FINALIZE(RS_RET_STRUC_DATA_INVLD);
+@@ -265,6 +266,7 @@ static rsRetVal ATTR_NONNULL()
+ 
+     *curridx = i;
+ finalize_it:
++    free(pVal);
+     RETiRet;
+ }
+ 
+diff --git a/runtime/msg.h b/runtime/msg.h
+index 9a66e88..0ed6efd 100644
+--- a/runtime/msg.h
++++ b/runtime/msg.h
+@@ -89,7 +89,7 @@ struct msg {
+         char *pszTIMESTAMP_MySQL; /* TIMESTAMP as MySQL formatted string (always 14 characters) */
+         char *pszTIMESTAMP_PgSQL; /* TIMESTAMP as PgSQL formatted string (always 21 characters) */
+         uchar *pszStrucData; /* STRUCTURED-DATA */
+-        uint16_t lenStrucData; /* (cached) length of STRUCTURED-DATA */
++        rs_size_t lenStrucData; /* (cached) length of STRUCTURED-DATA */
+         cstr_t *pCSAPPNAME; /* APP-NAME */
+         cstr_t *pCSPROCID; /* PROCID */
+         cstr_t *pCSMSGID; /* MSGID */
diff --git a/meta-oe/recipes-extended/rsyslog/rsyslog_8.2512.0.bb b/meta-oe/recipes-extended/rsyslog/rsyslog_8.2512.0.bb
index f132f4a764..23fa7b7146 100644
--- a/meta-oe/recipes-extended/rsyslog/rsyslog_8.2512.0.bb
+++ b/meta-oe/recipes-extended/rsyslog/rsyslog_8.2512.0.bb
@@ -28,6 +28,7 @@  SRC_URI = "https://www.rsyslog.com/files/download/rsyslog/${BPN}-${PV}.tar.gz \
            file://CVE-2026-19654.patch \
            file://CVE-2026-19654-regression.patch \
            file://CVE-2026-55556.patch \
+           file://CVE-2026-61548.patch \
 "
 
 SRC_URI:append:libc-musl = " \