Skip to content

XSS vulnerability in @react-email/markdown #19

@gtsp233

Description

@gtsp233

Hi, I've found a Cross-Site Scripting (XSS) vulnerability in @react-email/markdown

Vulnerability Details:

  • Severity: High/Critical
  • Description: There's a risk of malicious script execution when the content of the markdown is malicious

Steps to Reproduce:

import React from "react";
import ReactDOM from "react-dom/client";
import { Markdown } from "@react-email/markdown";

function App() {
    return <Markdown>{`<img src='' onError=alert(1) />'`}</Markdown>
}

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<App />);

Suggested Fix or Mitigation:
Since the dependency, markdown parser md-to-react-email": "4.1.0", does not sanitize the markdown output, I'd suggest sanitizing the markdown output using popular libraries like dompurify to make this package safe by default

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions