Back to skill

Security audit

Cms Search

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent network search skill that sends search queries to a fixed CMS backend using an environment-provided key, with no evidence of persistence, local data harvesting, or destructive behavior.

Install only if you are comfortable sending your search terms, selected source, optional datetime, and CMS_USER_KEY to the fixed CMS search service. Treat returned results as untrusted web evidence, especially for medical, financial, policy, or business-sensitive topics, and verify important claims independently.

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
cms_search.py:41
Finding

Untrusted Remote Search Content Is Emitted Without Validation or Isolation

Content
View full analysis
str: result = (obj.get("result") or "").strip() source = (obj.get("source") or "").strip() lines = [] if result: lines.append(result) if source: lines.append(f"\n来源: {source}") return "\n".join(lines).strip() + "\n" ``` The related workflow directs the agent to use and synthesize these results: ```markdown 1. 根据问题、上下文、实体别名、时间范围和证据需求确定搜索词。 2. 简单事实搜索 1 次;需要总结、比较、验证或追踪最新信息时,拆成 2-7 个维度。 3. 每个搜索词分别调用一次 `cms_search.py`;完成后合并、去重并交叉验证结果。 ``` ### Technical Analysis The HTTP response is controlled by the remote search service and may incorporate attacker-controlled indexed web content. After JSON parsing, the script extracts the `result` and `source` fields and prints them directly as Markdown. It does not: - Validate that the response conforms to an expected schema. - Explicitly identify returned text as untrusted data. - Delimit remote content from agent instructions. - Prevent instruction-like text from being presented to the consuming agent. - Enforce a maximum response-body size before calling `resp.read()`. Consequently, a compromised search service or poisoned indexed page could supply instruction-like content that the agent might treat as authoritative directions rather than search evidence. This is an indirect prompt-injection risk. The Python script itself does not evaluate the response as code or directly invoke additional tools, so ...[truncated 2049 chars]
Remediation
View remediation
MAX_RESPONSE_BYTES: raise SystemExit("CMS response exceeds the permitted size.") body_bytes = resp.read(MAX_RESPONSE_BYTES + 1) if len(body_bytes) > MAX_RESPONSE_BYTES: raise SystemExit("CMS response exceeds the permitted size.") body = body_bytes.decode("utf-8", errors="replace") try: obj = json.loads(body) except json.JSONDecodeError: raise SystemExit("CMS returned invalid JSON.") if not isinstance(obj, dict): raise SystemExit("CMS returned an unexpected response structure.") result = obj.get("result", "") source = obj.get("source", "") if not isinstan ...[truncated 474 chars]
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (9)

Tainted flow: 'req' from os.environ.get (line 30, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · cms_search.py (reported line 41)May include surrounding context.

python
method="POST",
    )

    with urllib.request.urlopen(req, timeout=DEFAULT_TIMEOUT_SECONDS) as resp:
        body = resp.read().decode("utf-8", errors="replace")

    try:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
`cms_search.py` 与本 `SKILL.md` 位于同一目录。根据本文件的实际位置取得脚本的绝对路径,不要依赖当前工作目录。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
`cms_search.py` 与本 `SKILL.md` 位于同一目录。根据本文件的实际位置取得脚本的绝对路径,不要依赖当前工作目录。

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill invokes a local Python script that performs networked searches and depends on an environment-provided secret, but it declares no tool scope or permissions boundaries. Without explicit scope, an agent platform may over-grant capabilities or fail to constrain when the skill can access network and environment state, increasing the blast radius if the skill is misused or chained unexpectedly.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The description is extremely broad and can match many ordinary requests for information, causing the skill to trigger in contexts far beyond a narrowly defined search use case. Over-broad activation can route sensitive or specialized queries into a network-enabled workflow by default, leading to unnecessary external data access, privacy leakage, or reduced user control over tool use.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The manifest describes a search/retrieval skill, but the code requires access to a secret-like value via CMS_USER_KEY. Reading environment-held credentials is a distinct capability beyond basic search logic and is not disclosed in the stated purpose.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The code sends user-provided search terms and an environment-derived user key to an external service without any user-visible disclosure, consent flow, or data-classification guardrails. In a search skill, users may submit sensitive medical, financial, policy, or competitive-intelligence queries, so silent transmission to a third-party backend can create privacy, compliance, and audit risks.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The instruction to interpret current time as 'Asia/Shanghai (UTC+8)' imposes a fixed locale/timezone behavior for all users. There is no user choice, opt-in, or statement that the skill is intended only for a China-specific context, so this is a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The argument help strings are presented only in Chinese, which imposes a specific language on users without opt-in or an alternative locale path. Under the stated policy, language constraints should be user-selectable or clearly justified.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.