morgan vulnerable to Log Injection via unescaped double quote in quoted log fields
morgan is an HTTP request logger middleware for Node.js. In versions before 1.12.1, its escapeLogField() function does not escape the double quote character, which delimits the quoted fields of the Apache combined log format that morgan emits. An unauthenticated remote attacker who controls a value written to a quoted field, such as the User-Agent or Referer header, can include a double quote to close that field early, so a log consumer that parses the log by field position reads attacker-supplied text as the following field. In the built-in formats this makes the recorded value differ from the value that was sent, and in custom formats that quote an attacker-controlled token before a server-controlled one it can forge values such as the response status. No newline is injected, so record separation stays intact. The issue is fixed in morgan 1.12.1, which escapes the double quote. Users should upgrade to morgan 1.12.1 or later.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2026-87859
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 8 Nov 2026, 03:32 UTC · Revision 1
Source evidence
morgan vulnerable to Log Injection via unescaped double quote in quoted log fields
core-osv · Original sourcePublished 11 Sept 2026, 09:15 UTC
morgan is an HTTP request logger middleware for Node.js. In versions before 1.12.1, its escapeLogField() function does not escape the double quote character, which delimits the quoted fields of the Apache combined log format that morgan emits. An unauthenticated remote attacker who controls a value written to a quoted field, such as the User-Agent or Referer header, can include a double quote to close that field early, so a log consumer that parses the log by field position reads attacker-supplied text as the following field. In the built-in formats this makes the recorded value differ from the value that was sent, and in custom formats that quote an attacker-controlled token before a server-controlled one it can forge values such as the response status. No newline is injected, so record separation stays intact. The issue is fixed in morgan 1.12.1, which escapes the double quote. Users should upgrade to morgan 1.12.1 or later.
osv:CVE-2026-87859
Complete source record
{
"id": "8d7a33436534c8bdca9d12c15ac65b8fb3ab200976b2e766162c8b3a66514af8",
"url": "https://osv.dev/vulnerability/CVE-2026-87859",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "morgan vulnerable to Log Injection via unescaped double quote in quoted log fields",
"summary": "morgan is an HTTP request logger middleware for Node.js. In versions before 1.12.1, its escapeLogField() function does not escape the double quote character, which delimits the quoted fields of the Apache combined log format that morgan emits. An unauthenticated remote attacker who controls a value written to a quoted field, such as the User-Agent or Referer header, can include a double quote to close that field early, so a log consumer that parses the log by field position reads attacker-supplied text as the following field. In the built-in formats this makes the recorded value differ from the value that was sent, and in custom formats that quote an attacker-controlled token before a server-controlled one it can forge values such as the response status. No newline is injected, so record separation stays intact. The issue is fixed in morgan 1.12.1, which escapes the double quote. Users should upgrade to morgan 1.12.1 or later.",
"evidence": "osv:CVE-2026-87859",
"products": [],
"severity": "medium",
"structured": {
"id": "CVE-2026-87859",
"aliases": [
"CVE-2026-87859",
"GHSA-9f6g-j8ch-79g4"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/expressjs/morgan",
"type": "GIT",
"events": [
{
"introduced": "0"
},
{
"fixed": "b1272e70812dbc504321eeb5a43d14b0822c150d"
}
],
"database_specific": {
"extracted_events": [
{
"range": [
{
"introduced": "0"
},
{
"fixed": "1.12.1"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StandardRange"
},
{
"range": [
{
"introduced": "0"
},
{
"fixed": "1.12.1"
}
],
"source": "DESCRIPTION"
}
]
}
}
],
"versions": [
"1.12.0",
"1.11.0",
"1.10.0",
"1.9.1",
"1.9.0",
"1.8.2",
"1.8.1",
"1.8.0",
"1.7.0",
"1.6.1",
"1.6.0",
"1.5.3",
"1.5.2",
"1.5.1",
"1.5.0",
"1.4.1",
"1.4.0",
"1.3.2",
"1.3.1",
"1.3.0",
"1.2.3",
"1.2.2",
"1.2.1",
"1.2.0",
"1.1.1",
"1.1.0",
"1.0.1",
"1.0.0"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-87859.json"
}
}
],
"modified": "2026-10-28T02:30:53.312382868Z",
"provider": "osv",
"references": [
"https://cna.openjsf.org/security-advisories.html",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/87xxx/CVE-2026-87859.json",
"https://github.com/expressjs/morgan/security/advisories/GHSA-9f6g-j8ch-79g4",
"https://nvd.nist.gov/vuln/detail/CVE-2026-87859"
],
"provider_metadata": {
"cwe_ids": [
"CWE-117"
],
"cna_assigner": "openjs",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/87xxx/CVE-2026-87859.json"
}
},
"related_cves": [
{
"value": "CVE-2026-87859",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 522241,
"published_at": "2026-09-11T09:15:19.109+00:00"
}