redis: fix CVE-2024-31227

Redis is an open source, in-memory database that persists on disk.
An authenticated with sufficient privileges may create a malformed
ACL selector which, when accessed, triggers a server panic and
subsequent denial of service. The problem exists in Redis 7 prior
to versions 7.2.6 and 7.4.1. Users are advised to upgrade. There
are no known workarounds for this vulnerability.

Reference:
https://security-tracker.debian.org/tracker/CVE-2024-31227

Upstream-patch:
https://github.com/redis/redis/commit/b351d5a3210e61cc3b22ba38a723d6da8f3c298a

Signed-off-by: Divya Chellam <divya.chellam@windriver.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
This commit is contained in:
Divya Chellam
2025-01-31 12:50:58 +00:00
committed by Armin Kuster
parent 19592ce1c4
commit 58aae3874f
2 changed files with 34 additions and 0 deletions
@@ -0,0 +1,33 @@
From b351d5a3210e61cc3b22ba38a723d6da8f3c298a Mon Sep 17 00:00:00 2001
From: Oran Agra <oran@redislabs.com>
Date: Wed, 2 Oct 2024 20:01:14 +0300
Subject: [PATCH] Fix ACL SETUSER Read/Write key pattern selector
(CVE-2024-31227)
The '%' rule must contain one or both of R/W
CVE: CVE-2024-31227
Upstream-Status: Backport [https://github.com/redis/redis/commit/b351d5a3210e61cc3b22ba38a723d6da8f3c298a]
Signed-off-by: Divya Chellam <divya.chellam@windriver.com>
---
src/acl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/acl.c b/src/acl.c
index 6d86093..6b53d90 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -1036,7 +1036,7 @@ int ACLSetSelector(aclSelector *selector, const char* op, size_t oplen) {
flags |= ACL_READ_PERMISSION;
} else if (toupper(op[offset]) == 'W' && !(flags & ACL_WRITE_PERMISSION)) {
flags |= ACL_WRITE_PERMISSION;
- } else if (op[offset] == '~') {
+ } else if (op[offset] == '~' && flags) {
offset++;
break;
} else {
--
2.40.0
@@ -18,6 +18,7 @@ SRC_URI = "http://download.redis.io/releases/${BP}.tar.gz \
file://0006-Define-correct-gregs-for-RISCV32.patch \
file://CVE-2023-41056.patch \
file://CVE-2023-45145.patch \
file://CVE-2024-31227.patch \
"
SRC_URI[sha256sum] = "97065774d5fb8388eb0d8913458decfcb167d356e40d31dd01cd30c1cc391673"