The vulnerability exists in the redirectToAuthorization function within the src/oauth/provider.js file of the wong2/mcp-cli package. The core of the issue is a command injection flaw, identified as CWE-77. The vulnerability arises because the function passes an unsanitized authorizationUrl to the open library, which can be manipulated by a remote attacker to execute arbitrary commands on the host system.
The provided patch, commit 35629664cc5d3aea4c3d083d075fe26e7c346b59, clearly shows the remediation. The developers have introduced a call to sanitizeUrl from the strict-url-sanitise library to process the authorizationUrl before it is passed to the open function. This sanitization step ensures that any malicious characters or command sequences are removed, mitigating the command injection risk.
Based on this evidence, the McpOAuthClientProvider.redirectToAuthorization function is the precise location of the vulnerability. Any runtime profile or stack trace generated during the exploitation of this vulnerability would show this function being called as it is the entry point for the malicious input.