Back to skill

Security audit

design-analysis

Security checks for vulnerabilities and agentic risk

Overview

This skill mostly does what it says, but it generates HTML in a way that can run unsafe JavaScript when opened and logs full invocation parameters.

Install only if you trust the design folder, filenames, and any custom section content. Treat generated HTML as active content: do not open or host reports created from untrusted inputs on an authenticated or shared origin, and choose a new output filename to avoid overwriting existing files.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
index.js:566
Finding
Arbitrary JavaScript Execution in Generated HTML Reports<![CDATA[ ## Vulnerability Details **File Location**: `index.js:133`, `index.js:268-269`, and `index.js:566-621` **Vulnerability Type**: Stored cross-site scripting and unsafe HTML generation **Risk Level**: High ### Vulnerable Code ```javascript ${imageFiles.map((file, index) => `<li><span class="highlight">${path.basename(file)}</span> - 第${index + 1}张设计稿</li>` ).join('\n')} ``` ```javascript <meta name="viewport" content="width=${dimensions.width}, height=${dimensions.height}"> <title>${title}</title> ``` ```javascript const pages = ${JSON.stringify(sections, null, 2)}; ``` ```javascript pages.forEach((page, index) => { const pageEl = document.createElement('div'); pageEl.className = 'page'; pageEl.id = `page-${index}`; // 使用绝对路径加载图片 const imagePath = page.image ? `${window.location.pathname.replace(/[^/]*$/, '')}${page.image}` : ''; const imageHtml = imagePath ? `<img src="${imagePath}" alt="${page.title}" onerror="this.parentElement.innerHTML='<div class=\'image-placeholder\' style=\'width:100%;height:800px;background:#e0e0e0;display:flex;align-items:center;justify-content:center;color:#999;font-size:24px;border-radius:8px;\'>图片加载失败</div>'" />` : `<div class="image-placeholder">图片位置: ${page.title}</div>`; pageEl.innerHTML = ` <div class="page-content"> <div class="text-section"> <h1>${page.title}</h1> ${page.tags ? page.tags.map(tag => `<span class="tag">${tag}</span>`).join('') : ''} ${page.content} </div> <div class="image-section"> ${imageHtml} </div> </div> `; container.appendChild(pageEl); }); ``` ### Technical Analysis The report generator embeds multiple untrusted values into HTML, HTML attributes, CSS, and an executable inline JavaScript block without context-appropriate encoding or sanitization. These values include: - The report `title` - Cu ...[truncated 3811 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Safely serialize data embedded in HTML** Do not insert raw `JSON.stringify()` output into an executable script block. At minimum, encode HTML-sensitive characters: ```javascript function serializeForInlineScript(value) { return JSON.stringify(value) .replace(/</g, '\\u003C') .replace(/>/g, '\\u003E') .replace(/&/g, '\\u0026') .replace(/\u2028/g, '\\u2028') .replace(/\u2029/g, '\\u2029'); } ``` A safer design is to place encoded JSON in a non-executable `<script type="application/json">` element or a separate JSON resource and parse it explicitly. 2. **Avoid `innerHTML` for ordinary text** Construct the report with DOM APIs and assign untrusted text through `textContent`: ```javascript const heading = document.createElement('h1'); heading.textContent = page.title; ``` Create image elements with `document.createElement('img')` and assign `src` and `alt` properties instead of constructing an HTML attribute string. 3. **Sanitize intentionally supported HTML** If `sections[].content` must support HTML, sanitize it with a maintained allowlist-based HTML sanitizer. Permit only the tags and attributes required for report formatting. Remove: - `<script>` elements - Event-handler attributes such as `onclick` and `onerror` - `javascript:` URLs - Dangerous SVG and MathML content - Embedded frames and active objects - Unapproved external resource URLs If arbitrary HTML is not essential, treat section content as plain text or accept a structured content model instead. 4. **Escape server-generated HTML** Apply HTML text encoding to the report title and generated filename list. Use separate encoders for HTML text, HTML attributes, URLs, CSS values, and JavaScript data. 5. **Validate image names and paths** Require image references to be basenames present in the scanned input set. Reject quotes, control characters, path s ...[truncated 911 chars]

T09 · Insecure Skill Coding Practices

Warning
Location
run.js:24
Finding
Sensitive OpenClaw Context May Be Disclosed Through Unrestricted Parameter Logging<![CDATA[ ## Vulnerability Details **File Location**: `run.js:24-25` **Vulnerability Type**: Sensitive data exposure through application logs **Risk Level**: Medium ### Vulnerable Code ```javascript async function run(params) { console.log('🎨 Design Analysis Skill 启动'); console.log('📥 接收参数:', JSON.stringify(params, null, 2)); try { ``` The wrapper documentation identifies `params.context` as OpenClaw context information: ```javascript * @param {Object} params.context - OpenClaw上下文信息 ``` ### Technical Analysis The Skill serializes and logs the complete `params` object before validating or filtering it. The object may contain the documented OpenClaw context as well as future parameters that are not needed to generate the report. Agent context objects can contain conversation data, internal identifiers, user information, filesystem paths, task metadata, or credentials supplied by an orchestration layer. Logging the entire object creates an unnecessary secondary copy of that information. The call to `JSON.stringify()` is recursive for ordinary enumerable properties, so nested sensitive values can also be disclosed. In deployments where standard output is retained, forwarded to centralized logging, displayed in an administrative interface, or included in diagnostic bundles, users with log access may gain access to information outside the report-generation task. ### Attack Path 1. OpenClaw or another caller invokes `run(params)` with a populated `context` object or another parameter containing sensitive information. 2. Before parameter validation, the wrapper executes: ```javascript JSON.stringify(params, null, 2) ``` 3. The complete serialized object is written to standard output. 4. The runtime, container platform, process manager, or centralized logging service retains or forwards that output. 5. A user or service with access to those logs obtains the sensitive context data. An attacker may also deliberately cause sensitive values t ...[truncated 849 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Remove full-object logging** Do not serialize the entire invocation object. Log only fields required for operational diagnostics: ```javascript console.log('Design Analysis Skill started', { hasInputFolder: Boolean(params.input_folder || params.inputFolder), hasOutputFile: Boolean(params.output_file || params.outputFile), hasCustomSections: Array.isArray(params.sections) }); ``` 2. **Never log Agent context by default** Explicitly omit `params.context`, conversation data, authorization information, tokens, cookies, and user content. 3. **Use allowlist-based structured logging** Construct a new diagnostic object from approved fields instead of attempting to remove known sensitive fields from the original object. 4. **Apply recursive redaction as defense in depth** If broader diagnostic logging is required, recursively redact keys such as: - `authorization` - `token` - `apiKey` - `secret` - `password` - `cookie` - `session` - `credential` - `context` 5. **Restrict and expire logs** Apply least-privilege access controls, encryption at rest, short retention periods, and auditing to runtime and centralized logs. 6. **Add tests** Invoke the wrapper with nested mock secrets and verify that no secret values or context contents appear in captured standard output. ]]>
Vulnerability Patterns
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (14)

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The document title, section headings, usage examples, and sample dialogue are all written as if the skill is to be used in Chinese, including explicit example commands the user should say. Because the file does not offer an opt-in language choice or explain that the skill is intentionally region-specific, this creates a natural-language locale policy concern under the language/locale rule.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The skill description is presented entirely in Chinese and the invocation example also assumes Chinese-language use, with no indication that users may choose another language. Per the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is documented and justified.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The skill instructions and examples are presented entirely in Chinese, which effectively forces a specific language for users without any opt-in or explanation of a region-specific requirement. The policy requires either offering a language/locale choice or clearly documenting why the locale restriction is necessary.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The document declares `lang="zh-CN"`, and the visible UI text throughout the page is Chinese-only, which imposes a specific language/locale on users. Under the stated policy, locale constraints should either provide user opt-in/choice or be clearly documented as justified for a region-specific use case.

Intent-Code Divergence

Medium
Confidence
97% confidence
Finding
The embedded page content states that on mobile the layout automatically switches to a vertical arrangement, but the actual CSS fixes both html/body and page containers to 1920x1280 and provides no media queries or alternate mobile layout rules. This is an active contradiction between the documented behavior presented to users and the implemented behavior.

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
The generated document hard-codes `lang="zh-CN"`, and the surrounding UI text is also fixed in Chinese. This imposes a specific language/locale on all users without any opt-in, selection mechanism, or documented region-specific requirement, which matches the language/locale policy violation criteria.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The comments, status messages, and example invocation text throughout the script are written in Chinese, including user-facing installation and usage guidance. This creates a language/locale restriction for users without offering an alternative language or documenting that the skill is intended only for a Chinese-speaking audience.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
The package description is written entirely in Chinese, indicating a language-specific skill presentation with no opt-in or alternative locale described. Under the policy rules, forcing a specific language without user choice is a natural-language policy concern unless the locale restriction is explicitly justified.

Natural-Language Policy Violations

Medium
Confidence
89% confidence
Finding
The manifest's permission and usage fields are presented only in Chinese, which can impose a single-language experience on users without an explicit opt-in mechanism. The file does not state that the skill is intentionally limited to a Chinese-speaking audience or region-specific workflow.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
This code presents its title, status messages, and errors in Chinese throughout the file, which forces a specific language/locale on users. The policy allows locale constraints only when users are given a choice or when the restriction is clearly documented and justified, neither of which is present here.

Missing User Warnings

Low
Confidence
91% confidence
Finding
This markdown file documents a file-output behavior ('写入UTF-8编码的HTML文件') and earlier examples require an explicit output path, but it does not disclose overwrite risk or advise users to choose a safe destination. For markdown files, omissions around behaviors affecting user data or filesystem state should be flagged when no warning is present.

Missing User Warnings

Low
Confidence
88% confidence
Finding
This markdown file documents a skill that generates and writes an HTML file to a user-specified path via `outputFile`, but it does not warn that running the skill will create or overwrite a local file. For markdown files, user-impacting file modification behavior should be disclosed so users understand the effect on their filesystem.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The document declares `lang="zh-CN"`, and the visible interface text throughout the file is also fixed in Chinese. For an all-file-types policy check, this is a natural-language locale constraint with no visible opt-in, alternative language selection, or justification that the skill is intentionally region-specific.

Natural-Language Policy Violations

Low
Confidence
88% confidence
Finding
The file's natural-language comments, log messages, errors, and CLI usage are presented exclusively in Chinese, with no indication that users can choose another language. This can violate a language/locale policy when a skill is expected to be locale-neutral or user-selectable.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
test.js:60