CVE-2018-3737: Vulnerability in sshpk package - ReDoS when parsing crafted invalid public keys in lib/formats/ssh.js

node-sshpk Updated 02 Oct 2025

Summary

07/06/2018
N/A
Yes i
High
7.5

CVE-2018-3737: sshpk is vulnerable to ReDoS when parsing crafted invalid public keys. Affects node-sshpk across 2 version ranges.

< 1.13.1+dfsg-2 < a17ec8861242649038dcdba8f8d7df5edf2ddb8c

Fixed in 1.13.1+dfsg-2. 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 Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

The sshpk package is a library for working with SSH keys in Node.js. It provides functionality for parsing, generating, and manipulating SSH keys. The vulnerability (CVE-2018-3737) arises from a Regular Expression Denial of Service (ReDoS) issue when parsing crafted invalid public keys in the lib/formats/ssh.js module.

Vulnerability Detail

The vulnerability allows an attacker to cause a Denial of Service (DoS) by sending specially crafted invalid public keys. When the sshpk package attempts to parse these keys, it enters into an inefficient regular expression matching process, leading to excessive CPU usage and potentially causing the application to become unresponsive. This vulnerability can be exploited remotely without authentication, making it a significant security concern.

How To Fix

Minimum fixed version

1.13.1+dfsg-2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-sshpk

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

Workaround

If updating the package is not immediately feasible, a temporary workaround is to implement input validation for SSH keys before passing them to the sshpk package. This can involve validating the key format and structure to ensure they meet the expected criteria. Here's an example of how to perform input validation in Node.js:

const sshpk = require('sshpk');

function validateSSHKey(key) {

try {

    sshpk.parseKey(key);
    return true;
  } catch (error) {
    return false;
  }
}

const key = '...'; // SSH key to validate

if (validateSSHKey(key)) {
  // Proceed with using the key
} else {
  // Handle invalid key
}

Conclusion

The sshpk package is vulnerable to a ReDoS issue when parsing crafted invalid public keys. This can lead to a Denial of Service (DoS) condition, potentially impacting the availability of the application. It is crucial to update the package to version 1.13.2 or later to fix the vulnerability. If immediate update is not possible, implementing input validation for SSH keys can serve as a temporary workaround. For further assistance on vulnerability remediation, please reach out to DevNack.com.

See every vulnerability recorded for node-sshpk →

Share this vulnerability

FAQ

The vulnerability allows an attacker to cause a Denial of Service (DoS) by sending specially crafted invalid public keys. This can lead to the application becoming unresponsive and unavailable to legitimate users.

Yes, this vulnerability can be exploited remotely without authentication. Attackers can send malicious requests containing the crafted invalid public keys to trigger the ReDoS issue.

Yes, the vulnerability has been fixed in version 1.13.2 of the sshpk package. It is recommended to update to this version or later to mitigate the risk.

A temporary workaround is to implement input validation for SSH keys before passing them to the sshpk package. This can help prevent the exploitation of the vulnerability by ensuring only valid keys are processed.

No, authentication is not required to exploit this vulnerability. Attackers can exploit the vulnerability remotely without any authentication.

Related vulnerabilities

Recent vulnerabilities recorded for node-sshpk.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

1.13.1+dfsg-2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-sshpk

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