From f4c8ac2da1c631b2cc8d99064e4eec38a455dc13 Mon Sep 17 00:00:00 2001 From: Ankur Tyagi Date: Thu, 3 Sep 2026 21:49:47 +1200 Subject: [PATCH] libiec61850: patch CVE-2026-18582 Details: https://nvd.nist.gov/vuln/detail/cve-2026-18582 Signed-off-by: Ankur Tyagi Signed-off-by: Anuj Mittal --- .../libiec61850/files/CVE-2026-18582.patch | 51 +++++++++++++++++++ .../libiec61850/libiec61850_1.6.1.bb | 1 + 2 files changed, 52 insertions(+) create mode 100644 meta-networking/recipes-connectivity/libiec61850/files/CVE-2026-18582.patch diff --git a/meta-networking/recipes-connectivity/libiec61850/files/CVE-2026-18582.patch b/meta-networking/recipes-connectivity/libiec61850/files/CVE-2026-18582.patch new file mode 100644 index 0000000000..6fcd1662b9 --- /dev/null +++ b/meta-networking/recipes-connectivity/libiec61850/files/CVE-2026-18582.patch @@ -0,0 +1,51 @@ +From 43aa106301639f2afddf11302d25e84c5482e26c Mon Sep 17 00:00:00 2001 +From: Michael Zillgith +Date: Tue, 16 Jun 2026 19:24:12 +0100 +Subject: [PATCH] - MMS server: fixed - oversized RptID written to RCB can + trigger invalid free when reports are sent later + (LIB61850-561)(GHSA-7qg8-hm25-rv5v) + +(cherry picked from commit 5b2a69f44256b8548927d8afdd7ac5f5381abe1e) + +CVE: CVE-2026-18582 +Upstream-Status: Backport [https://github.com/mz-automation/libiec61850/commit/5b2a69f44256b8548927d8afdd7ac5f5381abe1e] + +Signed-off-by: Ankur Tyagi +--- + src/iec61850/server/mms_mapping/reporting.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/src/iec61850/server/mms_mapping/reporting.c b/src/iec61850/server/mms_mapping/reporting.c +index 2a230c28..a44f0583 100644 +--- a/src/iec61850/server/mms_mapping/reporting.c ++++ b/src/iec61850/server/mms_mapping/reporting.c +@@ -557,7 +557,6 @@ updateSingleTrackingValue(MmsMapping* self, ReportControl* rc, const char* name, + attributeToUpdate = trkInst->resv; + else if (!strcmp(name, "DatSet")) + { +- + char datSet[130]; + const char* datSetStr = MmsValue_toString(newValue); + +@@ -2664,6 +2663,12 @@ Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, const char* + goto exit_function; + } + ++ if (MmsValue_getStringSize(value) > 129) ++ { ++ retVal = DATA_ACCESS_ERROR_OBJECT_VALUE_INVALID; ++ goto exit_function; ++ } ++ + #if (CONFIG_MMS_THREADLESS_STACK != 1) + Semaphore_wait(rc->rcbValuesLock); + #endif +@@ -3677,7 +3682,7 @@ sendNextReportEntrySegment(ReportControl* self) + + const char* rptIdStr = MmsValue_toString(rptIdFromRcb); + +- if (rptIdStr[0] == 0) ++ if (rptIdStr[0] == 0 || MmsValue_getStringSize(rptIdFromRcb) > 129) + { + /* use default rptId when RptID is empty in RCB */ + updateWithDefaultRptId(self, &rptId); diff --git a/meta-networking/recipes-connectivity/libiec61850/libiec61850_1.6.1.bb b/meta-networking/recipes-connectivity/libiec61850/libiec61850_1.6.1.bb index 5a76ba5330..b22d8a09c9 100644 --- a/meta-networking/recipes-connectivity/libiec61850/libiec61850_1.6.1.bb +++ b/meta-networking/recipes-connectivity/libiec61850/libiec61850_1.6.1.bb @@ -17,6 +17,7 @@ SRCREV = "a13961110b8238d2d8ea577c1fb7592ba3017ad8" SRC_URI = "git://github.com/mz-automation/${BPN}.git;branch=v1.6;protocol=https;tag=v${PV} \ file://0001-pyiec61850-Use-CMAKE_INSTALL_LIBDIR-from-GNUInstallD.patch \ + file://CVE-2026-18582.patch \ "