Back to skill

Security audit

codebase-to-course-cn

Security checks for vulnerabilities and agentic risk

Overview

This is a legitimate Chinese code-to-course generator, but generated interactive HTML may run injected browser code from untrusted repository content.

Install only if you are comfortable with a skill reading the target repository and writing a generated course directory. Use trusted repositories, inspect the generated module HTML before opening index.html, and avoid generating/opening courses from untrusted repos until the innerHTML sinks are replaced or strict escaping/sanitization is added.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
references/main.js:175
Finding

Stored HTML and Script Injection in Generated Course Content

Content
View full analysis
{ const selected = $('.quiz-option.selected', q); const feedback = $('.quiz-feedback', q); const correct = q.dataset.correct; const rightExp = q.dataset.explanationRight || ''; const wrongExp = q.dataset.explanationWrong || ''; if (!selected) { feedback.textContent = 'Pick an answer first!'; feedback.className = 'quiz-feedback show warning'; return; } $$('.quiz-option', q).forEach(o => o.disabled = true); if (selected.dataset.value === correct) { selected.classList.add('correct'); feedback.innerHTML = 'Exactly! ' + rightExp; feedback.className = 'quiz-feedback show success'; } else { selected.classList.add('incorrect'); const correctBtn = $(`.quiz-option[data-value="${correct}"]`, q); if (correctBtn) correctBtn.classList.add('correct'); feedback.innerHTML = 'Not quite. ' + wrongExp; feedback.className = 'quiz-feedback show error'; } }); }; ``` The bug-challenge engine contains equivalent unsafe sinks: ```javascript window.checkBugLine = function (el, isCorrect) { const challenge = el.closest('.bug-challenge'); const feedback = $('.bug-feedback', challenge); if (isCorrect) { el.classList.add('correct'); feedback.innerHTML = 'Found it! ' + (el.dataset.explanation || ''); feedback.className = 'bug-feedback show success'; $$('.bug-line', challenge).forEach(l => l.style.pointerEvents = 'none'); } else { el.classList.add('incorrect'); feedback.inner ...[truncated 3013 chars]
Remediation
View remediation
` in text nodes and code blocks. - Escape both quotation marks when inserting values into attributes. - Serialize `data-steps` through a JSON encoder rather than manually constructing attributes. - Validate and allowlist URL schemes before generating links. - Never copy repository text directly into raw HTML. 5. Treat repository source, comments, documentation, filenames, commit metadata, and configuration as untrusted input, including repositories explicitly selected by the user. 6. Add adversarial regression tests using payloads containing: - Closing tags such as `` and ``. - Single and double quotation marks. - Event-handler attributes. - `javascript:` URLs. - SVG and image-based script-capable markup. - Malformed JSON and HTML attribute boundaries. 7. Consider adding a restrictive Content Security Policy to generated courses. To make that effective, first replace inline `onclick` handlers with `addEventListener`, then disallow inline script execution and unnecessary network destinations. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (25)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 8)May include surrounding context.

md
将任意代码库转换为精美的交互式课程。输出是一个**目录**,包含预构建的 `styles.css`、`main.js`、每个模块的 HTML 文件以及组装好的 `index.html` — 可直接在浏览器中打开,无需任何设置。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 234)May include surrounding context.

md
将任意代码库转换为精美的交互式课程。输出是一个**目录**,包含预构建的 `styles.css`、`main.js`、每个模块的 HTML 文件以及组装好的 `index.html` — 可直接在浏览器中打开,无需任何设置。

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/_base.html (reported line 8)May include surrounding context.

html
<meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>COURSE_TITLE</title>

  <!--
    中国大陆可访问性:使用系统字体,无需外部 CDN
    标题字体:粗几何风格系统字体回退
    正文字体:清晰无衬线系统字体回退

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/_base.html (reported line 8)May include surrounding context.

html
<meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>COURSE_TITLE</title>

  <!--
    中国大陆可访问性:使用系统字体,无需外部 CDN
    标题字体:粗几何风格系统字体回退
    正文字体:清晰无衬线系统字体回退

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/content-philosophy-pro.md (reported line 120)May include surrounding context.

md
- **核心代码** — 仅在上述方式无法充分表达时,展示 10-15 行最核心的代码

**示例(好的方式):**
> 认证系统采用 JWT + Refresh Token 双 token 方案。Access Token 有效期 15 分钟,存储在内存中;Refresh Token 有效期 7 天,存储在 HttpOnly Cookie 中。Token 验证通过中间件统一处理,失败后自动尝试刷新。
>
> [数据流动画:用户请求 → 中间件验证 → Token 过期 → 刷新流程 → 重新请求]

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/design-system.md (reported line 239)May include surrounding context.

md
<div class="nav-dots">
      <button class="nav-dot" data-target="module-1" data-tooltip="模块 1 名称"
              role="tab" aria-label="模块 1"></button>
      <!-- 每个模块一个 -->
    </div>
  </div>
</nav>

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/design-system.md (reported line 239)May include surrounding context.

md
<div class="nav-dots">
      <button class="nav-dot" data-target="module-1" data-tooltip="模块 1 名称"
              role="tab" aria-label="模块 1"></button>
      <!-- 每个模块一个 -->
    </div>
  </div>
</nav>

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/interactive-elements.md (reported line 205)May include surrounding context.

md
<p class="dnd-zone-label">角色 A 的描述</p>
      <div class="dnd-zone-target">拖到这里</div>
    </div>
    <!-- 更多区域 -->
  </div>
  <button onclick="checkDnD()">检查匹配</button>
  <button onclick="resetDnD()">重置</button>

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/interactive-elements.md (reported line 205)May include surrounding context.

md
<p class="dnd-zone-label">角色 A 的描述</p>
      <div class="dnd-zone-target">拖到这里</div>
    </div>
    <!-- 更多区域 -->
  </div>
  <button onclick="checkDnD()">检查匹配</button>
  <button onclick="resetDnD()">重置</button>

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/interactive-elements.md (reported line 405)May include surrounding context.

md
<div class="arch-icon">📄</div>
      <span>组件 A</span>
    </div>
    <!-- 更多组件 -->
  </div>
  <div class="arch-zone arch-zone-external">
    <h4 class="arch-zone-label">外部服务</h4>

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document is written as a prescriptive design system in Chinese and frames the experience for non-technical users without indicating any language choice. This becomes a policy concern because later requirements also explicitly optimize for mainland China users, implying a fixed locale rather than offering user selection or documenting a justified region-specific scope.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The note says the font choice is made so users in mainland China can view the content normally without using a VPN, which is a locale-specific design policy. The file does not clarify that this is an optional regional profile or that users can choose another locale, so it appears to impose a specific regional assumption.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The README states that course content is output in Chinese by default, and the examples and positioning consistently assume Chinese-only usage. The policy for this category flags language constraints when a skill forces a specific language without user opt-in, and no alternative language selection is documented here.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases include broad natural-language requests such as '教授这段代码' and '代码库入门指南', which can match ordinary user intent outside a deliberate opt-in to this skill. That increases the chance of accidental activation of a high-capability skill that can analyze repositories, create files, and later run build steps, causing unintended workspace actions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs cloning arbitrary GitHub repositories, writing a new course directory, and executing build.sh, but it does not require explicit user consent or present a safety warning before these side effects. This is dangerous because untrusted repositories and generated build scripts can introduce harmful code execution or unexpected filesystem modifications in the user's environment.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

L305-L307 规定输出内容默认使用中文,除非用户明确要求其他语言。这对未主动选择中文的用户施加了默认语言限制,属于语言/locale 策略风险,因为文档没有先提供语言选择或征得用户同意。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The document title and all instructional content are written exclusively in Chinese, indicating a fixed language requirement for the skill guidance. Under the policy, language constraints should either offer user choice or be clearly documented as justified region-specific behavior, which is not present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file is entirely framed as a Chinese-language content philosophy and repeatedly prescribes language usage norms, such as using specific business-language wording. There is no indication that the user can opt into another language or that the Chinese-only constraint is required for a region-specific use case, which creates a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The markdown explicitly states that the design should ensure proper display for users in mainland China and prescribes Chinese-priority system fonts. This is a locale-specific constraint presented as a default requirement, with no indication that users can choose other locales or that the limitation is optional.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The file says the skill is aimed at mainland China users and therefore avoids Google Fonts or external CDNs. While the technical rationale may be valid, the document does not present this as an opt-in regional mode or clearly justify the region lock as a scoped, compliance-driven variant.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The entire guidance file is written in Chinese, and there is no indication that language selection is optional or that the skill is specifically limited to Chinese-speaking users. Under the policy criteria, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file contains user-facing instructional content solely in Chinese, starting with the title and continuing throughout the document. Under the language/locale policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file contains user-facing natural-language instructions exclusively in Chinese across the entire template. Under the policy rule, forcing a specific language without user opt-in is a locale/language policy violation unless the file clearly documents a justified region-specific constraint, which it does not.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The root HTML element hard-codes lang="en", which imposes an English locale in a file that otherwise contains Chinese comments and does not indicate that the content is intentionally English-only. Per the policy, forcing a specific language without user choice or clear justification is a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The natural-language comments state that the system fonts are selected because they are accessible in mainland China and repeat that constraint in the font token section. This expresses a locale-specific design policy, but the file does not indicate user choice or explain why the skill must target that locale specifically.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.