diff options
| -rw-r--r-- | meta-networking/recipes-protocols/opcua/open62541/CVE-2024-53429.patch | 44 | ||||
| -rw-r--r-- | meta-networking/recipes-protocols/opcua/open62541_1.3.8.bb | 1 |
2 files changed, 45 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/opcua/open62541/CVE-2024-53429.patch b/meta-networking/recipes-protocols/opcua/open62541/CVE-2024-53429.patch new file mode 100644 index 0000000000..7afd7eb752 --- /dev/null +++ b/meta-networking/recipes-protocols/opcua/open62541/CVE-2024-53429.patch | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | From c69c42bb55f66e1721367dc9c98d0b4a63b14c25 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Julius Pfrommer <julius.pfrommer@web.de> | ||
| 3 | Date: Tue, 22 Oct 2024 21:47:15 +0200 | ||
| 4 | Subject: [PATCH] refactor(core): Validate Variant ArrayLength against its | ||
| 5 | ArrayDimensions during binary decode | ||
| 6 | |||
| 7 | This lead to the fuzzer complaing since we hade the check for _encode | ||
| 8 | but not for _decode. This is not a direct memory issue per se. But the | ||
| 9 | consistency check allows early discovery of problematic values and | ||
| 10 | can potentially remove bugs where the user relies on the array | ||
| 11 | dimensions and the array length to match. | ||
| 12 | |||
| 13 | CVE: CVE-2024-53429 | ||
| 14 | Upstream-Status: Backport [https://github.com/open62541/open62541/commit/b9473527623125b5ca264dae4551f8cc414b3bc3] | ||
| 15 | (cherry picked from commit b9473527623125b5ca264dae4551f8cc414b3bc3) | ||
| 16 | Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com> | ||
| 17 | --- | ||
| 18 | src/ua_types_encoding_binary.c | 11 ++++++++++- | ||
| 19 | 1 file changed, 10 insertions(+), 1 deletion(-) | ||
| 20 | |||
| 21 | diff --git a/src/ua_types_encoding_binary.c b/src/ua_types_encoding_binary.c | ||
| 22 | index 7b3a4f6b8..0272ba399 100644 | ||
| 23 | --- a/src/ua_types_encoding_binary.c | ||
| 24 | +++ b/src/ua_types_encoding_binary.c | ||
| 25 | @@ -1093,9 +1093,18 @@ DECODE_BINARY(Variant) { | ||
| 26 | } | ||
| 27 | |||
| 28 | /* Decode array dimensions */ | ||
| 29 | - if(isArray && (encodingByte & (u8)UA_VARIANT_ENCODINGMASKTYPE_DIMENSIONS) > 0) | ||
| 30 | + if(isArray && (encodingByte & (u8)UA_VARIANT_ENCODINGMASKTYPE_DIMENSIONS) > 0) { | ||
| 31 | ret |= Array_decodeBinary((void**)&dst->arrayDimensions, &dst->arrayDimensionsSize, | ||
| 32 | &UA_TYPES[UA_TYPES_INT32], ctx); | ||
| 33 | + /* Validate array length against array dimensions */ | ||
| 34 | + size_t totalSize = 1; | ||
| 35 | + for(size_t i = 0; i < dst->arrayDimensionsSize; ++i) { | ||
| 36 | + if(dst->arrayDimensions[i] == 0) | ||
| 37 | + return UA_STATUSCODE_BADDECODINGERROR; | ||
| 38 | + totalSize *= dst->arrayDimensions[i]; | ||
| 39 | + } | ||
| 40 | + UA_CHECK(totalSize == dst->arrayLength, ret = UA_STATUSCODE_BADDECODINGERROR); | ||
| 41 | + } | ||
| 42 | |||
| 43 | ctx->depth--; | ||
| 44 | return ret; | ||
diff --git a/meta-networking/recipes-protocols/opcua/open62541_1.3.8.bb b/meta-networking/recipes-protocols/opcua/open62541_1.3.8.bb index 19a50aee3a..ed859c9c92 100644 --- a/meta-networking/recipes-protocols/opcua/open62541_1.3.8.bb +++ b/meta-networking/recipes-protocols/opcua/open62541_1.3.8.bb | |||
| @@ -19,6 +19,7 @@ SRC_URI = " \ | |||
| 19 | git://github.com/OPCFoundation/UA-Nodeset;name=ua-nodeset;protocol=https;branch=v1.04;destsuffix=git/deps/ua-nodeset \ | 19 | git://github.com/OPCFoundation/UA-Nodeset;name=ua-nodeset;protocol=https;branch=v1.04;destsuffix=git/deps/ua-nodeset \ |
| 20 | git://github.com/LiamBindle/MQTT-C.git;name=mqtt-c;protocol=https;branch=master;destsuffix=git/deps/mqtt-c \ | 20 | git://github.com/LiamBindle/MQTT-C.git;name=mqtt-c;protocol=https;branch=master;destsuffix=git/deps/mqtt-c \ |
| 21 | file://0001-fix-build-do-not-install-git-files.patch \ | 21 | file://0001-fix-build-do-not-install-git-files.patch \ |
| 22 | file://CVE-2024-53429.patch \ | ||
| 22 | " | 23 | " |
| 23 | 24 | ||
| 24 | S = "${WORKDIR}/git" | 25 | S = "${WORKDIR}/git" |
