T09 · Insecure Skill Coding Practices
- Location
scripts/cache_manager.py:137- Finding
Unsafe Pickle Deserialization in Persistent Embedding Cache
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill mostly does what it claims, but its local persistence and dependency setup include review-worthy security risks before installation.
Review before installing. Use an isolated virtual environment, pin and audit dependencies, avoid enabling or loading persistent embedding caches from untrusted locations, and treat saved sessions/exports as plaintext files that may contain private story drafts and prompts.
scripts/cache_manager.py:137Unsafe Pickle Deserialization in Persistent Embedding Cache
requirements.txt:1Unpinned and Unused Third-Party Dependencies Expand Supply-Chain Exposure
The skill is ներկայացված as a context-stabilization/writing aid, but the documented behavior includes persistence, embedding cache management, prompt/context caching, and loading data from disk. This mismatch is dangerous because hidden stateful storage broadens the attack surface beyond text generation, enabling unintended retention of sensitive prompts, stories, or contextual data and making users less likely to apply appropriate safeguards.
The skill documentation indicates capabilities consistent with file read/write behavior (for session save/load, export, and disk-backed cache) but does not declare any explicit tool scope or permissions. This creates a least-privilege and transparency problem: an operator may invoke the skill without understanding that it can persist or access local data, increasing the risk of unintended data exposure or overwriting files.
This code presents its user-facing title entirely in Chinese, and the rest of the script continues with Chinese-only prompts and status messages. That creates a language/locale policy concern because the skill effectively forces a specific language without any user opt-in or documented justification.
From the operational step labels through the advanced usage examples, the script consistently emits Chinese-only instructional text. Because no alternate locale or user choice is offered, the file contains natural-language behavior that enforces a specific language across the whole user experience.
The RuntimeError message at L073 is presented only in Chinese, which imposes a specific language for at least one user-facing interaction. The policy requires avoiding forced language/locale behavior unless the user is given a choice or the restriction is clearly justified.
The manifest describes a skill for stable-context continuation of long novel text, which implies prompt/context management for generation. This file also implements explicit story export and session persistence to disk, adding file-management behavior beyond the stated continuation function.
Saving and loading config/history files introduces a general local persistence capability. For a skill whose stated purpose is stable continuation output, this capability is not obviously required from the manifest alone and should be explicitly justified or declared.
This code persists cache contents to disk and later reloads them, which is a file write/read operation that may store user-derived text embeddings and timestamps. There is no confirmation prompt, user-facing log, or explanatory comment/docstring in this file warning that prompt-derived data may be persisted locally.
The code deserializes a cache file using pickle.load() from a path derived from configuration without any integrity check or safe format restriction. If an attacker can modify or replace that file, loading it can execute arbitrary Python code during deserialization, making this a real code-execution risk rather than a harmless cache issue.
try:
with open(self.persist_path, 'rb') as f:
data = pickle.load(f)
with self._lock:
self._cache = OrderedDict(data.get('cache', {}))
This code embeds Chinese-only anchor keys, field descriptions, and a default prompt instructing the model in Chinese, which creates a natural-language locale constraint. The file does not indicate that language selection is optional or that the skill is intentionally limited to a Chinese-specific use case.
This Python file contains hard-coded Chinese user-facing messages such as '综合评分' and '发现问题', which imposes a specific language on users. The file does not provide any user opt-in, locale selection, or documented region-specific justification, matching the language/locale policy violation criteria.
This code emits multiple natural-language strings in Chinese, such as context headers and summaries, with no apparent user opt-in or locale selection. That creates a language/locale policy issue because the skill behavior is fixed to a specific language rather than allowing the user to choose.
Several returned and formatted user-facing strings are hard-coded in Chinese, such as context labels and summary/status messages. This creates a natural-language locale constraint without any visible opt-in, fallback, or justification that the skill is intended only for Chinese-language use.
The code exports full story history, including user prompts and generated content, directly to disk in plaintext without any consent flow, visibility controls, redaction, or sensitivity checks. In this skill’s context, prompts and generated long-form content may contain private user material, making unintended local persistence and later disclosure a real privacy/security risk.
The method returns a fixed Chinese label "【相关上下文】" and the keyword extraction logic is tailored around Chinese text and Chinese stopwords. This creates a language-specific behavior without offering the user a language choice or documenting a justified locale constraint, which matches the policy-violation category for language/locale restrictions.
The dependency is specified with a lower bound only, which permits installation of any newer release, including versions with breaking changes or known vulnerable transitive trees. In a security-sensitive AI skill, unpinned packages like langchain increase supply-chain risk and make builds non-reproducible, especially given this package family has a history of security advisories.
langchain>=0.1.0
langchain-community>=0.0.10
sentence-transformers>=2.2.0
faiss-cpu>=1.7.4
The manifest does not pin langchain, and the package has numerous known advisories including arbitrary code execution and unsafe deserialization issues in its ecosystem. Because the installed version cannot be verified from this file, the deployment may resolve to an affected release, creating significant uncertainty and potential exposure in an LLM-integrated skill.
Using an unpinned minimum version for langchain-community allows resolution to arbitrary later releases, making the environment non-deterministic and exposing the skill to newly introduced or previously known flaws. This is more concerning because langchain-community has multiple published advisories, so version ambiguity materially affects risk.
langchain>=0.1.0
langchain-community>=0.0.10
sentence-transformers>=2.2.0
faiss-cpu>=1.7.4
pydantic>=2.0.0
langchain-community is unpinned despite multiple published advisories, including SQL injection, denial of service, and unsafe pickle/deserialization issues. In a context-generation skill that likely handles external text and retrieval components, uncertainty about the installed version makes the dependency risk materially more dangerous.
The sentence-transformers requirement is not pinned, so installations may vary over time and pull in unexpected dependency updates. While the package is not flagged here with specific advisories, the lack of reproducibility still creates avoidable supply-chain and stability risk.
langchain>=0.1.0
langchain-community>=0.0.10
sentence-transformers>=2.2.0
faiss-cpu>=1.7.4
pydantic>=2.0.0
An open-ended faiss-cpu version constraint can lead to inconsistent builds and unintended adoption of vulnerable or incompatible releases. Even absent a cited CVE in this finding, unpinned infrastructure packages increase operational and supply-chain exposure.
langchain>=0.1.0
langchain-community>=0.0.10
sentence-transformers>=2.2.0
faiss-cpu>=1.7.4
pydantic>=2.0.0
The pydantic dependency is only lower-bounded, allowing installation of versions that may contain known denial-of-service or parsing issues. Because pydantic often processes untrusted input in Python applications, unclear version selection can directly affect the skill's attack surface.
langchain-community>=0.0.10
sentence-transformers>=2.2.0
faiss-cpu>=1.7.4
pydantic>=2.0.0
The unpinned pydantic dependency cannot be verified against known advisories, including denial-of-service conditions in validation and regex handling. Since validation libraries often process attacker-controlled input, version ambiguity can leave the application unexpectedly exposed.
The save_session method creates directories and writes configuration/history data to disk, which is a safety-relevant file-write operation. In this file there is no confirmation prompt, logging/print statement, or explanatory comment/docstring warning the user that session data will be persisted.
The prompt prefix is hardcoded as Chinese text ("【核心设定】") with no indication that the user can choose a language or locale. For organizations requiring language neutrality or user-selected locale, this natural-language constraint can be a policy violation.
No suspicious patterns detected.