// For flags

CVE-2022-31108

Arbitrary `CSS` injection into the generated graph affecting the container HTML in mermaid.js

Severity Score

6.1
*CVSS v3.1

Exploit Likelihood

*EPSS

Affected Versions

*CPE

Public Exploits

1
*Multiple Sources

Exploited in Wild

-
*KEV

Decision

-
*SSVC
Descriptions

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.

Mermaid es una herramienta de diagramación y gráficos basada en JavaScript que usa definiciones de texto inspiradas en Markdown y un renderizador para crear y modificar diagramas complejos. Un atacante es capaz de inyectar "CSS" arbitrario en el gráfico generado permitiéndole cambiar el estilo de los elementos fuera del gráfico generado, y potencialmente exfiltrar información confidencial usando selectores "CSS" especialmente diseñados. El siguiente ejemplo muestra cómo un atacante puede filtrar el contenido de un campo de entrada forzando el atributo "value" un carácter a la vez. Siempre que haya una coincidencia real, el navegador hará una petición "http" para "cargar" una imagen de fondo que permitirá al atacante saber cuál es el valor del carácter. Este problema puede conllevar a una "Divulgación de información" por medio de selectores CSS y funciones capaces de generar peticiones HTTP. Esto también permite a un atacante cambiar el documento de manera que puede llevar a un usuario a llevar a cabo acciones no deseadas, como hacer clic en un enlace, etc. Este problema ha sido resuelto en versión 9.1.3. Es recomendado a usuarios actualizar. Los usuarios que no puedan actualizarse deben asegurarse de que las entradas del usuario sean escapadas apropiadamente antes de insertarlas en bloques CSS

*Credits: N/A
CVSS Scores
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None
Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
None
Availability
None
Attack Vector
Network
Attack Complexity
Medium
Authentication
None
Confidentiality
Partial
Integrity
Partial
Availability
None
* Common Vulnerability Scoring System
SSVC
  • Decision:-
Exploitation
-
Automatable
-
Tech. Impact
-
* Organization's Worst-case Scenario
Timeline
  • 2022-05-18 CVE Reserved
  • 2022-06-28 CVE Published
  • 2024-01-19 EPSS Updated
  • 2024-08-03 CVE Updated
  • 2024-08-03 First Exploit
  • ---------- Exploited in Wild
  • ---------- KEV Due Date
CWE
  • CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
  • CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
CAPEC
Affected Vendors, Products, and Versions
Vendor Product Version Other Status
Vendor Product Version Other Status <-- --> Vendor Product Version Other Status
Mermaid Project
Search vendor "Mermaid Project"
Mermaid
Search vendor "Mermaid Project" for product "Mermaid"
>= 8.0.0 < 9.1.3
Search vendor "Mermaid Project" for product "Mermaid" and version " >= 8.0.0 < 9.1.3"
node.js
Affected