T09 · Insecure Skill Coding Practices
- 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
Security audit
Security checks for vulnerabilities and agentic risk
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.
s2_ha_local_adapter.py:10Home Assistant bearer token can be transmitted over plaintext HTTP
s2_ha_local_adapter.py:15Home Assistant destination validation is vulnerable to unsafe .local trust and DNS rebinding
main.py:9Intent validation permits unsafe types, values, and physical-command ranges
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
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.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
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.
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.
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.
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.
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.
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.
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.
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.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
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
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.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
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
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.
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.
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.
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.