The vulnerability lies in the serialization of Cilium network policy rules. Specifically, the ToCIDRSet and FromCIDRSet fields in EgressCommonRule and IngressCommonRule structs were tagged with json:"omitempty". When a policy's toGroups or fromGroups referred to a non-existent entity (like an AWS security group), it would resolve to an empty set of IP addresses. This resulted in an empty slice for the ToCIDRSet or FromCIDRSet fields.
Due to the omitempty tag, this empty slice was omitted from the JSON output when the policy was serialized. The absence of this field was interpreted by Cilium's policy enforcement engine as having no L3 restrictions, which defaults to an "allow all" behavior. The intended behavior for an empty set of IPs should be "deny all".
The CreateDerivative methods for EgressRule, EgressDenyRule, IngressRule, and IngressDenyRule are the functions responsible for constructing these vulnerable policy rule objects that are then incorrectly serialized.
The patch fixes this by changing the JSON tag from omitempty to omitzero. The omitzero tag ensures that an empty slice is serialized into the JSON (e.g., "toCIDRSet":[]), which is correctly interpreted by the policy engine as "deny all" for L3 traffic, thus enforcing the intended policy.