Back to skill

Security audit

我要退休

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent China retirement and social-insurance calculator, but its instructions show an unsafe command pattern that could let crafted user input run unintended shell commands in some agent runtimes.

Review this skill before installing if your agent executes markdown command templates through a shell. It should be changed to pass arguments as a subprocess argument array or strictly validate and quote every user-provided value. Also treat its calculations as reference only because the included social-insurance base data is from 2024 and may be outdated.

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
SKILL.md:48
Finding

Unquoted User-Controlled Arguments May Enable Shell Command Injection

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 48–64
Vulnerability Type: Shell command injection through unsafe argument interpolation
Risk Level: Medium

Vulnerable Code

bash
python scripts/calculate_retirement.py <出生日期> <性别> <身份类型> <月工资> <城市> <就业类型> <是否含公积金>

The documented examples use the same unquoted command construction:

bash
python scripts/calculate_retirement.py 1985-06-15 male worker 15000 北京 employee true
python scripts/calculate_retirement.py 1985-06-15 male worker 15000 北京 flexible

Technical Analysis

The Skill directs the agent to construct a shell command using values collected from the user, including textual values such as city, gender, job type, and employment type. These arguments are not quoted, escaped, or explicitly validated before being placed into the command.

The Python script itself does not invoke a shell and does not independently execute injected commands. The exposure arises when an agent or integration follows SKILL.md by interpolating user-provided values into a command string and then submits that string to a shell. Shell metacharacters such as semicolons, command substitutions, pipes, redirections, or logical operators could consequently be interpreted as shell syntax rather than as literal argument content.

Although several parameters are expected to be enums, the Python entry point does not strictly validate all of them. An unknown city is accepted and mapped to default city data, and unknown employment types fall through to employee calculations. This increases the likelihood that crafted textual input can reach command construction without rejection.

Attack Path

  1. An attacker supplies a crafted textual field, such as a city containing shell syntax:
    text
    Beijing; touch /tmp/retirement_skill_injected #
    
  2. The agent inserts the value into the documented command withou ...[truncated 1403 chars]
Remediation
View remediation

Remediation Suggestions

  1. Invoke the calculator through a subprocess argument array rather than a shell command string:

    python
    subprocess.run(
        [
            sys.executable,
            "scripts/calculate_retirement.py",
            birth_date,
            gender,
            job_type,
            str(monthly_salary),
            city,
            employment_type,
            str(include_housing_fund).lower(),
        ],
        shell=False,
        check=True,
    )
    
  2. Explicitly state in SKILL.md that implementations must not use shell=True, os.system, or string-based shell execution with collected values.

  3. Validate every input before execution:

    • Require dates to match YYYY-MM-DD and represent valid calendar dates.
    • Restrict gender to male or female.
    • Restrict job type to worker or cadre.
    • Restrict employment type to employee or flexible.
    • Restrict the housing-fund option to true or false.
    • Require salary to be finite, non-negative, and within a reasonable upper bound.
    • Restrict city to a supported allowlist or pass it only as a literal argument array element.
  4. Add equivalent validation to scripts/calculate_retirement.py so unsafe or unsupported values are rejected even when callers bypass the documented workflow.

  5. If a shell is unavoidably required, apply a proven platform-specific quoting function to every argument. Argument-array execution remains the preferred mitigation.

Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (6)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The example trigger phrases are broad enough to match common retirement and social-insurance questions in general chat, which can cause the platform to invoke this skill more often than intended. In an agent ecosystem, over-broad routing can expose users to incorrect domain-specific calculations, unnecessary collection of personal data such as birth date and salary, or suppression of better-matched skills.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases are broad, generic retirement-planning terms such as asking when one can retire or how much social insurance to pay. This can cause the skill to activate in conversations where the user did not intend a China-specific retirement calculator, leading to incorrect assumptions, unnecessary collection of sensitive personal data, and context confusion.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill is hard-scoped to Chinese users and Chinese retirement/social-insurance rules without an explicit locale gate or up-front limitation check. If invoked for users outside China or for Chinese-speaking users in other jurisdictions, it may provide materially incorrect legal/financial guidance and collect location and employment details under false assumptions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file presents all instructions, policy descriptions, and disclaimers solely in Chinese. Under the natural-language policy rule, forcing a specific language without user opt-in can be a policy violation unless the locale restriction is clearly documented and justified, which is not stated in the file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The README presents the skill entirely in Chinese and all example invocations assume Chinese-language interaction, but it does not explicitly state that the skill is China-specific or that Chinese is an intentional locale constraint. Under the policy, forcing a specific language without opt-in or documented justification can be a natural-language policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This code file contains user-facing natural-language text that assumes Chinese as the only supported language. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale constraint is clearly documented and justified.

Content

No source excerpt is available for this finding.