The vulnerability in Cilium, identified as GHSA-q6h5-q3q6-f87x, allows for cross-namespace service traffic hijacking and can lead to service translation failure. This is due to improper handling of CiliumLocalRedirectPolicy with addressMatcher.
The analysis of the patches reveals two main vulnerable functions depending on the Cilium version:
-
For versions < 1.17.16 (patched in PR #45412): The vulnerable function is Manager.upsertService located in pkg/redirectpolicy/manager.go. This function did not perform any checks to see if a service already existed at the frontend address specified by a CiliumLocalRedirectPolicy. This allowed a policy to override an existing service, leading to traffic hijacking. The fix introduced a new function, UpsertServiceWithCheck, which verifies the ownership of the frontend before allowing an update, unless a compatibility flag is enabled.
-
For versions 1.18.2 to 1.18.9 and 1.19.0 to 1.19.3 (patched in PRs #45585 and #45584): The vulnerable function is lrpController.updateRedirects in pkg/loadbalancer/redirectpolicy/controller.go. This function had two flaws. First, it would unconditionally delete a frontend if no backend pods were available for the redirect policy, which could delete an existing service's entry. Second, it did not prevent the policy from overriding an existing service's frontend. The patch adds checks to ensure that the controller only deletes frontends it created and does not override frontends belonging to other services.
The root cause of the vulnerability is the lack of ownership and conflict checks when applying CiliumLocalRedirectPolicy. An attacker with permissions to create these policies could have exploited this to either hijack traffic to sensitive services or cause a denial of service by breaking service translation.