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

Reject proxy requests to 0.0.0.0 as well #107402

Merged
merged 1 commit into from
Jan 10, 2022

Conversation

anguslees
Copy link
Member

@anguslees anguslees commented Jan 7, 2022

What type of PR is this?

/kind bug

What this PR does / why we need it:

Various IP addresses are known to be invalid/unsafe as destination addresses for apiserver proxy queries. The apiserver will reject attempts to proxy to these destination addresses, if a pod/service/node somehow reports as having one of these addresses.

Previously this check included loopback, link-local, and multicast CIDRs. This PR extends the checks to also reject all-zero. (All checks include both IPv4 and IPv6 equivalents.)

As an implementation detail, the change is implemented by switching to golang's net.IP.IsGlobalUnicast. I invite the reader to review the source of that function and satisfy themselves that the resulting checks are equivalent.

Does this PR introduce a user-facing change?

apiserver will now reject connection attempts to 0.0.0.0/:: when handling a proxy subresource request

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 7, 2022
@k8s-ci-robot
Copy link
Contributor

@anguslees: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Jan 7, 2022
@k8s-ci-robot k8s-ci-robot added sig/network Categorizes an issue or PR as relevant to SIG Network. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jan 7, 2022
@aojea
Copy link
Member

aojea commented Jan 7, 2022

I don't know if it is possible for a service, node, ... to return those addresses, but tightening the validation here sgtm
/lgtm
/assign @thockin

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 7, 2022
@anguslees
Copy link
Member Author

I don't know if it is possible for a service, node, ... to return those addresses, but tightening the validation here sgtm

To be clear: I don't know of a case where this can happen either, except through 'legitimate' RBAC write access to Service/Pod/Node, which is why I'm not tagging this as a 'security' issue at this time. This is just a defence-in-depth improvement from my pov.

Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

Thanks!

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: anguslees, thockin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 10, 2022
@k8s-ci-robot k8s-ci-robot merged commit 10ded75 into kubernetes:master Jan 10, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.24 milestone Jan 10, 2022
@anguslees anguslees deleted the proxyzero branch January 12, 2022 10:45
k8s-ci-robot added a commit that referenced this pull request Jun 7, 2022
…07402-upstream-release-1.22

Automated cherry pick of #107402: Reject proxy requests to 0.0.0.0 as well
k8s-ci-robot added a commit that referenced this pull request Jun 7, 2022
…07402-upstream-release-1.23

Automated cherry pick of #107402: Reject proxy requests to 0.0.0.0 as well
k8s-ci-robot added a commit that referenced this pull request Jun 7, 2022
…07402-upstream-release-1.21

Automated cherry pick of #107402: Reject proxy requests to 0.0.0.0 as well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/network Categorizes an issue or PR as relevant to SIG Network. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants