← 返回列表

CVE-2021-25740

单站 Kubernetes Vulnerability Announcements 发布 Wed, 14 Jul 2021 03:30:07 +0000 入库 2026-11-18T06:56:49

Repository navigation

cve/wontfixIndicates that an announced CVE does not require a fix.Indicates that an announced CVE does not require a fix.

lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.Indicates that an issue or PR should not be auto-closed due to staleness.

needs-sigIndicates an issue or PR lacks a `sig/foo` label and requires one.Indicates an issue or PR lacks a `sig/foo` label and requires one.

needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.Indicates an issue or PR lacks a `triage/foo` label and requires one.

official-cve-feedIssues or PRs related to CVEs officially announced by Security Response Committee (SRC)Issues or PRs related to CVEs officially announced by Security Response Committee (SRC)

Description

on Jul 13, 2021

A security issue was discovered with Kubernetes that could enable users to send network traffic to locations they would otherwise not have access to via a confused deputy attack.

This issue has been rated Low severity (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N), and assigned CVE-2021-25740.

Am I vulnerable?

If a potential attacker can create or edit Endpoints or EndpointSlices in the Kubernetes API, they can potentially direct a LoadBalancer or Ingress implementation to expose backend IPs the attacker should not have access to.

Importantly, if the target’s NetworkPolicy already trusts the Load Balancer or Ingress implementation, NetworkPolicy can not be used to prevent exposure from other namespaces, potentially bypassing any security controls such as LoadBalancerSourceRanges.

This issue is a design flaw that cannot be fully mitigated without user-facing changes. With this public announcement, we can begin conversations about a long-term fix.

Affected Versions

All Kubernetes versions are affected.

How do I mitigate this vulnerability?

There is no patch for this issue, and it can currently only be mitigated by restricting access to the vulnerable features. To mitigate the exposure, we recommend restricting write access to Endpoints and EndpointSlices by updating the system:aggregate-to-edit role using the attached file. This will remove write access to Endpoints from the admin and edit roles:

# Allow kubectl auth reconcile to work
kubectl annotate --overwrite clusterrole/system:aggregate-to-edit rbac.authorization.kubernetes.io/autoupdate=true
# Test reconcile, then run for real if happy
kubectl auth reconcile --remove-extra-permissions -f aggregate_to_edit_no_endpoints.yaml.txt --dry-run
kubectl auth reconcile --remove-extra-permissions -f aggregate_to_edit_no_endpoints.yaml.txt
# Prevent autoreconciliation back to old state
kubectl annotate --overwrite clusterrole/system:aggregate-to-edit rbac.authorization.kubernetes.io/autoupdate=false

Note: This will prevent new versions of Kubernetes from reconciling new default permissions to this role. No new default permissions have been added to this role since v1.14.0, but we recommend you remove the autoupdate=false annotation as soon as a fix or other mitigation is possible.

For use-cases that need to edit these resources, we recommend creating a new purpose-built Role with the desired permissions, and using it only for those cases.

Detection

Services with an empty selector rely on custom endpoints and are vulnerable to the attack described above. We recommend manually auditing any such usage. The following kubectl command will list all Services in a cluster with their selector:

kubectl get svc --all-namespaces -o=custom-columns='NAME:metadata.name,NAMESPACE:metadata.namespace,SELECTOR:spec.selector'

Note: Some Services without selectors specified may have their Endpoints managed by other controllers or tools. For example, endpoints for the default/kubernetes Service are managed by the Kubernetes API Server.

If you find evidence that this vulnerability has been exploited, please contact security@kubernetes.io

Additional Advisory

A similar attack is possible using Ingress implementations that support forwarding to ExternalName Services. This can be used to forward to Services in other namespaces or, in some cases, sensitive endpoints within the Ingress implementation. If you are using the Ingress API, we recommend confirming that the implementation you’re using either does not support forwarding to ExternalName Services or supports disabling the functionality.

Additional Details

See the GitHub issue for more updates: #103675

Thank You,

Rob Scott on behalf of Kubernetes SIG Network and CJ Cullen on behalf of the Kubernetes Product Security Committee

Activity

  1. cjcullenadded kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.on Jul 13, 2021
  2. k8s-ci-robotadded needs-sigIndicates an issue or PR lacks a `sig/foo` label and requires one.Indicates an issue or PR lacks a `sig/foo` label and requires one.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.Indicates an issue or PR lacks a `triage/foo` label and requires one.on Jul 13, 2021
  3. cjcullenremoved kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.needs-sigIndicates an issue or PR lacks a `sig/foo` label and requires one.Indicates an issue or PR lacks a `sig/foo` label and requires one.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.Indicates an issue or PR lacks a `triage/foo` label and requires one.on Jul 13, 2021
  4. kubernetesdeleted a comment from k8s-ci-robot on Jul 13, 2021
  5. kubernetesdeleted a comment from k8s-ci-robot on Jul 13, 2021
  6. cjcullenchanged the title ~~[-]WIP[/-]~~ [+]CVE-2021-25740: Endpoint & EndpointSlice permissions allow cross-Namespace forwarding[/+] on Jul 14, 2021
  7. robscott commentedon Jul 15, 2021 MemberMore actions The aggregate_to_edit.yaml file referenced above was attached to the original disclosure email: https://groups.google.com/g/kubernetes-announce/c/aXolwNe_KT4/m/HKK3174yAQAJ. I'm not sure if there's a good way to attach it here.

  8. oktalzadded 2 commits that reference this issue on Jul 15, 2021
  9. liggitt commentedon Jul 15, 2021 MemberMore actions appended .txt suffix and attached it to the description Reacted by Rob Scott, smijolovic and raviranjanelastisys

  10. szuecsadded a commit that references this issue on Jul 28, 2021
  11. rtheis commentedon Nov 17, 2021 More actions Hi folks, I followed the instructions in the security advisory after upgrading my cluster from Kubernetes v1.21 to v1.22 and I'm left with the following difference which I suspect is due to #102858. End result is that I think the aggregate_to_edit.yaml file attached to https://groups.google.com/g/kubernetes-security-announce/c/WYE9ptrhSLE/m/EODhNR9yAQAJ needs to be updated. I would appreciate it if someone could review these findings. Thanks.

vagrant@verify-cluster:~/armada-ansible$ diff  /tmp/cluster-role-cve-1-21-post-upgrade-fix.yaml  /tmp/cluster-role-1-22.yaml
5,6c5,6
<     rbac.authorization.kubernetes.io/autoupdate: "false"
<   creationTimestamp: "2021-11-17T17:27:18Z"
---
>     rbac.authorization.kubernetes.io/autoupdate: "true"
>   creationTimestamp: "2021-11-15T16:50:51Z"
11,12c11,12
<   resourceVersion: "7386"
<   uid: 583ecf3d-47e7-450e-a3be-d7d45732d81a
---
>   resourceVersion: "96"
>   uid: 1c3d0834-8abd-4b1e-8d74-57b0b8cb1caf
50a51
>   - events
  1. 18 remaining items

  2. k8s-ci-robotadded official-cve-feedIssues or PRs related to CVEs officially announced by Security Response Committee (SRC)Issues or PRs related to CVEs officially announced by Security Response Committee (SRC)on Sep 29, 2025
  3. raesene commentedon Sep 30, 2025 More actions

  4. tabbysable commentedon Oct 17, 2025 MemberMore actions /reopen


    /remove-lifecycle rotten
    /lifecycle frozen
  5. k8s-ci-robotreopened this on Oct 17, 2025
  6. k8s-ci-robot commentedon Oct 17, 2025 ContributorMore actions @tabbysable: Reopened this issue.

Details In response to this:

/reopen
/remove-lifecycle rotten
/lifecycle frozen
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-sigs/prow repository.
18. k8s-ci-robotadded lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.Indicates that an issue or PR should not be auto-closed due to staleness.needs-sigIndicates an issue or PR lacks a `sig/foo` label and requires one.Indicates an issue or PR lacks a `sig/foo` label and requires one. and removed lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.Denotes an issue or PR that has aged beyond stale and will be auto-closed.on Oct 17, 2025
19. ### k8s-ci-robot commentedon Oct 17, 2025 ContributorMore actions There are no sig labels on this issue. Please add an appropriate label by using one of the following commands:
- /sig <group-name>
- /wg <group-name>
- /committee <group-name>
Please see the group list for a listing of the SIGs, working groups, and committees available.

Details 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-sigs/prow repository.

  1. k8s-ci-robot commentedon Oct 17, 2025 ContributorMore actions 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.

Details 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-sigs/prow repository.

  1. k8s-ci-robotadded needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.Indicates an issue or PR lacks a `triage/foo` label and requires one.on Oct 17, 2025
  2. tabbysable commentedon Jun 1, 2026 MemberMore actions Today I have updated the CVE record for this vulnerability to more-accurately reflect that all versions are affected. Please see the blog post for further information.


    /label cve/wontfix
    /close
  3. k8s-ci-robotadded cve/wontfixIndicates that an announced CVE does not require a fix.Indicates that an announced CVE does not require a fix.on Jun 1, 2026
  4. k8s-ci-robotclosed this as completedon Jun 1, 2026
  5. k8s-ci-robot commentedon Jun 1, 2026 ContributorMore actions @tabbysable: Closing this issue.

Details In response to this:

Today I have updated the CVE record for this vulnerability to more-accurately reflect that all versions are affected. Please see the blog post for further information.
/label cve/wontfix
/close
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-sigs/prow repository.

Metadata

Metadata

Assignees

Labels

cve/wontfixIndicates that an announced CVE does not require a fix.Indicates that an announced CVE does not require a fix.

lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.Indicates that an issue or PR should not be auto-closed due to staleness.

needs-sigIndicates an issue or PR lacks a `sig/foo` label and requires one.Indicates an issue or PR lacks a `sig/foo` label and requires one.

needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.Indicates an issue or PR lacks a `triage/foo` label and requires one.

official-cve-feedIssues or PRs related to CVEs officially announced by Security Response Committee (SRC)Issues or PRs related to CVEs officially announced by Security Response Committee (SRC)

原文链接:https://github.com/kubernetes/kubernetes/issues/103675