T08 · Insecure Dependencies
- Location
SKILL.md:196- Finding
Unpinned Mermaid CLI Package Is Downloaded and Executed
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 196, 254, and 280
Vulnerability Type: Unpinned third-party dependency execution
Risk Level: MediumVulnerable Code
At line 196:
bash npx @mermaid-js/mermaid-cli -i diagram.mmd -o diagram.pngAt line 254:
text A: Use the `mermaid-cli` tool: `npx @mermaid-js/mermaid-cli -i input.mmd -o output.png`.At line 280:
text | mermaid-cli | Optional tool | No | `npm install -g @mermaid-js/mermaid-cli` |Technical Analysis
The documented
npxcommand identifies@mermaid-js/mermaid-cliwithout an exact version. Depending on the local npm configuration and cache state,npxcan retrieve the current package release and execute its command. The global installation instruction is likewise unpinned.As a result, the code executed during image export is not immutable relative to the reviewed Skill. The effective package and transitive dependency graph can change after this audit. If a future upstream release, maintainer account, package publication process, or transitive dependency is compromised, invoking the documented command could execute altered code locally.
The package name is consistent with the stated Mermaid-export functionality, and the reviewed file contains no evidence that the package is currently malicious. The risk arises from executing an unpinned, remotely retrieved dependency rather than from a confirmed malicious payload.
Attack Path
- A user or agent follows the Skill instructions to export a Mermaid diagram as an image.
- The agent invokes
npx @mermaid-js/mermaid-clior globally installs the package without selecting an audited version. - npm resolves the package and its dependency tree at execution or installation time.
- If the resolved release or one of its dependencies has been compromised, malicious package code executes during installation or CLI invocation.
- That code operate ...[truncated 854 chars]
- Remediation
View remediation
Remediation Suggestions
-
Pin
@mermaid-js/mermaid-clito an exact, reviewed version rather than relying on the latest available release:bash npm install --save-dev --save-exact @mermaid-js/mermaid-cli@<audited-version> -
Commit and enforce a lockfile, then use a reproducible installation command such as:
bash npm ci -
Invoke the locally installed binary without permitting
npxto download missing packages:bash npx --no-install mmdc -i diagram.mmd -o diagram.pngAlternatively, invoke
./node_modules/.bin/mmdcdirectly. -
Remove the global installation recommendation. Keep the dependency isolated to the project or to a disposable export environment.
-
Run Mermaid rendering in a restricted sandbox or container with:
- No unnecessary secrets in environment variables.
- Minimal filesystem permissions.
- Restricted outbound network access.
- A non-privileged user.
- Resource and execution-time limits.
-
Review the pinned package and lockfile periodically using dependency auditing and provenance or integrity verification mechanisms.
-
Limit the Skill's
execpermission to explicit image-export requests. Mermaid text generation and editing should not require shell execution.
-
