Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions SPECS/polkit/CVE-2026-4897.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
From e133f7aa4a15dfeda0c1105192b47c36ccbdc15e Mon Sep 17 00:00:00 2001
From: Jan Rybar <[email protected]>
Date: Fri, 27 Mar 2026 15:57:01 +0100
Subject: [PATCH] CVE-2026-4897 - getline() string overflow

Report and fix by Aisle.com
Pavel Kohout, Aisle Research

Signed-off-by: Jan Rybar [email protected]
Signed-off-by: Azure Linux Security Servicing Account <[email protected]>
Upstream-reference: https://github.com/polkit-org/polkit/commit/7e122c8a5120c2aae2d9d44a26796dc18f5b677c.patch
---
src/polkitagent/polkitagenthelperprivate.c | 23 +++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/polkitagent/polkitagenthelperprivate.c b/src/polkitagent/polkitagenthelperprivate.c
index 1f32c0a..63333f6 100644
--- a/src/polkitagent/polkitagenthelperprivate.c
+++ b/src/polkitagent/polkitagenthelperprivate.c
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <errno.h>
#include <unistd.h>

#ifndef HAVE_CLEARENV
@@ -60,21 +61,25 @@ read_cookie (int argc, char **argv)
return strdup (argv[2]);
else
{
- char *ret = NULL;
- size_t n = 0;
- ssize_t r = getline (&ret, &n, stdin);
- if (r == -1)
+ #define POLKIT_AGENT_MAX_COOKIE 4096
+ char buf[POLKIT_AGENT_MAX_COOKIE + 2]; /* +1 for newline, +1 for NUL */
+ if (fgets (buf, sizeof(buf), stdin) == NULL)
{
if (!feof (stdin))
- perror ("getline");
- free (ret);
+ perror ("fgets");
return NULL;
}
- else
+ if (buf[strlen (buf) - 1] != '\n')
{
- g_strchomp (ret);
- return ret;
+ /* Cookie too long - drain remaining input and reject */
+ int c;
+ while ((c = getchar ()) != '\n' && c != EOF)
+ ;
+ errno = EOVERFLOW;
+ return NULL;
}
+ g_strchomp (buf);
+ return strdup (buf);
}
}

--
2.45.4

6 changes: 5 additions & 1 deletion SPECS/polkit/polkit.spec
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
Summary: A toolkit for defining and handling authorizations.
Name: polkit
Version: 0.119
Release: 4%{?dist}
Release: 5%{?dist}
Group: Applications/System
Vendor: Microsoft Corporation
License: GPLv2+
URL: https://www.freedesktop.org/software/polkit/docs/latest/polkit.8.html
Source0: https://www.freedesktop.org/software/polkit/releases/%{name}-%{version}.tar.gz
Patch0: CVE-2021-4034.patch
Patch1: CVE-2025-7519.patch
Patch2: CVE-2026-4897.patch
Distribution: Mariner
BuildRequires: autoconf
BuildRequires: expat-devel
Expand Down Expand Up @@ -112,6 +113,9 @@ fi
%{_libdir}/pkgconfig/*.pc

%changelog
* Thu Apr 02 2026 Azure Linux Security Servicing Account <[email protected]> - 0.119-5
- Patch for CVE-2026-4897

* Thu Jul 17 2025 Azure Linux Security Servicing Account <[email protected]> - 0.119-4
- Patch for CVE-2025-7519

Expand Down
Loading