Skip to content

fix(deps): update module github.com/sigstore/cosign/v2 to v2.2.4 [security] - #7

Merged
yuzichen12123 merged 2 commits into
alauda-v0.34.0from
renovate/go-github.com-sigstore-cosign-v2-vulnerability
Jul 24, 2025
Merged

fix(deps): update module github.com/sigstore/cosign/v2 to v2.2.4 [security]#7
yuzichen12123 merged 2 commits into
alauda-v0.34.0from
renovate/go-github.com-sigstore-cosign-v2-vulnerability

Conversation

@alaudaa-renovate

@alaudaa-renovate alaudaa-renovate Bot commented Jul 23, 2025

Copy link
Copy Markdown

This PR contains the following updates:

Package Change Age Confidence
github.com/sigstore/cosign/v2 v2.2.2 -> v2.2.4 age confidence

Cosign malicious artifacts can cause machine-wide DoS

BIT-cosign-2024-29903 / CVE-2024-29903 / GHSA-95pr-fxf5-86gv / GO-2024-2719

More information

Details

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:

https://github.com/sigstore/cosign/blob/286a98a4a99c1b2f32f84b0d560e324100312280/pkg/oci/remote/signatures.go#L56-L70

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):

https://github.com/sigstore/cosign/blob/286a98a4a99c1b2f32f84b0d560e324100312280/pkg/oci/remote/signatures.go#L56-L70

… 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:

https://github.com/sigstore/cosign/blob/14795db16417579fac0c00c11e166868d7976b61/pkg/oci/remote/index_test.go#L31-L57

Here, wantLayers is the number of manifests from these lines:

https://github.com/sigstore/cosign/blob/286a98a4a99c1b2f32f84b0d560e324100312280/pkg/oci/remote/signatures.go#L56-L60

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.

Severity

  • CVSS Score: 4.2 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:H

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Cosign malicious attachments can cause system-wide denial of service in github.com/sigstore/cosign

BIT-cosign-2024-29902 / CVE-2024-29902 / GHSA-88jx-383q-w4qc / GO-2024-2718

More information

Details

Cosign malicious attachments can cause system-wide denial of service in github.com/sigstore/cosign

Severity

Unknown

References

This data is provided by OSV and the Go Vulnerability Database (CC-BY 4.0).


Cosign malicious attachments can cause system-wide denial of service

BIT-cosign-2024-29902 / CVE-2024-29902 / GHSA-88jx-383q-w4qc / GO-2024-2718

More information

Details

Summary

A remote image with a malicious attachment can cause denial of service of the host machine running Cosign. This can impact other services on the machine that rely on having memory available such as a Redis database which can result in data loss. It can also impact the availability of other services on the machine that will not be available for the duration of the machine denial.

Details

The root cause of this issue is that Cosign reads the attachment from a remote image entirely into memory without checking the size of the attachment first. As such, a large attachment can make Cosign read a large attachment into memory; If the attachments size is larger than the machine has memory available, the machine will be denied of service. The Go runtime will make a SIGKILL after a few seconds of system-wide denial.

The root cause is that Cosign reads the contents of the attachments entirely into memory on line 238 below:

https://github.com/sigstore/cosign/blob/9bc3ee309bf35d2f6e17f5d23f231a3d8bf580bc/pkg/oci/remote/remote.go#L228-L239

...and prior to that, neither Cosign nor go-containerregistry checks the size of the attachment and enforces a max cap. In the case of a remote layer of f *attached, go-containerregistry will invoke this API:

https://github.com/google/go-containerregistry/blob/a0658aa1d0cc7a7f1bcc4a3af9155335b6943f40/pkg/v1/remote/layer.go#L36-L40

func (rl *remoteLayer) Compressed() (io.ReadCloser, error) {
	// We don't want to log binary layers -- this can break terminals.
	ctx := redact.NewContext(rl.ctx, "omitting binary blobs from logs")
	return rl.fetcher.fetchBlob(ctx, verify.SizeUnknown, rl.digest)
}

Notice that the second argument to rl.fetcher.fetchBlob is verify.SizeUnknown which results in not using the io.LimitReader in verify.ReadCloser:
https://github.com/google/go-containerregistry/blob/a0658aa1d0cc7a7f1bcc4a3af9155335b6943f40/internal/verify/verify.go#L82-L100

func ReadCloser(r io.ReadCloser, size int64, h v1.Hash) (io.ReadCloser, error) {
	w, err := v1.Hasher(h.Algorithm)
	if err != nil {
		return nil, err
	}
	r2 := io.TeeReader(r, w) // pass all writes to the hasher.
	if size != SizeUnknown {
		r2 = io.LimitReader(r2, size) // if we know the size, limit to that size.
	}
	return &and.ReadCloser{
		Reader: &verifyReader{
			inner:    r2,
			hasher:   w,
			expected: h,
			wantSize: size,
		},
		CloseFunc: r.Close,
	}, nil
}
Impact

This issue can allow a supply-chain escalation from a compromised registry to the Cosign user: If an attacher has compromised a registry or the account of an image vendor, they can include a malicious attachment and hurt the image consumer.

Remediation

Update to the latest version of Cosign, which limits the number of attachments. An environment variable can override this value.

Severity

  • CVSS Score: 4.2 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:H

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Cosign malicious artifacts can cause machine-wide DoS in github.com/sigstore/cosign

BIT-cosign-2024-29903 / CVE-2024-29903 / GHSA-95pr-fxf5-86gv / GO-2024-2719

More information

Details

Cosign malicious artifacts can cause machine-wide DoS in github.com/sigstore/cosign

Severity

Unknown

References

This data is provided by OSV and the Go Vulnerability Database (CC-BY 4.0).


Release Notes

sigstore/cosign (github.com/sigstore/cosign/v2)

v2.2.4

Compare Source

Bug Fixes

Features

  • Adds Support for Fulcio Client Credentials Flow, and Argument to Set Flow Explicitly (#​3578)

Documentation

  • add oci bundle spec (#​3622)
  • Correct help text of triangulate cmd (#​3551)
  • Correct help text of verify-attestation policy argument (#​3527)
  • feat: add OVHcloud MPR registry tested with cosign (#​3639)

Testing

  • Refactor e2e-tests.yml workflow (#​3627)
  • Clean up and clarify e2e scripts (#​3628)
  • Don't ignore transparency log in tests if possible (#​3528)
  • Make E2E tests hermetic (#​3499)
  • add e2e test for pkcs11 token signing (#​3495)

v2.2.3

Compare Source

Bug Fixes

  • Fix race condition on verification with multiple signatures attached to image (#​3486)
  • fix(clean): Fix clean cmd for private registries (#​3446)
  • Fixed BYO PKI verification (#​3427)

Features

  • Allow for option in cosign attest and attest-blob to upload attestation as supported in Rekor (#​3466)
  • Add support for OpenVEX predicate type (#​3405)

Documentation

  • Resolves #​3088: version sub-command expected behaviour documentation and testing (#​3447)
  • add examples for cosign attach signature cmd (#​3468)

Misc

  • Remove CertSubject function (#​3467)
  • Use local rekor and fulcio instances in e2e tests (#​3478)

Contributors

  • aalsabag
  • Bob Callaway
  • Carlos Tadeu Panato Junior
  • Colleen Murphy
  • Hayden B
  • Mukuls77
  • Omri Bornstein
  • Puerco
  • vivek kumar sahu

Configuration

📅 Schedule: Branch creation - "" in timezone Asia/Shanghai, Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Renovate Bot.

@alaudaa-renovate

alaudaa-renovate Bot commented Jul 23, 2025

Copy link
Copy Markdown
Author

ℹ Artifact update notice

File name: go.mod

In order to perform the update(s) described in the table above, Renovate ran the go get command, which resulted in the following additional change(s):

  • 74 additional dependencies were updated

Details:

Package Change
github.com/google/go-containerregistry v0.17.0 -> v0.19.1
github.com/sigstore/sigstore v1.8.0 -> v1.8.3
go.uber.org/zap v1.26.0 -> v1.27.0
cloud.google.com/go v0.110.10 -> v0.112.1
cloud.google.com/go/firestore v1.14.0 -> v1.15.0
cloud.google.com/go/iam v1.1.5 -> v1.1.6
cloud.google.com/go/kms v1.15.5 -> v1.15.8
cloud.google.com/go/longrunning v0.5.4 -> v0.5.5
cloud.google.com/go/storage v1.33.0 -> v1.39.1
filippo.io/edwards25519 v1.0.0 -> v1.1.0
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.1 -> v1.1.0
github.com/aws/aws-sdk-go v1.48.11 -> v1.51.6
github.com/aws/aws-sdk-go-v2 v1.23.5 -> v1.26.0
github.com/aws/aws-sdk-go-v2/config v1.25.11 -> v1.27.9
github.com/aws/aws-sdk-go-v2/credentials v1.16.9 -> v1.17.9
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.9 -> v1.16.0
github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.8 -> v1.3.4
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.8 -> v2.6.4
github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1 -> v1.8.0
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.3 -> v1.11.1
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.8 -> v1.11.6
github.com/aws/aws-sdk-go-v2/service/kms v1.27.2 -> v1.30.0
github.com/aws/aws-sdk-go-v2/service/sso v1.18.2 -> v1.20.3
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.2 -> v1.23.3
github.com/aws/aws-sdk-go-v2/service/sts v1.26.2 -> v1.28.5
github.com/aws/smithy-go v1.18.1 -> v1.20.1
github.com/coreos/go-oidc/v3 v3.9.0 -> v3.10.0
github.com/digitorus/timestamp v0.0.0-20230902153158-687734543647 -> v0.0.0-20231217203849-220c5c2851b7
github.com/go-logr/logr v1.3.0 -> v1.4.1
github.com/go-openapi/analysis v0.21.4 -> v0.23.0
github.com/go-openapi/errors v0.20.4 -> v0.22.0
github.com/go-openapi/jsonpointer v0.20.0 -> v0.21.0
github.com/go-openapi/jsonreference v0.20.2 -> v0.21.0
github.com/go-openapi/loads v0.21.2 -> v0.22.0
github.com/go-openapi/runtime v0.26.0 -> v0.28.0
github.com/go-openapi/spec v0.20.11 -> v0.21.0
github.com/go-openapi/strfmt v0.21.8 -> v0.23.0
github.com/go-openapi/swag v0.22.4 -> v0.23.0
github.com/go-openapi/validate v0.22.3 -> v0.24.0
github.com/golang/protobuf v1.5.3 -> v1.5.4
github.com/google/certificate-transparency-go v1.1.7 -> v1.1.8
github.com/google/wire v0.5.0 -> v0.6.0
github.com/googleapis/gax-go/v2 v2.12.0 -> v2.12.3
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 -> v2.19.1
github.com/hashicorp/vault/api v1.10.0 -> v1.12.2
github.com/jellydator/ttlcache/v3 v3.1.0 -> v3.2.0
github.com/klauspost/compress v1.17.2 -> v1.17.4
github.com/opencontainers/image-spec v1.1.0-rc5 -> v1.1.0
github.com/prometheus/client_golang v1.17.0 -> v1.19.0
github.com/prometheus/client_model v0.5.0 -> v0.6.0
github.com/prometheus/common v0.45.0 -> v0.51.1
github.com/sagikazarmark/locafero v0.3.0 -> v0.4.0
github.com/sigstore/fulcio v1.4.3 -> v1.4.5
github.com/sigstore/rekor v1.3.4 -> v1.3.6
github.com/sigstore/sigstore/pkg/signature/kms/aws v1.7.6 -> v1.8.3
github.com/sigstore/sigstore/pkg/signature/kms/azure v1.7.6 -> v1.8.3
github.com/sigstore/sigstore/pkg/signature/kms/gcp v1.7.6 -> v1.8.3
github.com/sigstore/sigstore/pkg/signature/kms/hashivault v1.7.6 -> v1.8.3
github.com/sigstore/timestamp-authority v1.2.0 -> v1.2.2
github.com/spf13/afero v1.10.0 -> v1.11.0
github.com/spf13/cast v1.5.1 -> v1.6.0
github.com/spf13/viper v1.17.0 -> v1.18.2
github.com/spiffe/go-spiffe/v2 v2.1.6 -> v2.2.0
github.com/xanzy/go-gitlab v0.94.0 -> v0.102.0
go.mongodb.org/mongo-driver v1.12.1 -> v1.14.0
go.opentelemetry.io/otel v1.21.0 -> v1.24.0
go.step.sm/crypto v0.38.0 -> v0.44.2
gocloud.dev v0.34.0 -> v0.37.0
google.golang.org/api v0.152.0 -> v0.172.0
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 -> v0.0.0-20240311173647-c811ad7063a7
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 -> v0.0.0-20240311173647-c811ad7063a7
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f -> v0.0.0-20240318140521-94a12d6c2237
google.golang.org/grpc v1.59.0 -> v1.62.1
k8s.io/klog/v2 v2.100.1 -> v2.120.1

@alaudaa-renovate
alaudaa-renovate Bot force-pushed the renovate/go-github.com-sigstore-cosign-v2-vulnerability branch 5 times, most recently from 781ac5f to bd1f417 Compare July 23, 2025 15:18
@alaudaa-renovate
alaudaa-renovate Bot force-pushed the renovate/go-github.com-sigstore-cosign-v2-vulnerability branch from bd1f417 to 6246d9b Compare July 23, 2025 15:31
@alaudaa-renovate

Copy link
Copy Markdown
Author

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

@yuzichen12123
yuzichen12123 merged commit 290019f into alauda-v0.34.0 Jul 24, 2025
1 check passed
@yuzichen12123
yuzichen12123 deleted the renovate/go-github.com-sigstore-cosign-v2-vulnerability branch July 24, 2025 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant