Vulnerabilities in pkg:npm/vite-plugin-static-copy
PACKAGECVE-2025-57753 is a MODERATE vite-plugin-static-copy files not included vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Vite plugin static copy libraries in the npm ecosystem. The issue involves vite-plugin-static-copy files not included in `src` are possible to access with a crafted request. Remediation is available by upgrading affected packages to version 3.1.2, 2.3.2.
pkg:npm/vite-plugin-static-copy
Vulnerability advisories affecting package pkg:npm/vite-plugin-static-copy. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-pp7p-q8fx-2968 | CVE-2025-57753 | MODERATE | vite-plugin-static-copy files not included in `src` are possible to access with a crafted request |
CVE-2025-57753 at a Glance
How to Fix CVE-2025-57753
To remediate this vulnerability, upgrade all affected Vite plugin static copy dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install vite-plugin-static-copy@3.1.2
npm install vite-plugin-static-copy@2.3.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls vite-plugin-static-copy
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2025-57753, inspect your project dependencies using npm:
npm ls vite-plugin-static-copy
Analyze the terminal output to locate any version of Vite plugin static copy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.1.2), your application is affected.
Note: The npm ls vite-plugin-static-copy command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Vite plugin static copy, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-57753 Affected Vite plugin static copy Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
vite-plugin-static-copy
|
npm |
≥ 3.0.0
< 3.1.2
|
3.1.2
|
|
vite-plugin-static-copy
|
npm |
≥ 0.4.3
< 2.3.2
|
2.3.2
|
References
Frequently Asked Questions
What is CVE-2025-57753?
Which Vite plugin static copy versions are affected?
What version fixes CVE-2025-57753?
Is vite-plugin-static-copy affected?
What CWE is associated with CVE-2025-57753?
How can I check npm dependencies for CVE-2025-57753?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-pp7p-q8fx-2968",
"modified" : "2025-08-21T19:16:58Z",
"published" : "2025-08-21T14:53:52Z",
"aliases" : [ "CVE-2025-57753" ],
"summary" : "vite-plugin-static-copy files not included in `src` are possible to access with a crafted request",
"details" : "### Summary\n\nFiles not included in `src` was possible to access with a crafted request.\n\n### Impact\n\nOnly apps explicitly exposing the Vite dev server to the network (using --host or [server.host config option](https://vitejs.dev/config/server-options.html#server-host)) are affected.\n\nArbitrary files can be disclosed by exploiting this vulnerability.\n\n### Details\n\nConsider the following configuration in used by `vite.config.ts`:\n\n```ts\nimport { defineConfig } from 'vite'\nimport { viteStaticCopy } from 'vite-plugin-static-copy'\n\nexport default defineConfig({\n plugins: [\n viteStaticCopy({\n targets: [\n {\n src: \"./public/images\",\n dest: \"./\",\n },\n ],\n }),\n ],\n });\n```\n\nThe files under the `./public/images` is only expected to be served. Abusing this vulnerability, an attacker can access arbitrary files on the filesystem.\n\n### PoC\nI've attached a demo app to showcase the bug.\n\nRun it with `npm run dev` and issue the following HTTP request\n\n```\nGET /static/images/../../../../../../../etc/passwd HTTP/1.1\nHost: localhost:3001\nContent-Length: 2\n```\nOR \n```\ncurl --path-as-is -i -s -k -X $'GET' \\\n -H $'Host: localhost:3001' -H $'Content-Length: 2' \\\n --data-binary $'\\x0d\\x0a' \\\n $'http://localhost:3001/static/images/../../../../../../../etc/passwd'\n```\nObserve that the `/etc/passwd` file is included in the response.\n\n<img width=\"1289\" height=\"449\" alt=\"Screenshot 2025-08-16 at 10 27 11 PM\" src=\"https://github.com/user-attachments/assets/4de12612-7b86-44d7-a403-c76f12832e37\" />",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "vite-plugin-static-copy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "3.1.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.1.1"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "vite-plugin-static-copy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.4.3"
}, {
"fixed" : "2.3.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 2.3.1"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/sapphi-red/vite-plugin-static-copy/security/advisories/GHSA-pp7p-q8fx-2968"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-57753"
}, {
"type" : "WEB",
"url" : "https://github.com/sapphi-red/vite-plugin-static-copy/commit/0bc6b49ed72b46eecfc9682045f4b46a19694969"
}, {
"type" : "WEB",
"url" : "https://github.com/sapphi-red/vite-plugin-static-copy/commit/4627afb8582083eab733881d3d974e1c1f23997d"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/sapphi-red/vite-plugin-static-copy"
}, {
"type" : "WEB",
"url" : "https://github.com/sapphi-red/vite-plugin-static-copy/releases/tag/vite-plugin-static-copy%402.3.2"
}, {
"type" : "WEB",
"url" : "https://github.com/sapphi-red/vite-plugin-static-copy/releases/tag/vite-plugin-static-copy%403.1.2"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2025-08-21T14:53:52Z",
"nvd_published_at" : "2025-08-21T16:15:34Z"
}
}