Back to skill

Security audit

xiaodu-bedtime-soother-official

Security checks for vulnerabilities and agentic risk

Overview

This skill is coherent for XiaoDu bedtime automation, but it deserves review because it controls home devices and stores child/household bedtime preferences without clear consent or retention limits.

Install only if you are comfortable with the skill controlling XiaoDu smart screens and relevant IoT devices for bedtime routines. Before use, require explicit consent for saving household or child bedtime preferences, set a reasonable maximum delay, and prefer confirmations before multi-step home-control actions.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/bedtime_story_tail.sh:79
Finding

Unbounded Delay Allows Resource Exhaustion and Arithmetic Failure

Content
View full analysis

Vulnerability Details

File Location: scripts/bedtime_story_tail.sh, lines 79–85
Vulnerability Type: Improper input validation and uncontrolled resource consumption
Risk Level: Medium

Vulnerable Code

bash
if ! [[ "$DELAY_MINUTES" =~ ^[0-9]+$ ]]; then
  echo "--delay-minutes must be an integer" >&2
  exit 1
fi

echo "$LOG_PREFIX sleeping for $DELAY_MINUTES minutes before bedtime ending sequence..."
sleep "$((DELAY_MINUTES * 60))"

Technical Analysis

The script validates DELAY_MINUTES only as a sequence of decimal digits. It does not impose a minimum or maximum value, limit input length, or verify that multiplication by 60 remains within Bash's signed integer range.

The documented workflow supports user-selected N-minute stop delays, so an untrusted or accidental request can be translated into the --delay-minutes argument. A large accepted value causes the script to remain in a foreground sleep for an excessive period. An extremely long numeric value can also overflow Bash arithmetic or produce a duration rejected by sleep, preventing the intended stop and screen-off sequence.

The arguments are correctly quoted, so this is not command injection. The issue is insufficient numeric range validation and use of a long-lived process as a scheduling mechanism.

Attack Path

  1. A user requests an extremely large delay before stopping bedtime media.
  2. The Agent or invoking process passes that value through --delay-minutes.
  3. The digits-only regular expression accepts the value.
  4. The script evaluates DELAY_MINUTES * 60.
  5. The process either enters an excessively long sleep or encounters arithmetic overflow or an invalid sleep duration.
  6. The intended pause and screen-off commands are delayed indefinitely or never executed.
  7. If multiple runs are launched independently or in the background, sleeping processes can accumulate and consume process-table and execution resources.

Impact Assessment

Exploitation doe ...[truncated 569 chars]

Remediation
View remediation

Remediation Suggestions

Enforce a strict operational range before performing arithmetic. Also limit the accepted string length so an oversized integer cannot reach Bash arithmetic evaluation.

For example:

bash
if ! [[ "$DELAY_MINUTES" =~ ^[0-9]{1,3}$ ]] ||
   (( DELAY_MINUTES < 1 || DELAY_MINUTES > 240 )); then
  echo "--delay-minutes must be an integer between 1 and 240" >&2
  exit 1
fi

delay_seconds=$((DELAY_MINUTES * 60))
sleep "$delay_seconds"

Additional hardening measures:

  1. Select a maximum delay appropriate to the product's bedtime-use requirements.
  2. Reject zero if immediate cleanup is not an intended mode.
  3. Prefer a managed scheduler or job queue with cancellation, deduplication, timeout enforcement, and status tracking over a long-lived foreground process.
  4. Prevent multiple pending cleanup jobs for the same device where the runtime supports job management.
  5. Add boundary tests for zero, the maximum accepted value, one value above the maximum, very long numeric strings, signs, decimals, and nonnumeric input.
  6. Make the documented default consistent: the implementation uses 15 minutes, while the help text and some test documentation state 5 minutes.
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

声明描述的是一个较完整的“儿童睡前模式/睡前场景编排”能力,强调复用 xiaodu-control-official 对智能屏和 IoT 设备做 scene-first 的睡前联动控制。但代码实际只是一个 shell 脚本:接收设备标识,等待 N 分钟,然后调用依赖脚本发送两条语音控制文本(暂停、关闭屏幕)。这更像“睡前故事结束后的定时收尾”工具,而不是用户触发的完整睡前场景 orchestrator。代码确实复用了 xiaodu-control-official,这一点与声明一致,但其主要功能范围明显更窄,且增加了一个重要但未在描述中体现的定时延迟能力。因此描述不能准确代表该代码块的实际行为。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The description specifies invocation and behavior entirely in Chinese, including the trigger phrases the user is expected to say. Because the file does not offer language choice, opt-in, or a documented region-specific justification, it creates a natural-language locale constraint that may violate language policy requirements.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill directs the agent to persist household and bedtime preferences into XIAODU_CONTEXT.md and MEMORY.md without requiring user notice, consent, retention limits, or data-minimization rules. Because these preferences can reveal child-related routines, device ownership, room associations, and household habits, silent persistence increases privacy risk and the chance of unintended disclosure across future sessions.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases shown in the test cases are broad, natural utterances such as '带孩子睡觉' and '开始睡前模式', which can plausibly occur in ordinary conversation and may activate the skill without sufficiently explicit intent. Because this skill performs physical environment changes and launches follow-on media actions, accidental activation could cause unintended device control in a child’s room or home environment.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

These additional trigger examples remain underspecified about when the skill should take control, including generic requests like '帮我哄孩子睡觉' and '把卧室调成适合睡觉的状态'. In this skill context, ambiguity is more dangerous because the flow can chain scene execution, lighting changes, smart screen behavior, audio playback, and delayed follow-up actions, amplifying the effect of a mistaken activation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The section on user-facing reporting style is entirely prescriptive and provides only Chinese examples, effectively directing the skill to communicate in Chinese. Under the policy rule, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly justified, which is not stated here.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/usage-notes.md (reported line 150)May include surrounding context.

md
避免这样对用户说:
- 我先执行了 list_scenes
- 我调用了 control_xiaodu
- 我刚刚起了一个 nohup 任务
- 我执行了某个脚本

## 串行执行规则