Backport of Fix for arbitrary file reads vulnerabilities into release/1.22.x#23250
Conversation
github-team-consul-core-pr-approver
left a comment
There was a problem hiding this comment.
Auto approved Consul Bot automated PR
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes temp seems not to be a GitHub user. Have you signed the CLA already but the status is still pending? Recheck it. |
1 similar comment
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes temp seems not to be a GitHub user. Have you signed the CLA already but the status is still pending? Recheck it. |
Backport
This PR is auto-generated from #23249 to be assessed for backporting due to the inclusion of the label backport/1.22.
🚨
The person who merged in the original PR is:
@santoshpulluri
This person should resolve the merge-conflict(s) by either:
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:
Kubernetes Auth
JWT Auth
AppRole Auth:
Testing:
Tests use symbolic links from allowed directories to temporary test directories, respecting the security boundaries while enabling test execution.
Overview of commits