The vulnerability is caused by a combination of two insecure default settings in kuma-cp. First, the Cross-Origin Resource Sharing (CORS) policy, configured in DefaultApiServerConfig, defaulted to [".*"],allowing any web page from any origin to send requests to thekuma-cpAPI server. Second, theLocalhostAuthenticator function, which checks if a request should be granted admin privileges, only verified that the request originated from a loopback IP address (127.0.0.1or::1`).
An attacker could exploit this by convincing a user running kuma-cp locally to visit a malicious website. The JavaScript on this website could then make a fetch() request to the kuma-cp API server running on localhost. The browser would send this request from the loopback address, satisfying the weak check in LocalhostAuthenticator and thus gaining admin access. The permissive CORS policy ensured the browser would not block this cross-origin request.
The patch addresses both issues. It changes the LocalhostAuthenticator to perform much stricter checks, ensuring the request is a direct call to localhost and not a cross-origin request from a browser. It also changes the default CORS policy to be restrictive ([]), requiring users to explicitly enable cross-origin access if needed.