The vulnerability exists in the getLoginRedirect method of the AuthenticationService class in the CakePHP authentication library. The security advisory explicitly mentions this method. By analyzing the commits that patch the vulnerability for versions 3.3.6 and 4.1.1, I confirmed the exact location of the flaw. The patches applied in commits df28ea4e712f1e5bd0e42be4a3c5c750ca50764d and ee24bd48b9c3ef693dc9965de8f0cc8020a7052c show changes directly within the getLoginRedirect function. The vulnerability is caused by insufficient validation of the redirect URL, specifically allowing backslashes to bypass the check for external domains. An attacker can craft a URL starting with backslashes (e.g., \\attacker.com) which parse_url does not recognize as having a host, but which browsers will treat as a redirect to an external domain. The fix involves normalizing backslashes to forward slashes and adding checks to prevent this bypass. Therefore, the AuthenticationService::getLoginRedirect function is the vulnerable function.