T09 · Insecure Skill Coding Practices
- Location
scripts/.mi.json:1- Finding
Committed Xiaomi Authentication Tokens and Sensitive Device Metadata
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill has a coherent XiaoAi voice-bridge purpose, but it ships sensitive Xiaomi session data and includes unsafe integration examples that need review before installation.
Do not install this package as-is. The publisher should remove the committed Xiaomi token/device file, revoke exposed sessions, replace unsafe exec examples with spawn or execFile argument arrays, stop printing transcripts by default, add clear privacy and consent guidance, and regenerate dependencies from an HTTPS registry. If you still test it, use a throwaway or tightly scoped Xiaomi account, a non-empty trigger prefix, and an unprivileged runtime environment.
scripts/.mi.json:1Committed Xiaomi Authentication Tokens and Sensitive Device Metadata
SKILL.md:108Shell Command Injection in the Documented TTS Integration
scripts/package-lock.json:17Dependency Lockfile Uses Plaintext HTTP Third-Party Package URLs
scripts/test-fetch.js:20Test Utility Writes Private Voice Conversation Transcripts to Standard Output
The documented behavior goes beyond a simple live voice bridge: it involves logging into a Xiaomi account, reading recent voice history from cloud-backed services, and printing user utterances to stdout. That mismatch materially increases privacy and credential risk because operators may deploy it expecting transient command forwarding, while it can expose historical conversations and account-linked data.
The skill requires high-value credentials in .env, including a Xiaomi account token or password, to log into a user account and control devices. Credential use is functionally necessary for this integration, but it still represents a real security risk because compromise of the host, logs, or misconfigured secret handling could expose account access with potential device-control and privacy consequences.
复制 .env.example 并填写配置:
cp .env.example .env
编辑 .env 文件:
YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).
{"mina":{"deviceId":"android_841fa1ed-e704-41ba-9cec-46c73be38b63","userId":"2277466353","passToken":"V1:pwROAesIuzMBPe5slLSsQlxaobuyZH0R3IgkV3uUgKwmaQ813TVZQtlyHOUwVXYws7jW/RyrdYuZTvyhb8z6LUYP4lwQKIB8ZvqxJEhhLn77i1aKdqFmDW4uHvhBLEX7IXva5tZmXyJlrBjKeQnq6AcJCAagkW4nO6cHa2diDrIEOvvGrGeygboxREgJadGlEDHNuI+yCv++jKKkJHDElD89TZNuykdf/PxsxGxY8RH+t0R6gu2mGG4kC1SJClM1myYL3i2ZxCLtNm1lBm3f1qGLiGTjSX4TuaajKBdr2NtoVsd5Uu8ZJG/F+GhyK73rpodmqEsK+JvfBFuVflf9qQ==","did":"小米AI音箱","debug":false,"pass":{"notificationUrl":"","ssecurity":"6BA2OB0M/LyDEPVEPJWoQA==","code":0,"passToken":"V1:pwROAesIuzMBPe5slLSsQlxaobuyZH0R3IgkV3uUgKwmaQ813TVZQtlyHOUwVXYws7jW/RyrdYuZTvyhb8z6LUYP4lwQKIB8ZvqxJEhhLn77i1aKdqFmDW4uHvhB
The project includes axios 1.13.5, which static analysis flags with multiple advisories including SSRF/proxy handling and prototype-pollution-related issues. In this skill's context, a bridge that listens to external voice-derived input and communicates with remote services increases the relevance of request-manipulation bugs, especially if untrusted input can influence URLs, headers, or proxy behavior.
form-data 4.0.5 is flagged for CRLF injection via unescaped multipart field names and filenames, which can enable malformed requests or header/body smuggling when attacker-controlled values are included in multipart uploads. If any voice-derived or externally sourced content is later packaged into multipart requests, this could be turned into request manipulation against upstream APIs.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
import { getMiNA } from "@mi-gpt/miot";
import dotenv from "dotenv";
// 加载 .env 文件
dotenv.config();
// 配置
The skill requires sensitive capabilities through environment variables (MI_USER_ID, MI_PASS_TOKEN or MI_PASSWORD, device identifiers) but does not declare any tool scope or permissions boundary. This weakens reviewability and least-privilege controls, making it easier for the skill to access credentials and external services without explicit operator awareness.
The skill describes continuous listening/polling and cloud-based speech retrieval but does not clearly warn users that voice data and transcripts are collected, transmitted, and processed through Xiaomi cloud services and then forwarded into an AI workflow. This omission undermines informed consent and increases privacy risk, especially in a household smart-speaker setting involving bystanders and potentially sensitive speech.
The example builds a shell command with interpolated response text: exec(... speak "${response}"). If the AI output or upstream voice-derived content contains shell metacharacters, command substitution, or quote-breaking payloads, this can lead to command injection and arbitrary command execution on the host.
This second example repeats the same unsafe pattern by embedding text directly into exec('node ... speak "${text}"'). Because the text may originate from users, assistants, or automations, it creates a straightforward command-injection path unrelated to the core bridge functionality.
Allowing an empty TRIGGER_PREFIX means the listener may process all captured XiaoAi voice messages rather than explicitly addressed commands. In the context of a continuously running bridge tied to cloud voice transcripts, this broadens collection and execution scope, increasing the chance of unintended command handling and privacy exposure.
The full integration example continues to shell-interpolate text in a TTS command, demonstrating the unsafe pattern in the most complete sample likely to be copied into production. Because this bridge processes voice commands and AI responses, it combines multiple untrusted input sources into a shell execution sink.
The documentation explicitly instructs users to supply Xiaomi account credentials and demonstrates access to conversation history, which is privacy-sensitive data. In the context of a voice-command bridge that continuously polls device conversations, failing to include clear privacy, consent, and credential-handling warnings increases the risk of account compromise and unauthorized collection of spoken content.
The environment variable example shows sensitive authentication material being stored and used without any warning about secret management, leakage in logs/shell history, or rotation. Because this skill bridges a household voice assistant account to an AI agent, exposure of these values could enable unauthorized device control and access to private conversation data.
The identifiers "xiaoai-bridge" and "XiaoAi speaker voice command bridge" suggest a language- or locale-specific assistant integration, but the manifest provides no note that this is optional, user-selected, or region-specific by design. That can create a natural-language policy concern if the skill effectively assumes a specific locale without documented opt-in or justification.
The manifest describes a voice-command bridge that captures XiaoAi messages, converts them into assistant instructions, and replies via TTS. This script instead loads raw Xiaomi account credentials from environment variables and performs an account login to fetch conversation history, which is a broader account-access capability than the stated bridge behavior itself.
The script accesses MI_USER_ID, MI_PASS_TOKEN, MI_PASSWORD, and MI_DEVICE_ID directly from the environment, which are sensitive values. There is no comment, docstring, or user-facing disclosure explaining that the skill reads credentials from the local environment.
The script pulls recent XiaoAi conversation history from a remote service and prints user utterances to stdout without any explicit warning, consent prompt, or data-minimization control. In the context of a voice bridge skill, these records can contain sensitive personal commands, household activity, or other private speech data, making silent retrieval and display a privacy risk.
The listener emits captured voice-command content and original utterances directly to stdout as JSON, which can expose sensitive spoken data to logs, parent processes, shell history wrappers, or other local collectors without any user disclosure or minimization. In this skill’s context, the data comes from continuous background monitoring of a smart speaker, which increases privacy risk because bystanders may not realize their speech is being captured and forwarded.
The lockfile pins package downloads to an HTTP mirror, which removes transport integrity and enables man-in-the-middle tampering of dependency tarballs in transit. Although npm integrity hashes provide some protection, relying on cleartext transport still weakens supply-chain trust, leaks metadata, and can combine dangerously with compromised lockfiles, mirror poisoning, or developer workflows that regenerate the lockfile from the same mirror.
This additional dependency confirms the project is systematically sourcing packages from the same cleartext regional mirror rather than an isolated one-off entry. Broad use of HTTP mirrors increases the attack surface for dependency substitution, interception, and policy drift across the entire install chain.
The repeated use of region-specific HTTP resolved URLs shows the insecure package source choice affects transitive dependencies as well, making the whole dependency graph subject to interception or mirror compromise. In a voice-command bridge that can trigger assistant actions, a supply-chain compromise could become an execution path into a highly privileged automation environment.
follow-redirects 1.15.11 is flagged for leaking custom authentication headers across cross-domain redirects. If this bridge sends authenticated requests to device, cloud, or TTS/AI endpoints, an attacker controlling a redirect target could capture tokens or session headers and pivot into connected services.
This manifest file describes the skill only as a "voice command bridge" without indicating what phrases, contexts, or boundaries govern activation. In a manifest file, the absence of specific trigger scope can lead to ambiguous or overly broad invocation behavior.
Using a caret version for @mi-gpt/miot allows automatic adoption of future minor/patch releases, which can introduce malicious or vulnerable code through the dependency supply chain. In a voice-command bridge that listens in the background and may forward commands to an assistant, a compromised dependency could gain access to audio-derived commands, tokens, or downstream automation flows.
"type": "module",
"main": "xiaoai-listen.js",
"dependencies": {
"@mi-gpt/miot": "^1.2.2",
"dotenv": "^17.3.1"
},
"engines": {
No suspicious patterns detected.