T09 · Insecure Skill Coding Practices
- Location
SKILL.md:265- Finding
Unsafe Mermaid Rendering Configuration Permits Active Content
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:265-271
Vulnerability Type: Unsafe client-side rendering configuration
Risk Level: Mediumjavascript mermaid.initialize({ startOnLoad: false, maxTextSize: 99999, fontSize: 14, securityLevel: 'loose' });Technical Analysis
The documented Mermaid configuration explicitly sets
securityLeveltoloose. This mode relaxes Mermaid's restrictions on HTML labels, links, and interactive content. If diagram definitions originate from users, repositories, generated model output, or other untrusted sources, a crafted definition may introduce active or deceptive content into the page hosting the rendered diagram.The configuration also raises
maxTextSizeto99999, substantially increasing the amount of diagram text Mermaid will process. This weakens a resource-consumption safeguard and may amplify client-side denial-of-service risk from unusually large or complex diagrams.Exploitation requires an application or user to adopt this example and render attacker-controlled Mermaid content without separate validation or sanitization. This is an insecure documented configuration rather than evidence of an existing deployed application compromise.
Attack Path
- A developer adopts the HTML rendering configuration from
SKILL.md. - The resulting page accepts or renders Mermaid definitions from an untrusted source.
- An attacker supplies a crafted diagram containing unsafe HTML or interactive link content, or a very large and complex diagram.
- Mermaid renders the input under
securityLevel: 'loose'. - Depending on the Mermaid version and browser integration, the crafted content may create active page content, deceptive navigation, or DOM interactions in the hosting page.
- Alternatively, oversized diagram input may consume excessive browser CPU or memory and impair page availability.
Impact Assessment
Successful exploitation ...[truncated 674 chars]
- A developer adopts the HTML rendering configuration from
- Remediation
View remediation
Remediation Suggestions
- Replace
securityLevel: 'loose'withsecurityLevel: 'strict'for ordinary rendering of untrusted or generated diagrams. - If stronger isolation is required, use Mermaid's sandboxed rendering mode or render diagrams inside a properly sandboxed iframe with the minimum necessary capabilities.
- Restore a conservative
maxTextSizelimit based on expected diagram sizes and reject oversized input before rendering. - Validate Mermaid input against an allowed subset of diagram syntax before processing it.
- Disable clickable links when they are unnecessary. Where links are required, permit only approved
httpsorigins and reject dangerous or unexpected URI schemes. - Apply a restrictive Content Security Policy that limits script sources, navigation targets, framing, and inline execution.
- Pin Mermaid to a reviewed, supported version and apply security updates promptly.
- Document that
loosemode must never be used with user-controlled, repository-controlled, or otherwise untrusted diagram content.
- Replace
