Executive brief
socket.io is a JavaScript library that enables real-time bidirectional communication between web clients and servers. A CORS (Cross-Origin Resource Sharing) misconfiguration in versions before 2.4.0 whitelists all domains by default, allowing attackers from any domain to make unauthorized requests to applications using vulnerable versions. This can result in API key theft, session hijacking, and unauthorized access to sensitive data.
Technical details
The vulnerability is an insecure-defaults CORS misconfiguration (CWE-346, CWE-453) in socket.io before version 2.4.0. The library accepts arbitrary origins in the Access-Control-Allow-Origin header, effectively trusting all domains by default. An attacker can craft a malicious web page that initiates socket.io connections to a vulnerable target application; if a victim visits the attacker's page, the browser will establish the connection and the attacker can send authenticated requests. No user interaction beyond visiting a malicious site is required. The vulnerability was fixed in version 2.4.0 with a commit that restricts CORS origins to proper whitelisting.
Affected products
- socket.io socket.io before 2.4.0
Timeline
- 2020-10-29: disclosed
- 2021-01-20: advisory
- 2.4.0: patched