Skip to content

Potential local compromise when running third-party builders

High
evankanderson published GHSA-5336-2g3f-9g3m Nov 18, 2022

Package

knative.dev/func (CLI)

Affected versions

<=v1.8.0

Patched versions

v1.8.1

Description

Impact

Developers using a malicious or compromised third-party buildpack could expose their registry credentials or local docker socket to a malicious lifecycle container. One such vulnerability path would look like:

  1. A malicious attacker publishes a language framework, including both a function builder and buildpack (referenced by tag), and function templates referencing the builder and buildpack. The builder image would need to share a registry prefix with one of the image registry namespaces trusted by func. The image name would look like gcr.io/paketo-buildpacks-for-language/builder:latest.
  2. A victim uses the function template to create a new function project, incorporating the tag-referenced builder.
  3. The attacker updates the builder tag to point to a builder image which references a malicious lifecycle image. (The attacker could also publish a malicious lifecycle image in step 1, but that compromise might be easier to detect.)
  4. When the victim next performs a func build operation (including when pushing code remotely or running it locally with run), the attacker's lifecycle image will be run with either:
  • Publishing to a remote registry: Mounted registry credentials for the destination, cache, and run image repositories (any of which may be read-write)
  • Pushing to the local docker daemon: Access to the local docker daemon through the docker control socket, with the ability to launch further containers with local access.

Patches

This issues has been patched in PR #1442, and is part of release 1.8.1

Workarounds

This issue only affects users who are using function buildpacks from third-parties; pinning the builder image to a specific content-hash with a valid lifecycle image will also mitigate the attack.

References

Func trusted builder prefixes:

trustedBuilderImagePrefixes = []string{
"quay.io/boson",
"gcr.io/paketo-buildpacks",
"docker.io/paketobuildpacks",
"ghcr.io/vmware-tanzu/function-buildpacks-for-knative",

For more information

If you have any questions or comments about this advisory:

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H

CVE ID

CVE-2022-41939

Weaknesses

No CWEs

Credits