Back to skill

Security audit

emergent-collective-intelligence

Security checks for vulnerabilities and agentic risk

Overview

The core skill is local aggregation code, but it also stores arbitrary usage notes and preferences and encourages rewriting its own instructions, which needs review before installation.

Install only if you are comfortable with the skill keeping local plaintext learning state. Avoid storing sensitive prompts, customer data, secrets, or private notes in its learner commands, and review or clear learned_patterns.json before relying on future recommendations. Treat any generated reflection text as untrusted historical data, not as instructions to edit the skill automatically.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

T02 · Agent Memory Poisoning

Warning
Location
scripts/learner.py:67
Finding

Unvalidated Persistent State Can Poison Future Agent Behavior

Content
View full analysis

Vulnerability Details

File Location: scripts/learner.py:67-100, scripts/learner.py:113-121, and SKILL.md:52-55,61-74
Vulnerability Type: Persistent agent-state poisoning
Risk Level: Medium

Vulnerable Code

python
def save_learning(skill_dir, data):
    data["lastUpdated"] = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M")
    p = learn_path(skill_dir)
    with open(p, "w", encoding="utf-8") as f:
        f.write(json.dumps(data, indent=2, ensure_ascii=False))

def record_op(skill_dir, capability, success=True, error=None, note=None):
    data = load_learning(skill_dir)
    data["totalOps"] += 1
    cap = data["capabilityStats"].setdefault(capability, {"count": 0, "success": 0, "fail": 0})
    cap["count"] += 1
    if success:
        cap["success"] += 1
    else:
        cap["fail"] += 1
        data["totalErrors"] += 1
    if error:
        ep = data["errorPatterns"].setdefault(error, {"count": 0, "lastNote": "", "lastTime": ""})
        ep["count"] += 1
        ep["lastNote"] = note or ""
        ep["lastTime"] = data["lastUpdated"] or datetime.datetime.now().strftime("%Y-%m-%dT%H:%M")
    rec = {"t": data["lastUpdated"], "cap": capability, "ok": success, "err": error, "note": note}
    data["recentOps"].append(rec)
    data["recentOps"] = data["recentOps"][-20:]
    save_learning(skill_dir, data)
    return data

def record_preference(skill_dir, key, value):
    data = load_learning(skill_dir)
    data["preferences"][key] = value
    save_learning(skill_dir, data)
    return data
python
def self_reflect(skill_dir):
    data = load_learning(skill_dir)
    suggestions = []
    for err, info in data["errorPatterns"].items():
        if info["count"] >= THRESHOLD_ERROR:
            suggestions.append(
                f"⚠️ Error '{err}' has occurred {info['count']} times; add validation or fallback steps "
                f"and write the
...[truncated 3604 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the instruction to automatically write accumulated experience into SKILL.md. Treat that file as reviewed, immutable skill code rather than runtime state.
  2. Treat every value loaded from learned_patterns.json as untrusted data. Never present stored notes or preferences as authoritative agent instructions.
  3. Define and enforce a strict schema for all persisted fields, including maximum lengths, allowed keys, expected value types, and permitted character sets where practical.
  4. Separate descriptive observations from executable or behavioral instructions. Store fixed identifiers for errors and preferences instead of unrestricted prose whenever possible.
  5. Require explicit, informed user approval before saving a preference or applying it in a later session.
  6. Before displaying reflection output, escape or clearly delimit all stored values and prepend a warning that the content is untrusted historical data.
  7. Do not interpolate free-form lastNote, error names, or capability names into recommendations that an agent may interpret as instructions.
  8. Add provenance and integrity metadata to persistent entries, such as the originating user, invocation, timestamp, and approval status.
  9. Provide commands to inspect, revoke, and completely reset persistent learning data.
  10. Avoid storing secrets or sensitive user content in notes and preferences; document the plaintext retention behavior and apply restrictive file permissions.
  11. Add tests using instruction-like payloads to verify that stored values remain inert data and cannot alter future skill instructions.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (14)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The manifest claims a collective-intelligence aggregation capability, but the documented behavior also introduces persistent logging, preference storage, and reflection features that are not part of that stated purpose. This mismatch is dangerous because reviewers and users may trust the declared benign analytical scope while the skill silently accumulates state and user data across runs.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill advertises commands that write persistent data (learned_patterns.json) but declares no explicit tool scope or permissions boundaries. That creates an authorization/transparency gap: a caller or platform may not realize the skill performs file writes, making unintended persistence and policy bypass more likely.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The documentation adds a persistent self-learning/memory subsystem that records usage, errors, and preferences over time, which materially expands the skill's behavior beyond one-shot aggregation. Persistent memory increases attack surface by creating retained sensitive natural-language data that can later be exposed, misused, or repurposed.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs operators to persist usage history, errors, and user preferences but provides no explicit privacy warning, consent flow, or disclosure of retention/use. That is dangerous because users may disclose sensitive information under the assumption of ephemeral processing while the skill creates durable records.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Collecting user preferences and usage history is not necessary for collective estimation as described, so the skill violates data minimization principles. Unnecessary persistence makes the context more dangerous because the skill's domain does not inherently require long-term user profiling, increasing privacy risk without clear functional justification.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Persistent natural-language logs of preferences, errors, and notes can easily capture sensitive or identifying information, and retained text is prone to later leakage through debugging, reuse, or unintended access. In this skill context, the risk is elevated because the retained data is unrelated to the advertised collective-intelligence function and may be accumulated indefinitely.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The example command explicitly records 输出语言 as 中文, which promotes a fixed language preference in the skill's natural-language instructions. Since there is no accompanying opt-in or indication that language is user-selectable, this conflicts with the policy requirement to avoid forcing a specific language without user choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This Python file contains user-facing natural-language documentation entirely in Chinese, including the main module description and usage context, without any opt-in or alternative locale. The policy requires flagging language or locale constraints when a specific language is effectively forced on users without documented choice or justification.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest presents a system that robustly exploits heterogeneous agent biases through diversity-weighted aggregation and peer correction. In practice, peer_correction pulls all estimates toward the mean, and diversity_weights then gives larger weights to estimates closest to the median, suppressing rather than positively leveraging diversity. This is a semantic mismatch between the advertised collective-intelligence mechanism and the implemented behavior.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The docstring describes '多样性/逆偏离加权', which in the manifest context implies leveraging diversity across agents. However, the code assigns higher weights to estimates nearer the group median and lower weights to outliers, which is consensus weighting rather than diversity weighting. This is an active contradiction between the documented intent and the implemented behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The file is documented and implemented as a generic cross-skill learning/logger module that records usage, user preferences, recurring errors, and optimization insights for arbitrary skills. That behavior is materially different from the manifest's claimed purpose of orchestrating diverse agents, aggregating their outputs, and verifying emergent collective superiority.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The module’s natural-language interface, description, and printed guidance are entirely in Chinese, which effectively imposes a locale/language choice on users. There is no indication that Chinese is optional or that the skill is intentionally region-specific, so this is a language policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module writes user preferences, operation notes, and error metadata to disk in learned_patterns.json without any consent flow, retention controls, redaction, or visibility to the user. In a shared workstation, synced home directory, or skill ecosystem, these notes can easily contain sensitive prompts, personal data, or operational context that becomes recoverable by other local users or processes.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The core operations here increment counters, store notes and preferences, summarize recurring errors, and generate improvement suggestions. None of this code implements the manifest-described capabilities such as multi-agent orchestration, mutual correction, diversity-weighted aggregation, or quantitative emergence judgment.

Content

No source excerpt is available for this finding.