The vulnerability is a Server-Side Request Forgery (SSRF) in Fulcio, identified as GHSA-59jp-pj84-45mr. The root cause is the use of an unanchored regular expression for validating OIDC issuer URLs from JWT tokens.
The analysis of the patch commit eaae2f2be56df9dea5f9b439ec81bedae4c0978d reveals the core of the issue. The function metaRegex, present in both the pkg/config/config.go and pkg/identity/base/issuer.go files, was responsible for creating a regex pattern from a given issuer string. This function failed to add start (^) and end ($) anchors to the generated regex.
Go's regexp.MatchString() function performs substring matching by default. Without anchors, an attacker could provide a malicious URL that contains a valid issuer pattern as a substring (e.g., https://attacker.com/?p=https://valid-issuer.com). The regex would incorrectly match, causing Fulcio to trust the attacker's URL.
The exploit flow involves Fulcio's GetIssuer and baseIssuer.Match functions, which used the vulnerable metaRegex function. When processing a JWT, these functions would match the malicious iss claim, leading the oidc.NewProvider() function to send a request to the attacker-controlled server. The attacker could then redirect Fulcio to an internal service by manipulating the OIDC discovery response, thus achieving a blind SSRF.
The patch remediates this by:
- Consolidating the
metaRegex logic into a single public function config.MetaRegex.
- Adding
^ and $ anchors to the regex pattern to ensure it matches the entire URL string, not just a substring.
The identified vulnerable functions are the original metaRegex functions that created the flawed regex, and the GetIssuer and Match methods that used this regex to validate potentially malicious input.