polkit: fix CVE-2025-7519

A flaw was found in polkit. When processing an XML policy with 32 or
more nested elements in depth, an out-of-bounds write can be triggered.
This issue can lead to a crash or other unexpected behavior, and
arbitrary code execution is not discarded. To exploit this flaw, a
high-privilege account is needed as it's required to place the
malicious policy file properly.

Reference:
https://nvd.nist.gov/vuln/detail/CVE-2025-7519

Upstream-patch:
https://github.com/polkit-org/polkit/commit/107d3801361b9f9084f78710178e683391f1d245

Signed-off-by: Praveen Kumar <praveen.kumar@windriver.com>
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
This commit is contained in:
Praveen Kumar
2025-09-26 12:41:06 +05:30
committed by Gyorgy Sarvari
parent 8846a5a318
commit 033f224986
2 changed files with 35 additions and 0 deletions
@@ -0,0 +1,34 @@
From 107d3801361b9f9084f78710178e683391f1d245 Mon Sep 17 00:00:00 2001
From: Jan Rybar <jrybar@redhat.com>
Date: Fri, 6 Jun 2025 13:25:55 +0200
Subject: [PATCH] Nested .policy files cause xml parsing overflow leading to
crash
CVE: CVE-2025-7519
Upstream-Status: Backport [https://github.com/polkit-org/polkit/commit/107d3801361b9f9084f78710178e683391f1d245]
Signed-off-by: Praveen Kumar <praveen.kumar@windriver.com>
---
src/polkitbackend/polkitbackendactionpool.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/polkitbackend/polkitbackendactionpool.c b/src/polkitbackend/polkitbackendactionpool.c
index 43f89cb..f4acca9 100644
--- a/src/polkitbackend/polkitbackendactionpool.c
+++ b/src/polkitbackend/polkitbackendactionpool.c
@@ -739,6 +739,12 @@ _start (void *data, const char *el, const char **attr)
guint num_attr;
ParserData *pd = data;
+ if (pd->stack_depth < 0 || pd->stack_depth >= PARSER_MAX_DEPTH)
+ {
+ g_warning ("XML parsing reached max depth?");
+ goto error;
+ }
+
for (num_attr = 0; attr[num_attr] != NULL; num_attr++)
;
--
2.40.0
@@ -28,6 +28,7 @@ SRC_URI = "http://www.freedesktop.org/software/polkit/releases/polkit-${PV}.tar.
file://0002-CVE-2021-4115-GHSL-2021-077-fix.patch \
file://0003-Added-support-for-duktape-as-JS-engine.patch \
file://0004-Make-netgroup-support-optional.patch \
file://CVE-2025-7519.patch \
"
SRC_URI[sha256sum] = "c8579fdb86e94295404211285fee0722ad04893f0213e571bd75c00972fd1f5c"