Vite: Cross origin script execution through Vite custom middleware
### Summary When accessing a malicious site while a dev server using Vite is running, that site was able to load scripts in a page served by the dev server. ### Impact Only apps that match the following conditions are affected: - the dev server passes an unchanged browser request URL to `server.transformIndexHtml`: this is normally used for `server.middlewareMode: true` or `appType: 'custom'`. The internal call for `appType: 'spa'` and `appType: 'mpa'` does not match this. - the transformed HTML contains an inline module script - from the script in the page served by the dev server, the app stores sensitive values in the location accessible or allows critical actions ### Details [Vite's SSR guide for 8.2.1](https://github.com/vitejs/vite/blob/421615865dad3ed39137d17281814fc78a41246c/docs/guide/ssr.md#L119-L131) documents the affected setup. The application embeds Vite in middleware mode, reads trusted HTML, and passes the browser's unchanged request URL to the transform: ```js const url = req.originalUrl template = await vite.transformIndexHtml(url, template) ``` For a development server at `http://localhost:5173`, an attacker can send this URL: ```text http://localhost:5173//evil.example/payload.js?/../../package.json ``` In Vite 8.2.1, [`createDevHtmlTransformFn` and `getHtmlFilename` in `indexHtml.ts`](https://github.com/vitejs/vite/blob/421615865dad3ed39137d17281814fc78a41246c/packages/vite/src/node/server/middlewares/indexHtml.ts#L99-L115) use the request URL as both the
- Products
- vite, vite-plus
- Affected versions
- Not specified
- Fixed versions
- 1.1.0, 6.4.4, 7.3.7, 8.1.6, 8.2.4, 8.3.3
- CVEs
- CVE-2026-112945
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 31 Oct 2026, 14:35 UTC · Revision 1
Source evidence
Vite: Cross origin script execution through Vite custom middleware
core-osv · Original sourcePublished 21 Oct 2026, 16:48 UTC
### Summary When accessing a malicious site while a dev server using Vite is running, that site was able to load scripts in a page served by the dev server. ### Impact Only apps that match the following conditions are affected: - the dev server passes an unchanged browser request URL to `server.transformIndexHtml`: this is normally used for `server.middlewareMode: true` or `appType: 'custom'`. The internal call for `appType: 'spa'` and `appType: 'mpa'` does not match this. - the transformed HTML contains an inline module script - from the script in the page served by the dev server, the app stores sensitive values in the location accessible or allows critical actions ### Details [Vite's SSR guide for 8.2.1](https://github.com/vitejs/vite/blob/421615865dad3ed39137d17281814fc78a41246c/docs/guide/ssr.md#L119-L131) documents the affected setup. The application embeds Vite in middleware mode, reads trusted HTML, and passes the browser's unchanged request URL to the transform: ```js const url = req.originalUrl template = await vite.transformIndexHtml(url, template) ``` For a development server at `http://localhost:5173`, an attacker can send this URL: ```text http://localhost:5173//evil.example/payload.js?/../../package.json ``` In Vite 8.2.1, [`createDevHtmlTransformFn` and `getHtmlFilename` in `indexHtml.ts`](https://github.com/vitejs/vite/blob/421615865dad3ed39137d17281814fc78a41246c/packages/vite/src/node/server/middlewares/indexHtml.ts#L99-L115) use the request URL as both the
osv:GHSA-9jrq-w75r-8gcw
vite
Fixed versions: 8.3.3
vite
Fixed versions: 8.2.4
vite
Fixed versions: 8.1.6
vite
Fixed versions: 7.3.7
vite
Fixed versions: 6.4.4
vite-plus
Fixed versions: 1.1.0
Complete source record
{
"id": "11fb19808a06f1e3bc5d2eef57c083b661ccd53926960e0bc557851cfedb6b2f",
"url": "https://osv.dev/vulnerability/GHSA-9jrq-w75r-8gcw",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Vite: Cross origin script execution through Vite custom middleware",
"summary": "### Summary When accessing a malicious site while a dev server using Vite is running, that site was able to load scripts in a page served by the dev server. ### Impact Only apps that match the following conditions are affected: - the dev server passes an unchanged browser request URL to `server.transformIndexHtml`: this is normally used for `server.middlewareMode: true` or `appType: 'custom'`. The internal call for `appType: 'spa'` and `appType: 'mpa'` does not match this. - the transformed HTML contains an inline module script - from the script in the page served by the dev server, the app stores sensitive values in the location accessible or allows critical actions ### Details [Vite's SSR guide for 8.2.1](https://github.com/vitejs/vite/blob/421615865dad3ed39137d17281814fc78a41246c/docs/guide/ssr.md#L119-L131) documents the affected setup. The application embeds Vite in middleware mode, reads trusted HTML, and passes the browser's unchanged request URL to the transform: ```js const url = req.originalUrl template = await vite.transformIndexHtml(url, template) ``` For a development server at `http://localhost:5173`, an attacker can send this URL: ```text http://localhost:5173//evil.example/payload.js?/../../package.json ``` In Vite 8.2.1, [`createDevHtmlTransformFn` and `getHtmlFilename` in `indexHtml.ts`](https://github.com/vitejs/vite/blob/421615865dad3ed39137d17281814fc78a41246c/packages/vite/src/node/server/middlewares/indexHtml.ts#L99-L115) use the request URL as both the",
"evidence": "osv:GHSA-9jrq-w75r-8gcw",
"products": [
{
"name": {
"value": "vite",
"evidence": "/affected/0/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "8.3.3",
"evidence": "/affected/0/ranges"
}
],
"affected_versions": []
},
{
"name": {
"value": "vite",
"evidence": "/affected/1/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "8.2.4",
"evidence": "/affected/1/ranges"
}
],
"affected_versions": []
},
{
"name": {
"value": "vite",
"evidence": "/affected/2/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "8.1.6",
"evidence": "/affected/2/ranges"
}
],
"affected_versions": []
},
{
"name": {
"value": "vite",
"evidence": "/affected/3/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "7.3.7",
"evidence": "/affected/3/ranges"
}
],
"affected_versions": []
},
{
"name": {
"value": "vite",
"evidence": "/affected/4/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "6.4.4",
"evidence": "/affected/4/ranges"
}
],
"affected_versions": []
},
{
"name": {
"value": "vite-plus",
"evidence": "/affected/5/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "1.1.0",
"evidence": "/affected/5/ranges"
}
],
"affected_versions": []
}
],
"severity": "low",
"structured": {
"id": "GHSA-9jrq-w75r-8gcw",
"aliases": [
"CVE-2026-112945",
"GHSA-9jrq-w75r-8gcw"
],
"metrics": [
{
"type": "CVSS_V4",
"score": "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N"
}
],
"affected": [
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "8.3.0"
},
{
"fixed": "8.3.3"
}
]
}
],
"package": {
"name": "vite",
"purl": "pkg:npm/vite",
"ecosystem": "npm"
},
"database_specific": {
"source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-9jrq-w75r-8gcw/GHSA-9jrq-w75r-8gcw.json",
"last_known_affected_version_range": "<= 8.3.2"
}
},
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "8.2.0"
},
{
"fixed": "8.2.4"
}
]
}
],
"package": {
"name": "vite",
"purl": "pkg:npm/vite",
"ecosystem": "npm"
},
"database_specific": {
"source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-9jrq-w75r-8gcw/GHSA-9jrq-w75r-8gcw.json",
"last_known_affected_version_range": "<= 8.2.3"
}
},
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "8.0.0"
},
{
"fixed": "8.1.6"
}
]
}
],
"package": {
"name": "vite",
"purl": "pkg:npm/vite",
"ecosystem": "npm"
},
"database_specific": {
"source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-9jrq-w75r-8gcw/GHSA-9jrq-w75r-8gcw.json",
"last_known_affected_version_range": "<= 8.1.5"
}
},
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "7.0.0"
},
{
"fixed": "7.3.7"
}
]
}
],
"package": {
"name": "vite",
"purl": "pkg:npm/vite",
"ecosystem": "npm"
},
"database_specific": {
"source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-9jrq-w75r-8gcw/GHSA-9jrq-w75r-8gcw.json",
"last_known_affected_version_range": "<= 7.3.6"
}
},
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "0"
},
{
"fixed": "6.4.4"
}
]
}
],
"package": {
"name": "vite",
"purl": "pkg:npm/vite",
"ecosystem": "npm"
},
"database_specific": {
"source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-9jrq-w75r-8gcw/GHSA-9jrq-w75r-8gcw.json",
"last_known_affected_version_range": "<= 6.4.3"
}
},
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "0"
},
{
"fixed": "1.1.0"
}
]
}
],
"package": {
"name": "vite-plus",
"purl": "pkg:npm/vite-plus",
"ecosystem": "npm"
},
"database_specific": {
"source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-9jrq-w75r-8gcw/GHSA-9jrq-w75r-8gcw.json",
"last_known_affected_version_range": "<= 1.0.0"
}
}
],
"modified": "2026-10-21T17:00:26.569382874Z",
"provider": "osv",
"references": [
"https://github.com/vitejs/vite/security/advisories/GHSA-9jrq-w75r-8gcw",
"https://nvd.nist.gov/vuln/detail/CVE-2026-112945",
"https://github.com/vitejs/vite/pull/23653",
"https://github.com/vitejs/vite/commit/7dafd8e56f152403a3230608fa4005273c2e9e17",
"https://github.com/vitejs/vite"
],
"provider_metadata": {
"cwe_ids": [
"CWE-80"
],
"severity": "LOW",
"github_reviewed": true,
"nvd_published_at": "2026-10-20T16:17:05Z",
"github_reviewed_at": "2026-10-21T16:48:14Z"
}
},
"related_cves": [
{
"value": "CVE-2026-112945",
"evidence": "/aliases"
}
],
"security_relevant": true,
"severity_evidence": "/database_specific/severity"
},
"source_id": "core-osv",
"document_id": 394603,
"published_at": "2026-10-21T16:48:14+00:00"
}