The vulnerability described is a Server-Side Request Forgery (SSRF) in the Mattermost Server. The investigation began by identifying the patched version (10.5.10) and the last vulnerable version (10.5.9). A comparison of the commits between these two versions revealed a security-related commit with the message [MM-64911] Ensure redirect URL is validated before redirecting. This commit modified the fullyQualifiedRedirectURL function in server/channels/web/oauth.go. The code changes clearly show the addition of robust validation for the targetURL parameter, which was previously handled insecurely. The original implementation was susceptible to SSRF because it would concatenate a user-provided targetURL with the siteURLPrefix without proper validation, allowing an attacker to control the final URL and direct the server to make requests to arbitrary locations. The patch mitigates this by ensuring the scheme, host, and path of the targetURL are safe before constructing the final redirect URL. Although the vulnerability description mentions the 'Agents Plugin', the vulnerable function is in the core server's OAuth flow, which is likely leveraged by the plugin, making this the root cause of the vulnerability.