SecurityContext

CVE-2022-31108: Mermaid - CSS Injection

  • Cve: CVE-2022-31108
  • Name: Mermaid - CSS Injection
  • Description: Mermaid is a JavaScript based diagramming and charting tool that uses Markdown-inspired text definitions and a renderer to create and modify complex diagrams. An attacker is able to inject arbitrary `CSS` into the generated graph allowing them to change the styling of elements outside of the generated graph, and potentially exfiltrate sensitive information by using specially crafted `CSS` selectors. The following example shows how an attacker can exfiltrate the contents of an input field by bruteforcing the `value` attribute one character at a time. Whenever there is an actual match, an `http` request will be made by the browser in order to "load" a background image that will let an attacker know what's the value of the character. This issue may lead to `Information Disclosure` via CSS selectors and functions able to generate HTTP requests. This also allows an attacker to change the document in ways which may lead a user to perform unintended actions, such as clicking on a link, etc. This issue has been resolved in version 9.1.3. Users are advised to upgrade. Users unable to upgrade should ensure that user input is adequately escaped before embedding it in CSS blocks.
  • Impact: Attackers can exfiltrate sensitive data and manipulate document actions via CSS injection, leading to information disclosure and potential user deception.
  • Remediation: Upgrade to version 9.1.3 or later, or ensure user input is properly escaped before embedding in CSS.
  • Vulnerability impact: information_disclosure
  • Requirement type: user_interaction
  • Requirements: Attacker needs to inject malicious CSS into diagram definitions
  • Labels source: projectdiscovery
  • Severity: medium
  • Cvss score: 6.1
  • Cvss vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
  • Epss score: 0.00929
  • Epss percentile: 0.61301
  • Assignee: [email protected]
  • Published at: 2022-06-28T19:15:09Z
  • Age in days: 1610
  • Modified at: 2026-06-17T04:44:48Z
  • Patch available: yes
  • Public exploits total: 1
  • References total: 2
  • Products total: 1
  • Oss: yes
  • Projects total: 1
  • Advisory url: https://nvd.nist.gov/vuln/detail/CVE-2022-31108
  • Nvd status: modified
  • Checked, none or zero: known exploited entries, nuclei templates, public exploits capped, rejected by nvd
  • Not known: vulnerability type, hackerone

Cwe

IdName
CWE-74Improper Neutralization of Special Elements in Output Used by a Downstream Component
CWE-79Improper Neutralization of Input During Web Page Generation

Public exploits

UrlSourceAdded date
https://github.com/mermaid-js/mermaid/security/advisories/GHSA-x3vm-38hw-55wfnvd2022-06-28

References

UrlSourceTags
https://github.com/mermaid-js/mermaid/commit/0ae1bdb61adff1cd485caff8c62ec6b8ac57b225nvdPatch, Third Party Advisory
https://github.com/mermaid-js/mermaid/security/advisories/GHSA-x3vm-38hw-55wfnvdExploit, Third Party Advisory

Products

ProductAffectedPlatform boundSourcesUrl
mermaid_project:mermaid>= 8.0.0, < 9.1.3nonvd/v1/products/mermaid_project/mermaid

Projects

RepositoryLink kindsIndexedUrl
mermaid-js/mermaidcommit, fix, package, security_advisoryyes/v1/repositories/mermaid-js/mermaid

Index

  • Repositories: 7
  • Repositories high signal: 5
  • Packages: 1

Exploitation

  • Public exploit: yes
  • Public exploit count: 1
  • Public exploit first date: 2022-06-28
  • Remote: yes
  • Checked, none or zero: known exploited, known exploited by, exploitation seen, initial access, authentication required
  • Not known: known exploited since, vulncheck known exploited since, nuclei template, initial access since, hackerone reports, exposed hosts