Back to skill

Security audit

paper-research-assistant

Security checks for vulnerabilities and agentic risk

Overview

The skill is not outright malicious, but its code generator can be tricked into writing files outside the chosen output folder.

Review before installing or running. Use only trusted paper metadata, run the scaffold generator in a sandbox or disposable directory, and inspect generated files before executing them. The publisher should sanitize the paper title into a safe directory name, verify every output path remains under the chosen output directory, and avoid silently overwriting existing files.

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
scaffold_code.py:13
Finding

Attacker-Controlled Path Traversal and Arbitrary File Overwrite

Content
View full analysis
dict: """生成 PyTorch 代码骨架""" title = metadata.get('title', 'Model').replace(' ', '_').replace('-', '_') files = { f'{title}/README.md': f"""# {metadata.get('title', 'Paper Implementation')} Unofficial PyTorch implementation based on the paper. ## Setup ```bash pip install -r requirements.txt ``` ## Usage ```bash python train.py --config configs/default.yaml ``` ## Structure - `model.py` - Core model architecture - `train.py` - Training loop - `evaluate.py` - Evaluation script - `datasets/` - Dataset loaders - `configs/` - Configuration files """, f'{title}/requirements.txt': """torch>=2.0.0 torchvision>=0.15.0 numpy>=1.24.0 pandas>=2.0.0 tqdm>=4.65.0 yaml>=6.0 """, f'{title}/model.py': f'''""" Core model architecture for {metadata.get("title", "Paper")} """ ... ''', f'{title}/train.py': '''""" Training loop for paper reproduction. """ ... ''', f'{title}/configs/default.yaml': f"""# Default configuration for {metadata.get('title', 'Model')} ... """, f'{title}/datasets/__init__.py': '''""" Dataset loaders. """ ... ''' } return files ``` The resulting paths are then written without containment validation or overwrite protection: ```python # 写入文件 output_dir = Path(args.output_dir) output_dir.mkdir(parents=True, exist_ok=True) for filepath, content in files.items(): full_path = output_dir / filepath full_path.parent.mkdir(parents=True, exist_ok=True) with open(full_path, 'w', encoding='utf-8') as f: f.write(content) print(f"Created: {full_pa ...[truncated 2585 chars]
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • 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 (11)

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

声明描述的是一个范围较广的论文研读与复现助手,但给定代码只覆盖其中很窄的一部分:基于输入元数据生成复现项目代码模板。它不处理 PDF,不分析论文内容,不生成研读报告,也不搜索外部资源。虽然“编写复现代码框架”与代码行为部分一致,但其余核心声明能力均未体现。此外,代码参数允许 framework 选择 tensorflow,但实际分支仅打印未实现并退出,因此与描述中“根据论文描述生成 PyTorch/TensorFlow 代码框架”也不完全一致。整体上,实际行为明显比声明更窄,属于描述与行为不匹配。

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · code_style.md (reported line 223)May include surrounding context.

checkpoints/ logs/ *.log .env .DS_Store

text

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill describes operations that read user-supplied files and write outputs to temporary or repository paths, but it does not declare any explicit tool scope or permissions boundaries. This can lead to overbroad file access at runtime, making it harder to constrain what the skill may read or overwrite if the surrounding agent grants default filesystem capabilities.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest description and title are written entirely in Chinese and present the skill as a Chinese-language assistant, with no indication that users may choose another language. Under the policy, forcing a specific language or locale without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This file presents all user-facing guidance exclusively in Chinese, including headings, instructions, and examples. Under the policy rule, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified.

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 file contains natural-language descriptions and error/output messages only in Chinese, including the module docstring and installation guidance. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is clearly documented and justified, which it is not here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This markdown template forces a specific language/locale for the generated report, as all headings, prompts, and labels are in Chinese. The policy requires flagging language or locale constraints when the skill does not explicitly offer user choice or document a justified region-specific limitation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file’s top-level docstring and CLI descriptions are written exclusively in Chinese, and there is no indication that users may choose another language or that the skill is intended only for a Chinese-language environment. This creates a natural-language locale constraint without opt-in, which matches the policy's language/locale violation category.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

技能清单强调的是论文研读、查找资源、编写复现代码框架和设计实验方案;本文件名与模块说明也写明是“代码骨架生成脚本”。但生成内容中包含完整训练循环与 torch.save 持久化模型,这已不仅是静态脚手架说明,而是直接产出可运行训练行为的项目模板。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file presents all guidance, examples, and instructions exclusively in Chinese. Under the policy rule for natural-language violations, forcing a specific language without user opt-in can be a locale-policy issue when no justification or alternative is provided.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

模块文档在 L003-L004 明确写着“根据论文描述生成 PyTorch/TensorFlow 代码框架”。然而主流程中只有 generate_pytorch_scaffold 被实现,选择 tensorflow 时仅打印“not yet implemented”并退出,构成文档对实际能力的主动误导。

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.