Skip to main content
Vulnerability Database/CVE-2026-106512

CVE-2026-106512: CakeResponse Header Injection XSS Vulnerability

CVE-2026-106512 is a header injection XSS flaw in CakeResponse::download() that allows attackers to execute malicious scripts through crafted filenames. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-106512 Overview

CVE-2026-106512 is a header injection vulnerability in the CakeResponse::download() method located in lib/Cake/Network/CakeResponse.php, used by MISP (Malware Information Sharing Platform). The method constructs a Content-Disposition header by interpolating a caller-supplied filename into a quoted string without sanitization. An authenticated user who can upload or name an attachment with a crafted filename can trigger stored cross-site scripting (XSS) when another user views the affected page. The flaw affects all callers of CakeResponse::download(), including attribute downloads, proposal downloads, and restSearch exports.

Critical Impact

An authenticated attacker can store malicious filenames that result in stored XSS execution on the application origin, enabling session hijacking, data exfiltration, and unauthorized actions on behalf of victim users.

Affected Products

  • MISP sachertortephp (CakePHP fork used by MISP)
  • lib/Cake/Network/CakeResponse.php — download() method
  • All MISP features invoking CakeResponse::download() (attribute downloads, proposal downloads, restSearch exports)

Discovery Timeline

  • 2026-10-06 - CVE-2026-106512 published to NVD
  • 2026-10-06 - Last updated in NVD database

Technical Details for CVE-2026-106512

Vulnerability Analysis

The CakeResponse::download($filename) method emits an HTTP response header of the form Content-Disposition: attachment; filename="$filename" without validating or escaping the supplied value. Two injection paths exist in the unpatched code. First, embedded C0 control characters such as carriage return (CR) or line feed (LF) cause PHP to refuse to emit the header entirely, silently dropping the attachment disposition. The response body then renders inline on the application origin using its own Content-Type (for example, text/html for an .html filename). Second, a double-quote character terminates the quoted-string value early, enabling injection of additional Content-Disposition parameters. The CWE-20 (Improper Input Validation) classification applies to both vectors.

Root Cause

The root cause is the direct string interpolation of untrusted input into a structured HTTP header value. The download() method applied no filtering for control characters and no escaping of the double-quote and backslash characters required to safely terminate a quoted-string header parameter per RFC 6266.

Attack Vector

An authenticated user creates an attachment, attribute, or proposal with a filename that contains CR/LF or a double-quote. When another authenticated user visits a page that triggers the download, the crafted filename reaches CakeResponse::download(). For the CR/LF path, the Content-Disposition header is suppressed and the HTML or JavaScript body executes inline. The commit message notes this is reachable even with download_attachments_on_load enabled, so the victim only needs to view the affected page.

php
// Patch 1 - Strip control characters from download filenames
// Source: https://github.com/MISP/sachertortephp/commit/afbc551aa6b8aedb87dfa1223a388e9a3178abfd
  * @return void
  */
 	public function download($filename) {
+		// Strip control characters: a CR/LF in the name makes PHP refuse to
+		// emit the whole header, which would silently drop the attachment
+		// disposition and let the body render inline.
+		$filename = preg_replace('/[\\x00-\\x1F\\x7F]/', '', (string)$filename);
 		$this->header('Content-Disposition', 'attachment; filename="' . $filename . '"');
 	}
php
// Patch 2 - Escape the quoted-string so a quote in the name cannot inject extra parameters
// Source: https://github.com/MISP/sachertortephp/commit/e2c80021729611922817a57d2317b2ffa7ed1439
 		// emit the whole header, which would silently drop the attachment
 		// disposition and let the body render inline.
 		$filename = preg_replace('/[\\x00-\\x1F\\x7F]/', '', (string)$filename);
+		// Escape the quoted-string so a quote in the name cannot inject extra
+		// Content-Disposition parameters.
+		$filename = addcslashes($filename, '"\\');
 		$this->header('Content-Disposition', 'attachment; filename="' . $filename . '"');
 	}

Detection Methods for CVE-2026-106512

Indicators of Compromise

  • Attachment, attribute, or proposal records whose filename field contains byte values in the range 0x00–0x1F or 0x7F (control characters including CR/LF).
  • Filenames containing unescaped double-quote (") or backslash (\) characters.
  • HTTP responses to MISP download endpoints that lack a Content-Disposition header but return a renderable Content-Type such as text/html.
  • Audit log entries showing attachment creation followed by views from other authenticated accounts.

Detection Strategies

  • Query the MISP database for Attribute, ShadowAttribute, and attachment records with filenames matching the regular expression /[\\x00-\\x1F\\x7F"\\]/.
  • Inspect reverse proxy or web server logs for download endpoint responses missing Content-Disposition headers.
  • Review restSearch export requests and attribute download requests for unusual filename parameters.

Monitoring Recommendations

  • Alert on any MISP download endpoint response served with Content-Type: text/html instead of a binary MIME type.
  • Monitor for creation of attributes or proposals by low-privilege users followed by rapid access from distinct sessions.
  • Capture and retain full HTTP response headers for MISP download endpoints to support retrospective hunting.

How to Mitigate CVE-2026-106512

Immediate Actions Required

  • Apply upstream commits afbc551aa6 and e2c80021729611922817a57d2317b2ffa7ed1439 to lib/Cake/Network/CakeResponse.php.
  • Audit existing attachments, attributes, and proposals for filenames containing control characters, double-quotes, or backslashes and remediate affected records.
  • Rotate session cookies and API keys for users who may have viewed malicious attachments.

Patch Information

Two security patches resolve the issue in the MISP sachertortephp repository. The first patch, GitHub Commit afbc551aa6, strips C0 control characters from the filename using preg_replace('/[\\x00-\\x1F\\x7F]/', '', ...). The second patch, GitHub Commit e2c8002172, escapes the quoted-string value with addcslashes($filename, '"\\') to prevent parameter injection. Both patches must be applied together.

Workarounds

  • Restrict attachment, attribute, and proposal creation to trusted users until patches are applied.
  • Deploy a web application firewall (WAF) rule that strips or rejects responses from MISP download endpoints lacking a Content-Disposition header.
  • Add a reverse-proxy filter that normalizes outbound Content-Disposition headers and enforces a safe filename character set.
bash
# Apply both upstream security patches
cd /var/www/MISP
git fetch origin
git cherry-pick afbc551aa6b8aedb87dfa1223a388e9a3178abfd
git cherry-pick e2c80021729611922817a57d2317b2ffa7ed1439

# Identify stored filenames containing control, quote, or backslash characters
mysql -u misp -p misp -e \
  "SELECT id, event_id, filename FROM attributes \
   WHERE filename REGEXP '[[:cntrl:]\"\\\\]';"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.