Back to skill

Security audit

BOM Compare Tool

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward Chinese-language BOM comparison utility, with one bounded terminal-output hardening issue users should be aware of.

Install only if a Chinese-language BOM comparison workflow is acceptable. Treat BOM files from untrusted parties carefully, because crafted cell values could make terminal output misleading; prefer trusted inputs or review results in a controlled terminal until output 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
compare.js:112
Finding

Terminal Control-Sequence Injection Through Untrusted BOM Fields

Content
View full analysis

Vulnerability Details

File Location: compare.js, lines 112-135
Vulnerability Type: Improper neutralization of terminal control sequences
Risk Level: Medium

Vulnerable Code

javascript
added.forEach(item => {
  report += `  ✅ ${item.partNo || item['物料编号']} - ${item.name || item['名称']}\n`;
});

removed.forEach(item => {
  report += `  ➖ ${item.partNo || item['物料编号']} - ${item.name || item['名称']}\n`;
});

changed.forEach(({ key, changes }) => {
  report += `  ⚠️ ${key}:\n`;
  for (const [field, { old: oldVal, new: newVal, pct }] of Object.entries(changes)) {
    if (pct) {
      report += `     ${field}: ${oldVal} → ${newVal} (${pct})\n`;
    } else {
      report += `     ${field}: ${oldVal} → ${newVal}\n`;
    }
  }
});

The resulting report is sent directly to the terminal at line 152:

javascript
console.log(generateCompareReport(args[0], args[1], result));

Technical Analysis

Values read from user-supplied CSV or XLSX files—including part numbers, names, field names, and changed values—are interpolated directly into a terminal report. The code does not remove or escape ANSI, OSC, C0, or C1 terminal control sequences before passing the report to console.log().

A malicious BOM can therefore contain escape sequences that are interpreted by the operator's terminal rather than displayed as ordinary text. Depending on terminal capabilities and configuration, these sequences can:

  • Clear, overwrite, conceal, or reposition terminal output.
  • Apply deceptive formatting to make malicious content appear trustworthy.
  • Insert forged report lines or hide legitimate additions and removals.
  • Change the terminal title.
  • Attempt OSC-based clipboard modification or other terminal-specific actions.

CSV parsing preserves embedded control characters, and XLSX cell values can likewise carry attacker-controlled strings into the report. The vulnerability does not requ ...[truncated 1643 chars]

Remediation
View remediation

Remediation Suggestions

  1. Sanitize every untrusted value before including it in terminal output. Remove ANSI CSI sequences, OSC sequences, and unsafe C0/C1 control characters while retaining necessary characters such as line separators only when intentionally introduced by the application.

  2. Apply sanitization at the final output boundary so all report fields are covered, including part numbers, names, field names, old values, new values, and file names.

  3. Use a maintained terminal-string sanitization library where possible. If implementing local sanitization, account for both ESC-based and 8-bit C1 sequence forms rather than only stripping color codes.

  4. Render control characters in a visible escaped form, such as \x1b, when preserving forensic visibility is preferable to deleting them.

  5. Validate imported BOM data and reject fields containing unexpected control characters. Apply maximum field-length limits to reduce terminal-output abuse.

  6. Add regression tests using malicious CSV and XLSX values containing CSI screen-clearing sequences, cursor movement, OSC title changes, and OSC clipboard payloads. Confirm that output contains only inert text.

  7. For machine-consumable output, provide a structured JSON mode and avoid rendering untrusted data directly in an interactive terminal.

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
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (2)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest explicitly sets the skill language to "中文", which indicates a fixed language requirement. Under the policy, locale or language constraints should either be optional, user-selectable, or clearly justified as region-specific; no such opt-in or justification appears in this file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The title and user-facing strings indicate the tool is designed to operate and present output in Chinese only. The policy requires flagging language or locale constraints when they are imposed without user opt-in or clear justification.

Content

No source excerpt is available for this finding.