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

CVE-2021-25746: Ingress-nginx directive injection via annotations #126813

Closed
Labels
area/security committee/security-response Denotes an issue or PR intended to be handled by the product security committee. kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. official-cve-feed Issues or PRs related to CVEs officially announced by Security Response Committee (SRC) priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@cjcullen
Copy link
Member

cjcullen commented Apr 22, 2022

Issue Details

A security issue was discovered in ingress-nginx where a user that can create or update ingress objects can use .metadata.annotations in 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-25746.

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 metadata.annotations values to known safe (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 #8503 for more details.

Acknowledgements

This vulnerability was reported by Anthony Weems, and separately by jeffrey&oliver.

Thank You,
CJ Cullen on behalf of the Kubernetes Security Response Committee

@cjcullen cjcullen added the kind/bug Categorizes issue or PR as related to a bug. label Apr 22, 2022
@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Apr 22, 2022
@cjcullen cjcullen changed the title Placeholder CVE-2021-25746: Ingress-nginx directive injection via annotations Apr 22, 2022
pgvishnuram referenced this issue in astronomer/astronomer Apr 22, 2022
* cherry-pick release-29 branch
* fixes kubernetes/ingress-nginx#8503
pgvishnuram referenced this issue in astronomer/astronomer Apr 22, 2022
* cherry-pick release-29 branch
* fixes kubernetes/ingress-nginx#8503
@strongjz
Copy link
Member

/triage accepted
/priority critical-urgent

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Apr 22, 2022
@bmv126
Copy link

bmv126 commented Apr 22, 2022

The issue talks about injection via annotation.
The deepInpect added in 1.2.0 does not check for annotation.
Not sure how is this fixed in 1.2.0

@longwuyuan
Copy link

longwuyuan commented Apr 23, 2022

@bmv126 the report itself says the CVE applies to release pre v1.2.0 so checking if there is a prescribed demonstrated way to see the exploit in action.

On v1.2.0 I installed the helm chart with --set controller.image.chroot=true, and now I am trying to create a ingress with a annotation that will demo this vulnerability. Do you have any thoughts on what annotation I can configure in a ingress to experience this exploit. I think the idea is to get access to a serviceaccount by breaking out of the nginx process with a clever annotation but I can't think of a good annotation (both key and value) to try. I think a publicly visible demo with the nginx process jailed/chrooted, will help make progress.

@foxylion
Copy link

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?

@yinfuqian
Copy link

Is there any way to reproduce this problem

@longwuyuan
Copy link

Please try to avoid public display of exploit and you can try to enable chroot image while installing the controller v1.2.0 to enable the jailing/chrooting of the nginx process.

@yinfuqian
Copy link

I hope I can see the actual impact of this problem, so I hope to reproduce this problem in the test environment. How can I deal with it

@longwuyuan
Copy link

@rikatz
Copy link
Contributor

rikatz commented May 10, 2022

This was fixed in v1.2.0

We plan to add more rules to the inspection

/close

@k8s-ci-robot
Copy link
Contributor

@rikatz: Closing this issue.

In response to this:

This was fixed in v1.2.0

We plan to add more rules to the inspection

/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.

@cji
Copy link
Member

cji commented Aug 20, 2024

/transfer kubernetes

@k8s-ci-robot k8s-ci-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Aug 20, 2024
@k8s-ci-robot k8s-ci-robot transferred this issue from kubernetes/ingress-nginx Aug 20, 2024
@cji
Copy link
Member

cji commented Aug 20, 2024

/area security
/kind bug
/committee security-response
/triage accepted
/lifecycle frozen
/label official-cve-feed

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. area/security committee/security-response Denotes an issue or PR intended to be handled by the product security committee. official-cve-feed Issues or PRs related to CVEs officially announced by Security Response Committee (SRC) and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security committee/security-response Denotes an issue or PR intended to be handled by the product security committee. kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. official-cve-feed Issues or PRs related to CVEs officially announced by Security Response Committee (SRC) priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
9 participants