Improper Input Validation Affecting github.com/kubernetes/kubernetes/pkg/volume/git_repo package, versions *


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.04% (12th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Improper Input Validation vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-GOLANG-GITHUBCOMKUBERNETESKUBERNETESPKGVOLUMEGITREPO-9404324
  • published14 Mar 2025
  • disclosed13 Mar 2025
  • creditChristophe Hauquiert

Introduced: 13 Mar 2025

NewCVE-2025-1767  (opens in a new tab)
CWE-20  (opens in a new tab)

How to fix?

There is no fixed version for github.com/kubernetes/kubernetes/pkg/volume/git_repo.

Overview

Affected versions of this package are vulnerable to Improper Input Validation. An attacker with create pod permission could access local git repositories belonging to other pods on the same node by exploiting this vulnerability.

Notes:

  1. This is only exploitable if the cluster still uses the deprecated in-tree gitRepo volume feature to clone git repositories from other pods within the same node;

  2. The in-tree gitRepo volume feature has been deprecated and will not receive security updates upstream;

  3. To detect whether this vulnerability has been exploited, the following command can be used to list all pods that use the in-tree gitRepo volume and clone to a .git subdirectory:

`kubectl get pods --all-namespaces -o json | jq '.items[] | select(.spec.volumes[].gitRepo.repository | test("^/")) | {name: .metadata.name, namespace: .metadata.namespace, repository: (.spec.volumes[] | select(.gitRepo) | .gitRepo.repository)}'`

Workaround

This can be mitigated by using an init container to perform git clone operation and then mount the directory into the Pod's container. An example of this approach is provided here.

The use of gitRepo volumes can be restricted in the cluster using policies such as ValidatingAdmissionPolicy or through Restricted pod security standard policy. The following Common Expression Language (CEL) expression can be used as part of a policy to reject use of gitRepo volumes: has(object.spec.volumes) || !object.spec.volumes.exists(v, has(v.gitRepo))

CVSS Base Scores

version 4.0
version 3.1