Skip to content

Commit 220b01c

Browse files
[AUTO-CHERRYPICK] Patch cri-o for CVE-2023-6476 & CVE-2023-0778 [MEDIUM] - branch main (#12412)
Co-authored-by: Sumedh Alok Sharma <sumsharma@microsoft.com>
1 parent 8979ebc commit 220b01c

3 files changed

Lines changed: 92 additions & 1 deletion

File tree

SPECS/cri-o/CVE-2023-0778.patch

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
Modified Patch to apply only for container export. The utils.go file
2+
does not have the volume export code in the vendored podman version.
3+
Modified by: Sumedh Sharma <sumsharma@microsoft.com>
4+
5+
From 6ca857feb07a5fdc96fd947afef03916291673d8 Mon Sep 17 00:00:00 2001
6+
From: Aditya R <arajan@redhat.com>
7+
Date: Fri, 10 Feb 2023 15:16:27 +0530
8+
Subject: [PATCH] volume,container: chroot to source before exporting content
9+
10+
* Utils must support higher level API to create Tar with chrooted into
11+
directory
12+
* Volume export: use TarwithChroot instead of Tar so we can make sure no
13+
symlink can be exported by tar if it exists outside of the source
14+
directory.
15+
* container export: use chroot and Tar instead of Tar so we can make sure no
16+
symlink can be exported by tar if it exists outside of the mointPoint.
17+
18+
[NO NEW TESTS NEEDED]
19+
[NO TESTS NEEDED]
20+
Race needs combination of external/in-container mechanism which is hard to repro in CI.
21+
22+
Closes: BZ:#2168256
23+
CVE: https://access.redhat.com/security/cve/CVE-2023-0778
24+
25+
Signed-off-by: Aditya R <arajan@redhat.com>
26+
---
27+
.../containers/podman/v3/libpod/container_internal.go | 4 ++--
28+
1 file changed, 2 insertions(+), 2 deletions(-)
29+
30+
diff --git a/vendor/github.com/containers/podman/v3/libpod/container_internal.go b/vendor/github.com/containers/podman/v3/libpod/container_internal.go
31+
index 8ffcccf..42cb682 100644
32+
--- a/vendor/github.com/containers/podman/v3/libpod/container_internal.go
33+
+++ b/vendor/github.com/containers/podman/v3/libpod/container_internal.go
34+
@@ -26,7 +26,7 @@ import (
35+
"github.com/containers/podman/v3/pkg/selinux"
36+
"github.com/containers/podman/v3/pkg/util"
37+
"github.com/containers/storage"
38+
- "github.com/containers/storage/pkg/archive"
39+
+ "github.com/containers/storage/pkg/chrootarchive"
40+
"github.com/containers/storage/pkg/idtools"
41+
"github.com/containers/storage/pkg/mount"
42+
"github.com/coreos/go-systemd/v22/daemon"
43+
@@ -757,7 +757,7 @@ func (c *Container) export(path string) error {
44+
}()
45+
}
46+
47+
- input, err := archive.Tar(mountPoint, archive.Uncompressed)
48+
+ input, err := chrootarchive.Tar(mountPoint, nil, mountPoint)
49+
if err != nil {
50+
return errors.Wrapf(err, "error reading container directory %q", c.ID())
51+
}
52+
--
53+
2.25.1
54+

SPECS/cri-o/CVE-2023-6476.patch

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From 5faee5d82556a6bf4dd1144d2a86e70d097ab200 Mon Sep 17 00:00:00 2001
2+
From: Peter Hunt <pehunt@redhat.com>
3+
Date: Thu, 7 Dec 2023 16:07:12 -0500
4+
Subject: [PATCH] allowed annotations: correctly filter prefixed annotations
5+
6+
without this fix, a pod is able to gain access to experimental annotations that are prefixes of container names.
7+
The most problematic of these is io.kubernetes.cri-o.UnifiedCgroup, which allows a user to arbitrarily
8+
change the resources of the pod, potentially leading to OOM.
9+
10+
Fixes CVE-2023-6476
11+
12+
Signed-off-by: Peter Hunt <pehunt@redhat.com>
13+
---
14+
internal/oci/oci.go | 2 +-
15+
1 file changed, 1 insertion(+), 1 deletion(-)
16+
17+
diff --git a/internal/oci/oci.go b/internal/oci/oci.go
18+
index 89ecfb2..b56b6d9 100644
19+
--- a/internal/oci/oci.go
20+
+++ b/internal/oci/oci.go
21+
@@ -216,7 +216,7 @@ func (r *Runtime) FilterDisallowedAnnotations(handler string, annotations map[st
22+
for ann := range annotations {
23+
for _, disallowed := range rh.DisallowedAnnotations {
24+
if strings.HasPrefix(ann, disallowed) {
25+
- delete(annotations, disallowed)
26+
+ delete(annotations, ann)
27+
}
28+
}
29+
}
30+
--
31+
2.25.1
32+

SPECS/cri-o/cri-o.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Summary: OCI-based implementation of Kubernetes Container Runtime Interfa
2626
# Define macros for further referenced sources
2727
Name: cri-o
2828
Version: 1.22.3
29-
Release: 9%{?dist}
29+
Release: 10%{?dist}
3030
License: ASL 2.0
3131
Vendor: Microsoft Corporation
3232
Distribution: Mariner
@@ -71,6 +71,8 @@ Patch15: CVE-2022-32149.patch
7171
Patch16: CVE-2022-4318.patch
7272
Patch17: CVE-2024-9341.patch
7373
Patch18: CVE-2024-45338.patch
74+
Patch19: CVE-2023-0778.patch
75+
Patch20: CVE-2023-6476.patch
7476
BuildRequires: btrfs-progs-devel
7577
BuildRequires: device-mapper-devel
7678
BuildRequires: fdupes
@@ -223,6 +225,9 @@ mkdir -p /opt/cni/bin
223225
%{_fillupdir}/sysconfig.kubelet
224226

225227
%changelog
228+
* Thu Jan 23 2025 Sumedh Sharma <sumsharma@microsoft.com> - 1.22.3-10
229+
- Add patch for CVE-2023-0778 & CVE-2023-6476.
230+
226231
* Mon Jan 06 2025 Sumedh Sharma <sumsharma@microsoft.com> - 1.22.3-9
227232
- Apply patch after extracting the vendor sources.
228233
- Fix patches with compilation errors.

0 commit comments

Comments
 (0)