Cross-Site Scripting Vulnerability in react-marked-markdown

react-marked-markdown Updated 02 Oct 2025

Summary

01/09/2020
HIGH
No i
High
Not published

GHSA-m7qm-r2r5-f77q: Cross-Site Scripting in react-marked-markdown. Affects react-marked-markdown versions >= 0.0.0. No fix is published. 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

react-marked-markdown is an npm package that provides a Markdown preview component for React applications. It allows users to render Markdown content in a preview format. The package is widely used in web development projects to display formatted text and content. However, all versions of react-marked-markdown are vulnerable to a cross-site scripting (XSS) attack when user input is provided to the href attribute.

Vulnerability Detail

The vulnerability in react-marked-markdown arises from a lack of proper input sanitization in the href attribute. When user input is allowed in href values, an attacker can inject malicious JavaScript code that will be executed in the context of the user's browser. This can lead to various security risks, such as stealing sensitive information, performing actions on behalf of the user, or redirecting the user to malicious websites. The vulnerability has been assigned a severity rating of HIGH and is classified under CWE-79 (Cross-Site Scripting).

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a workaround, you can manually sanitize the user input before passing it to react-marked-markdown. One way to achieve this is by using a library like DOMPurify to sanitize the href values. Here's an example of how you can implement this workaround:

import React from 'react';
import ReactDOM from 'react-dom';
import { MarkdownPreview } from 'react-marked-markdown';
import DOMPurify from 'dompurify';

const sanitizedHref = DOMPurify.sanitize('[XSS](javascript: alert`1`)');

ReactDOM.render(
  <MarkdownPreview
    markedOptions={{ sanitize: true }}
    value={sanitizedHref}
  />, 
  document.getElementById('root')
);

By using DOMPurify, you can ensure that any potentially malicious code is removed from the href value before rendering it in react-marked-markdown.

Conclusion

The react-marked-markdown package is vulnerable to a cross-site scripting (XSS) attack when user input is allowed in href values. This can lead to various security risks and compromise the integrity of the application. It is recommended to avoid using this module until a fix is available or to implement additional input validation and sanitization measures. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for react-marked-markdown →

Share this vulnerability

FAQ

react-marked-markdown is an npm package that provides a Markdown preview component for React applications. It allows users to render Markdown content in a preview format.

Cross-Site Scripting (XSS) is a type of security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users. This can lead to various security risks, such as stealing sensitive information or performing actions on behalf of the user.

The vulnerability in react-marked-markdown occurs due to a lack of proper input sanitization in the href attribute. When user input is allowed in href values, an attacker can inject malicious JavaScript code that will be executed in the user's browser.

The potential risks of this vulnerability include the theft of sensitive information, unauthorized actions performed on behalf of the user, and redirection to malicious websites.

Currently, there is no fix available for this vulnerability in react-marked-markdown. It is recommended to avoid using this module if you allow user input into href values.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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