CVE-2024-36621
Description
moby v25.0.5 is affected by a Race Condition in builder/builder-next/adapters/snapshot/layer.go. The vulnerability could be used to trigger concurrent builds that call the EnsureLayer function resulting in resource leaks/exhaustion.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
A race condition in Moby (Docker) v25.0.5's EnsureLayer function can lead to resource leaks/exhaustion during concurrent builds.
Vulnerability
Overview
CVE-2024-36621 is a race condition vulnerability identified in Moby (Docker) v25.0.5, specifically within the EnsureLayer function in builder/builder-next/adapters/snapshot/layer.go [1][3][4]. The issue arises when concurrent build processes simultaneously call this function, leading to unsynchronized access that can trigger resource leaks and eventual exhaustion of system resources [1][3].
Exploitation
To exploit this vulnerability, an attacker must have the ability to initiate multiple concurrent container builds on a system running the affected version of Moby. No special privileges beyond normal build access are required, as the race condition is triggered by standard build operations [1]. The attack vector is network-based, since builds can be initiated remotely via the Docker API or CLI, and the attack complexity is considered high due to the necessity of precise timing to win the race [1].
Impact
Successful exploitation can lead to resource leaks, such as file descriptors, memory, or storage, potentially causing resource exhaustion on the host system. This could degrade system performance or lead to denial of service (DoS) for legitimate container operations [1][3].
Mitigation
As of this advisory, users are strongly recommended to upgrade to a patched version of Moby that addresses the race condition. The Moby project is actively maintained, and fixes are typically incorporated in subsequent releases [2]. Check the official Moby repository and Docker release notes for updated versions that resolve CVE-2024-36621 [2][4].
AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
github.com/moby/mobyGo | < 26.0.0 | 26.0.0 |
Affected products
50- moby/mobydescription
- osv-coords48 versionspkg:apk/chainguard/cmctl-1.12pkg:apk/chainguard/docker-machine-driver-harvesterpkg:apk/chainguard/kubevelapkg:apk/chainguard/kubevela-vela-clipkg:apk/chainguard/kubevela-vela-corepkg:apk/chainguard/kubevela-vela-core-compatpkg:apk/chainguard/pulumipkg:apk/chainguard/pulumi-language-gopkg:apk/chainguard/pulumi-language-nodejspkg:apk/chainguard/pulumi-language-pythonpkg:apk/chainguard/py3.10-dockerpkg:apk/chainguard/py3.11-dockerpkg:apk/chainguard/py3.12-dockerpkg:apk/chainguard/py3.13-dockerpkg:apk/chainguard/py3-dockerpkg:apk/chainguard/rancher-2.10pkg:apk/chainguard/rancher-2.11pkg:apk/chainguard/rancher-agent-2.10pkg:apk/chainguard/rancher-agent-2.8pkg:apk/chainguard/rancher-agent-2.9pkg:apk/chainguard/rancher-machinepkg:apk/chainguard/vela-clipkg:apk/chainguard/vela-corepkg:apk/wolfi/cmctl-1.12pkg:apk/wolfi/docker-machine-driver-harvesterpkg:apk/wolfi/kubevelapkg:apk/wolfi/kubevela-vela-clipkg:apk/wolfi/kubevela-vela-corepkg:apk/wolfi/kubevela-vela-core-compatpkg:apk/wolfi/pulumipkg:apk/wolfi/pulumi-language-gopkg:apk/wolfi/pulumi-language-nodejspkg:apk/wolfi/pulumi-language-pythonpkg:apk/wolfi/py3.10-dockerpkg:apk/wolfi/py3.11-dockerpkg:apk/wolfi/py3.12-dockerpkg:apk/wolfi/py3.13-dockerpkg:apk/wolfi/py3-dockerpkg:apk/wolfi/rancher-2.10pkg:apk/wolfi/rancher-2.11pkg:apk/wolfi/rancher-agent-2.10pkg:apk/wolfi/rancher-agent-2.8pkg:apk/wolfi/rancher-agent-2.9pkg:apk/wolfi/rancher-machinepkg:apk/wolfi/vela-clipkg:apk/wolfi/vela-corepkg:golang/github.com/moby/mobypkg:rpm/opensuse/govulncheck-vulndb&distro=openSUSE%20Tumbleweed
< 1.12.17-r10+ 47 more
- (no CPE)range: < 1.12.17-r10
- (no CPE)range: < 1.0.5-r0
- (no CPE)range: < 1.9.13-r2
- (no CPE)range: < 1.9.13-r2
- (no CPE)range: < 1.9.13-r2
- (no CPE)range: < 1.9.13-r2
- (no CPE)range: < 3.142.0-r1
- (no CPE)range: < 3.142.0-r1
- (no CPE)range: < 3.142.0-r1
- (no CPE)range: < 3.142.0-r1
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0.15.0.137-r0
- (no CPE)range: < 1.9.13-r2
- (no CPE)range: < 1.9.13-r2
- (no CPE)range: < 1.12.17-r10
- (no CPE)range: < 1.0.5-r0
- (no CPE)range: < 1.9.13-r2
- (no CPE)range: < 1.9.13-r2
- (no CPE)range: < 1.9.13-r2
- (no CPE)range: < 1.9.13-r2
- (no CPE)range: < 3.142.0-r1
- (no CPE)range: < 3.142.0-r1
- (no CPE)range: < 3.142.0-r1
- (no CPE)range: < 3.142.0-r1
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0
- (no CPE)range: < 0.15.0.137-r0
- (no CPE)range: < 1.9.13-r2
- (no CPE)range: < 1.9.13-r2
- (no CPE)range: < 26.0.0
- (no CPE)range: < 0.0.20241209T183251-1.1
Patches
137545cc64434builder-next: fix missing lock in ensurelayer
2 files changed · +14 −8
builder/builder-next/adapters/snapshot/layer.go+3 −0 modified@@ -22,6 +22,9 @@ func (s *snapshotter) GetDiffIDs(ctx context.Context, key string) ([]layer.DiffI } func (s *snapshotter) EnsureLayer(ctx context.Context, key string) ([]layer.DiffID, error) { + s.layerCreateLocker.Lock(key) + defer s.layerCreateLocker.Unlock(key) + diffIDs, err := s.GetDiffIDs(ctx, key) if err != nil { return nil, err
builder/builder-next/adapters/snapshot/snapshot.go+11 −8 modified@@ -17,6 +17,7 @@ import ( "github.com/moby/buildkit/identity" "github.com/moby/buildkit/snapshot" "github.com/moby/buildkit/util/leaseutil" + "github.com/moby/locker" "github.com/opencontainers/go-digest" "github.com/pkg/errors" bolt "go.etcd.io/bbolt" @@ -51,10 +52,11 @@ type checksumCalculator interface { type snapshotter struct { opt Opt - refs map[string]layer.Layer - db *bolt.DB - mu sync.Mutex - reg graphIDRegistrar + refs map[string]layer.Layer + db *bolt.DB + mu sync.Mutex + reg graphIDRegistrar + layerCreateLocker *locker.Locker } // NewSnapshotter creates a new snapshotter @@ -71,10 +73,11 @@ func NewSnapshotter(opt Opt, prevLM leases.Manager, ns string) (snapshot.Snapsho } s := &snapshotter{ - opt: opt, - db: db, - refs: map[string]layer.Layer{}, - reg: reg, + opt: opt, + db: db, + refs: map[string]layer.Layer{}, + reg: reg, + layerCreateLocker: locker.New(), } slm := newLeaseManager(s, prevLM)
Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/advisories/GHSA-2mj3-vfvx-fc43ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2024-36621ghsaADVISORY
- gist.github.com/1047524396/5d44459edab5fafcdf86b43909b81135ghsaWEB
- github.com/moby/moby/blob/v25.0.5/builder/builder-next/adapters/snapshot/layer.goghsaWEB
- github.com/moby/moby/commit/37545cc644344dcb576cba67eb7b6f51a463d31eghsaWEB
News mentions
0No linked articles in our index yet.