Vulnerabilities in pkg:npm/canvg
PACKAGECVE-2025-25977 is a HIGH canvg prototype pollution vulnerability vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Canvg libraries in the npm ecosystem. The issue involves canvg prototype pollution vulnerability. Remediation is available by upgrading affected packages to version 4.0.3, 3.0.11.
pkg:npm/canvg
Vulnerability advisories affecting package pkg:npm/canvg. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-v2mw-5mch-w8c5 | CVE-2025-25977 | HIGH | canvg Prototype Pollution vulnerability |
CVE-2025-25977 at a Glance
How to Fix CVE-2025-25977
To remediate this vulnerability, upgrade all affected Canvg 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 canvg@4.0.3
npm install canvg@3.0.11
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls canvg
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2025-25977, inspect your project dependencies using npm:
npm ls canvg
Analyze the terminal output to locate any version of Canvg in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.0.3), your application is affected.
Note: The npm ls canvg 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-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. In Canvg, 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-25977 Affected Canvg Versions
2 component(s)References
Frequently Asked Questions
What is CVE-2025-25977?
Which Canvg versions are affected?
What version fixes CVE-2025-25977?
Is canvg affected?
What CWE is associated with CVE-2025-25977?
How can I check npm dependencies for CVE-2025-25977?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-v2mw-5mch-w8c5",
"modified" : "2025-03-17T15:41:44Z",
"published" : "2025-03-10T18:31:56Z",
"aliases" : [ "CVE-2025-25977" ],
"summary" : "canvg Prototype Pollution vulnerability",
"details" : "An issue in canvg prior to v.4.0.3 and v3.0.11 can lead to prototype pollution via the Constructor of the class StyleElement.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "canvg"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.0.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "canvg"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.0.11"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-25977"
}, {
"type" : "WEB",
"url" : "https://github.com/canvg/canvg/issues/1749"
}, {
"type" : "WEB",
"url" : "https://github.com/canvg/canvg/commit/c3743e6345f3e01aefdcdd412c3f26494f4b5d7d"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/canvg/canvg"
}, {
"type" : "WEB",
"url" : "https://github.com/canvg/canvg/blob/937668eced93e0335c67a255d0d2277ea708b2cb/src/Document/StyleElement.ts"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1321" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2025-03-12T15:33:44Z",
"nvd_published_at" : "2025-03-10T16:15:13Z"
}
}