Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSI: fix namespace ACL bypass on create/register APIs #24396

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

tgross
Copy link
Member

@tgross tgross commented Nov 7, 2024

When creating or registering a CSI volume, the RPC handler uses the volume specification's namespace instead of the request namespace. This works as intended, but the ACL check is only on the request namespace.

This allows a cross-namespace ACL bypass for authenticated users who have csi-write-volume capabilities in one namespace but not another namespace. Such a user can set the volume specification to a forbidden namespace while setting the -namespace flag in the CLI or API. The ACL check happens against the namespace they do have permission to, but the volume is created in the forbidden namespace.

This changeset fixes the bug by moving the namespace check into the loop over the volumes being written by the RPCs. It also updates the tests to better cover ACL checking in these two RPCs.

Ref: CVE-2024-10975
Ref: https://hashicorp.atlassian.net/browse/SECVULN-15463
Fixes: #24397

@tgross tgross force-pushed the b-csi-acl-namespace-confusion branch from 08e6869 to c96d663 Compare November 7, 2024 19:06
@tgross tgross force-pushed the b-csi-acl-namespace-confusion branch from c96d663 to 5edf1f7 Compare November 7, 2024 19:08
@tgross tgross added this to the 1.9.2 milestone Nov 7, 2024
@tgross tgross added backport/ent/1.7.x+ent Changes are backported to 1.7.x+ent backport/ent/1.8.x+ent Changes are backported to 1.8.x+ent backport/1.9.x backport to 1.9.x release line labels Nov 7, 2024
@tgross tgross marked this pull request as ready for review November 7, 2024 19:14
Copy link
Member

@gulducat gulducat left a comment

Choose a reason for hiding this comment

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

assuming tests pass, lgtm! only a couple code comment typos

nomad/csi_endpoint.go Outdated Show resolved Hide resolved
nomad/csi_endpoint.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@dduzgun-security dduzgun-security left a comment

Choose a reason for hiding this comment

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

LGTM! Would be good to merge when tests are 🟢, thanks for the awesome quick fix

When creating or registering a CSI volume, the RPC handler uses the volume
specification's namespace instead of the request namespace. This works as
intended, but the ACL check is only on the request namespace.

This allows a cross-namespace ACL bypass for authenticated users who have
`csi-write-volume` capabilities in one namespace but not another namespace. Such
a user can set the volume specification to a forbidden namespace while setting
the `-namespace` flag in the CLI or API. The ACL check happens against the
namespace they do have permission to, but the volume is created in the forbidden
namespace.

This changeset fixes the bug by moving the namespace check into the loop over
the volumes being written by the RPCs. It also updates the tests to better cover
ACL checking in these two RPCs.

Ref: CVE-2024-10975
Ref: https://hashicorp.atlassian.net/browse/SECVULN-15463
Fixes: #24397
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/ent/1.7.x+ent Changes are backported to 1.7.x+ent backport/ent/1.8.x+ent Changes are backported to 1.8.x+ent backport/1.9.x backport to 1.9.x release line theme/auth theme/security theme/storage type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HCSEC-2024-27 - Nomad Vulnerable To Cross-Namespace Volume Creation Abusing CSI Write Permission
3 participants