Back to skill

Security audit

auto-researcher

Security checks for vulnerabilities and agentic risk

Overview

This is a mostly coherent research tool, but it needs review because crafted research topics can trigger code execution and normal use sends queries to multiple outside services while writing files under /tmp.

Review before installing. Avoid using sensitive internal project names, customer data, credentials, or confidential plans as research topics because queries are sent to third-party services and reports are stored locally. Do not run the shell scripts with privileged accounts, and prefer a fixed, trusted output directory. The heredoc topic-injection issue should be fixed before normal use.

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/auto-research.sh:60
Finding

Arbitrary Python Code Execution Through Untrusted Topic Interpolation

Content
View full analysis

Vulnerability Details

File Location: scripts/auto-research.sh:60-66; scripts/auto-research-v2.sh:23-30
Vulnerability Type: Code injection through an unquoted heredoc
Risk Level: High

Vulnerable Code

From scripts/auto-research.sh:60-66:

bash
python3 << PYTHON_SCRIPT
import json
import os
from datetime import datetime

output_dir = "$OUTPUT_DIR"
topic = "$TOPIC"

From scripts/auto-research-v2.sh:23-30:

bash
python3 << PYTHON_SCRIPT
import json
import os
import urllib.request
import urllib.parse
from datetime import datetime

topic = "$TOPIC"
output_dir = "$OUTPUT_DIR"

Technical Analysis

Both shell scripts interpolate the attacker-controlled TOPIC argument directly into Python source code inside an unquoted heredoc. The value is not encoded as a Python string literal or passed through a data-only interface such as sys.argv or an environment variable.

An attacker can provide quotation marks, semicolons, newlines, comments, or other Python syntax that terminates the intended assignment and introduces additional Python statements. For example, a topic shaped like the following can turn the generated source into executable Python code:

text
"; __import__('os').system('attacker-controlled-command'); #

The resulting Python source is equivalent to:

python
topic = ""; __import__('os').system('attacker-controlled-command'); #"

This executes before the normal research workflow continues. The vulnerability does not require the topic to be interpreted as a shell command: it is a direct Python source-code injection caused by embedding untrusted data into generated code.

Attack Path

  1. An attacker supplies or persuades an agent to use a specially crafted research topic.
  2. The topic is passed as the first command-line argument to either shell script.
  3. Bash expands $TOPIC while constructing the unquoted heredoc.
  4. The expanded value becomes part of the Python program supplied to python3.
  5. Th ...[truncated 715 chars]
Remediation
View remediation

Remediation Suggestions

Use a quoted heredoc so that Bash performs no expansion within the Python source, and pass dynamic values through command-line arguments:

bash
python3 - "$OUTPUT_DIR" "$TOPIC" <<'PYTHON_SCRIPT'
import sys

output_dir = sys.argv[1]
topic = sys.argv[2]
PYTHON_SCRIPT

Apply the same pattern to every Python heredoc in both shell scripts.

Additional hardening should include:

  1. Never generate program source by concatenating or interpolating untrusted input.
  2. Use sys.argv, environment variables, standard input, or a serialized format such as JSON to transfer data between Bash and Python.
  3. Quote heredoc delimiters as <<'PYTHON_SCRIPT'.
  4. Add regression tests containing quotes, semicolons, backticks, dollar signs, newlines, and Python syntax.
  5. Run the research scripts with the minimum filesystem and network privileges required.
  6. Consider replacing the shell/Python hybrid implementation with a single Python entry point to remove the cross-language injection boundary.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/auto-research.sh:14
Finding

Predictable Shared Temporary Directories Permit Symlink-Based File Clobbering

Content
View full analysis

Vulnerability Details

File Location: scripts/auto-research.sh:14-15, 31-52, 260; scripts/auto-research-v2.sh:15-16, 83-112, 338; scripts/auto-researcher.py:466-469, 477-507
Vulnerability Type: Unsafe temporary-file and directory creation
Risk Level: Medium

Vulnerable Code

From scripts/auto-research.sh:14-15:

bash
OUTPUT_DIR="/tmp/research_$(date +%Y%m%d_%H%M%S)"
mkdir -p "$OUTPUT_DIR"

Representative file creation from the same script:

bash
curl -s "https://www.reddit.com/search.json?q=$TOPIC&limit=20" \
  -H "User-Agent: auto-researcher/1.0" > "$OUTPUT_DIR/reddit.json" 2>/dev/null || echo "⚠️  Reddit 搜索失败"
python
with open(f"{output_dir}/report.md", 'w', encoding='utf-8') as f:
    f.write(report)

From scripts/auto-research-v2.sh:15-16:

bash
OUTPUT_DIR="/tmp/research_$(date +%Y%m%d_%H%M%S)"
mkdir -p "$OUTPUT_DIR"

Representative file creation from the same script:

python
with open(f"{output_dir}/hackernews.json", 'w') as f:
    json.dump(hn_data, f, indent=2)
python
with open(f"{output_dir}/report_enhanced.md", 'w', encoding='utf-8') as f:
    f.write(report)

From scripts/auto-researcher.py:466-469:

python
if not output_dir:
    output_dir = f"/tmp/auto-researcher_{datetime.now().strftime('%Y%m%d_%H%M%S')}"

os.makedirs(output_dir, exist_ok=True)

Representative output creation from the Python implementation:

python
save_json(hn_results, os.path.join(output_dir, 'hackernews.json'))

Technical Analysis

The default output paths are generated from timestamps with one-second precision in a shared /tmp namespace. Their names are therefore predictable. Directory creation is not exclusive: mkdir -p and os.makedirs(..., exist_ok=True) both accept a directory that already exists.

After accepting the directory, the scripts create known output filenames using shell redirection or Python open(..., 'w'). These operations follow symbolic links and truncate their ...[truncated 1677 chars]

Remediation
View remediation

Remediation Suggestions

Create temporary directories atomically with unpredictable names and restrictive permissions.

For the shell scripts:

bash
umask 077
OUTPUT_DIR="$(mktemp -d "${TMPDIR:-/tmp}/auto-researcher.XXXXXXXXXX")" ||
    exit 1

For the Python implementation:

python
import tempfile

output_dir = tempfile.mkdtemp(prefix="auto-researcher-")
os.chmod(output_dir, 0o700)

Additional hardening should include:

  1. Do not use timestamp-only names for temporary directories.
  2. Do not accept a pre-existing default temporary directory.
  3. Set a restrictive umask, such as 077, before creating research data.
  4. Create files with exclusive semantics where appropriate, such as Python mode "x" or os.open() with O_CREAT | O_EXCL | O_NOFOLLOW.
  5. Validate user-supplied --output paths and document that they must point to trusted directories.
  6. Refuse symbolic-link output paths when overwriting is not explicitly requested.
  7. Clean up temporary data after use when retention is unnecessary.
  8. Avoid running the Skill with elevated privileges.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (20)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The description overstates the implemented functionality. The code does perform topic-based multi-source research and report generation, so the general purpose is aligned. However, the declared supported platforms include Reddit, YouTube, and news websites, none of which are directly queried by the script. Actual sources are Hacker News, GitHub, Product Hunt, Twitter/X, and generic web search through Jina/DuckDuckGo. Additionally, the promised outputs such as market trends, competition analysis, technical research, and user feedback summaries are not substantively produced; the markdown report contains fixed sections with placeholder bullets like '[根据数据填写...]' rather than real automated synthesis. Therefore this is a description-behavior mismatch due to overstated platform coverage and overstated analytical capability.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

代码的核心方向与声明部分一致,确实是在做多平台主题检索并生成结构化研究报告,因此不是完全无关的技能。但声明明显高于实际实现:一方面少了 YouTube 和新闻网站两个已宣称的平台;另一方面“自动输出”高级分析结论并未真正实现,报告中的主要讨论点、市场机会、风险和行动建议大多是模板或占位符。Product Hunt 也仅下载搜索页面 HTML,没有被纳入分析结果。因此描述不能准确代表实际能力,存在实质性夸大与功能缺失。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
89% confidence
Finding

该代码的总体方向与“自动研究助手”基本一致:确实会联网收集多平台信息并生成结构化报告,因此不是完全不同用途的技能。但描述存在明显夸大。实际实现的平台只有 Hacker News、GitHub、Product Hunt、Twitter/X 和 DuckDuckGo,缺少描述中列出的 Reddit、YouTube,以及真正的新闻网站集成。另一个重要偏差是“自动输出市场趋势、竞争分析、技术调研、用户反馈汇总”这一能力:代码虽然生成了这些章节标题,但大量内容是固定模板或占位符,例如“[根据数据中识别]”“[机会点 1]”,并没有执行实质性的分析推理。因此,描述未准确反映实际能力,属于实质性不匹配。

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases include very common words like '研究', '分析', and '收集信息', making accidental activation likely during ordinary conversation. Because the skill can perform network requests, shell actions, and local file writes, broad triggers materially raise the risk of unintended external data transmission and side effects without clear user intent.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The second Python heredoc is closed before the report-generation logic, so the advertised reporting code does not execute as intended and subsequent Python-like lines may instead be interpreted by the shell. In a shell script, this kind of boundary error can cause unexpected command execution attempts, misleading users about what ran, and unsafe failure modes if modified or partially matched by shell syntax.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill invokes shell commands, performs outbound network requests, and writes results to local files, but it declares no explicit tool scope or permission boundaries. In an agent ecosystem, this makes the capability surface opaque to users and policy engines, increasing the chance of unintended execution, data exfiltration, or unsafe file writes when the skill is triggered.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The description does not warn users that their query terms may be sent to multiple third-party services and that retrieved data and generated reports are stored locally. This creates a transparency and privacy problem: users may unknowingly disclose sensitive topics, customer names, or internal project details to external platforms and leave artifacts on disk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The top-level description is written as a Chinese-only assistant and states that it automatically generates structured reports, with no indication that users may choose another language. Because the file does not document a region-specific or compliance-based reason for this locale constraint, it appears to impose a language preference without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

User-facing comments, usage text, and runtime messages are written entirely in Chinese, with no language selection or indication that the skill is intended only for a Chinese-speaking audience. This creates a language policy issue because the skill effectively forces a locale/language choice on all users without opt-in or justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script transmits the user-supplied research topic to multiple third-party services, including a proxy service, and writes retrieved content to /tmp without explicit consent or warning. If users enter sensitive internal topics, project codenames, credentials by mistake, or regulated data, this can leak confidential information externally and leave recoverable local artifacts on shared systems.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest describes a cross-platform research assistant supporting X/Twitter, Reddit, YouTube, GitHub, Hacker News, Product Hunt, and news websites. In code, only Hacker News, GitHub, Product Hunt, Twitter/X, and a DuckDuckGo-based generic web search are actually queried; there is no Reddit, YouTube, or dedicated news-site collection logic.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

All usage text, status messages, and generated report sections are presented in Chinese, with no option for users to select another language. Per the policy, forcing a specific language without user opt-in is a natural-language policy concern unless clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest says the skill supports X/Twitter, Reddit, YouTube, GitHub, Hacker News, Product Hunt, and news websites. In code, the implemented collection steps only cover X/Twitter, Reddit, GitHub, Hacker News, and Product Hunt; there is no YouTube or news-site retrieval logic, so the actual behavior falls short of the described platform coverage.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script sends the user-supplied research topic to several third-party services via command-line tools and HTTP requests without any consent prompt, warning, or data-minimization controls. If users research confidential projects, customer names, internal codenames, or sensitive topics, this can cause unintended disclosure to external platforms and local shell history/process inspection surfaces.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest describes an automatic research assistant that outputs market trends, competition analysis, technical research, and user-feedback summaries. The generated report mainly lists fetched items and inserts placeholders like '[需要人工分析]' and template sections for opportunities, risks, and next steps, which means those promised analyses are not actually performed automatically.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Natural-language strings in the docstring, help text, logs, and generated report are written in Chinese, which effectively forces a specific language for users. The file does not indicate that this is a region-specific tool or provide any opt-in or alternative locale selection.

Content

No source excerpt is available for this finding.

Unbounded Resource Access

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.

Content

Scanner excerpt · scripts/auto-researcher.py (reported line 52)May include surrounding context.

python
color = colors.get(level, '')
    print(f"{color}{msg}{Color.ENDC}")

def fetch_json(url, headers=None, timeout=None):
    """获取 JSON 数据"""
    if headers is None:
        headers = {}

Unbounded Resource Access

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.

Content

Scanner excerpt · scripts/auto-researcher.py (reported line 70)May include surrounding context.

python
color = colors.get(level, '')
    print(f"{color}{msg}{Color.ENDC}")

def fetch_json(url, headers=None, timeout=None):
    """获取 JSON 数据"""
    if headers is None:
        headers = {}

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script transmits the user-supplied research topic to several external services, including the third-party Jina proxy, without any consent prompt, warning, or data-handling disclosure. Research topics can easily contain confidential business plans, customer names, internal incidents, or other sensitive terms, so silent exfiltration to multiple providers creates a real privacy and data-governance risk.

Content

No source excerpt is available for this finding.

Scope Creep

Low
Category
Excessive Agency
Confidence
70% confidence
Finding

Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.

Content

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

md
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

Static analysis

No suspicious patterns detected.