Back to skill

Security audit

三峰智能

Security checks for vulnerabilities and agentic risk

Overview

This smart-home skill is mostly coherent, but its PowerShell helper can send an auth token to a caller-controlled URL path, which needs review before use.

Review this skill before installing. It needs your smart-home credentials and can control real devices; token storage is documented as encrypted, but the request helper should be tightened to enforce the five documented API paths before you trust it with an active account token.

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

Error
Location
scripts/sufn-helpers.ps1:64
Finding
Bearer Token Disclosure Through Unvalidated API Path Construction## Vulnerability Details **File Location**: `scripts/sufn-helpers.ps1`, lines 64–96 **Vulnerability Type**: Unvalidated URI construction and credential disclosure **Risk Level**: High ### Vulnerable Code ```powershell function Invoke-SufnPlatform { param( [Parameter(Mandatory = $true)][string]$Path, [Parameter(Mandatory = $true)]$Body, [string]$AuthToken, [string]$Method = 'POST' ) # TLS 1.2+(函数级别保障,即使模块级设置被覆盖) [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $params = @{ Method = $Method Uri = "https://open.aibasis.cc$Path" ContentType = 'application/json' ErrorAction = 'Stop' } if ($Method -eq 'POST' -and $Body) { $params.Body = ($Body | ConvertTo-Json -Depth 12 -Compress) } if ($AuthToken) { $params.Headers = @{ Authorization = "Bearer $AuthToken" } } try { $response = Invoke-RestMethod @params # 检查业务层返回码 if ($response.PSObject.Properties.Name -contains 'code' -and $response.code -ne 0) { return $null } return $response } catch { return $null } } ``` ### Technical Analysis `Invoke-SufnPlatform` directly appends the caller-controlled `$Path` value to the trusted base-address string. It does not require a leading slash, reject URI authority delimiters, validate the resulting host, or enforce the documented endpoint allowlist. A crafted value such as `@attacker.example/` results in: ```text https://open.aibasis.cc@attacker.example/ ``` Under standard URI parsing, `open.aibasis.cc` becomes user-information and the effective destination host is `attacker.example`. Because the helper independently adds `Authorization: Bearer <token>` whenever `$AuthToken` is present, the credential can be sent to the attacker-controlled HTTPS en ...[truncated 1487 chars]
Remediation
## Remediation Suggestions 1. Enforce an exact method-and-path allowlist in `Invoke-SufnPlatform`, covering only the five documented endpoints. 2. Require paths to begin with exactly one `/` and reject values containing a URI scheme, backslashes, control characters, `@`, fragments, or an authority component. 3. Construct requests with `System.UriBuilder` or resolve a validated relative URI against a fixed base `System.Uri`; do not use raw string concatenation. 4. Before attaching the bearer token, verify that the final URI: - Uses the `https` scheme. - Has the exact host `open.aibasis.cc`. - Uses the expected port. - Contains no user-information. - Has an allowlisted absolute path. 5. Validate `$Method` against the method required for each endpoint rather than accepting an arbitrary string. 6. Disable automatic redirects where supported, or validate every redirect destination and never forward authorization credentials to another origin. 7. Add negative tests for paths such as `@attacker.example/`, `//attacker.example/`, absolute URLs, encoded delimiters, backslashes, and unexpected endpoints.
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 (6)

Vague Triggers

Medium
Confidence
93% confidence
Finding
技能描述包含“家庭或设备列表、查询设备状态、控制具体设备、执行已有模式或场景时使用”等较宽泛的触发表达,容易在普通家居对话中被意外选中。一旦误触发,该技能具备真实设备控制能力,可能导致未经充分确认的状态查询、家庭切换或设备操作。

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
“每次只发送一条简洁的用户回复,使用设备名称、房间名称和自然语言状态”结合全文仅使用中文措辞,实际对回复语言形成固定约束,但未说明可根据用户语言偏好切换。按组织语言/locale 政策,这类默认强制单一语言且无用户选择的说明属于自然语言策略风险。

Natural-Language Policy Violations

Medium
Confidence
85% confidence
Finding
The document is written as an internal instruction set headed in Chinese and explicitly restricts how the content may be presented, but it does not offer any user language choice or state that the skill is region-specific. This can violate language/locale policy when a skill effectively forces a specific language without opt-in.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The entire reference is written in Chinese and presents control mappings and terminology only in that language. Under the policy, a language or locale restriction should either provide user opt-in/choice or be clearly documented as a justified region-specific constraint, which is not present here.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The function persists data to state.json via WriteAllText and Move-Item, which is a file write affecting local user data. In this file there is no confirmation prompt, user-facing log/print, or comment/docstring warning that state will be stored on disk.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
Invoke-SufnPlatform sends JSON data to an external endpoint and may include an Authorization bearer token, which is a network transmission of potentially sensitive user or system data. The file contains no confirmation prompt, user-facing logging, or explanatory warning about contacting the remote service and sending authentication data.

Static analysis

No suspicious patterns detected.