The vulnerability, described as '1-Click RCE via Authentication Token Exfiltration From gatewayUrl', allows an attacker to steal a user's authentication token by tricking them into clicking a crafted link. The link contains a 'gatewayUrl' query parameter pointing to an attacker-controlled server.
The analysis of the security patch (commit a7534dc22382c42465f3676724536a014ce0cbf7) reveals that the vulnerability lies in the frontend UI code, specifically in how it handles the gatewayUrl from the URL.
The key file changed is ui/src/ui/app-settings.ts. The function applySettingsFromUrl is responsible for parsing the settings from the URL. Prior to the patch, this function would immediately apply the gatewayUrl from the query parameter by calling applySettings. This would trigger an automatic WebSocket connection to the new URL, sending the user's authentication token along with it.
The patch mitigates this by changing the behavior of applySettingsFromUrl. Instead of directly applying the new gatewayUrl, it stores it in a pendingGatewayUrl variable. A new UI confirmation modal (renderGatewayUrlConfirmation) is introduced, which prompts the user to confirm the change. Only after the user's confirmation, in the handleGatewayUrlConfirm function, is the new gateway URL applied and a connection established.
Therefore, the vulnerable function is applySettingsFromUrl as it was the entry point for the malicious input (gatewayUrl) and the trigger for the automatic connection that led to the token exfiltration.