Back to skill

Security audit

Learning Coordinator

Security checks for vulnerabilities and agentic risk

Overview

This looks like a real learning-memory coordinator, but it needs review because it can read or create local files through an unrestricted configured path and some reported learning actions are incomplete or placeholder behavior.

Install only if you trust the caller-controlled configuration and can keep learning_rules_file pinned to the intended ~/self-improving/learning.md path. Consider disabling auto_create or requiring explicit approval before file creation, and do not rely on the emerging-pattern or promotion APIs for production decisions until the placeholder and non-durable behavior is fixed.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/learning_coordinator.py:91
Finding

Unrestricted Filesystem Read and File Creation Through Configurable Rules Path

Content
View full analysis

Vulnerability Details

File Location: scripts/learning_coordinator.py, lines 91–94, 137–148, and 218–229
Vulnerability Type: Unrestricted filesystem path access
Risk Level: Medium

Vulnerable Code

python
self.learning_rules_file = self.config.get(
    'learning_rules_file',
    os.path.expanduser('~/self-improving/learning.md')
)
python
if not os.path.exists(self.learning_rules_file):
    if self.auto_create:
        self._ensure_file_exists()
    else:
        logger.warning(f"Learning rules file not found: {self.learning_rules_file}")
        return

try:
    with open(self.learning_rules_file, 'r', encoding='utf-8') as f:
        content = f.read()
python
parent_dir = os.path.dirname(self.learning_rules_file)
if parent_dir and not os.path.exists(parent_dir):
    os.makedirs(parent_dir, exist_ok=True)

content = """# Learning Mechanics
...
"""
with open(self.learning_rules_file, 'w', encoding='utf-8') as f:
    f.write(content)

Technical Analysis

The public LearningCoordinator constructor accepts the learning_rules_file configuration value without validating or constraining it. The path is subsequently passed directly to filesystem APIs.

If the supplied path exists, _load_rules() reads the file and places parsed content in self._rules. The public search() method can then return matching excerpts from that content. If the path does not exist and auto_create is enabled, _ensure_file_exists() recursively creates parent directories and writes a new file at the selected location.

The implementation performs no canonical path resolution, trusted-root enforcement, path traversal rejection, symbolic-link protection, file-type validation, or verification that configuration came from a trusted source. Consequently, a caller capable of controlling coordinator configuration can direct the process toward arbitrary paths accessible under the process account.

This issue does not provide unrestricted control ...[truncated 1955 chars]

Remediation
View remediation

Remediation Suggestions

  1. Restrict files to a trusted root

    • Define an explicit data root such as ~/self-improving/.
    • Resolve both the trusted root and requested path with Path.resolve().
    • Reject paths that are not descendants of the trusted root.
  2. Reject unsafe path forms

    • Reject traversal components and unexpected absolute paths before use.
    • Allow only expected filenames or extensions, such as learning.md.
    • Reject device files, sockets, FIFOs, and other non-regular files.
  3. Protect against symbolic-link attacks

    • Check each relevant path component for symbolic links.
    • Where supported, open files using flags such as O_NOFOLLOW.
    • Use atomic creation with exclusive semantics when creating a new file.
  4. Separate reading from creation

    • Default auto_create to False when configuration may be externally influenced.
    • Require explicit authorization before creating directories or files.
    • Avoid recursively creating arbitrary parent directory trees.
  5. Constrain information returned by search()

    • Ensure only the designated learning-rules file can be indexed.
    • Avoid returning raw excerpts from files whose provenance has not been validated.
    • Apply authorization controls if search results can be exposed to untrusted users.
  6. Validate configuration at the trust boundary

    • Use a schema that rejects unknown or unsafe path values.
    • Treat caller-supplied paths as untrusted unless the caller is explicitly authorized to select local files.

A suitable containment check should follow this pattern:

python
from pathlib import Path

trusted_root = Path("~/self-improving").expanduser().resolve()
requested = Path(configured_path).expanduser().resolve()

if requested != trusted_root / "learning.md":
    raise ValueError("learning_rules_file must be the approved learning rules file")

If multiple filenames must be supported, verify containment with `requested.is_relative_ ...[truncated 73 chars]

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 (11)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The documented behavior exceeds the declared role by creating/reading local files, searching rule content, and exposing broader operational actions than a narrowly scoped learning coordinator suggests. This mismatch is dangerous because reviewers may approve the skill for a limited coordination purpose while it actually has additional data access and mutation capabilities, undermining least privilege and informed consent.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill explicitly documents file read/write behavior via ~/self-improving/learning.md and even states it may auto-create a minimal version, yet it declares no permissions or allowed-tools scope. This creates an undeclared capability gap: operators and policy layers cannot accurately constrain or review filesystem access, increasing the chance of unintended local file modification or data exposure.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This markdown file contains substantial sections in Chinese within an otherwise English skill description, including architecture, integration notes, and error-code documentation. Because the skill does not state that it is region-specific or offer a language/locale option, it effectively imposes a specific language on some users, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

This Python example uses Chinese for the module docstring, comments, and all user-facing print messages throughout the file. Under the stated policy, forcing a specific language without user opt-in can be a natural-language policy violation, and there is no indication here that the locale is optional or region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This Python file contains prominent natural-language content in Chinese for the module description and operational comments, while offering no opt-in, fallback, or explanation that the skill is intended only for a Chinese-speaking context. That creates a language/locale policy concern because the skill implicitly enforces a specific language on maintainers or operators.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The code prepends directories to sys.path and then imports modules by name, which allows code execution from whatever module is found first in those locations. In a plugin/agent environment, this expands the trust boundary and can load attacker-controlled or unexpected local modules, leading to arbitrary code execution within the agent process.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The coordinator automatically creates and populates a rules file under the user's home directory when the configured file is missing. In an agent skill, writing persistent files outside a tightly scoped data directory can unexpectedly modify user state, create unauthorized persistence, and become a foothold for later behavior changes if other components trust that file.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The method claims to identify emerging patterns but returns hard-coded example data, which can mislead other components into acting on fabricated signals. In a self-improving memory system, falsified pattern outputs can corrupt promotion, confirmation, or adaptation logic and undermine integrity of the learning pipeline.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The compatibility wrapper reports a successful promotion without actually enforcing or persisting a real stage transition beyond a local cache entry. Security-relevant automation that trusts this success response could make downstream decisions on false state, creating integrity issues in learning or policy workflows.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file’s human-readable comments are entirely in Chinese, including section headings and descriptions, which imposes a specific language for operators reading or maintaining the configuration. No opt-in, alternate locale, or region-specific justification is provided in the file, so this appears to violate the language/locale policy criterion.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The file defines LearningCoordinator, but the CLI constructs EnhancedLearningCoordinator, which is not defined in the file. For a skill claiming to integrate enhanced learning coordination, this indicates an unjustified or broken runtime path rather than the documented coordinator behavior.

Content

No source excerpt is available for this finding.