Back to skill

Security audit

Iching Divination

Security checks for vulnerabilities and agentic risk

Overview

This I Ching skill mostly matches its stated purpose, but it sends users' questions to an undisclosed third-party AI endpoint by default and includes a hardcoded API key plus broader tool permissions than the feature needs.

Install only after the publisher removes and rotates the embedded API key, documents the third-party AI endpoint and data sent, makes remote AI interpretation opt-in, narrows the activation scope to explicit divination requests, and reduces allowed tools to what the skill actually needs.

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

T09 · Insecure Skill Coding Practices

Error
Location
iching.py:13
Finding

Hard-Coded API Credential in Source Code

Content
View full analysis
Remediation
View remediation

other

Warning
Location
iching.py:181
Finding

User Questions Are Transmitted to an Undisclosed Third-Party Endpoint by Default

Content
View full analysis
str: """构建AI解读提示词""" return f"""你是易经大师,用简洁温暖的语言解读卦象。 【用户问题】 {data['question']} 【卦象】 卦名: {data['name']}({data['hexagram']}) 下卦: {data['lower']} - {Bagua.MEANINGS.get(data['lower'], '')} 上卦: {data['upper']} - {Bagua.MEANINGS.get(data['upper'], '')} 六爻: {' '.join(data['lines'])} 卦辞: {data['guaci']} 请写一段150-200字的解读,包含: 1. 卦象基本含义(一句话概括) 2. 对用户问题的直接回答 3. 具体行动建议(2-3条) 风格要求: - 像朋友聊天,有温度 - 不迷信,强调主观能动性 - 具体可行,不说空话 - 适度鼓励,不过度乐观 用中文回答。""" def _call_ai(self, prompt: str) -> str: """调用MiniMax AI""" import urllib.request data = { "model": "MiniMax-M2.7-highspeed", "messages": [{"role": "user", "content": prompt}], "max_tokens": 800 } req = urllib.request.Request( MINIMAX_URL, data=json.dumps(data).encode(), headers={ "Authorization": f"Bearer {MINIMAX_KEY}", "Content-Type": "application/json" }, method="POST" ) try: with urllib.request.urlopen(req, timeout=60) as resp: result = json.loads(resp.read()) return result["choices"][0]["message"]["content"] except Exception as e: return f"AI解读暂时不可用,请稍后再试。" ``` ```python def divine(question: str, use_ai: bool = True) -> Dict: engine = IChingDivination() hexagram = engine.generate_hexagram(question) if use_ai: result = engine.interpret(hexagram) else: result = { **hexagram, "interpretation": "(AI解读已禁用)" } return result ``` ## Technical Analysis The complete user question is interpolated into an AI prompt and sent in an HTTP ...[truncated 2599 chars]
Remediation
View remediation
Dict: ... ``` 4. Warn users not to include secrets, account credentials, identifying details, medical records, or confidential business information. 5. Minimize outbound content by removing the original question when a locally generated category or redacted summary is sufficient. 6. Add redaction controls for common sensitive data such as email addresses, telephone numbers, account identifiers, and access tokens. 7. Provide a fully functional local interpretation mode that does not contact external services. 8. Document network behavior in `SKILL.md`, including how users can disable it. 9. Establish contractual and technical controls for retention, deletion, encryption, access logging, and downstream processing. 10. Add tests that verify no network request occurs unless the user explicitly enables remote AI interpretation. ]]>
Vulnerability Patterns
  • 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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (13)

Tainted flow: 'req' from os.environ.get (line 193, 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 · iching.py (reported line 204)May include surrounding context.

python
)
        
        try:
            with urllib.request.urlopen(req, timeout=60) as resp:
                result = json.loads(resp.read())
                return result["choices"][0]["message"]["content"]
        except Exception as e:

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The core functional purpose broadly matches the description: this is indeed an I Ching divination/interpretation tool. However, the declared permissions list is empty, while the code clearly performs external HTTP POST requests to https://api.sfkey.cn/v1/chat/completions and authenticates with a bearer token. That is a materially undeclared capability/resource access. Additionally, the code includes a hardcoded fallback API key, which is a sensitive credential-handling behavior not reflected in the description or permissions. So this is not a purpose mismatch, but it is a description/behavior mismatch on capabilities and resource access.

Content

No source excerpt is available for this finding.

Lp1

High
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The code reads environment variables to obtain credentials, but the skill metadata apparently does not declare this capability. Undeclared access to secrets/environment weakens least-privilege guarantees and makes review and operator consent less reliable.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill embeds a hardcoded bearer token in source code and uses it to call a third-party API. Hardcoded credentials are easily leaked via source control, logs, packaging, or reuse by unauthorized parties, enabling abuse of the external service and possible billing/account compromise.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

Using an embedded default API credential without disclosure is dangerous because it silently authorizes external network use and exposes a reusable secret to anyone with code access. In practice, this can lead to credential theft, quota exhaustion, unauthorized billing, and loss of control over the linked account.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger list is very broad, covering common topics like business decisions, career, relationships, money, future, and general advice. This can cause the skill to activate in many ordinary conversations, potentially overriding more appropriate domain-specific skills and steering users toward ungrounded divination-style guidance in sensitive decision contexts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The description strongly centers Chinese-language behavior and does not indicate that the assistant should respect the user's preferred language. This can degrade usability and cause confusing or inaccessible responses, especially when the skill auto-triggers for non-Chinese-speaking users.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This skill is a content-only divination/advice skill, yet it requests Bash, Write, and WebFetch capabilities that are not necessary for interpreting I Ching guidance. Excess permissions enlarge the attack surface: if the skill is ever triggered or modified, it could access the filesystem, write files, run shell commands, or fetch remote content unrelated to the user's request.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The usage examples instruct fixed Chinese-language system responses without offering a locale choice. In combination with broad triggers, this increases the chance that users receive responses in an unexpected language, reducing clarity and trust.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
87% confidence
Finding

The code performs external transmission to a third-party endpoint, which is expected for an AI-backed feature but still security-relevant. In this skill context, the danger is elevated because users may reveal sensitive personal concerns during divination and are not clearly told their data leaves the local tool.

Content

Scanner excerpt · iching.py (reported line 15)May include surrounding context.

python
# API配置
MINIMAX_KEY = os.environ.get('MINIMAX_KEY', 'sk-y9avgZsHEoTQ9be4jBVvmaEjWAvmJgfAs7ZCJ1lMRUrMNqvr')
MINIMAX_URL = "https://api.sfkey.cn/v1/chat/completions"


class Bagua:

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest describes a divination tool, but the code transmits user questions to an external AI provider for interpretation. That mismatch is security-relevant because users and reviewers may not expect third-party data sharing, especially for sensitive personal, emotional, or decision-making questions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

User-submitted divination questions are sent verbatim to an external AI service without any visible warning, consent, or minimization. Because users may include intimate relationship, health, career, or financial details, this creates a real privacy and data-governance risk in the context of a seemingly harmless spiritual tool.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The instruction 用中文回答。 hard-codes the model's response language. This is a natural-language locale policy issue because the skill does not offer the user any language selection or document that it is intentionally limited to Chinese-only use.

Content

No source excerpt is available for this finding.