Back to skill

Security audit

InsurAI Taiwan Personal Insurance

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent, but it needs review because sensitive insurance data and the API key can be sent to a configurable HTTPS endpoint and external OCR handling is not tightly scoped.

Review before installing. Use this only for Taiwan insurance workflows, keep INSURAI_AGENT_URL pinned to a trusted InsurAI endpoint, avoid unnecessary personal identifiers, and require explicit consent before sending policy documents to any OCR or document-processing service.

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
scripts/insurai_api.py:65
Finding

Arbitrary HTTPS Endpoint Can Receive the API Key and Sensitive Insurance Data

Content
View full analysis
str: """Read only the documented InsurAI API key; never enumerate environment variables.""" try: return os.environ["INSURAI_API_KEY"].strip() except KeyError: return "" def _validate_base_url() -> None: parsed = urlparse(BASE) if parsed.scheme != "https" or not parsed.netloc: raise RuntimeError("INSURAI_AGENT_URL must be an https URL.") ``` ```python def get_session() -> Session: global _session _load_http_dependencies() api_key = _get_api_key() headers = {**HEADERS, "X-API-KEY": api_key} if _session is None: _session = Session() # Increase pool size for batch operations _session.mount("https://", adapters.HTTPAdapter( pool_connections=10, pool_maxsize=20, max_retries=0, # we handle retries manually )) _session.headers.update(headers) elif _session.headers.get("X-API-KEY") != api_key: # API key changed (e.g. reloaded in long-running process) — refresh headers _session.headers.update(headers) return _session ``` ### Technical Analysis The destination is controlled by the `INSURAI_AGENT_URL` environment variable. Validation only confirms that the URL has an `https` scheme and a nonempty network location. It does not verify that the hostname is `insurai.com.tw` or another explicitly trusted InsurAI host. The resulting session attaches `INSURAI_API_KEY` to every request through the `X-API-KEY` header. The API functions also submit insurance-planning information that may include age, gender, occupation, family circumstance ...[truncated 1816 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/insurai_api.py:143
Finding

Automatic Redirect Handling Can Forward Custom Authentication and Request Data to Another Origin

Content
View full analysis
Session: global _session _load_http_dependencies() api_key = _get_api_key() headers = {**HEADERS, "X-API-KEY": api_key} if _session is None: _session = Session() # Increase pool size for batch operations _session.mount("https://", adapters.HTTPAdapter( pool_connections=10, pool_maxsize=20, max_retries=0, # we handle retries manually )) _session.headers.update(headers) elif _session.headers.get("X-API-KEY") != api_key: # API key changed (e.g. reloaded in long-running process) — refresh headers _session.headers.update(headers) return _session ``` ```python _validate_base_url() session = get_session() last_exc: Optional[Exception] = None last_retryable_response: Any = None # last 429/5xx seen; surfaced if retries exhaust def _log(msg: str) -> None: if not _QUIET: print(msg, file=sys.stderr) for attempt in range(1, max_retries + 1): is_last_attempt = attempt == max_retries try: response = session.request(method, url, timeout=timeout, **kwargs) ``` ### Technical Analysis The helper uses `requests.Session.request()` without setting `allow_redirects=False`. Consequently, redirects are followed according to the `requests` library's default behavior. The custom `X-API-KEY` value is installed as a session-wide header. Standard redirect authentication protection primarily addresses conventional authorization headers; the implementation does not explicitly strip the custom API-key header or validate the origin of every redirect target. A `307 Temporary Redirect` or `308 Permanent Redirect` can preserve the HTTP method and request body. Therefore, a redirected planning ...[truncated 1710 chars]
Remediation
View remediation
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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (16)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- Read [insurai-api-spec.md](references/insurai-api-spec.md) when selecting an endpoint or interpreting request and response fields.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- Read [insurai-api-spec.md](references/insurai-api-spec.md) when selecting an endpoint or interpreting request and response fields.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The workflow instructs sending policy images or PDFs to an external OCR/document-processing capability, but it does not require a privacy notice, minimization, retention limits, or user consent. Because insurance documents commonly contain highly sensitive personal, financial, and beneficiary information, silent transfer to a third party materially increases privacy, compliance, and data-exposure risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The README states the skill is for Republic of China (Taiwan) insurance tasks and provides the primary usage description in Traditional Chinese, but does not indicate any user choice of language or locale. Under the policy rule, forcing a specific language/locale without opt-in can be a natural-language policy violation unless clearly justified as region-specific compliance tooling.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill uses environment variables and network access to send user insurance data to an external API, but it does not declare an explicit tool scope such as permissions or allowed-tools. That mismatch weakens policy enforcement and reviewability, making it easier for the skill to access sensitive capabilities without clear machine-readable constraints.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The document is written entirely in Traditional Chinese, including normative instructions and API usage guidance, but it does not state that the skill is region-specific or provide any user language/locale opt-in. Under the policy, forcing a specific language without user choice is a natural-language policy violation unless the constraint is explicitly justified.

Content

No source excerpt is available for this finding.

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · references/insurai-api-spec.md (reported line 164)May include surrounding context.

}

text

| 欄位                  | 說明                                                                                                                  |
| --------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `productCodes`        | 推薦結果清單,每筆為一組主約與可搭配附約(**回傳 key 為 `productCodes`,非 `combinations`**)                         |
| `main`                | 主約商品(`code` / `name` / `insurer` / `mainBenefits`)                                                              |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · references/insurai-api-spec.md (reported line 237)May include surrounding context.

}

text

| 欄位          | 說明                                                                                     |
| ------------- | ---------------------------------------------------------------------------------------- |
| `productCode` | 商品代碼                                                                                 |
| `metadata`    | 商品 metadata(**JSON 物件**;主約存在 `riderProductCodes` 時可能包含 `officialRiders`) |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · references/insurai-api-spec.md (reported line 239)May include surrounding context.

md
| 欄位          | 說明                                                                                     |
| ------------- | ---------------------------------------------------------------------------------------- |
| `productCode` | 商品代碼                                                                                 |
| `metadata`    | 商品 metadata(**JSON 物件**;主約存在 `riderProductCodes` 時可能包含 `officialRiders`) |

---

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file contains a natural-language locale restriction stating the skill is only applicable to Taiwan and that all other countries or regions must be rejected. Under the policy rule, forcing a locale constraint without user choice or opt-in is a policy concern unless it is clearly documented and justified as region-specific compliance tooling; this file states the restriction but does not provide a user choice mechanism.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases are broad enough to match common conversational requests about policies and coverage, which can cause the skill to activate in situations where the user did not intend sensitive insurance analysis or external data handling. In this context, accidental activation is more dangerous because the workflow proceeds into policy review, recommendation, and OCR-based document processing involving personal financial and health-adjacent data.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The workflow directs direct execution of a local helper script for API operations, while the skill metadata says mandatory scope and rejection rules must be applied before any API call. This creates a bypass risk: an agent following the workflow literally could invoke the API without enforcing those safeguards, leading to out-of-scope insurance guidance or unauthorized processing of sensitive policy data.

Content

No source excerpt is available for this finding.

Unbounded Resource Access

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.

Content

Scanner excerpt · scripts/insurai_api.py (reported line 108)May include surrounding context.

python
_session.mount("https://", adapters.HTTPAdapter(
            pool_connections=10,
            pool_maxsize=20,
            max_retries=0,  # we handle retries manually
        ))
        _session.headers.update(headers)
    elif _session.headers.get("X-API-KEY") != api_key:

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The natural-language description and usage guidance state that the skill is for Republic of China (Taiwan) personal insurance tasks and present the instructions in English and Traditional Chinese, which constrains locale and regional applicability. While this may be business-justified, the file does not explicitly frame the locale restriction as a user choice or opt-in in the skill description itself.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This code emits a hard-coded Traditional Chinese error message for HTTP 402 while most other user-facing messages in the file are in English. Because the file does not offer a language selection mechanism or document a justified locale restriction, it forces a specific language on users unexpectedly.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The batch-size validation message is hard-coded in Traditional Chinese, while surrounding CLI messaging is in English. This creates an inconsistent forced-language experience without any visible opt-in or documented regional limitation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.