The vulnerability lies in Envoy's RBAC filter's handling of HTTP headers with multiple values. The core issue is that the filter concatenates values from headers with the same name into a single comma-separated string before applying matching rules. This allows an attacker to bypass 'Deny' rules that use an 'exact match' condition.
For instance, if a policy is set to deny requests with the header internal: true, an attacker can send a request containing two instances of that header. The RBAC filter processes this as a single header with the value "true,true". The exact match comparison against "true" fails, thus bypassing the security policy and granting unauthorized access.
The patch rectifies this by introducing a new function, matchesHeadersIndividually, which iterates through each header value and applies the matching logic to them one by one. This ensures that if any of the values match the deny rule, the request is correctly blocked. The new, secure behavior is controlled by the runtime flag envoy.reloadable_features.rbac_match_headers_individually.
The function HeaderMatcher::matches is the primary vulnerable function as it orchestrates this flawed matching process. The helper function HeaderDataImpl::matchesHeaders is also directly involved by providing the concatenated header string that enables the bypass.