Back to skill

Security audit

minor-detection

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent minor-detection purpose, but it handles sensitive age-profiling data with broad activation, remote model endpoints, logging exposure, and an unsafe retrieval asset loader that warrant Review before installation.

Install only in an environment where the classifier and embedding endpoints are explicitly trusted, use dedicated low-scope API keys, avoid sending conversations that must remain fully local, restrict logs because they may contain conversation-derived data, and do not use or replace retrieval asset indexes from untrusted sources.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/_classifier_client.py:20
Finding

Unrestricted remote endpoints can receive sensitive conversations and bearer credentials

Content
View full analysis
str: normalized = (base_url or "").rstrip("/") if normalized.endswith("/chat/completions"): return normalized return f"{normalized}/chat/completions" ``` ```python if not api_key: raise ClassifierAPIError("missing classifier api key") total_attempts = max(1, int(max_retries) + 1) for attempt in range(total_attempts): try: response = requests.post( _chat_url(base_url), headers={ "Authorization": f"Bearer {api_key}", "Content-Type": "application/json", }, json={ "model": model, "messages": messages, "temperature": temperature, "response_format": {"type": "json_object"}, }, timeout=timeout_sec, ) ``` The related embedding path has the same endpoint-control issue: ```python if not self.api_key: raise RuntimeError("missing embedding api key") if not self.base_url: raise RuntimeError("missing embedding base url") url = f"{self.base_url}/embeddings" headers = { "Authorization": f"Bearer {self.api_key}", "Content-Type": "application/json", } payload = { "model": self.embedding_model, "input": text, } with httpx.Client(timeout=30.0) as client: response = client.post(url, headers=headers, json=payload) ``` ### Technical Analysis The classifier and embedding clients accept arbitrary base URLs from environment configuration. They do not enforce HTTPS, restrict destinations to approved hosts, reject loopback or link-local targets, or otherwise validate the destination before transmi ...[truncated 2169 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/run_minor_detection_pipeline.py:97
Finding

Sensitive conversation-derived queries are exposed in process arguments and stderr observability logs

Content
View full analysis
Dict[str, Any]: command = [sys.executable, str(_script_path(script_name)), *args] env = dict(os.environ) env.update(export_embedding_env()) completed = subprocess.run( command, capture_output=True, text=True, encoding="utf-8", errors="replace", check=False, env=env, ) output_text = (completed.stdout or "").strip() parsed_output: Dict[str, Any] = {} if output_text: try: parsed_output = json.loads(output_text.splitlines()[-1]) except Exception: parsed_output = {} observability["script_calls"].append( { "script_name": script_name, "status": "completed" if completed.returncode == 0 else "failed", "exit_code": completed.returncode, "failed": completed.returncode != 0, "command": " ".join(command), "output_json": parsed_output or None, } ) ``` The sensitive retrieval query is supplied as a command-line argument: ```python payload = _run_json_script( RETRIEVE_SCRIPT_NAME, [ "--query", retrieval_query, "--top-k", str(RETRIEVAL_TOP_K), "--raw-time-hint", raw_time_hint, "--time-features-json", temp_path.read_text(encoding="utf-8"), ], observability, ) ``` The recorded command is then emitted to stderr: ```python def _emit_observability(observability: Dict[str, Any]) -> None: print(f"{OBSERVABILITY_PREFIX} {json.dumps(observability, ensure_ascii=False)}", file=sys.stderr) ``` ### Technical Analysis `retrieval_q ...[truncated 1975 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/_skill_retrieval_utils.py:151
Finding

Untrusted retrieval indexes can trigger arbitrary code execution through pickle deserialization

Content
View full analysis
None: if not self.index_path.exists(): raise FileNotFoundError(f"Missing retrieval index: {self.index_path}") with open(self.index_path, "rb") as handle: index_data = pickle.load(handle) self.embeddings = index_data.get("embeddings") self.samples = list(index_data.get("samples", [])) self.manifest = dict(index_data.get("manifest", {})) ``` The retrieval command permits selection of an asset directory: ```python def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser(description="Retrieve similar cases from built-in retrieval assets.") parser.add_argument( "--assets-dir", default=str(Path(__file__).resolve().parents[1] / "assets" / "retrieval_assets"), help="Directory containing retrieval manifest, index, and corpus.", ) ``` The selected index is loaded by `SkillSemanticRetriever`: ```python assets_dir = Path(args.assets_dir) manifest_path = assets_dir / "manifest.json" index_path = assets_dir / "index.pkl" corpus_path = assets_dir / "corpus.jsonl" if not manifest_path.exists() or not index_path.exists() or not corpus_path.exists(): _emit_disabled_payload(assets_dir, "built-in retrieval assets are unavailable") return try: retriever = SkillSemanticRetriever( index_path=str(index_path), corpus_path=str(corpus_path), manifest_path=str(manifest_path), ) ``` ### Technical Analysis Python pickle is not a data-only serialization format. A pickle stream can contain instructions that import modules and invoke arbitrary callables during `pickle.load`. Therefore, loading a pickle is equivalent to executing code from the producer of that file ...[truncated 2181 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
references/classifier-user-template.md:10
Finding

Untrusted conversation and retrieval content can inject instructions into classifier and repair prompts

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (36)

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 1)May include surrounding context.

md
# Schema Repair Template

你现在要把一个不完整或不规范的 minor-detection 输出修复为合法 JSON。

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/classifier-system.md (reported line 1)May include surrounding context.

md
# Schema Repair Template

你现在要把一个不完整或不规范的 minor-detection 输出修复为合法 JSON。

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/classifier-user-template.md (reported line 1)May include surrounding context.

md
# Schema Repair Template

你现在要把一个不完整或不规范的 minor-detection 输出修复为合法 JSON。

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/evidence-rules.md (reported line 1)May include surrounding context.

md
# Schema Repair Template

你现在要把一个不完整或不规范的 minor-detection 输出修复为合法 JSON。

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/icbo-guidelines.md (reported line 1)May include surrounding context.

md
# Schema Repair Template

你现在要把一个不完整或不规范的 minor-detection 输出修复为合法 JSON。

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/output-schema.md (reported line 1)May include surrounding context.

md
# Schema Repair Template

你现在要把一个不完整或不规范的 minor-detection 输出修复为合法 JSON。

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/retrieval-query-template.md (reported line 1)May include surrounding context.

md
# Schema Repair Template

你现在要把一个不完整或不规范的 minor-detection 输出修复为合法 JSON。

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/schema-repair-template.md (reported line 1)May include surrounding context.

md
# Schema Repair Template

你现在要把一个不完整或不规范的 minor-detection 输出修复为合法 JSON。

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
92% confidence
Finding

The code clones the full parent process environment and passes it to child scripts, which can unnecessarily expose secrets such as API keys, tokens, proxy settings, or cloud credentials to any invoked helper process. In this pipeline, helper scripts are separate execution units, so broad environment inheritance expands the blast radius if a helper script is compromised, replaced, or logs its environment.

Content

Scanner excerpt · scripts/run_minor_detection_pipeline.py (reported line 101)May include surrounding context.

python
def _run_json_script(script_name: str, args: List[str], observability: Dict[str, Any]) -> Dict[str, Any]:
    command = [sys.executable, str(_script_path(script_name)), *args]
    env = dict(os.environ)
    env.update(export_embedding_env())
    completed = subprocess.run(
        command,

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger description is extremely broad and instructs activation even when the user does not explicitly request minor detection, covering general profiling, age tendency, student persona, and risk analysis. This can cause over-triggering on ordinary conversations and send sensitive chat history and metadata to a remote classifier, creating privacy, consent, and misclassification risks around inferring whether a person is a minor.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

整个技能说明以中文固定表述技能用途和输出约束,但未说明这是面向特定中文环境的区域性技能,也未提供语言选择或用户同意机制。按规则,强制特定语言而无用户选择属于自然语言层面的组织政策风险。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Lines L22-L23 state that all natural-language fields must default to Simplified Chinese except enum values. This imposes a specific language/locale policy without offering user opt-in or documenting a region-specific need, which matches the natural-language policy violation criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The template instructions are written entirely in Chinese and require the model to follow them, which imposes a specific language/locale behavior. There is no opt-in, alternative language option, or documented justification that this template is intentionally region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The substantive guidance in this file is written entirely in Chinese, which imposes a specific language on downstream users or operators. The file does not offer an alternative language option or explain that the skill is intentionally limited to a Chinese-language or region-specific context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This file contains user-facing natural-language instructions entirely in Chinese, with no indication that another language is supported or that Chinese is required for a documented region-specific purpose. Under the policy, forcing a specific language without user opt-in can be a language or locale policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file’s instructional content is written entirely in Chinese, including required field constraints and output rules, with no indication that users may choose another language or that the skill is intentionally limited to a Chinese-only context. This creates a natural-language locale policy concern because it effectively imposes a specific language without opt-in or documented justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The natural-language instructions in this template are entirely in Chinese and direct the model to produce the retrieval query text in that language. There is no indication that the user can choose the output language or that the template is limited to a China-specific or Chinese-only context, which creates a locale-policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The operative instructions are written entirely in Chinese and do not provide any language or locale choice for users. Under the language/locale policy, forcing a specific language without opt-in is a natural-language policy violation unless clearly justified as region-specific, which is not documented here.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This code sends the provided messages payload to an external chat-completions endpoint and includes a bearer API key in the request headers. The file contains no confirmation prompt, logging, or explanatory comment near the operation warning that user/system data will be transmitted off-host.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The file’s natural-language documentation is entirely in Chinese, and the code also relies on Chinese-language identity markers. Under the policy for language/locale, forcing a specific language without offering a choice or documenting a justified regional constraint can violate organizational locale requirements.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code contains natural-language strings and documentation exclusively in Chinese, including user-facing fallback values later in the file, with no indication that language choice is configurable or limited to a justified region-specific context. That creates a language/locale policy concern because the skill appears to impose a specific language by default rather than offering user choice.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This function sends both the raw model response text and the normalized payload to an external chat completion service for schema repair. If those inputs contain user content, profile data, or other sensitive information, the code creates a secondary data egress path without any minimization, redaction, or explicit trust boundary enforcement in this component.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The embedded natural-language instruction is written in Chinese and constrains component behavior without any indication that language selection is optional or region-specific. This can violate language/locale policy when the skill does not provide user opt-in or documented justification for the locale restriction.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The retriever sends conversation-derived text, including user messages and optional time-related tags, to an external embeddings endpoint via httpx.Client.post(). In a skill context, this can expose sensitive user content to a third-party service without any code-level minimization, consent, redaction, or enforcement that the endpoint is trusted, which makes privacy leakage a real risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The function build_time_feature_payload defaults timezone to "Asia/Shanghai", which imposes a specific locale assumption in behavior. Under the policy, locale-specific behavior should be user-selectable or clearly justified as region-specific; this file does not provide such opt-in or justification.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.