CodiMD Content Security Policy Bypass Vulnerability Allowing Cross-Site Scripting

Vulnerability

A vulnerability exists in CodiMD versions through 2.5.4, where the Content Security Policy (CSP) intended to protect against Cross-Site Scripting (XSS) in uploaded SVG files can be bypassed. This issue arises in scenarios involving different-origin file storage, such as AWS S3. While it may be considered user error to host untrusted JavaScript on AWS without proper CSP headers, the vulnerability highlights a flaw in CodiMD's handling of file uploads and CSP enforcement.

Impact

Exploitation of this vulnerability allows for stored Cross-Site Scripting, where uploaded SVG files containing malicious JavaScript are executed when the file is accessed.

Reproduction

The vulnerability can be reproduced by uploading an SVG file with embedded JavaScript to a CodiMD instance that stores files on a different origin, such as AWS S3. After uploading the file, accessing it through the application will trigger the XSS payload. This can be done by logging into the application, creating a new note, and using the image upload feature to send the malicious SVG file.

Added: Jun 9, 2025, 7:46 PM
Updated: Jun 9, 2025, 7:46 PM

Vulnerability Rating

Custom Algorithm
spread
3.4
impact
1.7
exploitability
6.5
remediation
0.0
relevance
0.0
threat
6.4
urgency
2.9
incentive
1.7

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.