Back to skill

Security audit

Chatmosp Msr Generator

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to support a real ChatMOSP calculation workflow, but it needs review because it runs unverified external Python code with unsanitized task paths and sends generated files through Feishu.

Install only if you trust the external `mosp-for-chatMOSP` copy and companion skills. Before use, restrict task names to simple safe characters, verify the engine source and commit, run it in a limited workspace without unrelated secrets, and confirm whether Feishu upload is acceptable or use a local-only workflow.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:76
Finding
Shell Command Injection Through Unquoted Task Name<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 76–78; mirrored in `SKILL_cn.md`, lines 75–77 **Vulnerability Type**: Shell command injection caused by unsafe variable interpolation **Risk Level**: High ### Vulnerable Code ```bash cd mosp-for-chatMOSP python3 utils/msr.py --json OUTPUT/{task_name}/input.json --output OUTPUT/{task_name}/ cd - ``` The same unquoted placeholder is subsequently used when accessing and processing generated files: ```bash ls -lh OUTPUT/{task_name}/ini.xyz ls -lh OUTPUT/{task_name}/{task_name}_cluster.xyz ``` ### Technical Analysis The instructions interpolate `{task_name}` directly into shell commands without quoting, canonicalizing, or validating it. The document does not require `{task_name}` to match a restricted character set. If the task name can be derived from user-controlled input, an attacker may include shell metacharacters such as semicolons, command substitutions, redirection operators, or whitespace. When the resulting command is executed through a shell, those characters can alter command structure and cause additional commands to run. Path traversal sequences such as `../` may also cause commands to read from or write to locations outside the intended `OUTPUT` directory. Quoting alone would prevent shell token injection but would not prevent traversal, so both validation and containment checks are necessary. ### Attack Path 1. An attacker supplies or influences a task name containing a shell payload, such as a semicolon followed by an arbitrary command. 2. The task name passes through the parameter-builder or file-organizer workflow because this Skill defines no strict validation requirement. 3. The Agent substitutes the value into the documented `python3`, `ls`, or visualization command. 4. A shell parses the injected metacharacters as command syntax. 5. The injected command executes with the same operating-system identity and permissions as the Agent. 6. Alternatively, a task name con ...[truncated 712 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Restrict task names to a conservative allowlist before any filesystem or process operation: ```python if not re.fullmatch(r"[A-Za-z0-9._-]+", task_name): raise ValueError("Invalid task name") ``` 2. Reject path separators, traversal components, control characters, whitespace, and shell metacharacters. 3. Build paths with a filesystem API such as `pathlib.Path`, resolve them, and verify that every resolved path remains under the intended `OUTPUT` directory. 4. Execute Python programs through an argument-array API such as `subprocess.run([...], shell=False, check=True)` rather than constructing shell command strings. 5. If shell execution cannot be avoided, quote every expansion; however, do not treat quoting as a substitute for path validation and containment checks. 6. Apply the same protections to MSR generation, output validation, visualization, and Feishu attachment paths. 7. Add negative tests covering values containing `../`, spaces, semicolons, command substitutions, newlines, absolute paths, and symbolic-link escapes. 8. Update both language versions of the Skill so their security requirements remain consistent. ]]>

T08 · Insecure Dependencies

Warning
Location
SKILL.md:155
Finding
Unpinned External Calculation Engine Is Executed Without Integrity Verification<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 76–91 and 155–158; mirrored in `SKILL_cn.md`, lines 75–90 and 153–156 **Vulnerability Type**: Unverified and unpinned executable dependency **Risk Level**: Medium ### Vulnerable Code The Skill directly executes scripts from an external `mosp-for-chatMOSP` clone: ```bash cd mosp-for-chatMOSP python3 utils/msr.py --json OUTPUT/{task_name}/input.json --output OUTPUT/{task_name}/ cd - ``` It also executes the dependency's visualization script: ```bash cd mosp-for-chatMOSP && python3 utils/paint.py \ OUTPUT/{task_name}/{task_name}_cluster.xyz \ --output OUTPUT/{task_name}/structure.png cd mosp-for-chatMOSP && python3 utils/paint.py \ OUTPUT/{task_name}/{task_name}_cluster.xyz \ --gif OUTPUT/{task_name}/rotation.gif ``` The dependency declaration only identifies the component as cloned: ```markdown - **mosp-for-chatMOSP** — MSR calculation engine (cloned) - **chatmosp-parameter-builder** — parameter building and gas entropy calculation - **chatmosp-file-organizer** — directory structure - **chatmosp-input-coordinator** — task entry point ``` No official repository URL, immutable revision, expected cryptographic digest, signature, or integrity-verification procedure is specified. ### Technical Analysis The package's primary behavior is delegated to Python scripts that are not included in the audited artifact. Because the external clone is not pinned or authenticated, the code executed at runtime may differ from the code originally reviewed. A compromised upstream repository, malicious fork, altered local clone, branch movement, or unsafe installation source could replace `utils/msr.py` or `utils/paint.py`. Python then executes the modified script as trusted local code. This creates a supply-chain trust gap: reviewing the two Skill documents is insufficient to determine the behavior of the actual calculation engine. The audit found no evidence that the current dependency is mali ...[truncated 1321 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Specify the authoritative HTTPS repository for `mosp-for-chatMOSP`; do not permit arbitrary forks or ambiguous package sources. 2. Pin the dependency to an immutable, reviewed commit rather than a mutable branch or tag. 3. Record expected SHA-256 hashes for `utils/msr.py`, `utils/paint.py`, and other executable dependency files. 4. Verify the commit identity, signatures where available, and file hashes before every execution. Abort on any mismatch. 5. Vendor the reviewed scripts into a controlled release artifact where licensing and maintenance requirements allow it. 6. Audit the complete pinned dependency, including transitive Python imports and installation hooks. 7. Use a locked dependency manifest with hashes for the external engine's Python packages. 8. Run the calculation engine in a sandbox or container with minimal filesystem access, no unnecessary credentials, restricted network access, and explicit resource limits. 9. Prevent untrusted users from modifying the dependency directory, and verify ownership and permissions before execution. 10. Document a controlled update process requiring review and new integrity metadata whenever the dependency revision changes. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (7)

Ae1

High
Category
analysis-evasion
Content
> - If the user writes in Chinese, read `SKILL.md` in this same directory and respond in Chinese.
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Anti-Refusal Statement

High
Category
Anti-Refusal
Content
Show 5-option confirmation → User confirms → R=20Å, no warning →
Confidence
80% confidence
Finding
Skill instructs the agent to omit warnings, disclaimers, or ethical commentary. Stripping safety caveats hides risk from the user and is a common jailbreak preamble.

Hidden Instructions

High
Category
Prompt Injection
Content
---
name: chatmosp-msr-generator
description: |
  chatMOSP 系统的 MSR(多尺度结构重构)计算引擎。调用 mosp-for-chatMOSP/utils/msr.py
Confidence
60% confidence
Finding
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Hidden Instructions

High
Category
Prompt Injection
Content
---
name: chatmosp-msr-generator
description: |
  chatMOSP 系统的 MSR(多尺度结构重构)计算引擎。调用 mosp-for-chatMOSP/utils/msr.py
Confidence
60% confidence
Finding
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill explicitly transmits generated files to Feishu, an external channel, but does not require any explicit user notice or consent at the point of transmission. Even if the files are scientific outputs, they may contain sensitive research data, project names, or metadata, so silent exfiltration to a third-party messaging platform creates a real privacy and data-handling risk.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
- ✅ Target directory has been created by file-organizer
- ✅ External `mosp-for-chatMOSP` installed, with `utils/msr.py` and `utils/paint.py`
- ❌ DO NOT bypass parameter-builder and build parameters manually
- ❌ DO NOT skip user confirmation and execute calculation directly

## 3. Input Contract (Required fields in input.json)
Confidence
85% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill explicitly instructs the agent to transmit generated output files to Feishu, but it does not require a clear user-facing disclosure or a fresh consent check immediately before external transmission. This creates a data exfiltration/privacy risk because generated artifacts and captions may contain sensitive research parameters, filenames, or workspace-derived metadata that leave the local environment.

Static analysis

No suspicious patterns detected.