CVE-2025-25977: Canvg Canvg Prototype Pollution Vulnerability Vulnerability

HIGH
Advisory Identifier: GHSA-v2mw-5mch-w8c5
CWE-1321
Published
Advisory Summary

CVE-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.

CVE-2025-25977 at a Glance

CVE Identifier CVE-2025-25977
GHSA Identifier GHSA-v2mw-5mch-w8c5
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product Canvg
Package Ecosystem npm
Published Date
Last Updated

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.

canvg fixed: 4.0.3
npm install canvg@4.0.3
canvg fixed: 3.0.11
npm install canvg@3.0.11
Verify Direct and Transitive Dependencies

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

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.

CVE-2025-25977 Affected Canvg Versions

2 component(s)
Fixed Versions:
4.0.33.0.11
Product / Package Ecosystem Affected Versions Fixed Version
canvg
npm
≥ 4.0.0
< 4.0.3
4.0.3
canvg
npm
< 3.0.11
3.0.11

References

Frequently Asked Questions

What is CVE-2025-25977?
CVE-2025-25977 is a security vulnerability in Canvg involving canvg Prototype Pollution vulnerability under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which Canvg versions are affected?
Affected versions include releases prior to 4.0.3, 3.0.11 across affected packages: canvg.
What version fixes CVE-2025-25977?
Upgrading to 4.0.3, 3.0.11 (or the latest patched release for your respective branch) resolves the vulnerability.
Is canvg affected?
Yes, canvg is affected in releases prior to 4.0.3, 3.0.11. Upgrade your dependency to 4.0.3, 3.0.11 or later.
What CWE is associated with CVE-2025-25977?
CVE-2025-25977 is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') (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.).
How can I check npm dependencies for CVE-2025-25977?
Run the dependency tree command: 'npm ls canvg'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}