4.2medium
Cosign vulnerable to machine-wide denial of service via malicious artifacts
- Severity
- 4.2medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.85% (higher than 59% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-95pr-fxf5-86gvBIT-COSIGN-2024-29903GO-2024-2719
Description
Cosign provides code signing and transparency for containers and binaries. Prior to version 2.2.4, maliciously-crafted software artifacts can cause denial of service of the machine running Cosign thereby impacting all services on the machine. The root cause is that Cosign creates slices based on the number of signatures, manifests or attestations in untrusted artifacts. As such, the untrusted artifact can control the amount of memory that Cosign allocates. The exact issue is Cosign allocates excessive memory on the lines that creates a slice of the same length as the manifests. Version 2.2.4 contains a patch for the vulnerability.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| sigstore cosign | < 2.2.4, before 2.2.4 | CVE List, NVD |
| github.com/sigstore/cosign (Go) | up to 2.2.3, all versions | GitHub Advisory Database, Go Vulnerability Database |
| github.com/sigstore/cosign/v2 (Go) | before 2.2.4 | GitHub Advisory Database, Go Vulnerability Database |
| cosign (Bitnami) | before 2.2.4 | Bitnami Vulnerability Database |
All scores
| GitHub_M | 4.2medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:H |
| GitHub | 4.2medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:H |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| Bitnami Vulnerability Database | high rating |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.
What each source says
CVE List
Cosign provides code signing and transparency for containers and binaries. Prior to version 2.2.4, maliciously-crafted software artifacts can cause denial of service of the machine running Cosign thereby impacting all services on the machine. The root cause is that Cosign creates slices based on the number of signatures, manifests or attestations in untrusted artifacts. As such, the untrusted artifact can control the amount of memory that Cosign allocates. The exact issue is Cosign allocates excessive memory on the lines that creates a slice of the same length as the manifests. Version 2.2.4 contains a patch for the vulnerability.
GitHub Advisory Database
Maliciously-crafted software artifacts can cause denial of service of the machine running Cosign, thereby impacting all services on the machine. The root cause is that Cosign creates slices based on the number of signatures, manifests or attestations in untrusted artifacts. As such, the untrusted artifact can control the amount of memory that Cosign allocates.
As an example, these lines demonstrate the problem:
This Get() method gets the manifest of the image, allocates a slice equal to the length of the layers in the manifest, loops through the layers and adds a new signature to the slice.
The exact issue is Cosign allocates excessive memory on the lines that creates a slice of the same length as the manifests.
Remediation
Update to the latest version of Cosign, where the number of attestations, signatures and manifests has been limited to a reasonable value.
Cosign PoC
In the case of this API (also referenced above):
… The first line can contain a length that is safe for the system and will not throw a runtime panic or be blocked by other safety mechanisms. For the sake of argument, let’s say that the length of m, err := s.Manifest() is the max allowed (by the machine without throwing OOM panics) manifests minus 1. When Cosign then allocates a new slice on this line: signatures := make([]oci.Signature, 0, len(m.Layers)), Cosign will allocate more memory than is available and the machine will be denied of service, causing Cosign and all other services on the machine to be unavailable.
To illustrate the issue here, we run a modified version of TestSignedImageIndex() in pkg/oci/remote:
Here, wantLayers is the number of manifests from these lines:
To test this, we want to make wantLayers high enough to not cause a memory on its own but still trigger the machine-wide OOM when a slice gets create with the same length. On my local machine, it would take hours to create a slice of layers that fulfils that criteria, so instead I modify the Cosign production code to reflect a long list of manifests:
// Get implements oci.Signatures
func (s *sigs) Get() ([]oci.Signature, error) {
m, err := s.Manifest()
if err != nil {
return nil, err
}
// Here we imitate a long list of manifests
ms := make([]byte, 2600000000) // imitate a long list of manifests
signatures := make([]oci.Signature, 0, len(ms))
panic("Done")
//signatures := make([]oci.Signature, 0, len(m.Layers))
for _, desc := range m.Layers {
With this modified code, if we can cause an OOM without triggering the panic("Done"), we have succeeded.
Go Vulnerability Database
Cosign malicious artifacts can cause machine-wide DoS in github.com/sigstore/cosign
NVD (es)
Cosign proporciona firma de código y transparencia para contenedores y binarios. Antes de la versión 2.2.4, los artefactos de software creados con fines malintencionados podían provocar la denegación de servicio de la máquina que ejecuta Cosign, lo que afectaba a todos los servicios de la máquina. La causa principal es que Cosign crea sectores basados en la cantidad de firmas, manifiestos o certificaciones en artefactos que no son de confianza. Como tal, el artefacto que no es de confianza puede controlar la cantidad de memoria que asigna Cosign. El problema exacto es que Cosign asigna memoria excesiva en las líneas, lo que crea un segmento de la misma longitud que los manifiestos. La versión 2.2.4 contiene un parche para la vulnerabilidad.
References
Related
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-29903 changed 2024-08-02 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-95pr-fxf5-86gv changed 2026-09-10 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2024-2719 changed 2026-02-04 | CC-BY-4.0 |
| NVD | CVE-2024-29903 changed 2026-06-17 | Public domain |
| Bitnami Vulnerability Database | BIT-COSIGN-2024-29903 changed 2026-09-08 | Apache-2.0 |