Skip to content

Commit 7e73c65

Browse files
azurelinux-securityarchana25-msjslobodzian
authored
[AutoPR- Security] Patch moby-containerd-cc for CVE-2025-64329, CVE-2024-25621 [HIGH] (microsoft#15042)
Co-authored-by: Archana Shettigar <[email protected]> Co-authored-by: jslobodzian <[email protected]>
1 parent a9d9b63 commit 7e73c65

File tree

3 files changed

+176
-1
lines changed

3 files changed

+176
-1
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
From 0450f046e6942e513d0ebf1ef5c2aff13daa187f Mon Sep 17 00:00:00 2001
2+
From: Akihiro Suda <[email protected]>
3+
Date: Mon, 27 Oct 2025 16:42:59 +0900
4+
Subject: [PATCH] Fix directory permissions
5+
6+
- Create /var/lib/containerd with 0o700 (was: 0o711).
7+
- Create config.TempDir with 0o700 (was: 0o711).
8+
- Create /run/containerd/io.containerd.grpc.v1.cri with 0o700 (was: 0o755).
9+
- Create /run/containerd/io.containerd.sandbox.controller.v1.shim with 0o700 (was: 0o711).
10+
- Leave /run/containerd and /run/containerd/io.containerd.runtime.v2.task created with 0o711,
11+
as required by userns-remapped containers.
12+
/run/containerd/io.containerd.runtime.v2.task/<NS>/<ID> is created with:
13+
- 0o700 for non-userns-remapped containers
14+
- 0o710 for userns-remapped containers with the remapped root group as the owner group.
15+
16+
Signed-off-by: AllSpark <[email protected]>
17+
Signed-off-by: Azure Linux Security Servicing Account <[email protected]>
18+
Upstream-reference: AI Backport of https://github.com/containerd/containerd/commit/0450f046e6942e513d0ebf1ef5c2aff13daa187f.patch
19+
20+
---
21+
pkg/cri/cri.go | 8 ++++++++
22+
runtime/v2/manager.go | 2 ++
23+
services/server/server.go | 14 ++++++++++++--
24+
3 files changed, 22 insertions(+), 2 deletions(-)
25+
26+
diff --git a/pkg/cri/cri.go b/pkg/cri/cri.go
27+
index aa57313..55db3a2 100644
28+
--- a/pkg/cri/cri.go
29+
+++ b/pkg/cri/cri.go
30+
@@ -62,6 +62,14 @@ func initCRIService(ic *plugin.InitContext) (interface{}, error) {
31+
return nil, fmt.Errorf("invalid plugin config: %w", err)
32+
}
33+
34+
+ if err := os.MkdirAll(ic.State, 0700); err != nil {
35+
+ return nil, err
36+
+ }
37+
+ // chmod is needed for upgrading from an older release that created the dir with 0755
38+
+ if err := os.Chmod(ic.State, 0700); err != nil {
39+
+ return nil, err
40+
+ }
41+
+
42+
c := criconfig.Config{
43+
PluginConfig: *pluginConfig,
44+
ContainerdRootDir: filepath.Dir(ic.Root),
45+
diff --git a/runtime/v2/manager.go b/runtime/v2/manager.go
46+
index 73e1af7..d48ac8f 100644
47+
--- a/runtime/v2/manager.go
48+
+++ b/runtime/v2/manager.go
49+
@@ -133,6 +133,8 @@ type ManagerConfig struct {
50+
// NewShimManager creates a manager for v2 shims
51+
func NewShimManager(ctx context.Context, config *ManagerConfig) (*ShimManager, error) {
52+
for _, d := range []string{config.Root, config.State} {
53+
+ // root: the parent of this directory is created as 0700, not 0711.
54+
+ // state: the parent of this directory is created as 0711 too, so as to support userns-remapped containers.
55+
if err := os.MkdirAll(d, 0711); err != nil {
56+
return nil, err
57+
}
58+
diff --git a/services/server/server.go b/services/server/server.go
59+
index 2a548ef..04782bf 100644
60+
--- a/services/server/server.go
61+
+++ b/services/server/server.go
62+
@@ -76,12 +76,22 @@ func CreateTopLevelDirectories(config *srvconfig.Config) error {
63+
return err
64+
}
65+
66+
- if err := sys.MkdirAllWithACL(config.State, 0711); err != nil {
67+
+ if err := sys.MkdirAllWithACL(config.Root, 0700); err != nil {
68+
+ return err
69+
+ }
70+
+ // chmod is needed for upgrading from an older release that created the dir with 0o711
71+
+ if err := os.Chmod(config.Root, 0700); err != nil {
72+
return err
73+
}
74+
75+
+ // For supporting userns-remapped containers, the state dir cannot be just mkdired with 0o700.
76+
+ // Each of plugins creates a dedicated directory beneath the state dir with appropriate permission bits.
77+
if config.TempDir != "" {
78+
- if err := sys.MkdirAllWithACL(config.TempDir, 0711); err != nil {
79+
+ if err := sys.MkdirAllWithACL(config.TempDir, 0700); err != nil {
80+
+ return err
81+
+ }
82+
+ // chmod is needed for upgrading from an older release that created the dir with 0o711
83+
+ if err := os.Chmod(config.Root, 0700); err != nil {
84+
return err
85+
}
86+
if runtime.GOOS == "windows" {
87+
--
88+
2.45.4
89+
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
From 155777be3c6c8bb1e5d3c48df543079eed20bed9 Mon Sep 17 00:00:00 2001
2+
From: AllSpark <[email protected]>
3+
Date: Mon, 10 Nov 2025 03:04:25 +0000
4+
Subject: [PATCH] fix(cri): prevent goroutine leak in ContainerIO.Attach by
5+
honoring ctx cancellation and removing writer group entries; plumb context
6+
through attach call
7+
8+
Signed-off-by: Azure Linux Security Servicing Account <[email protected]>
9+
Upstream-reference: AI Backport of https://github.com/containerd/containerd/commit/c575d1b5f4011f33b32f71ace75367a92b08c750.patch
10+
---
11+
pkg/cri/io/container_io.go | 14 +++++++++++---
12+
pkg/cri/sbserver/container_attach.go | 2 +-
13+
pkg/cri/server/container_attach.go | 2 +-
14+
3 files changed, 13 insertions(+), 5 deletions(-)
15+
16+
diff --git a/pkg/cri/io/container_io.go b/pkg/cri/io/container_io.go
17+
index 70bc8b7..e158410 100644
18+
--- a/pkg/cri/io/container_io.go
19+
+++ b/pkg/cri/io/container_io.go
20+
@@ -17,6 +17,7 @@
21+
package io
22+
23+
import (
24+
+ "context"
25+
"errors"
26+
"io"
27+
"strings"
28+
@@ -134,7 +135,7 @@ func (c *ContainerIO) Pipe() {
29+
30+
// Attach attaches container stdio.
31+
// TODO(random-liu): Use pools.Copy in docker to reduce memory usage?
32+
-func (c *ContainerIO) Attach(opts AttachOptions) {
33+
+func (c *ContainerIO) Attach(ctx context.Context, opts AttachOptions) {
34+
var wg sync.WaitGroup
35+
key := util.GenerateID()
36+
stdinKey := streamKey(c.id, "attach-"+key, Stdin)
37+
@@ -175,8 +176,15 @@ func (c *ContainerIO) Attach(opts AttachOptions) {
38+
}
39+
40+
attachStream := func(key string, close <-chan struct{}) {
41+
- <-close
42+
- logrus.Infof("Attach stream %q closed", key)
43+
+ select {
44+
+ case <-close:
45+
+ logrus.Infof("Attach stream %q closed", key)
46+
+ case <-ctx.Done():
47+
+ logrus.Infof("Attach client of %q cancelled", key)
48+
+ // Avoid writeGroup heap up
49+
+ c.stdoutGroup.Remove(key)
50+
+ c.stderrGroup.Remove(key)
51+
+ }
52+
// Make sure stdin gets closed.
53+
if stdinStreamRC != nil {
54+
stdinStreamRC.Close()
55+
diff --git a/pkg/cri/sbserver/container_attach.go b/pkg/cri/sbserver/container_attach.go
56+
index 56f69c6..b2a534a 100644
57+
--- a/pkg/cri/sbserver/container_attach.go
58+
+++ b/pkg/cri/sbserver/container_attach.go
59+
@@ -79,6 +79,6 @@ func (c *criService) attachContainer(ctx context.Context, id string, stdin io.Re
60+
},
61+
}
62+
// TODO(random-liu): Figure out whether we need to support historical output.
63+
- cntr.IO.Attach(opts)
64+
+ cntr.IO.Attach(ctx, opts)
65+
return nil
66+
}
67+
diff --git a/pkg/cri/server/container_attach.go b/pkg/cri/server/container_attach.go
68+
index cd79f3b..aa6519a 100644
69+
--- a/pkg/cri/server/container_attach.go
70+
+++ b/pkg/cri/server/container_attach.go
71+
@@ -79,6 +79,6 @@ func (c *criService) attachContainer(ctx context.Context, id string, stdin io.Re
72+
},
73+
}
74+
// TODO(random-liu): Figure out whether we need to support historical output.
75+
- cntr.IO.Attach(opts)
76+
+ cntr.IO.Attach(ctx, opts)
77+
return nil
78+
}
79+
--
80+
2.45.4
81+

SPECS/moby-containerd-cc/moby-containerd-cc.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Summary: Industry-standard container runtime for confidential containers
77
Name: moby-%{upstream_name}
88
Version: 1.7.7
9-
Release: 9%{?dist}
9+
Release: 10%{?dist}
1010
License: ASL 2.0
1111
Group: Tools/Container
1212
URL: https://www.containerd.io
@@ -25,6 +25,8 @@ Patch5: CVE-2023-45288.patch
2525
Patch7: CVE-2023-44487.patch
2626
Patch8: CVE-2025-27144.patch
2727
Patch9: CVE-2024-40635.patch
28+
Patch10:CVE-2024-25621.patch
29+
Patch11:CVE-2025-64329.patch
2830

2931
%{?systemd_requires}
3032

@@ -82,6 +84,9 @@ fi
8284
%config(noreplace) %{_sysconfdir}/containerd/config.toml
8385

8486
%changelog
87+
* Mon Nov 10 2025 Azure Linux Security Servicing Account <[email protected]> - 1.7.7-10
88+
- Patch for CVE-2025-64329, CVE-2024-25621
89+
8590
* Wed Apr 16 2025 Manuel Huber <[email protected]> - 1.7.7-9
8691
- Fix CVE-2024-40635
8792

0 commit comments

Comments
 (0)