Vulnerabilities in pkg:npm/png-img

PACKAGE
Advisory Identifier: GHSA-q5wr-fvpq-p67g
Advisory Summary

CVE-2020-28248 is a HIGH (CVSS 8.8) integer overflow vulnerability (CWE-190: Integer Overflow or Wraparound) affecting Png img libraries in the npm ecosystem. The issue involves integer overflow in png-img. Remediation is available by upgrading affected packages to version 3.1.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/png-img

1 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-q5wr-fvpq-p67g CVE-2020-28248 HIGH Integer Overflow in png-img

CVE-2020-28248 at a Glance

CVE Identifier CVE-2020-28248
GHSA Identifier GHSA-q5wr-fvpq-p67g
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-190: Integer Overflow or Wraparound
Affected Product Png img
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.8

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

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 High (A:H)

How to Fix CVE-2020-28248

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

png-img fixed: 3.1.0
npm install png-img@3.1.0
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 png-img

How to Check if You Are Affected

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

npm ls png-img

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

Note: The npm ls png-img 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-190: Integer Overflow or Wraparound, where the product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. this occurs when an integer value is incremented to a value that is too large to store in the associated representation. when this occurs, the value may become a very small or negative number. In Png img, 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 integer overflow in the PngImg::InitStorage_() function of png-img before 3.1.0 leads to an under-allocation of heap memory and subsequently an exploitable heap-based buffer overflow when loading a crafted PNG file.

CVE-2020-28248 Affected Png img Versions

1 component(s)
Fixed Versions:
3.1.0
Product / Package Ecosystem Affected Versions Fixed Version
png-img
npm
< 3.1.0
3.1.0

References

Frequently Asked Questions

What is CVE-2020-28248?
CVE-2020-28248 is a security vulnerability in Png img involving Integer Overflow in png-img under CWE-190: Integer Overflow or Wraparound.
Which Png img versions are affected?
Affected versions include releases prior to 3.1.0 across affected packages: png-img.
What version fixes CVE-2020-28248?
Upgrading to 3.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is png-img affected?
Yes, png-img is affected in releases prior to 3.1.0. Upgrade your dependency to 3.1.0 or later.
What is the CVSS score of CVE-2020-28248?
CVE-2020-28248 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2020-28248?
CVE-2020-28248 is classified under CWE-190: Integer Overflow or Wraparound (The product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. This occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may become a very small or negative number.).
How can I check npm dependencies for CVE-2020-28248?
Run the dependency tree command: 'npm ls png-img'. 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-q5wr-fvpq-p67g",
  "modified" : "2021-07-26T18:09:11Z",
  "published" : "2021-12-10T17:23:30Z",
  "aliases" : [ "CVE-2020-28248" ],
  "summary" : "Integer Overflow in png-img",
  "details" : "An integer overflow in the PngImg::InitStorage_() function of png-img before 3.1.0 leads to an under-allocation of heap memory and subsequently an exploitable heap-based buffer overflow when loading a crafted PNG file.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "png-img"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-28248"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gemini-testing/png-img/commit/14ac462a32ca4b3b78f56502ac976d5b0222ce3d"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gemini-testing/png-img"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gemini-testing/png-img/compare/v3.0.0...v3.1.0"
  }, {
    "type" : "ADVISORY",
    "url" : "https://securitylab.github.com/advisories/GHSL-2020-142-gemini-png-img"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-190", "CWE-787" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-07-26T18:09:11Z",
    "nvd_published_at" : "2021-02-20T00:15:00Z"
  }
}