Описание
ORAS CLI: Cyclic Referrer Graph Can Cause Unbounded Recursion and Resource Consumption
Summary
A malicious OCI registry can return a cyclic referrer graph (e.g. A -> A or A -> B -> A). The ORAS CLI's recursive referrer traversal does not track visited descriptors, so a cycle causes unbounded recursion and memory growth — a client-side denial of service.
This affects oras discover (recursive referrer traversal) and the recursive referrer counting used by oras backup and oras restore. Because oras discover --depth defaults to 0 (unlimited), discover is affected out of the box.
Note: This advisory covers only the ORAS CLI (
oras.land/oras). The related Referrers API pagination loop in theoras-golibrary is tracked in a separate advisory on the oras-go repository.
Details
In oras discover, recursive referrer traversal follows discovered referrers without maintaining a visited-descriptor set.
Simplified flow:
A malicious registry can create cyclic graphs such as:
or
Because traversal does not track previously visited descriptors, recursion never reaches a terminating condition.
Similarly, the recursive counting logic (graph.RecursiveFindReferrers, used by the backup and restore workflows) accumulates descriptors without cycle detection, causing unbounded memory growth.
PoC
Create valid descriptors where:
or:
Run:
The recursive traversal continues indefinitely, causing unbounded recursion and eventual resource exhaustion.
Impact
A malicious OCI registry can trigger client-side denial of service against ORAS CLI users and automation.
Potential impacts include:
- Excessive CPU utilization
- Excessive memory consumption
- Unbounded recursion
- Hung CI/CD jobs
- Stalled automation pipelines
- Failed backup or discovery operations
The issue does not enable arbitrary code execution, artifact substitution, or integrity bypass, but it can reliably prevent ORAS operations from completing when interacting with malicious registry metadata.
Patch
cmd/oras/root/discover.go—fetchAllReferrersthreads avisiteddigest set; an already-traversed descriptor returns immediately, breaking cycles. Behavior is unchanged for valid (acyclic) referrer graphs.internal/graph/graph.go—RecursiveFindReferrerstracks visited descriptors by digest and only recurses into unseen referrers, so traversal terminates on a cyclic graph.
Пакеты
oras.land/oras
< 1.3.3
1.3.3
Связанные уязвимости
ORAS (OCI Registry As Storage) is a CLI and library for managing artifacts in OCI registries. In ORAS CLI versions up to and including 1.3.2, the recursive referrer traversal does not track visited descriptors, so a malicious OCI registry that returns a cyclic referrer graph causes unbounded recursion and memory growth. This affects oras discover, whose recursive traversal is enabled by default because the --depth option defaults to 0 (unlimited), as well as the recursive referrer counting used by the oras backup and oras restore workflows. A cyclic graph can be as simple as A referring to B and B referring back to A. A malicious registry can use this to cause a client-side denial of service, exhausting CPU and memory and hanging automation or CI/CD pipelines that run ORAS against untrusted registry metadata. The vulnerability does not extend to code execution, artifact substitution, or integrity bypass. This issue has been fixed in version 1.3.3.
ORAS (OCI Registry As Storage) is a CLI and library for managing artifacts in OCI registries. In ORAS CLI versions up to and including 1.3.2, the recursive referrer traversal does not track visited descriptors, so a malicious OCI registry that returns a cyclic referrer graph causes unbounded recursion and memory growth. This affects oras discover, whose recursive traversal is enabled by default because the --depth option defaults to 0 (unlimited), as well as the recursive referrer counting used by the oras backup and oras restore workflows. A cyclic graph can be as simple as A referring to B and B referring back to A. A malicious registry can use this to cause a client-side denial of service, exhausting CPU and memory and hanging automation or CI/CD pipelines that run ORAS against untrusted registry metadata. The vulnerability does not extend to code execution, artifact substitution, or integrity bypass. This issue has been fixed in version 1.3.3.
ORAS (OCI Registry As Storage) is a CLI and library for managing artif ...