Skip to content

Comments

Backport of Fix for arbitrary file reads vulnerabilities into release/1.22.x#23252

Merged
santoshpulluri merged 1 commit intorelease/1.22.xfrom
backport/sec_vul_arb_file_read/smoothly-eternal-beetle
Feb 23, 2026
Merged

Backport of Fix for arbitrary file reads vulnerabilities into release/1.22.x#23252
santoshpulluri merged 1 commit intorelease/1.22.xfrom
backport/sec_vul_arb_file_read/smoothly-eternal-beetle

Conversation

@hc-github-team-consul-core
Copy link
Collaborator

Backport

This PR is auto-generated from #23249 to be assessed for backporting due to the inclusion of the label backport/1.22.

The below text is copied from the body of the original PR.


Description

This PR fixes a security vulnerability in the Vault CA provider's authentication methods (Kubernetes, JWT, and AppRole) that allowed arbitrary file reads through path traversal attacks.

Root Cause:

The auth providers used os.ReadFile() directly on user-supplied file paths without proper validation, allowing attackers to read any file on the system by manipulating configuration parameters:

Solution

Implemented OS-level path traversal protection using Go's os.OpenRoot() function, which creates a chroot-like restriction preventing access outside designated directories.

Security Measures:

Whitelist Validation: Only allow file reads from pre-defined standard directories
OS-Level Enforcement: Use os.OpenRoot() to prevent path traversal and symlink escapes at the kernel level
Defense in Depth: Multiple layers of validation ensure security even if one layer has bugs

Allowed Directories:

  1. Kubernetes Auth

    • /var/run/secrets/kubernetes.io/serviceaccount
    • /run/secrets/kubernetes.io/serviceaccount
  2. JWT Auth

    • /var/run/secrets/kubernetes.io/serviceaccount
    • /run/secrets/kubernetes.io/serviceaccount
    • /var/run/secrets
    • /run/secrets
  3. AppRole Auth:

    • /var/run/secrets/vault
    • /run/secrets/vault
    • /var/run/secrets
    • /run/secrets

Testing:

Tests use symbolic links from allowed directories to temporary test directories, respecting the security boundaries while enabling test execution.


Overview of commits

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto approved Consul Bot automated PR

@github-actions github-actions bot added the theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies label Feb 23, 2026
@santoshpulluri santoshpulluri merged commit a989831 into release/1.22.x Feb 23, 2026
101 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants