Skip to content

Commit 560aff9

Browse files
authored
[MEDIUM] Patch for iputils CVE-2025-47268 (microsoft#14045)
1 parent 8fdbd49 commit 560aff9

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed

SPECS/iputils/CVE-2025-47268.patch

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
From a2e2ebea3641884dd436d938451d6c4db583ae28 Mon Sep 17 00:00:00 2001
2+
From: Aninda <[email protected]>
3+
Date: Thu, 19 Jun 2025 12:55:39 -0400
4+
Subject: [PATCH] Address CVE-2025-47268
5+
Upstream Patch Reference: https://github.com/iputils/iputils/pull/585/commits/b41e4a10ab1f749a9bd149c608213c9704c3147f.patch
6+
7+
---
8+
iputils_common.h | 3 +++
9+
ping/ping_common.c | 22 +++++++++++++++++++---
10+
2 files changed, 22 insertions(+), 3 deletions(-)
11+
12+
diff --git a/iputils_common.h b/iputils_common.h
13+
index 26e8f7c..d3070cb 100644
14+
--- a/iputils_common.h
15+
+++ b/iputils_common.h
16+
@@ -10,6 +10,9 @@
17+
!!__builtin_types_compatible_p(__typeof__(arr), \
18+
__typeof__(&arr[0]))])) * 0)
19+
20+
+/* 1000001 = 1000000 tv_sec + 1 tv_usec */
21+
+#define TV_SEC_MAX_VAL (LONG_MAX/1000001)
22+
+
23+
#ifdef __GNUC__
24+
# define iputils_attribute_format(t, n, m) __attribute__((__format__ (t, n, m)))
25+
#else
26+
diff --git a/ping/ping_common.c b/ping/ping_common.c
27+
index ba46252..d68b21e 100644
28+
--- a/ping/ping_common.c
29+
+++ b/ping/ping_common.c
30+
@@ -734,16 +734,32 @@ int gather_statistics(struct ping_rts *rts, uint8_t *icmph, int icmplen,
31+
32+
restamp:
33+
tvsub(tv, &tmp_tv);
34+
- triptime = tv->tv_sec * 1000000 + tv->tv_usec;
35+
- if (triptime < 0) {
36+
- error(0, 0, _("Warning: time of day goes back (%ldus), taking countermeasures"), triptime);
37+
+
38+
+ if (tv->tv_usec >= 1000000) {
39+
+ error(0, 0, _("Warning: invalid tv_usec %ld us"), tv->tv_usec);
40+
+ tv->tv_usec = 999999;
41+
+ }
42+
+
43+
+ if (tv->tv_usec < 0) {
44+
+ error(0, 0, _("Warning: invalid tv_usec %ld us"), tv->tv_usec);
45+
+ tv->tv_usec = 0;
46+
+ }
47+
+
48+
+ if (tv->tv_sec > TV_SEC_MAX_VAL) {
49+
+ error(0, 0, _("Warning: invalid tv_sec %ld s"), tv->tv_sec);
50+
+ triptime = 0;
51+
+ } else if (tv->tv_sec < 0) {
52+
+ error(0, 0, _("Warning: time of day goes back (%ld s), taking countermeasures"), tv->tv_sec);
53+
triptime = 0;
54+
if (!rts->opt_latency) {
55+
gettimeofday(tv, NULL);
56+
rts->opt_latency = 1;
57+
goto restamp;
58+
}
59+
+ } else {
60+
+ triptime = tv->tv_sec * 1000000 + tv->tv_usec;
61+
}
62+
+
63+
if (!csfailed) {
64+
rts->tsum += triptime;
65+
rts->tsum2 += (double)((long long)triptime * (long long)triptime);
66+
--
67+
2.34.1
68+

SPECS/iputils/iputils.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
Summary: Programs for basic networking
22
Name: iputils
33
Version: 20211215
4-
Release: 2%{?dist}
4+
Release: 3%{?dist}
55
License: BSD-3 AND GPLv2+ AND Rdisc
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
88
Group: Applications/Communications
99
URL: https://github.com/iputils/iputils
1010
Source0: https://github.com/iputils/iputils/archive/20211215.tar.gz#/%{name}-%{version}.tar.gz
1111
Patch0: ping_test_ipv6_localhost.patch
12+
Patch1: CVE-2025-47268.patch
1213
BuildRequires: iproute
1314
BuildRequires: libcap-devel
1415
BuildRequires: libgcrypt-devel
@@ -67,6 +68,9 @@ mv -f RELNOTES.tmp RELNOTES.old
6768
%exclude %{_sysconfdir}/init.d/ninfod.sh
6869

6970
%changelog
71+
* Thu Jun 19 2025 Aninda Pradhan <[email protected]> - 20211215-3
72+
- Fix CVE-2025-47268 with an upstream patch
73+
7074
* Wed Sep 20 2023 Jon Slobodzian <[email protected]> - 20211215-2
7175
- Recompile with stack-protection fixed gcc version (CVE-2023-4039)
7276

0 commit comments

Comments
 (0)