CVE-2015-7982: Command Injection in gm

gm Updated 02 Oct 2025

Summary

01/09/2020
Yes i
Critical
Not published

CVE-2015-7982: Command Injection in gm. Affects gm versions < 1.21.1. Fixed in 1.21.1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The gm package is an npm package used for image manipulation. It provides a set of tools and functions for working with graphics and images. The package is widely used in various applications and frameworks to perform tasks such as resizing, cropping, and applying filters to images. However, versions of gm prior to 1.21.1 are vulnerable to a command injection vulnerability.

Vulnerability Detail

The command injection vulnerability in gm is triggered when user input is passed into the gm.compare() function without proper sanitization. This allows an attacker to inject arbitrary commands into the system, potentially leading to remote code execution or other malicious activities. The vulnerability arises from a failure to correctly sanitize user input before calling the graphics magic binary. An attacker can exploit this vulnerability by crafting malicious input that includes shell commands, which are then executed by the system.

How To Fix

Minimum fixed version

1.21.1

This is the first release that contains the fix.

npm install gm@1.21.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If updating to the latest version is not immediately feasible, a temporary workaround is to validate and sanitize user input before passing it to the gm.compare() function. This can be done by implementing input validation and filtering mechanisms to ensure that only expected and safe input is processed by the function. Additionally, it is recommended to restrict access to the affected functionality or disable it altogether until the package can be updated.

Conclusion

The command injection vulnerability in gm can have severe consequences, including remote code execution. It is crucial to update to version 1.21.1 or later of the gm package to mitigate this vulnerability. If immediate update is not possible, implementing input validation and sanitization mechanisms can provide temporary protection. For further support and assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for gm →

Share this vulnerability

FAQ

The command injection vulnerability in gm can lead to remote code execution, allowing an attacker to execute arbitrary commands on the system. This can result in unauthorized access, data breaches, and other malicious activities.

Versions of gm prior to 1.21.1 are affected by this vulnerability.

While there may not be a publicly known exploit for this specific vulnerability, command injection vulnerabilities are commonly targeted by attackers. It is important to address this vulnerability promptly to prevent potential exploitation.

The recommended mitigation is to update to version 1.21.1 or later of the gm package. If immediate update is not possible, implementing input validation and sanitization mechanisms can help mitigate the risk until the package can be updated.

How To Fix

Minimum fixed version

1.21.1

This is the first release that contains the fix.

npm install gm@1.21.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback