Skip to content

Commit 517ce36

Browse files
[AutoPR- Security] Patch dnf5 for CVE-2024-1930 [MEDIUM] (microsoft#14461)
1 parent d4eaa5d commit 517ce36

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

SPECS/dnf5/CVE-2024-1930.patch

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
From aa19993dc833771333149829fb36c79709f4dff4 Mon Sep 17 00:00:00 2001
2+
From: Marek Blaha <[email protected]>
3+
Date: Mon, 12 Feb 2024 09:40:02 +0100
4+
Subject: [PATCH] dnfdaemon: Limit number of simultaneously active sessions
5+
6+
Signed-off-by: Azure Linux Security Servicing Account <[email protected]>
7+
Upstream-reference: https://github.com/rpm-software-management/dnf5/commit/c090ffeb79da57b88d51da6ee76f02f6512c7d91.patch
8+
---
9+
dnf5daemon-server/session_manager.cpp | 12 ++++++++++++
10+
1 file changed, 12 insertions(+)
11+
12+
diff --git a/dnf5daemon-server/session_manager.cpp b/dnf5daemon-server/session_manager.cpp
13+
index 57c036b..d60d7ca 100644
14+
--- a/dnf5daemon-server/session_manager.cpp
15+
+++ b/dnf5daemon-server/session_manager.cpp
16+
@@ -26,11 +26,15 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
17+
#include <sdbus-c++/sdbus-c++.h>
18+
19+
#include <iostream>
20+
+#include <numeric>
21+
#include <random>
22+
#include <sstream>
23+
#include <string>
24+
#include <thread>
25+
26+
+// TODO(mblaha): Make this constant configurable
27+
+const int MAX_SESSIONS = 3;
28+
+
29+
SessionManager::SessionManager() {
30+
connection = sdbus::createSystemBusConnection(dnfdaemon::DBUS_NAME);
31+
dbus_register();
32+
@@ -98,6 +102,14 @@ sdbus::MethodReply SessionManager::open_session(sdbus::MethodCall & call) {
33+
if (!active) {
34+
throw sdbus::Error(dnfdaemon::ERROR, "Cannot open new session.");
35+
}
36+
+ // limit number of simultaneously opened sessions
37+
+ const int num_sessions = std::accumulate(
38+
+ sessions.begin(), sessions.end(), 0, [](int sum, const auto & sender) { return sum + sender.second.size(); });
39+
+ if (num_sessions >= MAX_SESSIONS) {
40+
+ auto reply = call.createErrorReply(sdbus::Error(
41+
+ dnfdaemon::ERROR, "Cannot open new session - maximal number of simultaneously opened sessions achieved."));
42+
+ return reply;
43+
+ }
44+
45+
auto sender = call.getSender();
46+
dnfdaemon::KeyValueMap configuration;
47+
--
48+
2.45.4
49+

SPECS/dnf5/dnf5.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@
3737
Summary: Command-line package manager
3838
Name: dnf5
3939
Version: %{project_version_major}.%{project_version_minor}.%{project_version_patch}
40-
Release: 2%{?dist}
40+
Release: 3%{?dist}
4141
License: GPL-2.0-or-later
4242
Vendor: Microsoft Corporation
4343
Distribution: Mariner
4444
URL: https://github.com/rpm-software-management/dnf5
4545
Source0: %{url}/archive/%{version}/dnf5-%{version}.tar.gz
46+
Patch0: CVE-2024-1930.patch
4647
# ========== build requires ==========
4748
BuildRequires: bash-completion
4849
BuildRequires: cmake
@@ -590,6 +591,9 @@ done
590591

591592

592593
%changelog
594+
* Fri Aug 08 2025 Azure Linux Security Servicing Account <[email protected]> - 5.0.14-3
595+
- Patch for CVE-2024-1930
596+
593597
* Wed Sep 20 2023 Jon Slobodzian <[email protected]> - 5.0.14-2
594598
- Recompile with stack-protection fixed gcc version (CVE-2023-4039)
595599

0 commit comments

Comments
 (0)