Skip to content

Commit 9de751f

Browse files
Patch dnf5 for CVE-2024-2746, CVE-2024-1929
1 parent 40c76f2 commit 9de751f

File tree

3 files changed

+106
-1
lines changed

3 files changed

+106
-1
lines changed

SPECS/dnf5/CVE-2024-1929.patch

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
From bdc6e9895af1bf9759d56314f2018d7fb1ca0abf Mon Sep 17 00:00:00 2001
2+
From: AllSpark <[email protected]>
3+
Date: Mon, 18 Aug 2025 07:25:14 +0000
4+
Subject: [PATCH] dnfdaemon: Explicitly specify allowed config overrides
5+
6+
Signed-off-by: Azure Linux Security Servicing Account <[email protected]>
7+
Upstream-reference: AI Backport of https://github.com/rpm-software-management/dnf5/commit/6e51bf2f0d585ab661806076c1e428c6482ddf86.patch
8+
---
9+
dnf5daemon-server/session.cpp | 38 ++++++++++++++++++++++++++++++++++-
10+
1 file changed, 37 insertions(+), 1 deletion(-)
11+
12+
diff --git a/dnf5daemon-server/session.cpp b/dnf5daemon-server/session.cpp
13+
index 8e86723..fd50514 100644
14+
--- a/dnf5daemon-server/session.cpp
15+
+++ b/dnf5daemon-server/session.cpp
16+
@@ -34,6 +34,37 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
17+
#include <chrono>
18+
#include <iostream>
19+
#include <string>
20+
+#include <unordered_set>
21+
+
22+
+static const std::unordered_set<std::string> ALLOWED_MAIN_CONF_OVERRIDES = {
23+
+ "allow_downgrade",
24+
+ "allow_vendor_change",
25+
+ "best",
26+
+ "clean_requirements_on_remove",
27+
+ "disable_excludes",
28+
+ "exclude_from_weak",
29+
+ "exclude_from_weak_autodetect",
30+
+ "excludepkgs",
31+
+ "ignorearch",
32+
+ "includepkgs",
33+
+ "installonly_limit",
34+
+ "installonlypkgs",
35+
+ "install_weak_deps",
36+
+ "keepcache",
37+
+ "module_obsoletes",
38+
+ "module_platform_id",
39+
+ "module_stream_switch",
40+
+ "multilib_policy",
41+
+ "obsoletes",
42+
+ "optional_metadata_types",
43+
+ "protect_running_kernel",
44+
+ "reposdir",
45+
+ "skip_broken",
46+
+ "skip_if_unavailable",
47+
+ "skip_unavailable",
48+
+ "strict",
49+
+};
50+
+
51+
52+
53+
Session::Session(
54+
@@ -63,7 +94,12 @@ Session::Session(
55+
auto value = opt.second;
56+
auto bind = opt_binds.find(key);
57+
if (bind != opt_binds.end()) {
58+
- bind->second.new_string(libdnf::Option::Priority::RUNTIME, value);
59+
+ if (ALLOWED_MAIN_CONF_OVERRIDES.find(key) != ALLOWED_MAIN_CONF_OVERRIDES.end()) {
60+
+ bind->second.new_string(libdnf::Option::Priority::RUNTIME, value);
61+
+ } else {
62+
+ base->get_logger()->warning("Config option {} not allowed.", key);
63+
+ continue;
64+
+ }
65+
} else {
66+
base->get_logger()->warning("Unknown config option: {}", key);
67+
}
68+
--
69+
2.45.4
70+

SPECS/dnf5/CVE-2024-2746.patch

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
From 94b4f01fc13c453c6207752ad4ba33ede1b581de Mon Sep 17 00:00:00 2001
2+
From: AllSpark <[email protected]>
3+
Date: Mon, 18 Aug 2025 07:24:45 +0000
4+
Subject: [PATCH] dnf5daemon: Remove reposdir from allowed config overrides by
5+
rejecting reposdir in session overrides
6+
7+
Signed-off-by: Azure Linux Security Servicing Account <[email protected]>
8+
Upstream-reference: AI Backport of https://github.com/rpm-software-management/dnf5/commit/07c5770482605ca78aaed41f7224d141c5980de4.patch
9+
---
10+
dnf5daemon-server/session.cpp | 4 ++++
11+
1 file changed, 4 insertions(+)
12+
13+
diff --git a/dnf5daemon-server/session.cpp b/dnf5daemon-server/session.cpp
14+
index fd50514..fc4f57e 100644
15+
--- a/dnf5daemon-server/session.cpp
16+
+++ b/dnf5daemon-server/session.cpp
17+
@@ -92,6 +92,10 @@ Session::Session(
18+
for (auto & opt : conf_overrides) {
19+
auto key = opt.first;
20+
auto value = opt.second;
21+
+ if (key == "reposdir") {
22+
+ base->get_logger()->warning("Config override not allowed: {}", key);
23+
+ continue;
24+
+ }
25+
auto bind = opt_binds.find(key);
26+
if (bind != opt_binds.end()) {
27+
if (ALLOWED_MAIN_CONF_OVERRIDES.find(key) != ALLOWED_MAIN_CONF_OVERRIDES.end()) {
28+
--
29+
2.45.4
30+

SPECS/dnf5/dnf5.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@
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-1929.patch
47+
Patch1: CVE-2024-2746.patch
4648
# ========== build requires ==========
4749
BuildRequires: bash-completion
4850
BuildRequires: cmake
@@ -590,6 +592,9 @@ done
590592

591593

592594
%changelog
595+
* Mon Aug 18 2025 Azure Linux Security Servicing Account <[email protected]> - 5.0.14-3
596+
- Patch for CVE-2024-2746, CVE-2024-1929
597+
593598
* Wed Sep 20 2023 Jon Slobodzian <[email protected]> - 5.0.14-2
594599
- Recompile with stack-protection fixed gcc version (CVE-2023-4039)
595600

0 commit comments

Comments
 (0)