Back to skill

Security audit

Smart Agent Template

Security checks for vulnerabilities and agentic risk

Overview

This skill is partly a workflow template, but it also ships bot integrations and startup behavior with unsafe defaults that users should review before installing.

Install only after reviewing and disabling the default auto-update, removing TLS-verification bypasses and SDK rewriting, requiring authenticated webhook/bot access, sanitizing IDs before filesystem use, and clearing bundled runtime history. Treat this as a Review item rather than a routine workflow-template skill.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
Findings (9)

T03 · Remote Payload Retrieval and Execution

Error
Location
docs/OLLAMA_SETUP.md:16
Finding

Unverified Remote Installer Is Piped Directly to a Shell

Content
View full analysis
Remediation
View remediation

T07 · Tool Hijacking and Spoofing

Error
Location
integrations/feishu/start_longconn.sh:21
Finding

Feishu Launcher Rewrites an Installed SDK and Disables TLS Verification

Content
View full analysis
/dev/null || true # Modify line 152 python3 <
Remediation
View remediation

T03 · Remote Payload Retrieval and Execution

Error
Location
scripts/auto_update.sh:42
Finding

Default Startup Workflow Pulls Unreviewed Code from a Mutable Branch

Content
View full analysis
/dev/null || { [ "$SILENT" != "true" ] && echo "⚠️ 无法连接远程仓库" exit 0 } REMOTE_COMMIT=$(git rev-parse "$REMOTE/$BRANCH") if [ "$LOCAL_COMMIT" = "$REMOTE_COMMIT" ]; then [ "$SILENT" != "true" ] && echo "✅ 已是最新版本" exit 0 fi git pull "$REMOTE" "$BRANCH" || { echo "❌ 更新失败,请手动处理" exit 1 } TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S") UPDATE_LOG="- [$TIMESTAMP] 自动更新: $LOCAL_COMMIT -> $REMOTE_COMMIT" if [ -f "$MEMORY_FILE" ]; then echo "$UPDATE_LOG" >> "$MEMORY_FILE" fi ``` ### Technical Analysis The mandatory startup procedure invokes an updater that is enabled by default and pulls from the mutable `main` branch. The update is applied without checking a signed commit, pinned release, expected hash, reviewed diff, or user approval. Because the repository contains executable scripts and Agent instruction files, changing the remote branch can alter both locally executed code and the behavioral rules loaded by the Agent. The effective payload can therefore change after the Skill package has passed review. ### Attack Path 1. An attacker compromises the remote repository, maintainer account, CI release process, or configured Git remote. 2. The attacker pushes modified scripts or Agent instructions to `main`. 3. On startup, the workflow executes `scripts/auto_up ...[truncated 508 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
integrations/feishu/bot.py:47
Finding

Feishu Public Webhook Accepts Unauthenticated Message Events

Content
View full analysis
bool: """验证飞书请求签名""" if not encrypt_key: return True # 未配置加密则跳过验证 content = timestamp + nonce + encrypt_key + body sig = hashlib.sha256(content.encode()).hexdigest() return sig == signature ``` ```python # Verify signature timestamp = self.headers.get('X-Lark-Request-Timestamp', '') nonce = self.headers.get('X-Lark-Request-Nonce', '') signature = self.headers.get('X-Lark-Signature', '') if config.feishu.encrypt_key: if not verify_feishu_signature( timestamp, nonce, config.feishu.encrypt_key, body, signature ): self._send_response(401, {"error": "Invalid signature"}) return event_data = json.loads(body) # The token is checked only during URL verification if event_data.get('type') == 'url_verification': challenge = event_data.get('challenge', '') token = event_data.get('token', '') if token != config.feishu.verification_token: self._send_response(401, {"error": "Invalid token"}) return ``` ```python server = HTTPServer(('0.0.0.0', config.feishu.port), FeishuWebhookHandler) ``` ```python # VERIFICATION_TOKEN is optional # if not self.feishu.verification_token: # raise ValueError("FEISHU_VERIFICATION_TOKEN is required") ``` ### Technical Analysis The HTTP server listens on all interfaces. For normal message events, authentication is performed only if `FEISHU_ENCRYPT_KEY` happens to be configured. Configuration validation does not require the verification token or encryption key, and the token is checked only for the initial URL-verification event. Consequently, a deployment that follows the all ...[truncated 1077 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
integrations/memory_manager.py:75
Finding

Externally Supplied User IDs Are Used Directly in Filesystem Paths

Content
View full analysis
list: path = os.path.join(self.storage_dir, f"{user_id}_history.json") if os.path.exists(path): with open(path, 'r', encoding='utf-8') as f: return json.load(f) return [] def save_history(self, user_id: str, history: list): max_msgs = SHORT_TERM_ROUNDS * 2 if len(history) > max_msgs: history = history[-max_msgs:] path = os.path.join(self.storage_dir, f"{user_id}_history.json") with open(path, 'w', encoding='utf-8') as f: json.dump(history, f, ensure_ascii=False, indent=2) ``` ```python def _load_memory_file(self, user_id: str) -> str: path = os.path.join(self.storage_dir, f"{user_id}_memory.md") if os.path.exists(path): with open(path, 'r', encoding='utf-8') as f: return f.read() return "" def save_memory(self, user_id: str, content: str): path = os.path.join(self.storage_dir, f"{user_id}_memory.md") with open(path, 'w', encoding='utf-8') as f: f.write(content) ``` ```python def _load_tasks(self, user_id: str) -> Dict: path = os.path.join(self.storage_dir, f"{user_id}_tasks.json") if os.path.exists(path): with open(path, 'r', encoding='utf-8') as f: return json.load(f) return {} def _save_tasks(self, user_id: str, tasks: Dict): path = os.path.join(self.storage_dir, f"{user_id}_tasks.json") with open(path, 'w', encoding='utf-8') as f: json.dump(tasks, f, ensure_ascii=False, indent=2) ``` ### Technical Analysis ...[truncated 1609 chars]
Remediation
View remediation

T02 · Agent Memory Poisoning

Error
Location
integrations/memory_manager.py:173
Finding

User-Controlled Instructions Can Be Persisted and Reintroduced as Agent Memory

Content
View full analysis
str: memory = self.load_memory(user_id) parts = [base_prompt or "你是一个智能助手,回答简洁友好。"] if memory: parts.append(f"\n【用户记忆】\n{memory}") parts.append("\n请根据用户记忆和对话历史,准确理解上下文并回复.") return "\n".join(parts) ``` ### Technical Analysis The workflow explicitly instructs the Agent to persist statements containing trigger phrases such as “remember,” “always,” and “forever.” Separately, conversation history is summarized by an AI model and the generated result is saved as long-term memory. Stored memory is subsequently concatenated into the system prompt without being represented as structured, untrusted data. There is no policy that distinguishes factual preferences from executable instructions, no confirmation workflow, and no filtering of prompt-control language. This permits a user or unauthenticated web ...[truncated 980 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
integrations/feishu/data/memory/ou_13bb618d4267d6f3b15db89f6cc12d1b_history.json:1
Finding

Runtime Feishu Identifier and Conversation Transcript Are Included in the Package

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
integrations/telegram/bot.py:36
Finding

Telegram Bot Token Prefix Is Written to Process Logs

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
integrations/telegram/bot.py:38
Finding

Configured Telegram Administrator Boundary Is Not Enforced

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • 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 (195)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The declared description presents a broad workflow template with features like triple-judgment logic, automatic updates, WBS/task decomposition, exemption thresholds, and memory-management best practices. The supplied code chunk does something narrower and materially different: it analyzes stored conversation history to compute a health score, derives a strategy from that score, and adjusts context/system prompt behavior. While 'Context 优化' loosely overlaps with applying a strategy to context, the main implemented functionality is conversation-quality monitoring and adaptive prompt/context tuning, not the described workflow-template features. No dangerous extra permissions are evident, but the primary purpose is mismatched.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description presents a workflow/template artifact about agent operating norms and optimization practices. In contrast, the supplied code is specifically an operational Feishu bot integration: it opens a network listener, verifies Feishu webhook signatures/tokens, handles chat message events, creates an AI adapter, and sends outbound messages through Feishu APIs. This is a materially different primary purpose and includes undeclared external network/chat integration capabilities. While the description mentions memory management and smart-agent context, this code chunk itself is not implementing the described workflow best-practice template; it is implementing messaging infrastructure for Feishu.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description presents this as a workflow/template for Smart Agent best practices (decision logic, WBS/task规范, context optimization, memory management). However, the supplied code is not a generic workflow template; it is concrete integration code for a Feishu bot runtime. Its primary purpose is to run a messaging bot over Feishu long connections, process incoming IM events, invoke an AI backend, persist chat memory, and send replies. While memory and task parsing are related to the declared agent concepts, the dominant behavior—external bot integration, event handling, token retrieval, and message delivery—is undeclared and materially different from the stated template-oriented purpose. The SSL-verification disabling is also an undeclared security-relevant behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The declared description presents a high-level smart-agent workflow template with decision mechanisms, execution规范, WBS/task decomposition, memory management, and context optimization. However, the supplied code chunk does not implement any workflow logic, decision framework, auto-update behavior, context optimization, or memory features. Instead, it is a configuration module for Feishu bot credentials and AI engine settings. This is a materially different primary purpose, so the description does not accurately represent the code.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description presents a generic smart-agent workflow template focused on process design and best practices such as triple-decision logic, automatic updates, context optimization, WBS/task execution rules, thresholds, and memory management. The supplied code instead is specifically an operational Feishu integration handler: it receives Feishu events, extracts sender/message data, handles commands, invokes an AI adapter for responses, persists chat memory, tracks tasks, and reports status. While memory management and task-related behavior partially align with the template theme, the primary purpose is materially different and significantly more specific: a live chat bot integration for Feishu. This is an undeclared capability and trigger surface compared with the description, so it should be flagged as a mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description presents a generic workflow/template skill for agent execution logic and best practices, but the actual code chunk is specifically an operational launcher for a Feishu integration. Its primary purpose is to initialize configuration and start a Feishu bot, which is materially different from the described workflow-template functionality. This is not just a supporting implementation detail of the declared purpose; it introduces a concrete external integration and process-launching behavior not reflected in the description.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description presents a workflow/process template for smart-agent task management and execution best practices. The supplied code does not implement workflow logic, WBS decomposition, memory management, context optimization, or auto-update mechanisms. Instead, it is an integration startup script whose main purpose is to patch the websockets library so SSL certificate verification is disabled, then start a Feishu bot. Disabling SSL verification is a significant operational/security-affecting capability that is not reflected in the description. Therefore, the code’s actual behavior is materially different from the declared purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared description presents a workflow/process template for a smart agent, with planning and context-management best practices. The supplied code instead performs operational integration tasks for a Feishu bot: validating environment variables, reading credentials, patching the lark-oapi SDK, weakening SSL verification, and launching bot_longconn.py. These are materially different from the declared purpose and introduce undeclared capabilities involving external integration, local configuration access, code modification, and network-security behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

The description presents a comprehensive workflow template covering decision mechanisms, automatic updates, context optimization, task execution standards, WBS splitting, exemption thresholds, and memory management. However, this code chunk only implements the memory-management portion: local history/memory file storage, periodic AI-based summarization, optional OpenClaw-backed semantic search, prompt assembly, and conversation processing. While '自动更新' and 'Context 优化' are partially consistent with the summarization and prompt-building behavior, the broader declared functionality is not represented in this code. Additionally, the module can call an external executable via subprocess for memory search, which is a meaningful capability absent from the declaration. Therefore the description does not accurately represent what this specific code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

The declared description presents a comprehensive smart-agent workflow template with multiple advanced governance/workflow features. However, the supplied code is narrowly focused on message parsing and response-quality checking. It does not implement automatic updating, memory management, WBS decomposition, exemption thresholds, or a distinct three-stage decision mechanism. While there is some limited context handling and prompt optimization, the primary behavior is materially different and substantially narrower than the declared purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description presents this skill as a workflow/template and best-practice framework for agent execution, decision mechanisms, context optimization, WBS, and memory management. The supplied code instead implements a concrete task-tracking integration with filesystem persistence and task CRUD behavior. Its primary purpose is materially different: it manages numbered tasks and stores them in local JSON files, which is not described in the declared purpose. This is more than a supporting detail; it is the core behavior of the code. No evidence in the code supports the advertised triple-judgment mechanism, automatic update workflow logic, context optimization, WBS decomposition, exemption thresholds, or memory management.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The declared description presents a workflow/process template with decision mechanisms, auto-update behavior, WBS/task-planning guidance, exemption thresholds, and memory-management best practices. The supplied code does not implement that workflow logic. Instead, it is an integration layer for AI engines: it constructs message payloads from recent chat history and memory, builds system prompts, and calls OpenAI/Anthropic/DeepSeek/Ollama APIs or compatible endpoints. While there is a loose connection to 'context optimization' and memory usage, the primary purpose is materially different and includes undeclared network/model-integration capabilities. Therefore the description does not accurately represent the code chunk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The declared description presents this as a workflow/template specification emphasizing internal agent-process best practices such as triage logic, auto-update behavior, context optimization, WBS/task management, and memory strategy. The supplied code chunk instead implements a concrete Telegram integration: it starts a bot, validates Telegram-related environment configuration, creates an AI backend adapter, registers command and content handlers, and listens for incoming Telegram updates. This is a materially different primary purpose and introduces undeclared external communication capabilities and triggers through Telegram. While memory/task commands may loosely relate to the template theme, the main behavior of this code is bot operation rather than workflow-template logic.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The description presents a generic Smart Agent workflow/template focused on internal decision mechanisms, auto-update behavior, context optimization, WBS/task-execution norms, and memory best practices. The supplied code is specifically a Telegram integration layer that receives platform messages, exposes bot commands, sends replies, tracks per-user tasks, reports system/memory status, and handles media/file events. While some described themes partially overlap with the code (context optimization, memory management, task parsing), the primary purpose and major capabilities are materially different: this chunk is a Telegram bot handler implementation, not just a workflow template. The declared triggers are empty, but the code clearly reacts to Telegram commands and incoming messages. Therefore the description does not accurately represent what this code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description presents a workflow/agent template for task management and context optimization, but the supplied code is a simple log archival shell script. Its primary purpose is filesystem maintenance: locating old .md files under a logs directory and moving them into an archive folder. This is materially different from the declared smart-agent workflow functionality and introduces undeclared file-management behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The declared description presents this skill as a general workflow/template for agent execution practices and memory management best practices. However, the supplied code is a concrete filesystem maintenance script focused narrowly on compressing a specific markdown memory file when it exceeds 100 lines. It performs backup, filtering, and in-place edits to hot.md, which is much more specific operational behavior than the description suggests. While 'memory management' is mentioned in the description, the code's primary purpose is file cleanup/compression rather than implementing the broader workflow, decision mechanism, WBS, or context optimization claims. Therefore the code chunk does not accurately represent the declared purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description presents a workflow/template for agent behavior and process best practices, but the code is a concrete reporting utility that processes local metrics data and writes a weekly performance report. Its primary purpose is materially different from the declared workflow/template description. Although the code does not request dangerous permissions, it does access local log and report files and performs reporting/analytics capabilities that are not reflected in the description.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The description promises a broad smart-agent workflow template with decision logic, automatic updating, context optimization, and best-practice execution features. However, this code chunk only implements a repository/template health check: it inspects specific files/directories and enforces a size threshold for memory/hot.md. That is materially different from the declared primary purpose. While health checks could be a supporting utility within such a template, the supplied chunk itself does not exhibit the described workflow, update, or task-management capabilities, so the description does not accurately represent what this code actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

声明描述的是一个面向智能体流程设计的工作流模板与方法论集合,而提供的代码片段只实现了本地性能指标记录功能。两者主目的明显不同:声明强调流程机制、自动更新、上下文优化和记忆管理最佳实践;代码则只是把传入的运行数据写入日志文件。该日志记录能力并未在声明中体现,且代码没有展现声明中提到的三重判断、WBS 拆分、流程阈值或自动更新等核心行为。因此这是明显的描述与实际行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description presents a high-level agent workflow/process template, not a file-manipulation utility. The actual code’s primary purpose is safe file writing with locking semantics. That is a materially different behavior from workflow orchestration, context optimization, WBS/task-planning, or memory-management guidance. No triggers or permissions are declared, yet the code performs direct file system modification, which is an undeclared capability. This is therefore a clear description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description presents a workflow/template for smart-agent task orchestration and best practices, but the provided code is a simple log-search utility. Its primary purpose is materially different: it performs recursive grep operations over a specific logs directory rather than implementing workflow logic, auto-update behavior, context optimization, WBS decomposition, or memory management. No triggers or permissions are declared, yet the code accesses filesystem log data. This is a clear description-behavior mismatch.

Content

No source excerpt is available for this finding.

External Script Fetching

High
Category
Supply Chain
Confidence
98% confidence
Finding

The documentation instructs users to download and immediately execute a remote shell script via curl ... | sh, which bypasses inspection, integrity verification, and provenance checks. If the remote host, CDN path, or connection is compromised, users could execute arbitrary code on their systems with the privileges of the shell session.

Content

Scanner excerpt · docs/OLLAMA_SETUP.md (reported line 18)May include surrounding context.

Linux:

bash
curl -fsSL https://ollama.com/install.sh | sh

Windows:

Chaining Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

The | sh construct chains remote content retrieval directly into shell execution, eliminating the user's chance to review or validate what will run. In a setup guide, this is particularly dangerous because readers tend to copy-paste installation commands, amplifying the chance of arbitrary code execution if the upstream script is modified or intercepted.

Content

Scanner excerpt · docs/OLLAMA_SETUP.md (reported line 18)May include surrounding context.

Linux:

bash
curl -fsSL https://ollama.com/install.sh | sh

Windows:

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · docs/OLLAMA_SETUP.md (reported line 226)May include surrounding context.

bash
# 清理缓存重试
rm -rf ~/.ollama/models
ollama pull llama2

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · docs/OLLAMA_SETUP.md (reported line 226)May include surrounding context.

bash
# 清理缓存重试
rm -rf ~/.ollama/models
ollama pull llama2