Skip to content

Commit d23471b

Browse files
[AutoPR- Security] Patch moby-containerd for CVE-2025-64329, CVE-2024-25621 [HIGH] (microsoft#15068)
Co-authored-by: Archana Shettigar <[email protected]>
1 parent f0ae52b commit d23471b

File tree

3 files changed

+165
-1
lines changed

3 files changed

+165
-1
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
From 808ae14e2da379e517298396c2242e07d37503ad Mon Sep 17 00:00:00 2001
2+
From: AllSpark <[email protected]>
3+
Date: Tue, 11 Nov 2025 11:41:09 +0000
4+
Subject: [PATCH] Fix directory permissions: make root and tempdir 0o700 with
5+
chmod adjustments; keep state at 0o711 for userns; add comments in v2
6+
manager;
7+
8+
Signed-off-by: Azure Linux Security Servicing Account <[email protected]>
9+
Upstream-reference: AI Backport of https://github.com/containerd/containerd/commit/0450f046e6942e513d0ebf1ef5c2aff13daa187f.patch
10+
Signed-off-by: Azure Linux Security Servicing Account <[email protected]>
11+
Upstream-reference: https://raw.githubusercontent.com/microsoft/azurelinux/22d76f85edefac1f144ba78ea3b2e4529a238491/SPECS/moby-containerd/CVE-2024-25621.patch
12+
---
13+
pkg/cri/cri.go | 8 ++++++++
14+
runtime/v2/manager.go | 2 ++
15+
services/server/server.go | 14 ++++++++++++--
16+
3 files changed, 22 insertions(+), 2 deletions(-)
17+
18+
diff --git a/pkg/cri/cri.go b/pkg/cri/cri.go
19+
index 59861ed..dee6988 100644
20+
--- a/pkg/cri/cri.go
21+
+++ b/pkg/cri/cri.go
22+
@@ -19,6 +19,7 @@ package cri
23+
import (
24+
"flag"
25+
"fmt"
26+
+ "os"
27+
"path/filepath"
28+
29+
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
30+
@@ -79,6 +80,13 @@ func initCRIService(ic *plugin.InitContext) (interface{}, error) {
31+
}
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+
c := criconfig.Config{
42+
PluginConfig: *pluginConfig,
43+
ContainerdRootDir: filepath.Dir(ic.Root),
44+
diff --git a/runtime/v2/manager.go b/runtime/v2/manager.go
45+
index 1927cbb..1f26bbe 100644
46+
--- a/runtime/v2/manager.go
47+
+++ b/runtime/v2/manager.go
48+
@@ -109,6 +109,8 @@ type ManagerConfig struct {
49+
// NewShimManager creates a manager for v2 shims
50+
func NewShimManager(ctx context.Context, config *ManagerConfig) (*ShimManager, error) {
51+
for _, d := range []string{config.Root, config.State} {
52+
+ // root: the parent of this directory is created as 0700, not 0711.
53+
+ // state: the parent of this directory is created as 0711 too, so as to support userns-remapped containers.
54+
if err := os.MkdirAll(d, 0711); err != nil {
55+
return nil, err
56+
}
57+
diff --git a/services/server/server.go b/services/server/server.go
58+
index c2b504c..e707ae4 100644
59+
--- a/services/server/server.go
60+
+++ b/services/server/server.go
61+
@@ -86,16 +86,26 @@ func CreateTopLevelDirectories(config *srvconfig.Config) error {
62+
return errors.New("root and state must be different paths")
63+
}
64+
65+
- if err := sys.MkdirAllWithACL(config.Root, 0711); err != nil {
66+
+ if err := sys.MkdirAllWithACL(config.Root, 0700); err != nil {
67+
+ return err
68+
+ }
69+
+ // chmod is needed for upgrading from an older release that created the dir with 0o711
70+
+ if err := os.Chmod(config.Root, 0700); err != nil {
71+
return err
72+
}
73+
74+
+ // For supporting userns-remapped containers, the state dir cannot be just mkdired with 0o700.
75+
+ // Each of plugins creates a dedicated directory beneath the state dir with appropriate permission bits.
76+
if err := sys.MkdirAllWithACL(config.State, 0711); err != nil {
77+
return err
78+
}
79+
80+
if config.TempDir != "" {
81+
- if err := sys.MkdirAllWithACL(config.TempDir, 0711); err != nil {
82+
+ if err := sys.MkdirAllWithACL(config.TempDir, 0700); err != nil {
83+
+ return err
84+
+ }
85+
+ // chmod is needed for upgrading from an older release that created the dir with 0o711
86+
+ if err := os.Chmod(config.Root, 0700); err != nil {
87+
return err
88+
}
89+
if runtime.GOOS == "windows" {
90+
--
91+
2.45.4
92+
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
From 7c033a088394824e210a647b9597de98485882b7 Mon Sep 17 00:00:00 2001
2+
From: AllSpark <[email protected]>
3+
Date: Wed, 12 Nov 2025 11:59:50 +0000
4+
Subject: [PATCH] fix: avoid goroutine leak in ContainerIO.Attach by respecting
5+
context cancellation and breaking pipes; pass ctx from container_attach
6+
7+
Signed-off-by: Azure Linux Security Servicing Account <[email protected]>
8+
Upstream-reference: AI Backport of https://github.com/containerd/containerd/commit/083b53cd6f19b5de7717b0ce92c11bdf95e612df.patch
9+
---
10+
pkg/cri/io/container_io.go | 14 +++++++++++---
11+
pkg/cri/server/container_attach.go | 2 +-
12+
2 files changed, 12 insertions(+), 4 deletions(-)
13+
14+
diff --git a/pkg/cri/io/container_io.go b/pkg/cri/io/container_io.go
15+
index 70bc8b7..e158410 100644
16+
--- a/pkg/cri/io/container_io.go
17+
+++ b/pkg/cri/io/container_io.go
18+
@@ -17,6 +17,7 @@
19+
package io
20+
21+
import (
22+
+ "context"
23+
"errors"
24+
"io"
25+
"strings"
26+
@@ -134,7 +135,7 @@ func (c *ContainerIO) Pipe() {
27+
28+
// Attach attaches container stdio.
29+
// TODO(random-liu): Use pools.Copy in docker to reduce memory usage?
30+
-func (c *ContainerIO) Attach(opts AttachOptions) {
31+
+func (c *ContainerIO) Attach(ctx context.Context, opts AttachOptions) {
32+
var wg sync.WaitGroup
33+
key := util.GenerateID()
34+
stdinKey := streamKey(c.id, "attach-"+key, Stdin)
35+
@@ -175,8 +176,15 @@ func (c *ContainerIO) Attach(opts AttachOptions) {
36+
}
37+
38+
attachStream := func(key string, close <-chan struct{}) {
39+
- <-close
40+
- logrus.Infof("Attach stream %q closed", key)
41+
+ select {
42+
+ case <-close:
43+
+ logrus.Infof("Attach stream %q closed", key)
44+
+ case <-ctx.Done():
45+
+ logrus.Infof("Attach client of %q cancelled", key)
46+
+ // Avoid writeGroup heap up
47+
+ c.stdoutGroup.Remove(key)
48+
+ c.stderrGroup.Remove(key)
49+
+ }
50+
// Make sure stdin gets closed.
51+
if stdinStreamRC != nil {
52+
stdinStreamRC.Close()
53+
diff --git a/pkg/cri/server/container_attach.go b/pkg/cri/server/container_attach.go
54+
index a952150..3625229 100644
55+
--- a/pkg/cri/server/container_attach.go
56+
+++ b/pkg/cri/server/container_attach.go
57+
@@ -79,6 +79,6 @@ func (c *criService) attachContainer(ctx context.Context, id string, stdin io.Re
58+
},
59+
}
60+
// TODO(random-liu): Figure out whether we need to support historical output.
61+
- cntr.IO.Attach(opts)
62+
+ cntr.IO.Attach(ctx, opts)
63+
return nil
64+
}
65+
--
66+
2.45.4
67+

SPECS/moby-containerd/moby-containerd.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Summary: Industry-standard container runtime
66
Name: moby-%{upstream_name}
77
Version: 1.6.26
8-
Release: 12%{?dist}
8+
Release: 13%{?dist}
99
License: ASL 2.0
1010
Group: Tools/Container
1111
URL: https://www.containerd.io
@@ -23,6 +23,8 @@ Patch4: CVE-2024-24786.patch
2323
Patch5: CVE-2024-28180.patch
2424
Patch6: CVE-2025-27144.patch
2525
Patch7: CVE-2024-40635.patch
26+
Patch8: CVE-2024-25621.patch
27+
Patch9: CVE-2025-64329.patch
2628

2729
%{?systemd_requires}
2830

@@ -96,6 +98,9 @@ fi
9698
%dir /opt/containerd/lib
9799

98100
%changelog
101+
* Wed Nov 12 2025 Azure Linux Security Servicing Account <[email protected]> - 1.6.26-13
102+
- Patch for CVE-2025-64329, CVE-2024-25621
103+
99104
* Thu Sep 04 2025 Akhila Guruju <[email protected]> - 1.6.26-12
100105
- Bump release to rebuild with golang
101106

0 commit comments

Comments
 (0)