Repository navigation
committee/security-responseDenotes an issue or PR intended to be handled by the product security committee.Denotes an issue or PR intended to be handled by the product security committee.
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
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.
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)
priority/critical-urgentHighest priority. Must be actively worked on as someone's top priority right now.Highest priority. Must be actively worked on as someone's top priority right now.
triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Description
Issue Details
A security issue was discovered in ingress-nginx where a user that can create or update ingress objects can use the spec.rules[].http.paths[].path field of an Ingress object (in the networking.k8s.io or extensions API group) to obtain the credentials of the ingress-nginx controller. In the default configuration, that credential has access to all secrets in the cluster.
This issue has been rated High (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:L), and assigned CVE-2021-25745.
Affected Components and Configurations
This bug affects ingress-nginx. If you do not have ingress-nginx installed on your cluster, you are not affected. You can check this by running kubectl get po -n ingress-nginx.
Multitenant environments where non-admin users have permissions to create Ingress objects are most affected by this issue.
Affected Versions
- \<v1.2.0
Fixed Versions
- v1.2.0-beta.0
- v1.2.0
Mitigation
If you are unable to roll out the fix, this vulnerability can be mitigated by implementing an admission policy that restricts the spec.rules[].http.paths[].path field on the networking.k8s.io/Ingress resource to known safe characters (see the newly added rules, or the suggested value for annotation-value-word-blocklist).
Detection
If you find evidence that this vulnerability has been exploited, please contact security@kubernetes.io
Additional Details
See ingress-nginx Issue #8502 for more details.
Acknowledgements
This vulnerability was reported by Gafnit Amiga.
Thank You,
CJ Cullen on behalf of the Kubernetes Security Response Committee
Activity
- cjcullenadded kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.on Apr 22, 2022
- 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.needs-priorityIndicates a PR lacks a `priority/foo` label and requires one.Indicates a PR lacks a `priority/foo` label and requires one.on Apr 22, 2022
- cjcullenchanged the title ~~[-]Placeholder[/-]~~ [+]CVE-2021-25745: Ingress-nginx `path` can be pointed to service account token file[/+] on Apr 22, 2022
-
fhke commentedon Apr 22, 2022 More actions Should the invalidSecretsDir regex be updated to
/run/secrets? In the default ingress-nginx image,/var/runis symlinked to/run, so the service account token can be accessed through/run/secrets:
bash-5.1$ ls -l /var/run lrwxrwxrwx 1 root root 4 Apr 4 16:07 /var/run -> /run bash-5.1$ ls -l /run/secrets/kubernetes.io/serviceaccount/ total 0 lrwxrwxrwx 1 root root 13 Apr 22 17:44 ca.crt -> ..data/ca.crt lrwxrwxrwx 1 root root 16 Apr 22 17:44 namespace -> ..data/namespace lrwxrwxrwx 1 root root 12 Apr 22 17:44 token -> ..data/token bash-5.1$ Updating the regex to/run/secretswould block both paths. -
strongjz commentedon Apr 22, 2022 MemberMore actions /triage accepted
/priority critical-urgent - k8s-ci-robotadded triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.priority/critical-urgentHighest priority. Must be actively worked on as someone's top priority right now.Highest priority. Must be actively worked on as someone's top priority right now. and removed 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.needs-priorityIndicates a PR lacks a `priority/foo` label and requires one.Indicates a PR lacks a `priority/foo` label and requires one.on Apr 22, 2022
-
longwuyuan commentedon Apr 23, 2022 More actions @cjcullen , I am trying to experience this exploit in a instance of the ingress-nginx-controller, with chroot enabled on the nginx process.
Can you help me gt a example value for the specingress.spec.rules[].http.paths[].paththat will demonstrate this vulnerability, on a chrooted nginx process of the controller. -
foxylion commentedon Apr 25, 2022 More actions We were recently notified about this CVE. I see this seems to be fixed in v1.2.0.
Is there anything except from updating to the latest version required to mitgate this type of exploit? -
chipzoller commentedon Apr 25, 2022 More actions @foxylion yes, we are providing a Kyverno policy in the above linked PR (kyverno/policies#302)
-
xcq1 commentedon Apr 27, 2022 More actions @chipzoller This is only an alternative, if I can't update, correct?
From the CVE it sounds as if the whole fix is included in ingress-nginx v1.2.0. -
bmv126 commentedon Apr 27, 2022 More actions As the rules for deep inspect are hard-coded in the code.
Also as mentioned above by @fhke some rules are missed.
So it doesn't look like fixed in 1.2.0 just by upgrading.
May be just like bad annotation list these rules also should be exposed to user. -
bmv126 commentedon Apr 27, 2022 More actions
-
longwuyuan commentedon Apr 27, 2022 More actions @bmv126 this was discussed in the last community meeting. Maintainers were aware of this and are working on it from even before the issue was created or maybe even before the CVE was published.
The controller v1.20 introduces capability to jail/charoot the nginx process so it has been tested that the obvious use case of getting a shell, by breaking out of the nginx process, will land the actor in a jailed/chrooted shell, if at all. That is one layer of protection. If you want to discuss further, it was reported that users can use this link https://github.com/kubernetes/ingress-nginx/blob/main/SECURITY.md and be discreet about putting sensitive info in public places. You could also reach out to maintainers without including groups in such communication, so as to reduce the radius for info spread.
Reacted by Tobias Kuhn -
rikatz commentedon May 10, 2022 MemberMore actions @bmv126 can you please open a PR adding the new rules?
As the main code to fix this is shipped, I'm going to close this issue but I have some additional rules myself I want to add as well :) /close -
k8s-ci-robot commentedon May 10, 2022 ContributorMore actions @rikatz: Closing this issue.
Details In response to this:
@bmv126 can you please open a PR adding the new rules?
As the main code to fix this is shipped, I'm going to close this issue but I have some additional rules myself I want to add as well :) /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/test-infra repository.
16. k8s-ci-robotclosed this as completedon May 10, 2022
17. ### cji commentedon Aug 20, 2024 MemberMore actions /transfer kubernetes
/area security
/kind bug
/committee security-response
/triage accepted
/lifecycle frozen
/label official-cve-feed
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.on Aug 20, 2024
19. ### k8s-ci-robot commentedon Aug 20, 2024 ContributorMore actions @cji: The label(s) /label official-cve-feed cannot be applied. These labels are supported: api-review, tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash, team/katacoda, refactor. Is this label configured under labels -> additional_labels or labels -> restricted_labels in plugin.yaml?
Details In response to this:
/transfer kubernetes
/area security
/kind bug
/committee security-response
/triage accepted
/lifecycle frozen
/label official-cve-feed
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.
20. 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.on Aug 20, 2024
21. k8s-ci-robottransferred this issue fromkubernetes/ingress-nginxon Aug 20, 2024
22. ### cji commentedon Aug 20, 2024 MemberMore actions /area security
/kind bug
/committee security-response
/triage accepted
/lifecycle frozen
/label official-cve-feed
23. k8s-ci-robotadded committee/security-responseDenotes an issue or PR intended to be handled by the product security committee.Denotes an issue or PR intended to be handled by the product security committee.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) and removed 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.on Aug 20, 2024
Metadata
Metadata
Assignees
Labels
committee/security-responseDenotes an issue or PR intended to be handled by the product security committee.Denotes an issue or PR intended to be handled by the product security committee.
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
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.
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)
priority/critical-urgentHighest priority. Must be actively worked on as someone's top priority right now.Highest priority. Must be actively worked on as someone's top priority right now.
triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.