Back to skill

Security audit

tangyuan-parenting

Security checks for vulnerabilities and agentic risk

Overview

This parenting skill is mostly coherent, but it handles sensitive child information with unsafe command instructions and weak privacy boundaries.

Review before installing. Use it only in a private workspace, avoid committing or syncing tangyuan-logs, and treat medical content as general guidance rather than professional care. The command examples should be fixed to avoid shell interpolation of user feedback before using the logging workflow with untrusted text.

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

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:119
Finding
Shell Command Injection Through User-Derived Command Interpolation<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:119-122` **Vulnerability Type**: Command injection **Risk Level**: High ### Vulnerable Code ```markdown 3. **Write to the log file** - Determine today's date - Run the log manager script: ```bash python scripts/log_manager.py append --date {today_date} --data '{json_data}' ``` ``` Related retrieval workflows also construct shell commands using derived date values: ```bash python scripts/log_manager.py read --date {target_date} python scripts/log_manager.py read_week --date {target_date} ``` ### Technical Analysis The Skill instructs the Agent to interpolate structured feedback and date values directly into shell command text. In particular, `{json_data}` is placed inside single quotes without specifying a shell-safe encoding or escaping procedure. A feedback value containing a single quote can terminate the quoted argument. Subsequent shell metacharacters can then introduce an additional command. Validation performed by `argparse`, `json.loads`, or `datetime.strptime` does not mitigate this issue because the shell parses and executes the command line before the Python process receives its arguments. Although `scripts/log_manager.py` does not itself invoke a shell, the documented Skill workflow creates the vulnerable execution boundary by requiring the Agent to construct and run a Bash command from user-derived content. ### Attack Path 1. An attacker submits caregiver feedback containing a crafted quote and shell syntax, conceptually similar to: ```text '; attacker_command; # ``` 2. The Agent converts the feedback into JSON but embeds that JSON directly into the documented command: ```bash python scripts/log_manager.py append --date 2026-09-12 --data '{attacker_controlled_json}' ``` 3. The injected single quote terminates the intended `--data` argument. 4. The shell interprets the remaining metacharacters and attacker-controlled command as separate s ...[truncated 940 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not construct a shell command string from feedback or date values. 2. Invoke the script through a process API that accepts an argument array and does not enable shell parsing. For example: ```python subprocess.run( [ sys.executable, "scripts/log_manager.py", "append", "--date", validated_date, "--data", json.dumps(data, ensure_ascii=False), ], shell=False, check=True, ) ``` 3. Prefer passing feedback through standard input or a securely created JSON file rather than a command-line argument. This also reduces exposure through process listings. 4. Validate every date before process invocation using a strict `YYYY-MM-DD` parser. Do not pass the original user expression to a shell. 5. If shell execution cannot be avoided, apply platform-appropriate argument quoting through a proven library rather than manual replacement. This is a secondary mitigation and is less robust than eliminating the shell. 6. Add tests containing quotes, command substitutions, semicolons, newlines, and other shell metacharacters to verify that they remain literal data. 7. Run the Skill with least privilege and restrict filesystem and network access to reduce the impact of any future command-execution flaw. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/log_manager.py:67
Finding
Sensitive Childcare and Health Information Stored in Unprotected Plaintext Files<![CDATA[ ## Vulnerability Details **File Location**: `scripts/log_manager.py:67-106` **Vulnerability Type**: Plaintext storage of sensitive personal data with ambient permissions **Risk Level**: Medium ### Vulnerable Code The default storage root is the current working directory or an environment-selected directory: ```python def get_log_dir(base_dir=None): """获取日志根目录""" if base_dir is None: base_dir = os.environ.get("TANGYUAN_LOG_DIR", os.getcwd()) return Path(base_dir) / "tangyuan-logs" ``` The records are created as ordinary Markdown files without explicit permission controls or encryption: ```python # 自动创建目录 log_path.parent.mkdir(parents=True, exist_ok=True) # 获取当前时间作为记录时间 now = datetime.now().strftime("%H:%M") date_display = datetime.strptime(date_str, "%Y-%m-%d").strftime("%Y年%m月%d日") weekday_names = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"] weekday = weekday_names[datetime.strptime(date_str, "%Y-%m-%d").weekday()] # 判断文件是否已存在 is_new = not log_path.exists() with open(log_path, "a", encoding="utf-8") as f: if is_new: f.write(f"# 汤圆日志 - {date_display}({weekday})\n\n") f.write(f"## 反馈记录({now})\n\n") if isinstance(data, str): try: data = json.loads(data) except json.JSONDecodeError: # 如果不是 JSON,作为纯文本记录 f.write(f"{data}\n\n") print(f"✅ 已记录反馈到 {log_path}") return str(log_path) fields = [ ("meals", "🍚 饮食情况"), ("mood", "😊 情绪状态"), ("activities", "🎮 活动内容"), ("learning", "📚 学习内容"), ("health", "💪 身体状况"), ("sleep", "😴 睡眠情况"), ("notes", "📝 其他备注"), ] for key, label in fields: value = data.get(key, "") if value: f.write(f"### {label}\n{value}\n\n") f.write("---\n\n") ``` ### Technical Analysis The ...[truncated 1874 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Store logs in a dedicated private application-data directory rather than the current workspace. 2. Create the log root and date directories with owner-only permissions, such as `0700`. 3. Create new log files atomically with owner-only permissions, such as `0600`, and verify permissions for existing files before appending. 4. Prevent symbolic-link attacks and unintended file replacement by using safe file-opening flags where supported. 5. Encrypt sensitive records at rest using a managed key that is not stored alongside the data. 6. Minimize collected fields and avoid retaining precise routines or health details unless necessary for the requested functionality. 7. Implement configurable retention periods and secure deletion or user-controlled erasure. 8. Exclude `tangyuan-logs/` from source control and general-purpose synchronization by default. 9. Document the privacy implications and obtain informed consent before storing information about a minor. 10. Restrict runtime and backup access according to least privilege, and audit access to retained records where the hosting environment supports it. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (14)

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding
The skill description and the described behavior do not cleanly match: it advertises broad parenting-plan and knowledge-update functionality, while the concrete operational behavior centers on local log access plus additional undeclared log-listing capability. This mismatch can mislead users about what data will be accessed, stored, or surfaced, especially when handling sensitive child and health information.

Anti-Refusal Statement

High
Category
Anti-Refusal
Content
- Accept casual, conversational input — do not require structured format from grandma
- Parse generously — extract as much useful information as possible from natural language
- If feedback is very brief, still record it; do not demand more detail
- Always respond warmly and appreciatively to encourage continued daily feedback
- Flag any health concerns (fever, persistent cough, refusal to eat) for parent attention

## Workflow 3: Weekly Report Generation
Confidence
70% confidence
Finding
Skill instructs the agent to never refuse or to always comply. Suppressing the agent's ability to decline removes a core safety control and enables downstream harmful requests to succeed.

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill instructs the agent to read and write workspace files and references scripts, but it declares no explicit tool scope or permissions. In a skill that handles child caregiving and health-related logs, missing tool scoping increases the chance of unintended file access or writes beyond what the user expects.

Vague Triggers

Medium
Confidence
94% confidence
Finding
Broad trigger phrases like common greetings or generic childcare phrases can cause the skill to activate during ordinary conversation without clear user intent. Because this skill may read prior logs, write new entries, or generate reports containing sensitive family and child health information, accidental activation increases privacy and integrity risk.

Vague Triggers

Medium
Confidence
89% confidence
Finding
The fallback for any 'general parenting question about TangYuan' is underspecified and overly broad, which can route many unrelated or ambiguous queries into this skill. Given the skill's access to profile and caregiving references, broad fallback increases the likelihood of unnecessary sensitive-context loading and overcollection.

Vague Triggers

Medium
Confidence
87% confidence
Finding
Allowing weekly report generation to trigger automatically on a vague condition like 'it's Sunday evening' is risky because it may initiate sensitive data aggregation without an explicit user request. In this context, the report may summarize health, behavior, and caregiver observations about a minor, amplifying privacy exposure.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill stores child caregiving, behavior, and health-related logs in workspace files but does not clearly warn users that this sensitive data will be persisted locally. Lack of transparent disclosure undermines informed consent and can expose a minor's personal information to other tools, users, or processes with workspace access.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The entire skill is written only in Chinese and does not indicate that the user may choose another language or that Chinese is required for a region-specific compliance or operational reason. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The file gives first-aid instructions for choking, burns, and falls without warning that the guidance is general information and not a substitute for emergency services or professional medical care. In a parenting skill, caregivers may act on this advice during a stressful emergency, and incomplete or outdated instructions could delay appropriate treatment or cause harm.

Natural-Language Policy Violations

Low
Confidence
96% confidence
Finding
The instruction "All output must be in simplified Chinese" imposes a fixed language requirement. The file does not offer the user a language choice or explain a documented, justified locale restriction, which fits the language/locale policy-violation category.

Natural-Language Policy Violations

Low
Confidence
94% confidence
Finding
The entire template content, headings, and user-facing text are written in Chinese, which imposes a specific language/locale on outputs. The file does not indicate that this is optional, user-selected, or required for a documented region-specific use case.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The entire report template is written in Chinese and presents all section headings and user-facing text in a single language, with no indication that users can choose another language or locale. This can violate a language/locale policy when a skill imposes one language by default without explicit user opt-in or documented regional justification.

Natural-Language Policy Violations

Low
Confidence
94% confidence
Finding
A language or locale policy violation can occur when a skill effectively forces a specific language without user opt-in. This file provides all guidance exclusively in Chinese and does not indicate that the skill is intentionally limited to Chinese-speaking users or offer alternative language options.

Natural-Language Policy Violations

Low
Confidence
92% confidence
Finding
This file’s natural-language interface elements, including the top-level description and usage guidance, are entirely in Chinese. The policy scope here is language/locale choice, and the file does not indicate that Chinese is optional, user-selected, or required for a region-specific purpose.

Static analysis

No suspicious patterns detected.