Vulnerabilities in pkg:npm/node-twain

PACKAGE
Advisory Identifier: GHSA-wxr3-2hgv-qm8f
Advisory Summary

CVE-2024-21525 is a HIGH (CVSS 8.3) node-twain vulnerable to improper check vulnerability (CWE-703: Improper Check or Handling of Exceptional Conditions) affecting Node twain libraries in the npm ecosystem. The issue involves node-twain vulnerable to improper check or handling of exceptional conditions. Remediation is available in the latest vendor maintenance releases.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/node-twain

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/node-twain. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-wxr3-2hgv-qm8f CVE-2024-21525 HIGH node-twain vulnerable to Improper Check or Handling of Exceptional Conditions

CVE-2024-21525 at a Glance

CVE Identifier CVE-2024-21525
GHSA Identifier GHSA-wxr3-2hgv-qm8f
Severity HIGH
CVSS v3.1 Base Score 8.3
CWE Classification CWE-703: Improper Check or Handling of Exceptional Conditions
Affected Product Node twain
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability Low (A:L)

How to Fix CVE-2024-21525

To remediate this vulnerability, upgrade all affected Node twain dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

node-twain fixed: Latest secure release
npm install node-twain@Latest secure release
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 node-twain

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-21525, inspect your project dependencies using npm:

npm ls node-twain

Analyze the terminal output to locate any version of Node twain in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: The npm ls node-twain 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-703: Improper Check or Handling of Exceptional Conditions, where the product does not properly anticipate or handle exceptional conditions that rarely occur during normal operation of the product. In Node twain, 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

All versions of the package node-twain are vulnerable to Improper Check or Handling of Exceptional Conditions due to the length of the source data not being checked. Creating a new twain.TwainSDK with a productName or productFamily, manufacturer, version.info property of length >= 34 chars leads to a buffer overflow vulnerability.

CVE-2024-21525 Affected Node twain Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
node-twain
npm
≤ 0.0.16

References

Frequently Asked Questions

What is CVE-2024-21525?
CVE-2024-21525 is a security vulnerability in Node twain involving node-twain vulnerable to Improper Check or Handling of Exceptional Conditions under CWE-703: Improper Check or Handling of Exceptional Conditions.
Which Node twain versions are affected?
Affected versions include releases prior to current release patches across affected packages: node-twain.
What version fixes CVE-2024-21525?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is node-twain affected?
Yes, node-twain is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2024-21525?
CVE-2024-21525 has a CVSS v3.1 base score of 8.3 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:L.
What CWE is associated with CVE-2024-21525?
CVE-2024-21525 is classified under CWE-703: Improper Check or Handling of Exceptional Conditions (The product does not properly anticipate or handle exceptional conditions that rarely occur during normal operation of the product.).
How can I check npm dependencies for CVE-2024-21525?
Run the dependency tree command: 'npm ls node-twain'. 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-wxr3-2hgv-qm8f",
  "modified" : "2024-07-10T21:29:30Z",
  "published" : "2024-07-10T06:33:52Z",
  "aliases" : [ "CVE-2024-21525" ],
  "summary" : "node-twain vulnerable to Improper Check or Handling of Exceptional Conditions",
  "details" : "All versions of the package node-twain are vulnerable to Improper Check or Handling of Exceptional Conditions due to the length of the source data not being checked. Creating a new twain.TwainSDK with a productName or productFamily, manufacturer, version.info property of length >= 34 chars leads to a buffer overflow vulnerability.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "node-twain"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "0.0.16"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-21525"
  }, {
    "type" : "WEB",
    "url" : "https://gist.github.com/dellalibera/55b87634a6c360e5be22a715f0566c99"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Luomusha/node-twain"
  }, {
    "type" : "WEB",
    "url" : "https://security.snyk.io/vuln/SNYK-JS-NODETWAIN-6421153"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-703" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-07-10T21:29:30Z",
    "nvd_published_at" : "2024-07-10T05:15:11Z"
  }
}