The vulnerability lies in the custom and insecure parsing of OAuth redirect_uri values. The core of the issue was in the splitParts function, which used a simple string splitting mechanism based on delimiters, including the '@' symbol. This allowed attackers to craft URLs where the userinfo part of the URL was confused with the host, for example, https://expected-host.com@malicious-host.com. The matchCallbackURL function used splitParts and would incorrectly validate such a URL against a legitimate pattern (e.g., https://expected-host.com/*).
The patch addresses this by completely removing the custom URL parsing logic (splitParts and matchPath) and replacing it with a dedicated and standardized library, dunglas/go-urlpattern. The new implementation in matchCallbackURL and the new validation function ValidateCallbackURLPattern properly parse and match URL components according to web standards, thus preventing the userinfo confusion attack. The function dto.ValidateCallbackURL was also updated to use this new, secure validation logic. Identifying calls to the old, vulnerable functions utils.matchCallbackURL or dto.ValidateCallbackURL in a runtime profile would indicate a vulnerable version.