Back to skill

Security audit

universal-file-ops

Security checks for vulnerabilities and agentic risk

Overview

This skill is a real file/Python utility, but it gives agents broad file mutation, package installation, and code execution abilities with weak scoping and overstated safety controls.

Install only if you are comfortable granting this skill broad local file access and Python execution authority. Use it in a disposable or tightly scoped workspace, avoid delete/overwrite/no-backup operations on important data, do not run sandbox-test on untrusted code, and approve package installs only when the package names and sources are trusted.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (5)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/utils.py:35
Finding

Path Validation Allows Unrestricted Access to Arbitrary Files and Directories

Content
View full analysis
bool: """防止路径遍历攻击(Path Traversal)""" try: target = os.path.realpath(os.path.abspath(path)) if base: return os.path.commonprefix([target, os.path.realpath(base)]) == os.path.realpath(base) return True except Exception: return False ``` A representative caller is: ```python def run(action: str, file_path: str, **kwargs) -> str: """执行动作并返回标准化 JSON 字符串""" if not is_safe_path(file_path): return error_output(f"路径不合法(可能含遍历): {file_path}", file_path) encoding = kwargs.get("encoding", "utf-8") backup = kwargs.get("backup", True) try: if action == "read": result = do_read(file_path, encoding) elif action == "create": content = kwargs.get("content", "") overwrite = kwargs.get("overwrite", False) result = do_create(file_path, content, encoding, overwrite, backup) elif action == "update": content = kwargs.get("content", "") mode = kwargs.get("mode", "replace") line = kwargs.get("line", None) result = do_update(file_path, content, encoding, mode, line, backup) elif action == "delete": result = do_delete(file_path, backup) ``` ### Technical Analysis `is_safe_path()` only applies a containment check when a `base` argument is supplied. All audited CRUD callers invoke it without a base directory. Consequently, every path that can be normalized is considered safe, including: - Absolute paths outside the intended workspace. - Relative paths containing `..`. - Paths to configuration files, credentials, or ...[truncated 1707 chars]
Remediation
View remediation
bool: if not base: return False target = os.path.realpath(os.path.abspath(path)) root = os.path.realpath(os.path.abspath(base)) try: return os.path.commonpath([target, root]) == root except ValueError: return False ``` 4. Reject missing base-directory configuration instead of defaulting to unrestricted access. 5. Check each existing path component for symlinks where symlink traversal is not required. 6. Explicitly deny sensitive locations such as Agent configuration, credential stores, system directories, and startup files. 7. Require explicit authorization for deletion, overwrite, recursive operations, and backup bypass. 8. Add tests covering absolute paths, `..`, sibling-prefix paths, symlinks, and cross-drive paths on Windows. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/py_tools.py:263
Finding

Sandbox Test Feature Executes Untrusted Python with Full Host Permissions

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Error
Location
scripts/python_env.py:33
Finding

Unvalidated and Unpinned Package Installation Enables Supply-Chain Code Execution

Content
View full analysis
Tuple[bool, str]: """用多个镜像源重试安装,返回 (成功?, 输出信息)""" for attempt in range(max_retry): for mirror in MIRRORS: cmd = [pip_exe, "install", "-i", mirror] + packages rc, out, err = _run(cmd) if rc == 0: return True, out _log(f" 镜像 {mirror} 失败: {err[:100]}", "WARN") if attempt < max_retry - 1: wait = 2 ** attempt _log(f" 第 {attempt+1} 次重试,等待 {wait}s...", "INFO") time.sleep(wait) return False, err ``` ```python def cmd_install(args): if not os.path.exists(VENV_DIR): print(_error_response("UFO-5004")) return 1 pip = _get_venv_pip() if not pip: print(_error_response("UFO-5004")) return 1 ok, output = _pip_install_with_retry(pip, args.packages) ``` The sandbox command independently performs another unconstrained installation: ```python pkgs_to_install = ["pytest"] + extra_pkgs pip_result = subprocess.run( [pip_exe, "install"] + pkgs_to_install, capture_output=True, text=True, timeout=120 ) ``` ### Technical Analysis Package names and version specifiers are accepted directly from command-line input. The implementation does not provide: - An approved-package allowlist. - Exact version pinning. - Artifact hash verification. - A reviewed lockfile. - Package-name normalization or typo detection. - Rejec ...[truncated 1573 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/file_ops.py:85
Finding

Recursive Directory Deletion Proceeds After Backup Failure

Content
View full analysis
Dict[str, Any]: """删除文件或目录(不存在则幂等返回 success)""" if not os.path.exists(file_path): return {"deleted": False, "skipped": True, "reason": "文件不存在(幂等)", "file": file_path} rollback_id = backup_file(file_path, operation="delete") if backup else None if os.path.isdir(file_path): shutil.rmtree(file_path) else: os.remove(file_path) return {"deleted": True, "file": file_path, "backup_file": rollback_id} ``` The backup implementation is: ```python def backup_file(file_path: str, operation: str = "unknown") -> str | None: ensure_data_dirs() if not os.path.exists(file_path): return None ts = datetime.datetime.now().strftime("%Y%m%d_%H%M%S_%f") orig_name = os.path.basename(file_path) file_hash = compute_file_hash(file_path)[:8] backup_name = f"{ts}_{orig_name}_{file_hash}.bak" backup_path = os.path.join(BACKUP_DIR, backup_name) try: import shutil shutil.copy2(file_path, backup_path) record_backup(backup_name, file_path, operation) return backup_name except Exception as e: print(f"[WARN] 备份失败: {e}", file=sys.stderr) return None ``` ### Technical Analysis `backup_file()` always uses `shutil.copy2()`, which is a file-copy operation and cannot back up a directory tree. When passed a directory, it raises an exception. The exception is converted into a warning and `None`, but `do_delete()` does not verify the result. The function then invokes `shutil.rmtree()`, recursively deleting the directory. Thus, default backup-enabled deletion is irrecoverable for directories despite documentation stating that destructive ope ...[truncated 944 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/text_crud.py:96
Finding

Atomic Append Mode Replaces the Original File with Only the New Content

Content
View full analysis
bool: """ 原子写入:先写临时文件,再 os.replace 交换,写入中断不会产生残缺文件。 content 可以是 str(mode='w'/'a')或 list[str](mode='w',writelines)。 成功返回 True,失败抛出异常。 """ dir_path = os.path.dirname(os.path.abspath(file_path)) os.makedirs(dir_path, exist_ok=True) fd, tmp_path = tempfile.mkstemp( dir=dir_path, prefix=".tmp_", suffix=os.path.splitext(file_path)[1] ) try: if isinstance(content, list): with os.fdopen(fd, mode, encoding=encoding) as f: f.writelines(content) else: with os.fdopen(fd, mode, encoding=encoding) as f: f.write(content) os.replace(tmp_path, file_path) return True except BaseException: try: os.unlink(tmp_path) except Exception: pass raise ``` ### Technical Analysis `tempfile.mkstemp()` creates a new empty temporary file. Opening that temporary file in append mode only appends to the empty temporary file; it does not include the current contents of the destination. After writing the new content, `os.replace(tmp_path, file_path)` replaces the original ...[truncated 940 chars]
Remediation
View remediation
Vulnerability Patterns
  • 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
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (53)

Tainted flow: 'stdin_data' from sys.stdin.read (line 209, user input) → subprocess.run (code execution)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

External input (network, user) flows to a code execution sink. This enables remote code execution or command injection.

Content

Scanner excerpt · scripts/orchestrator.py (reported line 224)May include surrounding context.

python
))
            sys.exit(1)
        cmd = [sys.executable, str(script)]
        proc = subprocess.run(cmd, input=stdin_data, capture_output=True, text=True)
        # 透传脚本输出
        if proc.stdout:
            print(proc.stdout, end="")

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

If the skill effectively performs only limited CRUD or orchestration while claiming broader assurance and sandbox properties, users may trust it to safely validate or contain code when it cannot. In a skill that touches files and Python environments, false claims about safety controls materially increase operational risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

If the skill effectively performs only limited CRUD or orchestration while claiming broader assurance and sandbox properties, users may trust it to safely validate or contain code when it cannot. In a skill that touches files and Python environments, false claims about safety controls materially increase operational risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

If the skill effectively performs only limited CRUD or orchestration while claiming broader assurance and sandbox properties, users may trust it to safely validate or contain code when it cannot. In a skill that touches files and Python environments, false claims about safety controls materially increase operational risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

If the skill effectively performs only limited CRUD or orchestration while claiming broader assurance and sandbox properties, users may trust it to safely validate or contain code when it cannot. In a skill that touches files and Python environments, false claims about safety controls materially increase operational risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

If the skill effectively performs only limited CRUD or orchestration while claiming broader assurance and sandbox properties, users may trust it to safely validate or contain code when it cannot. In a skill that touches files and Python environments, false claims about safety controls materially increase operational risk.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> 📚 **渐进式加载**:本技能采用渐进式 MD 体系,`SKILL.md` 为入口(≤460行),详细内容拆分到 `references/*.md` 按需加载。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> 📚 **渐进式加载**:本技能采用渐进式 MD 体系,`SKILL.md` 为入口(≤460行),详细内容拆分到 `references/*.md` 按需加载。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `references/guide.md` | 使用指南 | 完整操作教程和示例 |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `references/guide.md` | 使用指南 | 完整操作教程和示例 |

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The sandbox-test feature materially expands the skill from file operations into package installation and arbitrary code execution. In context, that makes the risk higher, not lower: the skill accepts user-selected packages and test code, installs dependencies from the network, and runs them, enabling remote code execution and supply-chain abuse on the host under the guise of code-quality tooling.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill advertises capabilities that imply file read/write, network package installation, and shell-like script execution, but it does not declare an explicit tool scope such as permissions or allowed-tools. This weakens policy enforcement and makes it easier for an agent to over-grant access or execute the skill with broader privileges than users may expect.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill metadata and trigger phrases are entirely specified in Chinese, and the operational guidance and example output are also written to enforce Chinese-language usage. There is no indication that users may choose another language or that the Chinese-only constraint is required for a region-specific purpose, which matches the language policy violation criteria.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill includes operations with real system impact such as file writes, package installation, Python version switching, and test execution, but it does not present a prominent warning or confirmation model for these side effects. Users and agents may trigger destructive or environment-altering actions without understanding persistence, dependency drift, or data loss risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description is written entirely in Chinese, which indicates a language-specific presentation to users without any stated opt-in, alternative language, or region-specific justification. This can violate language/locale policy requirements when the skill is presented to a broader user base.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This markdown file presents its operational descriptions and release notes primarily in Chinese, with no indication that language choice is optional or limited to a justified region-specific audience. The policy scope explicitly includes language/locale violations in natural-language content, and no opt-in or justification is visible here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file title and description state the handbook provides user-facing error prompts in Chinese, but there is no indication that users can choose another language or opt in to this locale. This creates a natural-language policy concern because the skill appears to enforce a specific language for outputs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The document explicitly states that destructive or high-risk operations such as delete, overwrite, and disabling backups execute directly without runtime authorization. In a file-operations skill, this removes an important safety control and increases the chance of accidental or unauthorized destructive actions if the skill is invoked with unsafe parameters.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file contains natural-language requirements that all error messages must be "通俗易懂" and must avoid English technical terms, with all examples written only in Chinese. That imposes a specific language/locale on outputs without any user opt-in or alternative language path, which matches the language-policy violation criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

L001 将文件标题设为“输出报告模板”,且整份模板字段说明与示例消息均要求使用中文。尤其 L205 与 L290 明确要求问题消息为“通俗中文描述”,这构成了对输出语言的强制限定,但文档中未提供用户选择语言的机制,也未说明这是特定地区或合规场景所必需。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code embeds all user-facing documentation and error/help strings in Chinese, including the module docstring and later CLI/help text, with no indication that the skill is region-specific or that users can opt into another language. That creates a natural-language locale policy concern under the rule for forced language without user choice.

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/fix_and_test.py (reported line 17)May include surrounding context.

python
def run(cmd, cwd=None, input_data=None):
    if isinstance(input_data, str):
        input_data = input_data.encode()
    r = subprocess.run(
        cmd if isinstance(cmd, list) else cmd.split(),
        cwd=cwd, input=input_data,
        capture_output=True, text=True, timeout=120

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script unconditionally deletes a virtual environment directory with shutil.rmtree() and only emits a status message. In an agent skill focused on file operations, destructive filesystem actions are more sensitive because they may be triggered automatically and can cause data loss or break local development environments if the computed path is wrong or unexpectedly shared.

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/fix_and_test.py (reported line 123)May include surrounding context.

python
# ── 4. 运行测试 ────────────────────────────────────────────────────
print("\n[4] 运行全功能测试 ...\n")
sys.exit(subprocess.call([sys.executable, TEST_SCRIPT]))

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This code file contains natural-language descriptions, comments, and CLI messages exclusively in Chinese, including the module docstring that explains the tool’s purpose. Under the policy, forcing a specific language without offering a language choice or documenting a justified locale constraint is a violation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.