Back to skill

Security audit

tuya-local-control

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it claims for local Tuya device control, but it handles sensitive device keys that users must protect.

Install only if you intend to control Tuya devices you own. Treat tuya_devices.json like a password file: keep it out of git and chats, restrict who can read it, and rotate/re-fetch keys if it is exposed.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (4)

Credential Access

High
Category
Privilege Escalation
Confidence
85% confidence
Finding

The skill explicitly tells the user to obtain cloud API credentials and device local keys, then store/export them and write them into tuya_devices.json. These are highly sensitive secrets: exposure would allow unauthorized querying of the Tuya cloud project and direct local control of enrolled devices on the LAN.

Content

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

md
2. **Find the device on the LAN.** Optional but the fastest way to learn the IP and the protocol version. Run `python -m tinytuya scan` (or `tinytuya.deviceScan()`), or read the device list from your router's DHCP leases. Completion: you have an IP for the device. Devices are often at a fixed DHCP lease, but the IP can change — re-check before blaming the code.

3. **Fetch device ids + local keys from the cloud (one time).** Create a free **Tuya IoT Platform** project, enable **IoT Core**, and link your Smart Life / Tuya app account to it (Devices → Link App Account). Note the project's **Access ID / Client ID** and **Access Secret / Client Secret**, plus the region (`eu`, `us`, `cn`, `in`). Put them in environment variables and run the bundled `scripts/fetch_keys.py`. Completion: `tuya_devices.json` exists and lists at least one device with a local key.

4. **Probe the device locally.** Run `scripts/local_status.py <name-or-id>`. It opens a `tinytuya.Device` with the stored id + key + IP and calls `status()`. If it fails, try the other protocol version (`3.3` vs `3.4`) — this is the single most common cause of an empty or refused response. Completion: you get a JSON blob of DPS values.

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 · scripts/fetch_keys.py (reported line 10)May include surrounding context.

python
Credentials come from the environment -- never hardcode them:

  set TUYA_API_KEY=...         Access ID / Client ID
  set TUYA_API_SECRET=...      Access Secret / Client Secret
  set TUYA_API_REGION=eu       eu | us | cn | in   (default: eu)
  set TUYA_APP_DEVICE_ID=...   any device id from the app, used to bind the account

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 · scripts/fetch_keys.py (reported line 34)May include surrounding context.

python
Credentials come from the environment -- never hardcode them:

  set TUYA_API_KEY=...         Access ID / Client ID
  set TUYA_API_SECRET=...      Access Secret / Client Secret
  set TUYA_API_REGION=eu       eu | us | cn | in   (default: eu)
  set TUYA_APP_DEVICE_ID=...   any device id from the app, used to bind the account

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill instructs use of environment variables and writes a sensitive device inventory file (tuya_devices.json) containing local keys, but it declares no tool scope or permissions metadata. In an agent environment, missing explicit scope can lead to over-broad or implicit access to secrets and filesystem writes without clear user consent or sandboxing expectations.

Content

No source excerpt is available for this finding.