Skip to content

Commit 224de6f

Browse files
[AutoPR- Security] Patch polkit for CVE-2026-4897 [MEDIUM] (#16435)
1 parent 47b2b79 commit 224de6f

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed

SPECS/polkit/CVE-2026-4897.patch

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
From 9aa712d586604fcb8f2d5abbffd9030c147525ed Mon Sep 17 00:00:00 2001
2+
From: Jan Rybar <jrybar@redhat.com>
3+
Date: Fri, 27 Mar 2026 15:57:01 +0100
4+
Subject: [PATCH] CVE-2026-4897 - getline() string overflow
5+
6+
Report and fix by Aisle.com
7+
Pavel Kohout, Aisle Research
8+
9+
Signed-off-by: Jan Rybar jrybar@redhat.com
10+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
11+
Upstream-reference: https://github.com/polkit-org/polkit/commit/7e122c8a5120c2aae2d9d44a26796dc18f5b677c.patch
12+
---
13+
src/polkitagent/polkitagenthelperprivate.c | 23 +++++++++++++---------
14+
1 file changed, 14 insertions(+), 9 deletions(-)
15+
16+
diff --git a/src/polkitagent/polkitagenthelperprivate.c b/src/polkitagent/polkitagenthelperprivate.c
17+
index 1f32c0a..63333f6 100644
18+
--- a/src/polkitagent/polkitagenthelperprivate.c
19+
+++ b/src/polkitagent/polkitagenthelperprivate.c
20+
@@ -25,6 +25,7 @@
21+
#include <stdio.h>
22+
#include <string.h>
23+
#include <stdlib.h>
24+
+#include <errno.h>
25+
#include <unistd.h>
26+
27+
#ifndef HAVE_CLEARENV
28+
@@ -60,21 +61,25 @@ read_cookie (int argc, char **argv)
29+
return strdup (argv[2]);
30+
else
31+
{
32+
- char *ret = NULL;
33+
- size_t n = 0;
34+
- ssize_t r = getline (&ret, &n, stdin);
35+
- if (r == -1)
36+
+ #define POLKIT_AGENT_MAX_COOKIE 4096
37+
+ char buf[POLKIT_AGENT_MAX_COOKIE + 2]; /* +1 for newline, +1 for NUL */
38+
+ if (fgets (buf, sizeof(buf), stdin) == NULL)
39+
{
40+
if (!feof (stdin))
41+
- perror ("getline");
42+
- free (ret);
43+
+ perror ("fgets");
44+
return NULL;
45+
}
46+
- else
47+
+ if (buf[strlen (buf) - 1] != '\n')
48+
{
49+
- g_strchomp (ret);
50+
- return ret;
51+
+ /* Cookie too long - drain remaining input and reject */
52+
+ int c;
53+
+ while ((c = getchar ()) != '\n' && c != EOF)
54+
+ ;
55+
+ errno = EOVERFLOW;
56+
+ return NULL;
57+
}
58+
+ g_strchomp (buf);
59+
+ return strdup (buf);
60+
}
61+
}
62+
63+
--
64+
2.45.4
65+

SPECS/polkit/polkit.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
Summary: A toolkit for defining and handling authorizations.
22
Name: polkit
33
Version: 123
4-
Release: 3%{?dist}
4+
Release: 4%{?dist}
55
Group: Applications/System
66
Vendor: Microsoft Corporation
77
License: GPLv2+
88
URL: https://gitlab.freedesktop.org/polkit/polkit
99
Source0: https://gitlab.freedesktop.org/polkit/polkit/-/archive/%{version}/polkit-%{version}.tar.gz
1010
Patch0: CVE-2025-7519.patch
11+
Patch1: CVE-2026-4897.patch
1112
Distribution: Azure Linux
1213
BuildRequires: duktape-devel
1314
BuildRequires: expat-devel
@@ -124,6 +125,9 @@ fi
124125

125126

126127
%changelog
128+
* Thu Apr 02 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 123-4
129+
- Patch for CVE-2026-4897
130+
127131
* Thu Jul 17 2025 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 123-3
128132
- Patch for CVE-2025-7519
129133

0 commit comments

Comments
 (0)