CVE-2022-31108
What it is
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.
At a glance
- Exploitability
- Can be exploited over the network with a low-privilege account, but needs a user to act. Limited direct impact.
- Exploit odds
- 0.9% chance of exploitation in the next 30 days (EPSS).
- Fix
- A patch, advisory or fixed version is referenced. Upgrade or apply it.
Timeline
- PublishedDisclosed publicly on CVE.org and NVD
- Last updatedMost recent change to the record
Why it ranks here
- Exploited in the wild: no, CISA does not list it.
- Exploit odds: 0.9% in the next 30 days (EPSS).
- Severity: 4.1 MEDIUM (CVSS).
- Fix: a patch or advisory is linked.
Details
- Published
- Last modified
- Exploit probability
- 0.9% · EPSS, next 30 days
- Weakness
- CWE-74
- Record status
- Modified
Affected
- Mermaid Project Mermaid < 9.1.3
Attack profile CVSS 3.1 · 4.1
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- Low
- User interaction
- Required
- Scope
- Changed
- Confidentiality
- Low
- Integrity
- None
- Availability
- None
Raw vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:N/A:N
Is it in your code?
Hand this to your coding agent. It searches your project for the affected products and checks versions. Nothing leaves your machine.
Read https://cve-list.com/agent/cve/CVE-2022-31108.md and follow it. Check whether this project is affected by CVE-2022-31108. Read only. Don't change anything and don't upload my code. Tell me yes, no or not sure, with the file as proof.
Fix and advisories
- https://github.com/mermaid-js/mermaid/commit/0ae1bdb61adff1cd485caff8c62ec6b8ac57b225
- https://github.com/mermaid-js/mermaid/security/advisories/GHSA-x3vm-38hw-55wf
- https://github.com/mermaid-js/mermaid/commit/0ae1bdb61adff1cd485caff8c62ec6b8ac57b225
- https://github.com/mermaid-js/mermaid/security/advisories/GHSA-x3vm-38hw-55wf
References
- https://github.com/mermaid-js/mermaid/commit/0ae1bdb61adff1cd485caff8c62ec6b8ac57b225
- https://github.com/mermaid-js/mermaid/security/advisories/GHSA-x3vm-38hw-55wf
- https://github.com/mermaid-js/mermaid/commit/0ae1bdb61adff1cd485caff8c62ec6b8ac57b225
- https://github.com/mermaid-js/mermaid/security/advisories/GHSA-x3vm-38hw-55wf