Back to skill

Security audit

S2 Spatial Adapters

Security checks for vulnerabilities and agentic risk

Overview

This smart-home skill is purpose-aligned but needs Review because it can perform high-impact physical actions with weak runtime safety and network credential protections.

Review carefully before installing. Use dry-run by default, require explicit human confirmation for locks, feeders, and HVAC, use least-privileged credentials, avoid HTTP Home Assistant endpoints, and verify device-specific value limits before enabling S2_ENABLE_REAL_ACTUATION=True.

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

T09 · Insecure Skill Coding Practices

Error
Location
s2_ha_local_adapter.py:10
Finding

Home Assistant bearer token can be transmitted over plaintext HTTP

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
s2_ha_local_adapter.py:15
Finding

Home Assistant destination validation is vulnerable to unsafe .local trust and DNS rebinding

Content
View full analysis
bool: try: hostname = urlparse(url).hostname if not hostname: return False if hostname.endswith(".local") or hostname == "localhost": return True resolved_ip = socket.gethostbyname(hostname) ip_obj = ipaddress.ip_address(resolved_ip) is_safe = ip_obj.is_private or ip_obj.is_loopback if not is_safe: print(f" └─ 🚨 [SSRF Block] Target IP ({resolved_ip}) is not a local address.") return is_safe except Exception: return False ``` ```python if "unconfigured" in self._token or not self._validate_ssrf_safety(url): print(" └─ 🚨 [Execution Block] Invalid credential or failed SSRF validation.") return False headers = {"Authorization": f"Bearer {self._token}", "Content-Type": "application/json"} try: response = requests.post(url, headers=headers, json=payload, timeout=3.0) ``` ### Technical Analysis The SSRF control has two destination-binding weaknesses: 1. Any hostname ending in `.local` is accepted without resolving and validating its actual address. 2. Other hostnames are resolved once with `socket.gethostbyname()` for validation, but `requests.post()` subsequently performs its own connection and name resolution. The second behavior creates a time-of-check/time-of-use gap. A hostname can resolve to an accepted private address during validation and then resolve to a different destination when the HTTP client connects. This is a standard DNS-rebinding pattern. The risk is amplified because the subsequent request contains the Home Assistant bear ...[truncated 1918 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
main.py:9
Finding

Intent validation permits unsafe types, values, and physical-command ranges

Content
View full analysis
dict: if not isinstance(intent_data, dict): raise ValueError("Intent must be a JSON object.") allowed_keys = {"power", "brightness_pct", "color_temp", "temperature", "hvac_mode", "action", "feed_portions"} sanitized = {k: v for k, v in intent_data.items() if k in allowed_keys} if not sanitized: raise ValueError("No valid intent remains after filtering.") return sanitized ``` Representative downstream uses include: ```python if "temperature" in intent: return self._call_ha_service( "climate", "set_temperature", device_id, {"temperature": intent["temperature"]} ) ``` ```python if "feed_portions" in intent: tuya_commands.append( {"code": "manual_feed", "value": intent["feed_portions"]} ) ``` ### Technical Analysis The validation function implements only a global key allowlist. It does not enforce: - Expected data types. - Numeric bounds. - Finite numeric values. - Allowed enumerations. - Element-specific key combinations. - Protocol-specific capabilities. - Maximum feeder portions. - Safe temperature, brightness, or color-temperature ranges. Unknown keys are silently removed instead of causing rejection. Allowed keys with unsafe values pass unchanged into adapters or are transformed into vendor commands. This does not provide the documented “strict JSON schema” protection. A key allowlist may reduce direct command injection risk, but it does not establish that a requested physical action is semantically valid or safe. This is particularly important because the included Agent is designed to infer commands autonomously from natural-language context. ### Attack Path 1. An attacker manipulates user input, contextual data, or Agent output ...[truncated 1493 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (16)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.md (reported line 37)May include surrounding context.

md
We have completely overhauled the security architecture to protect your physical home from LLM hallucinations and network attacks. This package has passed rigorous Red Team auditing:

1. **Anti-Prompt-Injection**: Strict JSON schema whitelisting strips malicious commands hallucinated by AI Agents before they reach the physical layer.
2. **Application-Level Dereferencing**: Post-actuation, sensitive AES keys and Access Tokens are immediately un-bound and reassigned to safe stubs to expedite Python Garbage Collection.
3. **Data Leakage Prevention (DLP)**: All sensitive payloads and internal IP mappings are strictly redacted (`[REDACTED]`) in standard console outputs to protect your living habits from log aggregators.
4. **Hardcore SSRF & Endpoint Defense**: Deep DNS/IP resolution blocks UDP/HTTP DNS Rebinding attacks. Tuya endpoints are locked to a strict official whitelist.
5. **Cloud-Native Provisioning**: We strictly oppose storing plaintext credentials in local files. Zero file I/O. All secrets must be injected via secure OS-level runtime environments.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.md (reported line 52)May include surrounding context.

md
2. Cloud-Native Environment Injection

⚠️ SECURITY WARNING: Do NOT create local .env files. You MUST inject the following variables dynamically via your runtime environment, Docker ENV, or secure CI/CD vault:

    S2_ENABLE_REAL_ACTUATION (REQUIRED): Global Security Valve. Must be True to allow real physical requests. Defaults to Dry-Run sandbox.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly documents real-world physical actuation, including unlocking a door, and provides exact execution examples without embedding safety, authorization, or environment-gating warnings adjacent to those commands. In a smart-home control skill, this materially increases the chance of unsafe or unauthorized actuation by operators or downstream agents, especially if S2_ENABLE_REAL_ACTUATION=True is enabled in production.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This Python file contains user-visible error and status strings in Chinese, beginning with the validation error at L11 and continuing through the docstring and later log messages. The policy allows locale constraints only when users are given a choice or when the constraint is clearly documented and justified, neither of which is present here.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: requests==2.31.0 — 6 advisory(ies): CVE-2024-47081 (Requests vulnerable to .netrc credentials leak via malicious URLs); CVE-2024-35195 (Requests `Session` object does not verify requests after making first request wi); CVE-2026-25645 (Requests has Insecure Temp File Reuse in its extract_zipped_paths() utility func) +3 more

Medium
Category
Supply Chain
Confidence
97% confidence
Finding

The dependency is pinned to requests==2.31.0, which is flagged with multiple published advisories. Shipping a known vulnerable version can expose consumers of the skill to issues such as credential leakage, TLS/verification weaknesses, or unsafe temporary file handling if affected code paths are used.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The description promises translation of human intents and environmental contexts into physical actuation, which is broad enough to encourage action on implicit or ambiguous cues. Because the skill can control lighting, HVAC, locks, and feeders, overly expansive invocation language increases the risk of unintended physical-world actions from vague prompts or misclassification.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The welcome message explicitly claims the agent is connected to the Tuya cloud, which expands the perceived actuation and data-access scope beyond a purely local controller. In a physical-device control skill, overstating network/cloud connectivity can mislead users about where commands and data flow, and may normalize broader remote control than the documented interface justifies.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The welcome message is entirely in Chinese and does not offer the user a language choice or indicate that the skill is region-specific. This creates a natural-language policy issue because it imposes a specific language/locale by default without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Multiple print statements use Chinese-only status and warning messages, including safety and execution notices. This imposes a specific language on users/operators without offering a language choice or documenting a justified locale restriction, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · s2_ha_local_adapter.py (reported line 54)May include surrounding context.

python
headers = {"Authorization": f"Bearer {self._token}", "Content-Type": "application/json"}
        try:
            response = requests.post(url, headers=headers, json=payload, timeout=3.0)
            response.raise_for_status()
            print("   └─ ✅ [硬件响应] HA 网关确认执行。")
            return True

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file’s natural-language output strings are consistently Chinese-only, including error, safety, and execution-status messages. This can violate language/locale policy when users are not given an opt-in choice or documented justification for the locale restriction.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · s2_tuya_cloud_adapter.py (reported line 61)May include surrounding context.

python
headers = {"client_id": self._access_id, "access_token": token, "sign": sign, "t": t, "sign_method": "HMAC-SHA256", "Content-Type": "application/json"}
            
            print(f"   └─ 🔐 [HMAC-SHA256] 签名成功,发射!")
            resp = requests.post(f"{self._endpoint}{path}", headers=headers, json=body, timeout=5)
            if resp.json().get("success"):
                print("   └─ ✅ [硬件响应] 云端执行成功。")
                return True

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The execution entry point translates intents directly into real device commands, including sensitive actions such as door unlock and pet feeding, without any built-in user confirmation, authorization gate, or explicit safety interlock at call time. In a home-automation context this can enable unintended or unauthorized physical actuation if upstream intent generation is mistaken, spoofed, or abused.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The text says the agent template is designed for "OpenClaw / AutoGen" and notes a strictly locked configuration, which imposes a framework-specific operational constraint in natural language. While not severe, it presents a fixed tooling/operational policy without indicating alternatives, opt-in, or a documented reason tied to a compliance need.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

SQP-3 applies to all file types and covers language or locale policy violations. The file includes Chinese-only parenthetical headings such as '应用级凭证解绑', '防提示词注入', and '云原生环境注入' without indicating that multilingual output is optional or justified by a region-specific requirement.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

Multiple print statements use Chinese-only user-facing text, which imposes a specific language choice without offering localization or user opt-in. This is a natural-language policy issue because the skill does not appear to provide any mechanism to select or justify the locale.

Content

No source excerpt is available for this finding.