Back to skill

Security audit

arXiv Downloader

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent arXiv downloader, but its helper script can overwrite files outside the intended download folder when given a crafted file name.

Review before installing. Use only plain filenames, avoid running it unattended on untrusted arguments, and keep downloads in a dedicated folder. The script should be patched to reject path components in --name, enforce that final paths stay under the chosen output directory, avoid silent overwrites, and stream downloads with a size limit.

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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/download_arxiv.py:101
Finding

Arbitrary Filesystem Write and Overwrite Through Unsanitized Output Paths

Content
View full analysis
str: """从 URL 或 ID 中提取 arXiv ID""" # 匹配 URLs like https://arxiv.org/abs/2301.12345 url_pattern = r'arxiv\.org/(?:abs|pdf|ps)/([\d\.]+)' match = re.search(url_pattern, identifier) if match: return match.group(1) # 匹配纯 ID,如 2301.12345 或 arXiv:2301.12345 id_pattern = r'(?:arXiv:)?(\d{4}\.\d{4,5})(v\d+)?' match = re.search(id_pattern, identifier) if match: return match.group(1) return identifier ``` ```python # 确定输出路径 output_dir = Path(args.output_dir).expanduser().resolve() if args.name: if args.latex: ext = '.tar.gz' else: ext = '.pdf' filename = args.name if args.name.endswith(ext) else args.name + ext else: filename = f"{arxiv_id}.tar.gz" if args.latex else f"{arxiv_id}.pdf" output_path = output_dir / filename # 下载 url = get_latex_url(arxiv_id) if args.latex else get_pdf_url(arxiv_id) success = download_file(url, output_path) ``` The resulting path is subsequently created and opened for replacement: ```python output_path.parent.mkdir(parents=True, exist_ok=True) with open(output_path, 'wb') as f: f.write(content) ``` ### Technical Analysis The script uses the user-controlled `--name` value directly as a path component. It does not reject absolute paths, parent-directory components such as `..`, directory separators, or symbolic-link-based escapes. With `pathlib`, joining an absolute `filename` to `output_dir` discards the intended base directory. A relative name containing traversal components can similarly resolve outside the requested output directory. The script then creates missing parent directories and opens the destination in `wb` mode, which truncates and overwrites an existing ...[truncated 1895 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/download_arxiv.py:67
Finding

Unbounded Response Buffering Can Cause Memory Exhaustion

Content
View full analysis
Remediation
View remediation
max_bytes: raise ValueError("Response exceeds the maximum allowed size") output_path.parent.mkdir(parents=True, exist_ok=True) with open(output_path, "xb") as target: while True: chunk = response.read(64 * 1024) if not chunk: break total += len(chunk) if total > max_bytes: raise ValueError("Response exceeds the maximum allowed size") target.write(chunk) ``` 2. Enforce the byte limit even when `Content-Length` is absent or inaccurate. 3. Write to a temporary file in the destination directory and atomically rename it only after a successful, validated download. 4. Delete partial files when network, size-limit, or validation errors occur. 5. Apply process-level memory limits and an overall download deadline in addition to socket-operation timeouts. 6. Select separate, documented size ceilings for PDF and LaTeX archive downloads if their expected sizes differ materially. ]]>
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill documents and invokes a network-capable downloader but does not declare any explicit tool scope such as permissions or allowed-tools. This creates a governance gap: the agent may perform outbound network actions without clearly advertised constraints, making review, enforcement, and least-privilege controls weaker.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains natural-language instructions and output strings exclusively in Chinese, starting with the module docstring and continuing through argument help text. The policy for this category flags language/locale constraints when a skill forces a specific language without offering user choice or documenting a justified locale restriction.

Content

No source excerpt is available for this finding.