Socket.IO version 1.4.8 is a minor update to the widely used Node.js real-time communication framework, building upon the solid foundation of version 1.4.7. Both versions share the same core purpose: enabling bidirectional, event-based communication between web browsers and servers. They are licensed under the MIT license and boast debug tools and testing setups. The most notable difference manifests in the dependencies. Socket.IO 1.4.8 upgrades its engine.io dependency to version 1.6.11, while 1.4.7 relies on 1.6.10. Also, the socket.io-client dependency is updated from version 1.4.6 to 1.4.8. These updates likely incorporate bug fixes, performance improvements, and potentially new features within the underlying engine and client components.
For developers, this means that upgrading to 1.4.8 could offer enhanced stability and efficiency in their real-time applications. While the surface-level API might remain largely consistent, the under-the-hood improvements from the dependency upgrades concerning the new engine.io and socket.io-client could provide a more robust and performant experience. Developers should always review the changelogs of the dependent packages (engine.io and socket.io-client) when upgrading to understand the specific changes and potential implications for their applications. Both versions remain strong choices for building real-time features like chat applications, live dashboards, and collaborative tools.
All the vulnerabilities related to the version 1.4.8 of the package
CORS misconfiguration in socket.io
The package socket.io before 2.4.0 are vulnerable to Insecure Defaults due to CORS Misconfiguration. All domains are whitelisted by default.
socket.io has an unhandled 'error' event
A specially crafted Socket.IO packet can trigger an uncaught exception on the Socket.IO server, thus killing the Node.js process.
node:events:502
throw err; // Unhandled 'error' event
^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. (undefined)
at new NodeError (node:internal/errors:405:5)
at Socket.emit (node:events:500:17)
at /myapp/node_modules/socket.io/lib/socket.js:531:14
at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
code: 'ERR_UNHANDLED_ERROR',
context: undefined
}
| Version range | Needs minor update? |
|------------------|------------------------------------------------|
| 4.6.2...latest
| Nothing to do |
| 3.0.0...4.6.1
| Please upgrade to socket.io@4.6.2
(at least) |
| 2.3.0...2.5.0
| Please upgrade to socket.io@2.5.1
|
This issue is fixed by https://github.com/socketio/socket.io/commit/15af22fc22bc6030fcead322c106f07640336115, included in socket.io@4.6.2
(released in May 2023).
The fix was backported in the 2.x branch today: https://github.com/socketio/socket.io/commit/d30630ba10562bf987f4d2b42440fc41a828119c
As a workaround for the affected versions of the socket.io
package, you can attach a listener for the "error" event:
io.on("connection", (socket) => {
socket.on("error", () => {
// ...
});
});
If you have any questions or comments about this advisory:
Thanks a lot to Paul Taylor for the responsible disclosure.
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.
Vercel ms Inefficient Regular Expression Complexity vulnerability
A vulnerability, which was classified as problematic, has been found in vercel ms up to 1.x. This issue affects the function parse of the file index.js. The manipulation of the argument str leads to inefficient regular expression complexity. The attack may be initiated remotely. The exploit has been disclosed to the public and may be used. Upgrading to version 2.0.0 is able to address this issue. The name of the patch is caae2988ba2a37765d055c4eee63d383320ee662. It is recommended to upgrade the affected component. The associated identifier of this vulnerability is VDB-217451.
Resource exhaustion in engine.io
Engine.IO before 4.0.0 and 3.6.0 allows attackers to cause a denial of service (resource consumption) via a POST request to the long polling transport.
Uncaught exception in engine.io
A specially crafted HTTP request can trigger an uncaught exception on the Engine.IO server, thus killing the Node.js process.
events.js:292
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:209:20)
Emitted 'error' event on Socket instance at:
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}
This impacts all the users of the engine.io
package, including those who uses depending packages like socket.io
.
A fix has been released today (2022/11/20):
| Version range | Fixed version |
|-------------------|---------------|
| engine.io@3.x.y
| 3.6.1
|
| engine.io@6.x.y
| 6.2.1
|
For socket.io
users:
| Version range | engine.io
version | Needs minor update? |
|-----------------------------|---------------------|--------------------------------------------------------------------------------------------------------|
| socket.io@4.5.x
| ~6.2.0
| npm audit fix
should be sufficient |
| socket.io@4.4.x
| ~6.1.0
| Please upgrade to socket.io@4.5.x
|
| socket.io@4.3.x
| ~6.0.0
| Please upgrade to socket.io@4.5.x
|
| socket.io@4.2.x
| ~5.2.0
| Please upgrade to socket.io@4.5.x
|
| socket.io@4.1.x
| ~5.1.1
| Please upgrade to socket.io@4.5.x
|
| socket.io@4.0.x
| ~5.0.0
| Please upgrade to socket.io@4.5.x
|
| socket.io@3.1.x
| ~4.1.0
| Please upgrade to socket.io@4.5.x
(see here) |
| socket.io@3.0.x
| ~4.0.0
| Please upgrade to socket.io@4.5.x
(see here) |
| socket.io@2.5.0
| ~3.6.0
| npm audit fix
should be sufficient |
| socket.io@2.4.x
and below | ~3.5.0
| Please upgrade to socket.io@2.5.0
|
There is no known workaround except upgrading to a safe version.
If you have any questions or comments about this advisory:
engine.io
Thanks to Jonathan Neve for the responsible disclosure.
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.
Regular Expression Denial of Service in negotiator
Affected versions of negotiator
are vulnerable to regular expression denial of service attacks, which trigger upon parsing a specially crafted Accept-Language
header value.
Update to version 0.6.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.
```js
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 ex
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.
Improper Certificate Validation in xmlhttprequest-ssl
The xmlhttprequest-ssl package before 1.6.1 for Node.js disables SSL certificate validation by default, because rejectUnauthorized (when the property exists but is undefined) is considered to be false within the https.request function of Node.js. In other words, no certificate is ever rejected.
xmlhttprequest and xmlhttprequest-ssl vulnerable to Arbitrary Code Injection
This affects the package xmlhttprequest before 1.7.0; all versions of package xmlhttprequest-ssl. Provided requests are sent synchronously (async=False
on xhr.open
), malicious user input flowing into xhr.send
could result in arbitrary code being injected and run.
Resource exhaustion in socket.io-parser
The socket.io-parser
npm package before versions 3.3.2 and 3.4.1 allows attackers to cause a denial of service (memory consumption) via a large packet because a concatenation approach is used.
Insufficient validation when decoding a Socket.IO packet
Due to improper type validation in the socket.io-parser
library (which is used by the socket.io
and socket.io-client
packages to encode and decode Socket.IO packets), it is possible to overwrite the _placeholder object which allows an attacker to place references to functions at arbitrary places in the resulting query object.
Example:
const decoder = new Decoder();
decoder.on("decoded", (packet) => {
console.log(packet.data); // prints [ 'hello', [Function: splice] ]
})
decoder.add('51-["hello",{"_placeholder":true,"num":"splice"}]');
decoder.add(Buffer.from("world"));
This bubbles up in the socket.io
package:
io.on("connection", (socket) => {
socket.on("hello", (val) => {
// here, "val" could be a function instead of a buffer
});
});
:warning: IMPORTANT NOTE :warning:
You need to make sure that the payload that you received from the client is actually a Buffer
object:
io.on("connection", (socket) => {
socket.on("hello", (val) => {
if (!Buffer.isBuffer(val)) {
socket.disconnect();
return;
}
// ...
});
});
If that's already the case, then you are not impacted by this issue, and there is no way an attacker could make your server crash (or escalate privileges, ...).
Example of values that could be sent by a malicious user:
Sample packet: 451-["hello",{"_placeholder":true,"num":10}]
io.on("connection", (socket) => {
socket.on("hello", (val) => {
// val is `undefined`
});
});
undefined
Sample packet: 451-["hello",{"_placeholder":true,"num":undefined}]
io.on("connection", (socket) => {
socket.on("hello", (val) => {
// val is `undefined`
});
});
Array
, like "push"Sample packet: 451-["hello",{"_placeholder":true,"num":"push"}]
io.on("connection", (socket) => {
socket.on("hello", (val) => {
// val is a reference to the "push" function
});
});
Object
, like "hasOwnProperty"Sample packet: 451-["hello",{"_placeholder":true,"num":"hasOwnProperty"}]
io.on("connection", (socket) => {
socket.on("hello", (val) => {
// val is a reference to the "hasOwnProperty" function
});
});
This should be fixed by:
socket.io-parser@4.2.1
socket.io-parser@4.0.5
socket.io-parser@3.4.2
socket.io-parser@3.3.3
socket.io
package| socket.io
version | socket.io-parser
version | Covered? |
|---------------------|---------------------------------------------------------------------------------------------------------|------------------------|
| 4.5.2...latest
| ~4.2.0
(ref) | Yes :heavy_check_mark: |
| 4.1.3...4.5.1
| ~4.0.4
(ref) | Yes :heavy_check_mark: |
| 3.0.5...4.1.2
| ~4.0.3
(ref) | Yes :heavy_check_mark: |
| 3.0.0...3.0.4
| ~4.0.1
(ref) | Yes :heavy_check_mark: |
| 2.3.0...2.5.0
| ~3.4.0
(ref) | Yes :heavy_check_mark: |
socket.io-client
package| socket.io-client
version | socket.io-parser
version | Covered? |
|----------------------------|----------------------------------------------------------------------------------------------------------------|------------------------------------|
| 4.5.0...latest
| ~4.2.0
(ref) | Yes :heavy_check_mark: |
| 4.3.0...4.4.1
| ~4.1.1
(ref) | No, but the impact is very limited |
| 3.1.0...4.2.0
| ~4.0.4
(ref) | Yes :heavy_check_mark: |
| 3.0.5
| ~4.0.3
(ref) | Yes :heavy_check_mark: |
| 3.0.0...3.0.4
| ~4.0.1
(ref) | Yes :heavy_check_mark: |
| 2.2.0...2.5.0
| ~3.3.0
(ref) | Yes :heavy_check_mark: |
Insufficient validation when decoding a Socket.IO packet
A specially crafted Socket.IO packet can trigger an uncaught exception on the Socket.IO server, thus killing the Node.js process.
TypeError: Cannot convert object to primitive value
at Socket.emit (node:events:507:25)
at .../node_modules/socket.io/lib/socket.js:531:14
A fix has been released today (2023/05/22):
socket.io-parser@4.2.3
socket.io-parser@3.4.3
Another fix has been released for the 3.3.x
branch:
| socket.io
version | socket.io-parser
version | Needs minor update? |
|---------------------|---------------------------------------------------------------------------------------------------------|--------------------------------------|
| 4.5.2...latest
| ~4.2.0
(ref) | npm audit fix
should be sufficient |
| 4.1.3...4.5.1
| ~4.1.1
(ref) | Please upgrade to socket.io@4.6.x
|
| 3.0.5...4.1.2
| ~4.0.3
(ref) | Please upgrade to socket.io@4.6.x
|
| 3.0.0...3.0.4
| ~4.0.1
(ref) | Please upgrade to socket.io@4.6.x
|
| 2.3.0...2.5.0
| ~3.4.0
(ref) | npm audit fix
should be sufficient |
There is no known workaround except upgrading to a safe version.
If you have any questions or comments about this advisory:
Thanks to @rafax00 for the responsible disclosure.