CVE-2022-25851: Jpeg js Infinite Loop Vulnerability

HIGH
Advisory Identifier: GHSA-xvf7-4v9q-58w6
CVSS 7.5
CWE-835
Published
Advisory Summary

CVE-2022-25851 is a HIGH (CVSS 7.5) infinite loop vulnerability (CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')) affecting Jpeg js libraries in the npm ecosystem. The issue involves infinite loop in jpeg-js. Remediation is available by upgrading affected packages to version 0.4.4.

CVE-2022-25851 at a Glance

CVE Identifier CVE-2022-25851
GHSA Identifier GHSA-xvf7-4v9q-58w6
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')
Affected Product Jpeg js
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

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:N/A:H).

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 None (I:N)
Availability High (A:H)

How to Fix CVE-2022-25851

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

jpeg-js fixed: 0.4.4
npm install jpeg-js@0.4.4
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 jpeg-js

How to Check if You Are Affected

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

npm ls jpeg-js

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

Note: The npm ls jpeg-js 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-835: Loop with Unreachable Exit Condition ('Infinite Loop'), where the product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop. In Jpeg js, 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

The package jpeg-js before 0.4.4 is vulnerable to Denial of Service (DoS) where a particular piece of input will cause the program to enter an infinite loop and never return.

CVE-2022-25851 Affected Jpeg js Versions

1 component(s)
Fixed Versions:
0.4.4
Product / Package Ecosystem Affected Versions Fixed Version
jpeg-js
npm
< 0.4.4
0.4.4

References

Frequently Asked Questions

What is CVE-2022-25851?
CVE-2022-25851 is a security vulnerability in Jpeg js involving Infinite loop in jpeg-js under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop').
Which Jpeg js versions are affected?
Affected versions include releases prior to 0.4.4 across affected packages: jpeg-js.
What version fixes CVE-2022-25851?
Upgrading to 0.4.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is jpeg-js affected?
Yes, jpeg-js is affected in releases prior to 0.4.4. Upgrade your dependency to 0.4.4 or later.
What is the CVSS score of CVE-2022-25851?
CVE-2022-25851 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2022-25851?
CVE-2022-25851 is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop') (The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.).
How can I check npm dependencies for CVE-2022-25851?
Run the dependency tree command: 'npm ls jpeg-js'. 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-xvf7-4v9q-58w6",
  "modified" : "2022-06-20T21:58:35Z",
  "published" : "2022-06-11T00:00:17Z",
  "aliases" : [ "CVE-2022-25851" ],
  "summary" : "Infinite loop in jpeg-js",
  "details" : "The package jpeg-js before 0.4.4 is vulnerable to Denial of Service (DoS) where a particular piece of input will cause the program to enter an infinite loop and never return.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "jpeg-js"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.4.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-25851"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jpeg-js/jpeg-js/issues/105"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jpeg-js/jpeg-js/pull/106"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jpeg-js/jpeg-js/commit/9ccd35fb5f55a6c4f1902ac5b0f270f675750c27"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/jpeg-js/jpeg-js"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-2860295"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-JPEGJS-2859218"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-835" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-17T01:00:49Z",
    "nvd_published_at" : "2022-06-10T20:15:00Z"
  }
}