Back to skill

Security audit

winforms-to-qt-mapper

Security checks for vulnerabilities and agentic risk

Overview

This migration skill is not clearly malicious, but it needs Review because its generator can write unsafe output from unvalidated mapping data and its analysis reports overstate incomplete or simulated results.

Install only if you are comfortable treating this as a Chinese-language migration aid, not a finished automatic converter. Use it on disposable copies of projects, review any mapping JSON before generation, choose an empty output directory, and inspect generated CMake/C++/UI files before building or running them.

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

Error
Location
scripts/generate_qt_code.js:430
Finding
Unvalidated Mapping Data Enables Path Traversal and Generated-Code Injection<![CDATA[ ## Vulnerability Details **File Location**: `scripts/generate_qt_code.js`, lines 430–780 **Vulnerability Type**: Path traversal, arbitrary file overwrite, and generated-code injection **Risk Level**: High **Category**: T09: Insecure Skill Coding Practices ### Vulnerable Code The generator derives output filenames directly from the attacker-controllable `form.name` value: ```js function generateFormHeader(form) { const className = form.name; const lowerName = className.toLowerCase(); const headerContent = `#ifndef ${className.toUpperCase()}_H #define ${className.toUpperCase()}_H #include <QWidget> namespace Ui { class ${className}; } class ${className} : public QWidget { Q_OBJECT public: explicit ${className}(QWidget *parent = nullptr); ~${className}(); private slots: ${form.events.map(event => `void ${event.handler}();`).join('\n ')} private: Ui::${className} *ui; // Control member variables ${form.controls.map(control => `QWidget *${control.name}; // WinForms type: ${control.type}`).join('\n ')} }; #endif // ${className.toUpperCase()}_H `; const headerPath = path.join(options.output, `include/${lowerName}.h`); fs.writeFileSync(headerPath, headerContent); } ``` The same unvalidated value is used to construct source-file paths and C++ source code: ```js function generateFormSource(form) { const className = form.name; const lowerName = className.toLowerCase(); const sourceContent = `#include "${lowerName}.h" #include "ui_${lowerName}.h" #include <QMessageBox> #include <QDebug> ${className}::${className}(QWidget *parent) : QWidget(parent) , ui(new Ui::${className}) { ui->setupUi(this); setupUi(); setupConnections(); } void ${className}::setupConnections() { ${form.events.map(event => ` // ${event.control}.${event.event} -> ${event.handler} connect(${event.control}, &${getQtSignalForEvent(event.event)}, this, &${className}::${ev ...[truncated 3896 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Enforce a strict mapping schema** - Validate the complete JSON document before generation. - Require arrays and properties to have expected types. - Reject unknown fields where practical. - Impose reasonable limits on string lengths and collection sizes. 2. **Restrict generated identifiers** - Permit class, control, event-handler, and project names only when they match an appropriate identifier policy, such as: ```js const cppIdentifier = /^[A-Za-z_][A-Za-z0-9_]*$/; ``` - Reject path separators, traversal components, null bytes, control characters, newlines, and platform-reserved filenames. 3. **Enforce output-directory containment** - Resolve the output root and every destination to absolute paths. - Verify that each destination remains inside the intended root before writing: ```js const outputRoot = path.resolve(options.output); function safeOutputPath(relativePath) { const destination = path.resolve(outputRoot, relativePath); const expectedPrefix = outputRoot + path.sep; if (!destination.startsWith(expectedPrefix)) { throw new Error(`Output path escapes project directory: ${relativePath}`); } return destination; } ``` - Use the helper for every generated file. 4. **Apply context-specific escaping** - Escape C++ string literals separately from C++ comments and identifiers. - Escape XML text and attribute values using an XML library rather than string interpolation. - Quote and validate CMake values according to CMake syntax. - Do not assume that a single generic escaping function is safe for all output contexts. 5. **Reduce downstream execution risk** - Mark imported mapping and analysis files as untrusted in documentation. - Require users to review generated CMake and source files before building. - Avoid automatically invoking build tools on newly generated projects. ...[truncated 349 chars]
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • 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
Findings (95)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The mismatch is especially concerning because the skill appears to generate local project files and CMake configuration while presenting itself as a comprehensive migration solution. Users may integrate generated boilerplate and hardcoded environment assumptions into production repositories, creating brittle builds, hidden portability issues, and false confidence that migration-specific concerns were addressed.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The mismatch is especially concerning because the skill appears to generate local project files and CMake configuration while presenting itself as a comprehensive migration solution. Users may integrate generated boilerplate and hardcoded environment assumptions into production repositories, creating brittle builds, hidden portability issues, and false confidence that migration-specific concerns were addressed.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The mismatch is especially concerning because the skill appears to generate local project files and CMake configuration while presenting itself as a comprehensive migration solution. Users may integrate generated boilerplate and hardcoded environment assumptions into production repositories, creating brittle builds, hidden portability issues, and false confidence that migration-specific concerns were addressed.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The mismatch is especially concerning because the skill appears to generate local project files and CMake configuration while presenting itself as a comprehensive migration solution. Users may integrate generated boilerplate and hardcoded environment assumptions into production repositories, creating brittle builds, hidden portability issues, and false confidence that migration-specific concerns were addressed.

Ae1

High
Category
analysis-evasion
Content
node scripts/architecture_analyzer.js --project <路径> --output <文件>
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/architecture_analyzer.js --project <路径> --output <文件>
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/architecture_analyzer.js --project <路径> --output <文件>
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/architecture_analyzer.js --project <路径> --output <文件>
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/architecture_analyzer.js --project <路径> --output <文件>
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Intent-Code Divergence

High
Confidence
99% confidence
Finding
The script presents dependency and complexity analysis as if it were derived from the target WinForms project, but key functions return fixed placeholder data instead of computed results. In a migration-analysis skill, this can mislead users into trusting fabricated architectural conclusions, causing incorrect refactoring decisions, missed risks, and unsafe changes in enterprise codebases.

Intent-Code Divergence

High
Confidence
98% confidence
Finding
The generated Markdown report converts hard-coded dependency levels and fabricated complexity findings into authoritative-looking project documentation. Because this skill is explicitly marketed for enterprise WinForms-to-Qt migration guidance, false reports can directly drive architecture, testing, and prioritization decisions based on nonexistent evidence.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
.option('--intelligent', '启用智能映射', true)
    .option('--no-intelligent', '禁用智能映射(使用基础映射)')
    .option('--template <type>', '项目模板类型', 'basic-qt-widgets')
    .option('--skip-validation', '跳过迁移验证')
    .option('--dry-run', '试运行,不实际生成文件')
    .action(async (options) => {
        try {
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The manifest description and the entire user-facing README content are written in Chinese, with no indication that other languages are supported or that the user can opt into this locale. Under the policy, a skill should not effectively impose a specific language unless it offers a choice or clearly justifies a region-specific constraint.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This code file contains natural-language strings and comments that present the skill exclusively in Chinese, including the main description and subsequent console output. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly justified.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The package manifest includes outbound/network and server-side capabilities (`axios`, `ws`, `express`, `cors`, `helmet`, `compression`) that are not clearly required for an offline WinForms-to-Qt migration skill. This expands the attack surface by enabling data exfiltration, remote communication, or unexpected service exposure if later code paths use these libraries.

Intent-Code Divergence

Medium
Confidence
96% confidence
Finding
This section is presented as an automation script for analyzing WinForms/C# project complexity, yet it walks .cs files and passes their contents to Python's ast.parse, which only parses Python syntax. That is an active contradiction between the documentation's stated intent and the shown implementation, and would mislead users about the tool's actual behavior.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
This markdown file is entirely framed in Chinese and presents the guidance as the default skill content, with no indication that users may choose another language or locale. Under the policy rule, forcing a specific language without user opt-in is a natural-language policy violation unless the regional constraint is explicitly justified.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
This markdown file is written as a prescriptive reference entirely in Chinese, beginning with a Chinese-only title. Under the policy rule, forcing a specific language without user opt-in is a natural-language locale violation unless the locale constraint is explicitly justified, which is not stated here.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The interface example declares methods such as StopAcquisition, IsInitialized, IsAcquiring, LoadConfig, SaveConfig, ConnectToServer, DisconnectFromServer, IsConnected, and GetErrorCount, plus signals like DataReceived and AcquisitionProgressChanged. In the shown implementation section, only Initialize, Shutdown, StartAcquisition, GetLatestData, GetStatusMessage, and GetLastError are implemented, creating an active documentation-to-code contradiction rather than a mere omission.

Intent-Code Divergence

Medium
Confidence
94% confidence
Finding
The tests call wrapper_->IsInitialized(), wrapper_->GetErrorCount(), and wrapper_->IsAcquiring(), but those methods are not implemented in the provided MainControlWrapper.cpp sample. This directly conflicts with the document's claim of a working, fully tested implementation and suggests the code and accompanying test narrative are inconsistent.

Context-Inappropriate Capability

Medium
Confidence
90% confidence
Finding
The manifest describes this skill as providing migration guidance, architecture analysis, control mapping, event conversion, optimization, and testing guidance. In this document, the example for measuring memory usage launches an external system command via QProcess (`tasklist`), which introduces subprocess execution capability that is not justified by a documentation-oriented migration-mapping skill.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The title and entire document are written in Chinese, and there is no indication that users may choose another language or that the content is intentionally limited to a Chinese-speaking audience. Under the language/locale policy, forcing a specific language without opt-in is a natural-language policy concern.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
该文档在全局字体设置中明确指定使用“Microsoft YaHei”,并在全文中将其作为统一修复方案的一部分。这会把界面默认呈现绑定到特定中文区域字体,但文档没有说明仅适用于中文本地化场景,也没有提供其他语言/区域的可选方案。

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
The entire skill document is written exclusively in Chinese and includes fixed Chinese UI text examples such as button labels and window titles, without indicating that language selection is optional or that the skill is intended only for a Chinese-language environment. This can violate language/locale policy because it effectively forces one locale on users without opt-in or documented regional justification.

Natural-Language Policy Violations

Medium
Confidence
98% confidence
Finding
Natural-language strings throughout the file, including the header comment, console output, error messages, and help text, are presented only in Chinese. This imposes a specific language choice on all users with no documented opt-in, selection mechanism, or locale justification.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/analyze_winforms.js:255

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/core/analyzer/RoslynAnalyzer.js:596