Back to skill

Security audit

behavior-observability

Security checks for vulnerabilities and agentic risk

Overview

The skill needs review because it adds persistent self-learning and possible instruction rewrites that go beyond basic audit logging.

Install only if you are comfortable with the skill keeping local learning state and influencing future behavior. Treat learned_patterns.json as untrusted, avoid storing secrets or sensitive notes in it, and do not allow automatic SKILL.md rewrites without human review. Also verify the observability logging works for your use case, because the included CLI does not provide durable cross-run event history.

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

Error
Location
SKILL.md:55
Finding

Persistent Agent Memory Poisoning Through Unvalidated Learning State

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:55-77 and scripts/learner.py:69-96
Vulnerability Type: Persistent memory poisoning through automatically reused user-controlled preferences and agent-directed modification of governing instructions
Risk Level: High

Vulnerable Code and Instructions

The following is an English translation of the relevant instructions in SKILL.md:55-77:

markdown
This skill includes the general learning module `scripts/learner.py`. After each use,
it automatically reviews and accumulates experience to improve future output quality
and efficiency without manual maintenance.

`learned_patterns.json` records operation totals, capability usage frequency, error
patterns, user preferences, and improvement suggestions.

# Record a failure or exception
python scripts/learner.py record <skill-directory> \
  --capability capability-name --fail \
  --error recognition-failure --note "User supplied a nonstandard file"

# Record a user preference for direct use next time
python scripts/learner.py prefer <skill-directory> \
  --key output-language --val preferred-value

Iteration rules:
- When an error accumulates at least three occurrences, proactively add validation
  or fallback steps and write the experience back into this skill's `SKILL.md`.
- Important user preferences are written into `learned_patterns.json` and directly
  adopted the next time the skill is invoked.

The persistence implementation in scripts/learner.py:69-96 is:

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
    
...[truncated 4435 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the instruction to apply persisted preferences automatically. Present stored preferences as untrusted suggestions and require explicit confirmation from an authorized user before each adoption.
  2. Prohibit the learning workflow from modifying SKILL.md or any other governing instruction, executable, configuration, startup, or policy file.
  3. Separate passive telemetry from trusted configuration. Store operation statistics and free-form notes in a data-only location that is never interpreted as agent instructions.
  4. Define a strict schema for preferences. Permit only documented keys and constrained values, such as fixed enumerations, booleans, or bounded numeric values.
  5. Reject preference values, error names, and notes containing instruction-like content, control syntax, excessive length, unexpected structured data, or references to tool execution.
  6. Add provenance and trust metadata to every stored record, including who supplied it, when it was recorded, and whether an authorized reviewer approved it.
  7. Require human review and an explicit diff approval before any learned recommendation can affect operational behavior.
  8. Make the skill package and SKILL.md read-only at runtime where possible. Place mutable state in a separate directory with narrowly scoped permissions.
  9. Treat learned_patterns.json as potentially hostile when loaded. Validate its complete structure and fail closed on malformed, unknown, or unauthorized fields.
  10. Add tests demonstrating that stored free-form values cannot become system prompts, skill instructions, tool arguments, or file modifications in later sessions.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (18)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The manifest claims a narrow observability/audit role, but the later section introduces persistent preference storage, adaptive memory, and self-modifying workflow guidance that are outside that scope. This mismatch is dangerous because reviewers and orchestrators may trust the skill for passive logging while it actually accumulates user data and influences future behavior, creating hidden privacy and control risks.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file’s documented and implemented behavior is a generic cross-skill learning/self-improvement module, not an observability/audit logger as declared in the manifest. This scope mismatch is dangerous because it can silently introduce persistence, behavior shaping, and optimization logic into environments that expected passive audit logging only, undermining least privilege and trust boundaries.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script is explicitly designed as a generic self-evolution module usable by arbitrary WorkBuddy skills, enabling cross-skill learning and optimization not justified by the manifest. This broad applicability increases risk because any skill can persist notes, preferences, and inferred patterns through a shared mechanism, expanding data collection and behavioral influence beyond the expected audit context.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The CLI advertises emit, query, metrics, and timeline as if they operate on accumulated logged events, but main() creates a fresh EventLog on every run. This means emitted events are never available to later query/metrics/timeline commands, creating a false sense of observability and making operators believe audit and monitoring capabilities exist when they do not.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill promises audit/event logging suitable for observability and post-incident review, but EventLog stores all events only in process memory. In this design, logs disappear on process exit or between CLI invocations, so an attacker or faulty workflow can avoid durable auditability simply by ending the process, defeating forensic review and compliance expectations.

Content

No source excerpt is available for this finding.

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 · SKILL.md (reported line 37)May include surrounding context.

md
# 1) 入链
    log.emit("tool_call", "read /etc/hosts", "ok", "agent-7", "low", duration_ms=12)
    log.emit("tool_call", "write /tmp/x", "ok", "agent-7", "low", duration_ms=30)
    log.emit("tool_call", "delete /data", "error", "agent-7", "critical", duration_ms=5)
    log.emit("llm_call", "plan next", "ok", "planner", "low", duration_ms=420)
    assert len(log.events) == 4
    print("[1] 入链 4 条事件 ✓")

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 · scripts/observability.py (reported line 99)May include surrounding context.

python
# 1) 入链
    log.emit("tool_call", "read /etc/hosts", "ok", "agent-7", "low", duration_ms=12)
    log.emit("tool_call", "write /tmp/x", "ok", "agent-7", "low", duration_ms=30)
    log.emit("tool_call", "delete /data", "error", "agent-7", "critical", duration_ms=5)
    log.emit("llm_call", "plan next", "ok", "planner", "low", duration_ms=420)
    assert len(log.events) == 4
    print("[1] 入链 4 条事件 ✓")

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 · scripts/observability.py (reported line 106)May include surrounding context.

python
# 1) 入链
    log.emit("tool_call", "read /etc/hosts", "ok", "agent-7", "low", duration_ms=12)
    log.emit("tool_call", "write /tmp/x", "ok", "agent-7", "low", duration_ms=30)
    log.emit("tool_call", "delete /data", "error", "agent-7", "critical", duration_ms=5)
    log.emit("llm_call", "plan next", "ok", "planner", "low", duration_ms=420)
    assert len(log.events) == 4
    print("[1] 入链 4 条事件 ✓")

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill documents executable scripts that persist data to disk and maintain memory files, but it does not declare any explicit tool scope or permissions boundaries. In an agent ecosystem, missing scope declarations can cause the runtime or operator to underestimate what the skill may write or modify, increasing the chance of unintended file access and unsafe invocation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill advertises persistent structured logging of actions and payloads but does not warn users that their operational data may be written to disk. Without a persistence/privacy notice, operators may log secrets, prompts, tool inputs, or personal data into audit records unintentionally, creating confidentiality and compliance exposure.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Embedding a self-evolving learning and memory subsystem inside an observability skill expands the trust boundary from passive telemetry to active behavior shaping. That can lead to unreviewed persistence, policy drift, and future actions being influenced by stale or sensitive historical data without clear operator awareness.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The learning section describes storing usage history, user preferences, errors, and notes persistently, but it omits a privacy warning and any explanation of how long that data is kept or who can access it. This creates a realistic risk of sensitive user context being silently accumulated and reused across sessions.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documentation explicitly encourages storing user preferences, error notes, and adaptive memory unrelated to observability, which increases the chance that sensitive or context-specific information is retained and reused later. Because this storage is framed as a normal operating step, agents may persist user data broadly without necessity, consent, or minimization.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The plain-language memory instructions encourage recording preferences, error descriptions, and notes, which can easily include secrets, personal data, internal file paths, or other sensitive context. Because this information is retained in a general JSON memory file for future reuse, it can become a long-lived leakage channel and may influence later agent behavior in unsafe ways.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module description, usage text, and user-facing messages are entirely in Chinese, which imposes a specific language/locale on users. The file does not offer an opt-in language choice or explain that the tool is intentionally limited to a Chinese-speaking context.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The code stores user preferences and generates self-reflection recommendations, which exceeds the stated observability role of recording structured events for audit and replay. In an observability skill, this is risky because it changes the component from passive logging into a stateful profiling and behavior-influencing subsystem without clear disclosure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script persistently writes user preferences, operation notes, and related metadata to local disk without any user-facing notice, consent flow, retention policy, or redaction controls. Because notes may contain sensitive operational context or user-provided content, silent persistence can lead to privacy leakage and unintended long-term storage.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This Python file includes natural-language instructions and descriptions entirely in Chinese, and the runtime help text at the end is also Chinese-only. That imposes a specific language on users without any opt-in or alternative, which matches the language/locale policy concern for natural-language content.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.