T09 · Insecure Skill Coding Practices
- Location
skill.py:16- 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
The skill is disclosed as smart-home eldercare automation, but real mode can unlock a door and send a Home Assistant bearer token to a configurable HTTP endpoint with too little safety control.
Keep this skill in dry-run unless you have reviewed the device actions and network path. Before enabling real actuation, remove or gate door unlocking, require human approval or independent sensor confirmation, use HTTPS with a fixed trusted Home Assistant host, use a least-privilege token, and pin dependencies with a lockfile.
skill.py:16Home Assistant bearer token can be transmitted over plaintext HTTP
skill.py:39Safety-critical physical actions lack authenticated sensor input and runtime authorization
requirements.txt:1Unbounded and unhashed third-party dependencies permit unreproducible installations
This code can issue live unlock, lighting, and HVAC commands to external Home Assistant services, including unlocking a door during a fall-detection path. In context, that is especially dangerous because the trigger logic appears weak or incorrect, so a false positive or manipulated configuration could produce unauthorized physical actions affecting occupant safety and property security.
The request target is built from an environment-controlled base URL and then used in a live POST with an Authorization bearer token. If real actuation is enabled, a malicious or misconfigured HA_BASE_URL can redirect commands and credentials to an attacker-controlled endpoint, enabling SSRF-like outbound access and token exfiltration alongside physical-device command abuse.
# 真实物理控制逻辑
print(f" └─ 🔌 [物理执行层] 正在发送危险指令 POST {url} | 载荷: {payload}")
try:
response = requests.post(url, headers=HomeAssistantActuator.headers, json=payload, timeout=5)
response.raise_for_status()
print(f" └─ ✅ [硬件响应] 成功执行真实物理指令!")
return True
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"environment_variables": {
"S2_ENABLE_REAL_ACTUATION": "Default: False. Set to 'True' to allow actual HTTP requests to physical hardware.",
"HA_BASE_URL": "The REST API endpoint for Home Assistant (e.g., http://localhost:8123/api).",
"HA_BEARER_TOKEN": "Long-lived access token for Home Assistant authentication."
},
"language": "python",
"homepage": "https://space2.world"
The skill is explicitly wired for smart-home actuation through environment-provided Home Assistant connectivity and a runtime flag that can enable real device control. Even though dry-run is the default, the presence of production actuation capability in a skill with no authentication, authorization, safety policy, or user-confirmation layer creates meaningful physical-security risk.
The file includes prominent natural-language descriptions and runtime messaging in Chinese, but nowhere indicates that language is configurable or user-selected. Under the policy, forcing a specific language without opt-in is a natural-language policy violation unless the locale constraint is clearly documented and justified.
The skill performs external network transmission of command payloads and authorization headers to a configurable endpoint. External transmission alone is not always harmful, but here it carries control commands and a bearer token for physical automation, making confidentiality and destination integrity materially important.
# 真实物理控制逻辑
print(f" └─ 🔌 [物理执行层] 正在发送危险指令 POST {url} | 载荷: {payload}")
try:
response = requests.post(url, headers=HomeAssistantActuator.headers, json=payload, timeout=5)
response.raise_for_status()
print(f" └─ ✅ [硬件响应] 成功执行真实物理指令!")
return True
The dependency is specified with a lower bound only, which allows future installs to resolve to different versions over time. This weakens reproducibility and can unintentionally introduce vulnerable or incompatible releases through the software supply chain.
numpy>=1.24.0
scipy>=1.10.0
matplotlib>=3.7.0
requests>=2.28.0
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.
The dependency is not pinned to an exact version, so builds are non-deterministic and may pull in an unsafe or untested scipy release later. This creates a supply-chain risk even if no immediately exploitable issue is evident in the file itself.
numpy>=1.24.0
scipy>=1.10.0
matplotlib>=3.7.0
requests>=2.28.0
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.
Using a minimum-only version for matplotlib permits uncontrolled upgrades during installation. That can lead to unexpected behavior or exposure to future vulnerable versions, making the environment less predictable and less secure.
numpy>=1.24.0
scipy>=1.10.0
matplotlib>=3.7.0
requests>=2.28.0
An unpinned requests dependency is more concerning because it is commonly used for network communication and has a history of security advisories. Allowing arbitrary newer releases at install time can expose the skill to transport, credential-handling, or request-processing flaws.
numpy>=1.24.0
scipy>=1.10.0
matplotlib>=3.7.0
requests>=2.28.0
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.