Engine.IO-client is a crucial component for real-time communication in web applications, acting as the client-side counterpart to Engine.IO servers. Comparing versions 1.2.1 and 1.2.2 reveals subtle yet important updates for developers relying on robust and efficient connections. Both versions share core dependencies like ws for WebSocket communication, debug for logging, and custom modules for event handling (emitter), parsing (parseqs, parseuri, parsejson), and CORS support (has-cors). The xmlhttprequest dependency relies on a specific commit from a related GitHub repository ensuring consistent AJAX functionality.
The key difference lies in the engine.io-parser dependency, advancing from version 1.0.5 to 1.0.6 in the later release. While seemingly minor, updates in parser libraries can impact the reliability and performance of data encoding and decoding, crucial for binary data transfer and handling complex message structures. Furthermore, the development dependencies show a slight variance: Version 1.2.2 depends on engine.io version 1.2.2, while its predecessor used version 1.2.0. Typically, synchronized versioning between client and server-side components of Engine.IO ensures better compatibility and feature alignment. This suggests potential enhancements or bug fixes in the core Engine.IO protocol that are reflected in both the server and the client library. Finally, release dates provide context with version 1.2.2 released a week after version 1.2.1 potentially hinting at hotfixes and/or improvements to the version released previously.
Developers should consider upgrading to version 1.2.2 to leverage potentially improved parsing capabilities and ensure optimal compatibility with corresponding Engine.IO server versions.
All the vulnerabilities related to the version 1.2.2 of the package
Insecure Defaults Allow MITM Over TLS in engine.io-client
Affected versions of engine.io-client
do not verify certificates by default, and as such may be vulnerable to Man-in-the-Middle attacks.
The vulnerability is related to the way that node.js handles the rejectUnauthorized
setting. If the value is something that evaluates to false, such as undefined or null, certificate verification will be disabled.
Update to version 1.6.9 or later.
If you are unable to upgrade, ensure all calls to socket.io to have a rejectedUnauthorized: true
flag.
Remote Memory Disclosure in ws
Versions of ws
prior to 1.0.1 are affected by a remote memory disclosure vulnerability.
In certain rare circumstances, applications which allow users to control the arguments of a client.ping()
call will cause ws
to send the contents of an allocated but non-zero-filled buffer to the server. This may disclose sensitive information that still exists in memory after previous use of the memory for other tasks.
var ws = require('ws')
var server = new ws.Server({ port: 9000 })
var client = new ws('ws://localhost:9000')
client.on('open', function () {
console.log('open')
client.ping(50) // this sends a non-zeroed buffer of 50 bytes
client.on('pong', function (data) {
console.log('got pong')
console.log(data) // Data from the client.
})
})
Update to version 1.0.1 or greater.
DoS due to excessively large websocket message in ws
Affected versions of ws
do not appropriately limit the size of incoming websocket payloads, which may result in a denial of service condition when the node process crashes after receiving a large payload.
Update to version 1.1.1 or later.
Alternatively, set the maxpayload
option for the ws
server to a value smaller than 256MB.
Denial of Service in ws
Affected versions of ws
can crash when a specially crafted Sec-WebSocket-Extensions
header containing Object.prototype
property names as extension or parameter names is sent.
const WebSocket = require('ws');
const net = require('net');
const wss = new WebSocket.Server({ port: 3000 }, function () {
const payload = 'constructor'; // or ',;constructor'
const request = [
'GET / HTTP/1.1',
'Connection: Upgrade',
'Sec-WebSocket-Key: test',
'Sec-WebSocket-Version: 8',
`Sec-WebSocket-Extensions: ${payload}`,
'Upgrade: websocket',
'\r\n'
].join('\r\n');
const socket = net.connect(3000, function () {
socket.resume();
socket.write(request);
});
});
Update to version 3.3.1 or later.
debug Inefficient Regular Expression Complexity vulnerability
A vulnerability classified as problematic has been found in debug-js debug up to 3.0.x. This affects the function useColors of the file src/node.js. The manipulation of the argument str leads to inefficient regular expression complexity. Upgrading to version 3.1.0 is able to address this issue. The name of the patch is c38a0166c266a679c8de012d4eaccec3f944e685. It is recommended to upgrade the affected component. The identifier VDB-217665 was assigned to this vulnerability. The patch has been backported to the 2.6.x branch in version 2.6.9.
Regular Expression Denial of Service in debug
Affected versions of debug
are vulnerable to regular expression denial of service when untrusted user input is passed into the o
formatter.
As it takes 50,000 characters to block the event loop for 2 seconds, this issue is a low severity issue.
This was later re-introduced in version v3.2.0, and then repatched in versions 3.2.7 and 4.3.1.
Version 2.x.x: Update to version 2.6.9 or later. Version 3.1.x: Update to version 3.1.0 or later. Version 3.2.x: Update to version 3.2.7 or later. Version 4.x.x: Update to version 4.3.1 or later.
parse-uri Regular expression Denial of Service (ReDoS)
An issue in parse-uri v1.0.9 allows attackers to cause a Regular expression Denial of Service (ReDoS) via a crafted URL.
async function exploit() {
const parseuri = require("parse-uri");
// This input is designed to cause excessive backtracking in the regex
const craftedInput = 'http://example.com/' + 'a'.repeat(30000) + '?key=value';
const result = await parseuri(craftedInput);
}
await exploit();
Regular Expression Denial of Service in parsejson
Affected versions of parsejson
are vulnerable to a regular expression denial of service when parsing untrusted user input.
The parsejson
package has not been functionally updated since it was initially released.
Additionally, it provides functionality which is natively included in Node.js, and therefore the native JSON.parse()
should be used, for both performance and security reasons.