The vulnerability, identified as GHSA-cvw6-gfvv-953q, allowed a cross-namespace attack in the Fission serverless framework. The root cause was the lack of validation for the spec.environment.namespace field in the Function custom resource. An attacker with permissions to create functions in one namespace could create a function that pointed to an environment in a different, victim namespace.
The primary point of failure was the admission webhook's Function.Validate method in pkg/webhook/function.go, which was responsible for validating Function objects upon creation or update but failed to check for this cross-namespace reference. This allowed malicious Function objects to be persisted in the cluster.
Downstream controllers, which are responsible for the actual execution of functions, would then act on these malicious objects. Specifically, the newdeploy and poolmgr executor types contained vulnerable logic. The NewDeploy.fnCreate and NewDeploy.RefreshFuncPods functions in pkg/executor/executortype/newdeploy/newdeploymgr.go, and the GenericPoolManager.getFunctionEnv function in pkg/executor/executortype/poolmgr/gpm.go, would proceed to fetch and use the environment from the specified foreign namespace. This would cause the attacker's function code to be executed within the victim's environment, breaking tenant isolation and leading to potential code and credential theft.
The patch addresses this by first fixing the root cause in the Function.Validate webhook. Additionally, it adds "defense-in-depth" checks to the fnCreate, RefreshFuncPods, and getFunctionEnv functions to prevent exploitation even if the webhook is misconfigured or bypassed, or if stale, pre-patch Function objects exist in the cluster.