Back to skill

Security audit

hot-swap-context-as-MCP

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent portable memory-system builder, but it needs Review because its generated MCP server can mutate or delete durable memory and its source generation can turn an unsafe server name into Python code execution.

Use this only in an isolated workspace you are willing to modify. Keep the generated server on STDIO or localhost unless you add authentication and authorization, do not expose streamable HTTP to untrusted clients, avoid untrusted or unusual names for --name and --server-name, pin dependencies before installing, and back up any existing directory before scaffolding into it.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
source_text/init_context_os.py.txt:746
Finding

Arbitrary Python Code Injection Through Generated Server Name

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
source_text/init_context_os.py.txt:343
Finding

Unauthenticated Persistent Memory Read, Modification, and Deletion Operations

Content
View full analysis
dict[str, Any]: path = find_memory_path(object_id) if not path: return {"error": f"Memory object not found: {object_id}"} return parse_memory_object(path) ``` ```python @mcp.tool() def upsert_memory_object( object_id: str, memory_type: str, content: str, owner_scope: str = DEFAULT_OWNER_SCOPE, source: str = "human input", status: str = "draft", retrieval_trigger: str = "define-me", retrieval_form: str = "summary", freshness_rule: str = "define-me", confidence_threshold: float = 0.8, max_retrieval_scope: str = "1 object", writeback_trigger: str = "confirmed durable memory", human_review_required: bool = True, deprecation_rule: str = "replace when superseded", deletion_path: str = "delete file and regenerate bundle", governance_notes: str = "Document redaction, sharing, ownership, or retention constraints here.", evidence_and_linked_artifacts: str = "List supporting files, chats, or outputs here.", ) -> dict[str, Any]: if memory_type not in VALID_MEMORY_TYPES: return {"error": f"Invalid memory type: {memory_type}"} filename = MEMORY_DIR / f"{slugify(object_id)}.md" payload = { "object_id": object_id, "memory_type": memory_type, "owner_scope": owner_scope, "source": source, "status": status, "last_updated": utc_now()[:10], "content": content.strip(), "retrieval_trigger": retrieval_trigger, "retrieval_form": retrieval_form, "freshness_rule": freshness_rule, "confidence_threshold": confide ...[truncated 3963 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
source_text/init_context_os.py.txt:288
Finding

Unpinned MCP Dependency Allows Unreviewed Future Releases

Content
View full analysis
=1.2.0 """ ``` The generated workspace instructs users to install that requirement directly: ```bash python3.11 -m pip install -r mcp_server/requirements.txt ``` ### Technical Analysis The generated requirement specifies only a minimum version: ```text mcp[cli]>=1.2.0 ``` As a result, package resolution may install any later release available from the configured Python package index. There is no exact version pin, upper bound, lockfile, package hash, or index restriction. Python dependency installation can execute package-controlled build or installation behavior, and the installed package is subsequently imported by the generated server: ```python from mcp.server.fastmcp import FastMCP ``` This makes installation and runtime behavior dependent on whichever release is selected at installation time rather than the release reviewed with this project. The issue does not establish that the named package is malicious; it creates supply-chain exposure to future compromised, incompatible, or otherwise unreviewed releases. ### Attack Path 1. The generated workspace contains `mcp[cli]>=1.2.0`. 2. The user follows the documented installation command. 3. `pip` queries the environment's configured package index and selects a version satisfying the lower bound. 4. A newer unreviewed or compromised release is downloaded and installed. 5. Package-controlled installation behavior may execute during installation. 6. The generated MCP server subsequently imports and runs the installed package. 7. Malicious or vulnerable dependency behavior executes with the user's privileges. This path depends on compromise of a selected release, a hostile configured package index, or an unsafe future release; no such ma ...[truncated 723 chars]
Remediation
View remediation
``` 2. Generate and distribute a lockfile containing all transitive dependency versions. 3. Use hash-verified installations, for example through a requirements file generated with hashes and installed using `--require-hashes`. 4. Restrict installation to an approved package index and explicitly disable unexpected extra indexes. 5. Perform dependency vulnerability and provenance scanning before updating the pinned version. 6. Test updates in an isolated environment before changing the lockfile. 7. Document a controlled dependency-update procedure and supported Python version. 8. Prefer installing into a dedicated virtual environment with minimal filesystem and network privileges. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill clearly directs the agent to read files, write workspace artifacts, and execute shell commands, but it does not declare any explicit tool scope or permission boundaries. This creates an authorization ambiguity where an orchestrator or user may not realize the skill can modify the filesystem and invoke commands, increasing the chance of unintended or over-broad execution.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill instructs the agent to create a durable context vault, memory objects, artifacts, and governance files on disk, but it never requires an explicit user-facing warning or consent before storing potentially sensitive long-lived data. In a memory-oriented skill, this is more dangerous because users may provide personal, organizational, or regulated context that persists beyond the current session without clear acknowledgement.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill says to install runtime dependencies if the user wants the server fully runnable, but it does not require a separate confirmation or provide safety constraints around package installation. Installing dependencies changes the execution environment and can introduce supply-chain risk, especially when combined with generated code and shell execution instructions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

This code creates directories and writes a JSON manifest derived from the workspace, including file listings and metadata from memory objects. Although it prints the output path afterward, there is no prior user-facing warning in the code comments, docstring, or prompt that the generated bundle manifest may capture sensitive workspace structure and should be reviewed before sharing.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The generated server intentionally exposes create, update, delete, and bundle-building operations over workspace files, but the embedded descriptions do not prominently warn operators that connecting this MCP server grants remote mutation of durable local context files. In an agent setting, this increases the chance that a host or user enables the server without understanding that clients can modify or delete memory objects, which can lead to unauthorized data tampering or loss.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The scaffold resolves and creates the target directory, then unconditionally writes many files and chmods executables into it without checking whether the directory already contains user data or warning before overwriting. If pointed at an existing workspace, this can clobber configuration, scripts, or policy files and silently alter executable content, causing integrity loss and possibly changing downstream behavior.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The template uses a generic placeholder, "[WHEN TO LOAD]," for the retrieval trigger without requiring concrete trigger phrases, scope boundaries, or exclusion conditions. In a manifest-like markdown template, this can lead to overly broad or ambiguous activation behavior when the template is instantiated.

Content

No source excerpt is available for this finding.

Rp1

Low
Category
MCP Rug Pull
Confidence
60% confidence
Finding

pip install without ==version installs the latest release, which could include malicious changes.

Content

No source excerpt is available for this finding.