CVE-2026-5078: Morgan Package Vulnerable to Log Forging via Unneutralized Control Characters

morgan Updated 18 Jul 2026

Summary

10/07/2026
Yes i
Moderate
5.3

CVE-2026-5078: morgan vulnerable to Log Forging via unneutralized control characters in :remote-user. Affects morgan versions >= 1.2.0, < 1.11.0. Fixed in 1.11.0. 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Morgan is a popular logging middleware for Node.js applications, designed to simplify the process of logging HTTP requests. It provides various logging formats and is widely used in web applications to maintain access logs. However, a vulnerability has been identified in Morgan that allows attackers to manipulate log entries through crafted HTTP headers, compromising the integrity of the logs.

Vulnerability Detail

The vulnerability arises from Morgan's handling of the ':remote-user' token, which extracts the Basic auth username from the 'Authorization' header. This token does not neutralize control characters, allowing an attacker to inject CR/LF characters into the logs. As a result, an attacker can forge log lines, disrupting the one-request-per-line structure of access logs. This could lead to confusion in log analysis and potential exploitation of the logs for malicious purposes.

How To Fix

Latest published version: 1.12.1 as of 23 Oct 2026

npm install morgan@1.12.1

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.11.0

This is the first release that contains the fix.

npm install morgan@1.11.0

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

Workaround

As a temporary workaround, users can avoid using the ':remote-user' token in their custom log format. For example, you can define a custom format without ':remote-user' as follows: '

app.use(morgan(':method :url :status :res[content-length] - :response-time ms'));

'. This will prevent the injection of unneutralized control characters into the logs.

Conclusion

The CVE-2026-5078 vulnerability in the Morgan logging middleware poses a risk of log forgery due to unneutralized control characters in the ':remote-user' token. Users are advised to upgrade to version 1.11.0 or implement workarounds to mitigate the risk. Regular monitoring for vulnerabilities using tools like Vulert can help maintain application security.

See every vulnerability recorded for morgan →

Share this vulnerability

FAQ

CVE-2026-5078 is a vulnerability in the Morgan logging middleware that allows attackers to forge log entries by injecting control characters into the logs.

If your application uses Morgan for logging and is vulnerable, attackers can manipulate log entries, potentially leading to misleading logs and security issues.

Versions of Morgan from 1.2.0 up to 1.10.1 are affected by this vulnerability.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. Check your application with the Vulert playground at Vulert Scanner without needing to sign up.

The CVSS score of this vulnerability is 5.3, indicating a moderate severity level.

Related vulnerabilities

Recent vulnerabilities recorded for morgan.

How To Fix

Latest published version: 1.12.1 as of 23 Oct 2026

npm install morgan@1.12.1

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.11.0

This is the first release that contains the fix.

npm install morgan@1.11.0

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