Description
An issue was discovered in lib/Server.js in webpack-dev-server before 3.1.6. Attackers are able to steal developer's code because the origin of requests is not checked by the WebSocket server, which is used for HMR (Hot Module Replacement). Anyone can receive the HMR message sent by the WebSocket server via a ws://127.0.0.1:8080/ connection from any origin.
Remediation
References
https://github.com/webpack/webpack-dev-server/issues/1445
https://github.com/webpack/webpack-dev-server/commit/f18e5adf123221a1015be63e1ca2491ca45b8d10
https://blog.cal1.cn/post/Sniffing%20Codes%20in%20Hot%20Module%20Reloading%20Messages
Related Vulnerabilities
CVE-2022-21830 Vulnerability in npm package @rocket.chat/livechat
CVE-2021-23395 Vulnerability in npm package nedb
CVE-2021-45459 Vulnerability in npm package node-windows
CVE-2021-25946 Vulnerability in npm package nconf-toml
CVE-2015-0250 Vulnerability in maven package org.eclipse.birt.runtime:org.apache.batik.dom