Back to skill

Security audit

Workspace Cross-Drive Migration(工作空间跨盘迁移)

Security checks for vulnerabilities and agentic risk

Overview

This migration skill needs review because its formatting advice and manual history-editing instructions can cause data loss.

Keep independent backups of the workspace and WorkBuddy data. Use an existing compatible destination and avoid the manual history-rewrite command until corrected. Formatting erases the selected volume. Review the dry run before approving changes, and do not rely on the bundled rollback as a complete backup restore.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (7)

Code capability 'env' detected in scripts/ws_migrate_common.py but not covered by declared permissions.

High
Category
MCP Least Privilege
Confidence
75% confidence
Finding

The skill uses 'env' capability that is not covered by the declared 'allowed-tools' preapproval. Review the host runtime's actual enforcement policy; runtime permissions are unknown unless separately verified, and this declaration alone does not establish a permission ceiling.

Content

No source excerpt is available for this finding.

The FAT32 remediation instructs the user to format the destination drive without warning that formatting erases existing data.

Medium
Category
Output Handling
Confidence
97% confidence
Finding

The FAT32 guidance recommends formatting the destination without explaining that formatting erases existing volume contents. In a data-preserving migration workflow, following this advice could destroy unrelated destination-drive data even though the source workspace remains intact.

Content

No source excerpt is available for this finding.

The JSON validation fallback writes the invalid replacement instead of reverting exclusively to the original line.

Medium
Category
Excessive Agency
Confidence
99% confidence
Finding

When JSON conversion throws a terminating error, the catch block emits the original line, but execution then unconditionally emits the invalid replacement as well. Set-Content persists both, potentially corrupting conversation history precisely when validation is supposed to protect it.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/apply_migration.py (reported line 58)May include surrounding context.

python
"/R:2", "/W:2",  # 失败重试 2 次,每次等 2 秒
        "/NFL", "/NDL", "/NJH", "/NJS", "/NP",
    ]
    proc = subprocess.run(cmd, capture_output=True, check=False)
    out = (proc.stdout or b"").decode("mbcs", errors="replace")
    err = (proc.stderr or b"").decode("mbcs", errors="replace")
    # robocopy: 0-7 都算成功(1=有文件被复制,2=有额外项,3=1+2)

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/ws_migrate_common.py (reported line 288)May include surrounding context.

python
if os.name != "nt":
        return []
    try:
        out = subprocess.run(
            ["tasklist", "/FO", "CSV", "/NH"],
            capture_output=True, timeout=25, check=False,
        ).stdout

Tainted flow: 'tmp' from os.environ.get (line 319, credential/environment) → open (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/ws_migrate_common.py (reported line 320)May include surrounding context.

python
def save_json(path: Path, data, indent: int = 2) -> None:
    path.parent.mkdir(parents=True, exist_ok=True)
    tmp = path.with_suffix(path.suffix + ".tmp")
    with open(tmp, "w", encoding="utf-8", newline="\n") as f:
        json.dump(data, f, ensure_ascii=False, indent=indent)
    os.replace(tmp, path)

The script claims not to write any files, but --json explicitly writes a report to disk.

Low
Category
Excessive Agency
Confidence
99% confidence
Finding

The module documentation at L004 promises a purely read-only preflight that writes no files, and L210 repeats the read-only label. However, L218–L220 call C.save_json with a user-supplied output path when --json is provided. Although this export is explicitly documented and appropriate for migration planning, it contradicts the unconditional no-file-writes assurance.

Content

No source excerpt is available for this finding.