CVE-2015-7982: Gm Command Injection Vulnerability

CRITICAL
Advisory Identifier: GHSA-pjh3-jv7w-9jpr
CWE-77
Published
Advisory Summary

CVE-2015-7982 is a CRITICAL command injection vulnerability (CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')) affecting Gm libraries in the npm ecosystem. The issue involves command injection in gm. Remediation is available by upgrading affected packages to version 1.21.1.

CVE-2015-7982 at a Glance

CVE Identifier CVE-2015-7982
GHSA Identifier GHSA-pjh3-jv7w-9jpr
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
Affected Product Gm
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2015-7982

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

gm fixed: 1.21.1
npm install gm@1.21.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 gm

How to Check if You Are Affected

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

npm ls gm

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

Note: The npm ls gm 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-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), where the product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. In Gm, 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

Versions of `gm` prior to 1.21.1 are affected by a command injection vulnerability. The vulnerability is triggered when user input is passed into `gm.compare()`, which fails to sanitize input correctly before calling the graphics magic binary. ## Recommendation Update to version 1.21.1 or later.

CVE-2015-7982 Affected Gm Versions

1 component(s)
Fixed Versions:
1.21.1
Product / Package Ecosystem Affected Versions Fixed Version
gm
npm
< 1.21.1
1.21.1

References

Frequently Asked Questions

What is CVE-2015-7982?
CVE-2015-7982 is a security vulnerability in Gm involving Command Injection in gm under CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection').
Which Gm versions are affected?
Affected versions include releases prior to 1.21.1 across affected packages: gm.
What version fixes CVE-2015-7982?
Upgrading to 1.21.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is gm affected?
Yes, gm is affected in releases prior to 1.21.1. Upgrade your dependency to 1.21.1 or later.
What CWE is associated with CVE-2015-7982?
CVE-2015-7982 is classified under CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection') (The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2015-7982?
Run the dependency tree command: 'npm ls gm'. 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-pjh3-jv7w-9jpr",
  "modified" : "2021-09-23T21:23:47Z",
  "published" : "2020-09-01T15:18:55Z",
  "aliases" : [ "CVE-2015-7982" ],
  "summary" : "Command Injection in gm",
  "details" : "Versions of `gm` prior to 1.21.1 are affected by a command injection vulnerability. The vulnerability is triggered when user input is passed into `gm.compare()`, which fails to sanitize input correctly before calling the graphics magic binary.\n\n\n## Recommendation\n\nUpdate to version 1.21.1 or later.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "gm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.21.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.20.0"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2015-7982"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aheckmann/gm/commit/5f5c77490aa84ed313405c88905eb4566135be31"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/aheckmann/gm"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/54"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-77" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-31T18:09:27Z",
    "nvd_published_at" : null
  }
}