Back to skill

Security audit

BUDDY 宠物系统

Security checks for vulnerabilities and agentic risk

Overview

The skill is a mostly coherent virtual pet tool, but it uses shared persistent state in /tmp and includes broad activation plus AI-context prompt behavior that should be reviewed before installation.

Review this skill before installing if you use shared machines or multi-user agent runtimes. Prefer a version that stores state in a private per-user directory, validates saved pet names, documents the save command, and narrows activation to explicit /buddy commands.

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

Warning
Location
scripts/buddy.ts:23
Finding

Predictable Shared Temporary State Allows Cross-User Tampering and Symbolic-Link Attacks

Content
View full analysis
; } function loadState(): BuddyState { try { if (!existsSync(STATE_FILE)) { return { muted: false }; } const data = readFileSync(STATE_FILE, 'utf-8'); return JSON.parse(data); } catch { return { muted: false }; } } function saveState(state: BuddyState): void { try { writeFileSync(STATE_FILE, JSON.stringify(state, null, 2)); } catch (e) { // Silently fail if can't write state } } ``` The saved-pet operation writes user-controlled state to the same global file: ```ts if (command === 'save') { const species = args[2] as any; // Optional species parameter const petName = args[3] as string || '小墨'; // Optional name parameter const pet = generatePerfectCompanion(species); pet.name = petName; const state = loadState(); state.savedPet = pet; saveState(state); ``` ### Technical Analysis The application stores all state in the fixed, globally predictable path `/tmp/buddy-state.json`. The filename does not incorporate `userId`, so every invocation and every user of the Skill reads and modifies the same state. The code does not: - Isolate state by user. - Validate file ownership or permissions. - Verify that the path refers to a regular file. - prevent symbolic-link traversal. - Use restrictive file creation permissions explicitly. - Create the file atomically. - Validate parsed JSON against a runtime schema. TypeScript interfaces do not validate data returned by `JSON.parse`. Consequently, a party able to modify the s ...[truncated 2224 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
scripts/buddy.ts:266
Finding

Persistent Terminal Escape and Output Injection Through Unsanitized Pet Names

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (14)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill metadata and description understate material behavior: it appears to persist state, expose undocumented commands, and generate an 'AI CONTEXT INJECTION PROMPT'. Hidden persistence and prompt-generation capabilities reduce operator visibility and can enable unintended cross-session state or indirect prompt manipulation, especially because users and orchestrators may invoke the skill based on the declared description alone.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The trigger definition includes broad natural-language phrases and '任何与宠物互动相关的话题', which can cause the skill to activate on loosely related conversation. Over-broad activation increases the chance of unintended execution of skill logic, including persistence or prompt-related features, without clear user intent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The '调用时机' section uses topic-based matching such as '任何与 BUDDY、小墨、宠物相关的问题', which is insufficiently constrained. In context, this is more dangerous because the skill also advertises context injection and stateful behavior, so accidental triggering can have effects beyond harmless display output.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The file-level documentation says generation is deterministic and that each person has only one fixed pet. However, generateCompanion sets hatchedAt to Date.now(), so repeated calls for the same user produce different Pet objects over time rather than a fully fixed companion record.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The generated pet fields use fixed Chinese strings for the default name and personality, which forces a specific language in user-facing output. The file does not provide any user opt-in, localization mechanism, or documented region-specific justification for this language constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The perfect-companion generator returns fixed Chinese strings and comments indicate Chinese-specific defaults, again imposing a language choice on all users. This is a natural-language policy concern because the code provides no alternative language selection or documented justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This TypeScript file contains multiple hard-coded Chinese user-facing strings, including interaction text and mute/unmute instructions, with no opt-in or alternative locale handling. That creates a natural-language policy concern under the language/locale rule because the skill effectively forces one language for end users regardless of preference.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The 'prompt' command exposes explicit AI context-injection text that is not part of the stated pet skill purpose. In an agent environment, generating hidden or auxiliary prompt material is security-relevant because it can alter downstream model behavior outside the user's visible request and may be repurposed to influence responses in ways not covered by the manifest.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code actively supports AI context injection for a pet skill, which is not justified by the declared functionality of generating and displaying a virtual pet. Because skill context is potentially composable with other agent behaviors, this makes the feature more dangerous: even benign-seeming pet metadata can become a mechanism for steering model behavior or bypassing expected separation between tool output and model instructions.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The undocumented 'save' command adds persistent state and user-controlled behavior beyond the skill's declared pet interaction scope. Hidden persistence increases the attack surface, can surprise integrators or users, and creates an unreviewed path for storing and later replaying user-supplied content such as pet names.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

L003 的技能描述整体以中文固定表述触发和行为,未说明是否支持其他语言或允许用户选择语言。按自然语言策略要求,若技能对语言/locale 有默认强制约束而无用户选择,可能构成语言策略问题。

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The comment says the function validates that generation is deterministic, but the check only compares species, rarity, shiny, eye, and hat. It does not validate hatchedAt, name, personality, stats, or muted, so it does not actually prove full Pet determinism.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file hard-codes a Chinese pet name and Chinese-language personality description as defaults. This creates a locale/language preference in the skill behavior without any indication that the user can choose or opt in to that language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

This TypeScript file contains multiple user-facing labels in Chinese for rarity and hat names. Because there is no indication in this file that users can choose their language or that the skill is region-specific, the file appears to enforce a specific locale in a way that may violate language-choice policy.

Content

No source excerpt is available for this finding.