The vulnerability, CVE-2026-105861, describes an issue where Payload could send authentication data to unverified destinations under certain external upload configurations. The provided commit ba5cf6ae20d27a2c15106cb37466419031f86e6d is explicitly titled 'fix!: validate external file request origin 3.x', directly addressing this problem.
Upon analyzing the patch in packages/payload/src/uploads/getExternalFile.ts, it's clear that the getExternalFile function was the primary point of vulnerability. Before the patch, this function contained logic that would decide whether to 'trim' authentication cookies based on a naive check: if (!url.startsWith('http')). If a URL did not begin with 'http', the system incorrectly assumed it was an internal URL and would forward all cookies, including sensitive authentication data. This allowed for scenarios where a crafted relative URL or a URL without a protocol could resolve to an external, untrusted domain, leading to the leakage of session information.
The patch introduces robust URL parsing and validation functions (hasProtocol, validateFileURL, parseFileURL, getRequestBaseURL) and integrates them into getExternalFile. It removes the flawed trimAuthCookies logic and ensures that all URLs, including those encountered during redirects, are properly validated for their origin before authentication data is sent. The modification to the externalFileHeaderFilter signature also reflects this enhanced validation by providing isSameOrigin context, allowing for more granular control over header forwarding.
Therefore, the getExternalFile function is identified as the vulnerable function because it contained the insufficient validation logic that led to the exposure of authentication data.