Back to Policies

Verify Image Check CVE-2022-42889

CVE-2022-42889 is a critical vulnerability in the Apache Commons Text library which could lead to arbitrary code executions and occurs in versions 1.5 through 1.9. Detecting the affected package may be done in an SBOM by identifying the "commons-text" package with one of the affected versions. This policy checks attested SBOMs in CycloneDX format of an image specified under `imageReferences` and denies it if it contains versions 1.5-1.9 of the commons-text package. Using this for your own purposes will require customizing the `imageReferences`, `subject`, and `issuer` fields based on your image signatures and attestations.

View on GitHub

Policy Definition

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: check-image-vulns-cve-2022-42889
annotations:
policies.kyverno.io/title: Verify Image Check CVE-2022-42889
policies.kyverno.io/category: Software Supply Chain Security
policies.kyverno.io/severity: medium
policies.kyverno.io/subject: Pod
policies.kyverno.io/minversion: 1.8.3
kyverno.io/kyverno-version: 1.9.0
kyverno.io/kubernetes-version: "1.24"
policies.kyverno.io/description: CVE-2022-42889 is a critical vulnerability in the Apache Commons Text library which could lead to arbitrary code executions and occurs in versions 1.5 through 1.9. Detecting the affected package may be done in an SBOM by identifying the "commons-text" package with one of the affected versions. This policy checks attested SBOMs in CycloneDX format of an image specified under `imageReferences` and denies it if it contains versions 1.5-1.9 of the commons-text package. Using this for your own purposes will require customizing the `imageReferences`, `subject`, and `issuer` fields based on your image signatures and attestations.
spec:
validationFailureAction: Audit
webhookTimeoutSeconds: 10
rules:
- name: cve-2022-42889
match:
any:
- resources:
kinds:
- Pod
verifyImages:
- imageReferences:
- myreg.org/myrepo/someimage*
attestations:
- predicateType: https://cyclonedx.org/schema
attestors:
- entries:
- keyless:
subject: mysubject
issuer: myissuer
rekor:
url: https://rekor.sigstore.dev
conditions:
- all:
- key: "{{ components[?name=='commons-text'].version || 'none' }}"
operator: AllNotIn
value:
- "1.5"
- "1.6"
- "1.7"
- "1.8"
- "1.9"

Related Policies