Morgan (Nodejs), Log Injection Incomplete Fix, CVE-2026-5078 (Medium) -DC-Sep2026-2275

Listen to this Post

The vulnerability arises from an incomplete patch for CVE-2026-5078 within the Morgan HTTP request logger middleware for Node.js. Morgan is widely used to record incoming request details such as URL, headers, user-agent, referrer, and Basic Authentication username into access logs. The initial fix in version 1.11.0 aimed to neutralize dangerous C0 control characters (e.g., newlines, carriage returns), the DEL character, and backslashes to prevent log forgery. However, the developers overlooked three specific Unicode code points: U+0085 (Next Line, NEL), U+2028 (Line Separator), and U+2029 (Paragraph Separator). These characters are considered valid `obs-text` within HTTP header values per the RFC 7230 specification, meaning they can be transmitted by an attacker in ordinary request headers without violating protocol rules. Attackers can inject these separators into the request URL (:url token), the `User-Agent` or `Referer` headers, arbitrary custom headers accessed via :req

</code>, or the Basic Auth username (<code>:remote-user</code> token). When Morgan processes the request and writes the access log, it does not escape or strip these Unicode line separators; they are written directly to the log file as raw bytes. The critical impact occurs downstream: many modern log aggregation tools, SIEM systems, and script-based log parsers are ECMAScript-aware or Unicode-aware and interpret U+2028 and U+2029 as valid line terminators. Consequently, a single physical log line is split into multiple logical records at the injection point. This allows an attacker to craft a request that injects arbitrary fake log entries into the stream, complete with fabricated timestamps, status codes, or client IPs. The affected built-in log formats include <code>combined</code>, <code>common</code>, <code>default</code>, and <code>short</code>, alongside any custom format that uses the vulnerable tokens. Because the vulnerable tokens are core to access logging—the URL and headers are nearly always logged—there is no practical configuration-based workaround. The incomplete fix demonstrates that escaping only a subset of control characters is insufficient; proper handling must address all Unicode line-terminating code points. The only complete remediation is to upgrade to version 1.12.0, which fully escapes these Unicode separators.

<h2 style="color: blue;">DailyCVE Form:</h2>

Platform: Morgan Node.js
Version: Versions < 1.12.0
Vulnerability: Log Injection Forge
Severity: Medium
date: 2026-09-09

<h2 style="color: blue;">Prediction: Fixed 2026-09-15</h2>

<h2 style="color: blue;">What Undercode Say:</h2>

[bash]
Verify vulnerable version
npm list morgan
Test injection via User-Agent with NEL (U+0085) using printf
printf "GET / HTTP/1.1\r\nHost: localhost\r\nUser-Agent: test\xc2\x85injected\r\n\r\n" | nc localhost 3000
Test with LINE SEPARATOR (U+2028) in URL
curl -v "http://localhost:3000/%E2%80%A8fake_log_entry?q=1"
Test with PARAGRAPH SEPARATOR (U+2029) in Referer header
curl -H "Referer: http://attacker.com/%E2%80%A9 200 0.001" http://localhost:3000/
Simulate log split – check access.log for multiple lines
tail -f access.log | cat -A

Exploit: (Educational Purposes!)

An attacker sends a request with the `User-Agent` header containing `%E2%80%A8` (URL-encoded LINE SEPARATOR) followed by a forged log line. For example, the raw header value becomes User-Agent: Mozilla/5.0%E2%80%A8 127.0.0.1 - admin [10/Oct/2026:13:55:36] "GET /admin HTTP/1.1" 200 1234. When Morgan logs this, the physical record appears as a normal entry, but the `U+2028` causes a downstream parser to treat the text after the separator as a brand new log record. This forged entry can show a successful administrative access, inject false metrics, or hide real attack patterns by corrupting the log chronology. The same technique works with `:url` by requesting `/%E2%80%A9STATUS_500` to inject fabricated error logs, or using Basic Auth username with `%C2%85` to simulate different remote users.

Protection: from this CVE

Immediately upgrade Morgan to version 1.12.0 or later using npm install [email protected]. If upgrading is not feasible, implement a custom logging filter that strips or replaces all Unicode line separator characters (U+0085, U+2028, U+2029) from every token value before writing to the log. Additionally, configure your log shipper (e.g., Filebeat, Fluentd) to treat these characters as literal data rather than record separators, though this is less reliable. Monitor access logs for the presence of raw \x85, \xe2\x80\xa8, or `\xe2\x80\xa9` byte sequences to detect active exploitation attempts.

Impact:

Successful exploitation allows an external attacker to forge arbitrary log entries, leading to log poisoning and severe integrity issues for security monitoring. This can bypass intrusion detection rules that rely on log analysis, poison statistical dashboards, create false audit trails, or cover up malicious activity by injecting misleading entries that distract SOC analysts. In high-security environments, forged logs can compromise forensic investigations and regulatory compliance audits, as the access log can no longer be trusted as a reliable record of client interactions.

🎯Let’s Practice Exploiting & Learn Patching For Free:

🎓 Live Courses & Certifications:

Join Undercode Academy for Verified Certifications

🚀 Request a Custom Project:

Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top