Critical Malicious Code Vulnerability in Morgan.js Package

morgan.js Updated 27 Jan 2026

Summary

27/01/2026
CRITICAL
No i
Critical
Not published

MAL-2026-536: Malicious code in morgan.js (npm). Affected versions are not published. No fix is published. 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

Morgan.js is a popular logging middleware for Node.js applications, designed to simplify the logging of HTTP requests. It provides various logging formats and is widely used in web applications to track incoming requests and responses. However, the package has been compromised, leading to a severe security vulnerability that can fully compromise any system running it.

Vulnerability Detail

The vulnerability originates from malicious code embedded within the Morgan.js package. This code can grant unauthorized access to the system, allowing attackers to control the affected machine completely. As a result, any sensitive information, including secrets and keys stored on the computer, is at risk. The malicious nature of this code is classified under CWE-506, indicating that it contains embedded malicious code.

How To Fix

This package is malicious. Remove it and rotate any credentials it could have accessed.

npm uninstall morgan.js

If it arrived as a transitive dependency, remove the package that pulled it in, then reinstall.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a workaround, you can temporarily disable the use of Morgan.js in your application until the package is removed or updated. This can be done by commenting out the import statement and any middleware usage in your application code.

Conclusion

The discovery of malicious code in the Morgan.js package poses a significant threat to any system utilizing it. Immediate action is required to remove the package and secure any sensitive information. Users are encouraged to monitor their applications for vulnerabilities using tools like Vulert.

See every vulnerability recorded for morgan.js →

Share this vulnerability

FAQ

Morgan.js is a logging middleware for Node.js that helps developers log HTTP requests in their applications.

You can check if your application is affected by using Vulert, which monitors vulnerabilities in open-source packages. Visit Vulert Scanner to analyze your package-lock.json file.

If you have installed Morgan.js, you should remove it immediately and rotate any sensitive information stored on your system.

Currently, there is no patch available for Morgan.js due to the nature of the compromise. The best course of action is to remove the package.

Yes, you can continue using your application without Morgan.js by disabling it temporarily until a safe alternative is found.

How To Fix

This package is malicious. Remove it and rotate any credentials it could have accessed.

npm uninstall morgan.js

If it arrived as a transitive dependency, remove the package that pulled it in, then reinstall.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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