Headline
CVE-2022-21671: Potential exposure of Replit tokens to an Unauthorized Actor when using the default fallback WebSocket polling proxy in @replit/crosis
@replit/crosis is a JavaScript client that speaks Replit’s container protocol. A vulnerability that involves exposure of sensitive information exists in versions prior to 7.3.1. When using this library as a way to programmatically communicate with Replit in a standalone fashion, if there are multiple failed attempts to contact Replit through a WebSocket, the library will attempt to communicate using a fallback poll-based proxy. The URL of the proxy has changed, so any communication done to the previous URL could potentially reach a server that is outside of Replit’s control and the token used to connect to the Repl could be obtained by an attacker, leading to full compromise of that Repl (not of the account). This was patched in version 7.3.1 by updating the address of the fallback WebSocket polling proxy to the new one. As a workaround, a user may specify the new address for the polling host (gp-v2.replit.com) in the ConnectArgs. More information about this workaround is available in the GitHub Security Advisory.
Impact
When using this library as a way to programmatically communicate with Replit in a standalone fashion, if there are multiple failed attempts to contact Replit through a WebSocket, the library will attempt to communicate using a fallback poll-based proxy. The URL of the proxy has changed, so any communication done to the previous URL could potentially reach a server that is outside of Replit’s control and the token used to connect to the Repl could be obtained by an attacker, leading to full compromise of that Repl (not of the account).
Patches
This was patched in 7.3.1, by updating the address of the fallback WebSocket polling proxy to the new one.
Workarounds
Specify the new address for the polling host (gp-v2.replit.com) in the ConnectArgs:
const connectOptions: ConnectArgs = { // … pollingHost: 'gp-v2.replit.com’, }; client.connect(connectOptions);
For more information
Thanks to https://hackerone.com/orlserg for disclosing this.
If you have any questions or comments about this advisory:
- Open an issue in replit/crosis
- Email us at security@replit.com