New Kubernetes Vulnerability Allows Attackers to Access Clusters Remotely

A crucial vulnerability tracked as CVE-2024-7646, has been uncovered in the commonly frail ingress-nginx Kubernetes controller. The flaw enables attackers to bypass annotation validation, poses a indispensable bother to Kubernetes clusters, and demands rapid consideration from security teams and cluster directors.
Security researcher André Storfjord Kristiansen (@dev-bio on GitHub) found the vulnerability in the system ingress-nginx validates annotations on Ingress objects.
In Kubernetes, annotations place metadata to objects, and ingress-nginx configures diverse behaviors of the ingress controller.
By exploiting this flaw, attackers can inject malicious vow material into obvious annotations, bypassing validation checks. This might maybe consequence in arbitrary divulge injection and possible entry to the ingress-nginx controller’s credentials, which on the full bring collectively huge entry to cluster secrets in default configurations.
Here is a technical prognosis of the Kubernetes CVE-2024-7646 vulnerability with code examples:
Technical Evaluation of CVE-2024-7646
CVE-2024-7646 is a high-severity vulnerability in the ingress-nginx Kubernetes controller that allows attackers to bypass annotation validation. Let’s dive into the technical info.
Basically based completely on Armosec’s compare, The direct lies in how ingress-nginx validates annotations on Ingress objects. Annotations in Kubernetes are key-price pairs frail to join non-identifying metadata to objects. Ingress-nginx uses annotations to configure diverse behaviors of the ingress controller.
The vulnerability enables attackers to inject malicious vow material, collectively with carriage return (r) characters, into obvious annotations. This bypasses validation checks and can consequence in arbitrary divulge injection.
Here’s an example of a malicious Ingress object exploiting the vulnerability:
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: malicious-ingress annotations: nginx.ingress.kubernetes.io/configuration-snippet: | more_set_headers "X-Malicious-Header: Benign"; more_set_headers "X-Hacked: Truer HTTP/1.1 200 OK Content-Type: text/html r r Hacked!
On this case, the attacker injects an HTTP response into the configuration-snippet annotation the utilization of carriage returns. When ingress-nginx processes this annotation, it fails to validate and sanitize the enter successfully, allowing the injected response to be returned to the client.
A winning exploit of CVE-2024-7646 can allow attackers to:
- Inject arbitrary HTTP responses, potentially main to XSS attacks
- Construct arbitrary commands in the context of the ingress-nginx controller
- Fill entry to the ingress-nginx controller’s credentials, which on the full bring collectively huge entry to cluster secrets
Here’s very bad in multi-tenant environments the place non-admin customers can salvage Ingress objects.
Mitigation
To mitigate this vulnerability:
- Upgrade ingress-nginx to v1.11.2 or later, which gains a fix.
- Put in pressure strict RBAC insurance policies to limit who can salvage/alter Ingress objects:
apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: namespace: ingress-nginx name: ingress-creator rules: - apiGroups: ["networking.k8s.io"] resources: ["ingresses"] verbs: ["create", "get", "list", "watch"]
- Use admission controllers esteem ValidatingAdmissionWebhook to validate Ingress objects:
func validateIngress(ar v1.AdmissionReview) *v1.AdmissionResponse { ingress := &networkingv1.Ingress{} deserializer := codecs.UniversalDeserializer() if _, _, err := deserializer.Decode(ar.Request.Object.Raw, nil, ingress); err != nil { return &v1.AdmissionResponse{Result: &metav1.Status{Message: err.Error()}} } for _, a := range ingress.ObjectMeta.Annotations { if strings.Contains(a, "r") { return &v1.AdmissionResponse{ Result: &metav1.Status{ Message: "Annotation contains invalid character", }, Allowed: false, } } } return &v1.AdmissionResponse{Allowed: true} }
This webhook checks for the presence of r in annotations and rejects the Ingress if found.
- Allow Kubernetes audit logging to detect exploitation attempts.
By figuring out the technical info of CVE-2024-7646 and implementing these mitigations, you might presumably presumably also offer protection to your Kubernetes clusters from this bad vulnerability. Take care of vigilant, aid your systems up to this point, and adhere to security most efficient practices to reduction a sturdy security posture.
The Importance of Kubernetes Security
This vulnerability serves as a stark reminder of the ongoing want for vigilance and proactive security features in Kubernetes environments. As Kubernetes adoption continues to grow, it turns into increasingly crucial to no longer sleep-to-date with patches, adhere to security most efficient practices, and continuously computer screen for rising threats.
Customary security audits, suggested patching, and merely implementation of RBAC and community insurance policies are indispensable ideas for declaring a sturdy Kubernetes security posture. Tools esteem the ARMO Platform can present precious insights into your cluster’s security articulate.
May bring collectively to you suspect this vulnerability has been exploited for your atmosphere, contact [email protected] for steering and toughen. By working collectively and extremely best proactive, the Kubernetes neighborhood also can merely furthermore be obvious the persevered resilience and security of our clusters in the face of evolving threats.
Source credit : cybersecuritynews.com



