GHSA-JVCP-W94C-MVVH
Session cookie exposed to services opened through the port proxy
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 4.145.0 | code-server · -1 d desde divulgación | |
| Divulgación | Publicada | GHSA-JVCP-W94C-MVVH divulgada · CVSS 6.4 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
### Summary
code-server's session cookie could be read by services opened through the built-in port proxy. The cookie was sent to the proxied service on WebSocket connections, and because it was not marked `HttpOnly`, scripts on proxied pages could read it. The cookie acts as a reusable credential, so anyone who obtains it can sign in to code-server as the user.
### Details
code-server removes its session cookie from requests it forwards to proxied ports. This was only done for regular HTTP requests. WebSocket connections through `/proxy/<port>/`, `/absproxy/<port>/` and the proxy domain still sent the full `Cookie` header, including the session cookie, to the proxied service. Versions before `4.124.2` also sent the cookie on regular HTTP requests.
Separately, the session cookie was set without the `HttpOnly` attribute. Pages served through the path proxy share the code-server origin, so scripts on those pages could read the cookie with `document.cookie`.
### Impact
A malicious service listening on a port that the user opens through the proxy can capture the session cookie and replay it to get full access to code-server, including the terminal and file system, as the user running code-server. To exploit this, the attacker has to control a service reachable by the proxy, and a signed-in user has to open it.
### Patches
Fixed in 4.145.0. The session cookie is now removed from proxied WebSocket connections and is set with `HttpOnly`. Upgrade to 4.145.0 or later.
### Workarounds
Only open trusted services through the code-server proxy. After upgrading, change the code-server password if you previously opened untrusted services through the proxy, since this invalidates any session cookie that may have been captured.
### References
- https://github.com/coder/code-server/pull/8111
- https://github.com/coder/code-server/pull/8110
- https://github.com/coder/code-server/releases/tag/v4.145.0
### Credits
Thanks to @j9tdsn8nmk-hash, @bl4cksku11 and @Iraianbu-tech for reporting this issue.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npmcode-server |
Corregida | 4.145.0 | -1 d | 4.145.2 no afectada |
4.145.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/coder/code-server/security/advisories/GHSA-jvcp-w94c-mvvhLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
