Vulnerabilities in pkg:npm/@solana/pay

PACKAGE
Advisory Identifier: GHSA-j47c-j42c-mwqq
Advisory Summary

CVE-2022-35917 is a MODERATE (CVSS 5.3) solana pay vulnerable to weakness vulnerability (CWE-670: Always-Incorrect Control Flow Implementation) affecting @solana/pay libraries in the npm ecosystem. The issue involves solana pay vulnerable to weakness in transfer validation logic. Remediation is available by upgrading affected packages to version 0.2.1.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@solana/pay

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@solana/pay. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-j47c-j42c-mwqq CVE-2022-35917 MODERATE Solana Pay Vulnerable to Weakness in Transfer Validation Logic

CVE-2022-35917 at a Glance

CVE Identifier CVE-2022-35917
GHSA Identifier GHSA-j47c-j42c-mwqq
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-670: Always-Incorrect Control Flow Implementation
Affected Product @solana/pay
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.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:N/S:U/C:N/I:L/A:N).

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

How to Fix CVE-2022-35917

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

@solana/pay fixed: 0.2.1
npm install @solana/pay@0.2.1
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 @solana/pay

How to Check if You Are Affected

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

npm ls @solana/pay

Analyze the terminal output to locate any version of @solana/pay in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.2.1), your application is affected.

Note: The npm ls @solana/pay 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-670: Always-Incorrect Control Flow Implementation, where the code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated. In @solana/pay, 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

### Description When a Solana Pay transaction is located using a [reference key](https://github.com/solana-labs/solana-pay/blob/master/SPEC.md#reference), it may be checked to represent a transfer of the desired amount to the recipient, using the supplied [`validateTransfer` function](https://github.com/solana-labs/solana-pay/blob/master/core/src/validateTransfer.ts). An edge case regarding this mechanism could cause the validation logic to validate multiple transfers. ### Impact Most known Solana Pay point of sale applications are currently run on physical point of sale devices, which makes this issue unlikely to occur. However, there may be web-based point of sale applications using the protocol where it may be more likely to occur. ### Patches This issue has been patched as of version [`0.2.1`](https://www.npmjs.com/package/@solana/pay/v/0.2.1). Users of the Solana Pay SDK should upgrade to it.

CVE-2022-35917 Affected @solana/pay Versions

1 component(s)
Fixed Versions:
0.2.1
Product / Package Ecosystem Affected Versions Fixed Version
@solana/pay
npm
< 0.2.1
0.2.1

References

Frequently Asked Questions

What is CVE-2022-35917?
CVE-2022-35917 is a security vulnerability in @solana/pay involving Solana Pay Vulnerable to Weakness in Transfer Validation Logic under CWE-670: Always-Incorrect Control Flow Implementation.
Which @solana/pay versions are affected?
Affected versions include releases prior to 0.2.1 across affected packages: @solana/pay.
What version fixes CVE-2022-35917?
Upgrading to 0.2.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @solana/pay affected?
Yes, @solana/pay is affected in releases prior to 0.2.1. Upgrade your dependency to 0.2.1 or later.
What is the CVSS score of CVE-2022-35917?
CVE-2022-35917 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N.
What CWE is associated with CVE-2022-35917?
CVE-2022-35917 is classified under CWE-670: Always-Incorrect Control Flow Implementation (The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.).
How can I check npm dependencies for CVE-2022-35917?
Run the dependency tree command: 'npm ls @solana/pay'. 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-j47c-j42c-mwqq",
  "modified" : "2022-08-06T05:39:18Z",
  "published" : "2022-08-06T05:39:18Z",
  "aliases" : [ "CVE-2022-35917" ],
  "summary" : "Solana Pay Vulnerable to Weakness in Transfer Validation Logic",
  "details" : "### Description\nWhen a Solana Pay transaction is located using a [reference key](https://github.com/solana-labs/solana-pay/blob/master/SPEC.md#reference), it may be checked to represent a transfer of the desired amount to the recipient, using the supplied [`validateTransfer` function](https://github.com/solana-labs/solana-pay/blob/master/core/src/validateTransfer.ts). An edge case regarding this mechanism could cause the validation logic to validate multiple transfers.\n\n### Impact\nMost known Solana Pay point of sale applications are currently run on physical point of sale devices, which makes this issue unlikely to occur. However, there may be web-based point of sale applications using the protocol where it may be more likely to occur.\n\n### Patches\nThis issue has been patched as of version [`0.2.1`](https://www.npmjs.com/package/@solana/pay/v/0.2.1). Users of the Solana Pay SDK should upgrade to it.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@solana/pay"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.2.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.2.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/solana-labs/solana-pay/security/advisories/GHSA-j47c-j42c-mwqq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-35917"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/solana-labs/solana-pay/commit/ac6ce0d0a81137700874a8bf5a7caac3be999fad"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/solana-labs/solana-pay"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/solana-labs/solana-pay/blob/master/SPEC.md#reference"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/solana-labs/solana-pay/blob/master/core/src/validateTransfer.ts"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-670" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-08-06T05:39:18Z",
    "nvd_published_at" : "2022-08-01T22:15:00Z"
  }
}