Back to skill

Security audit

资产配置师

Security checks for vulnerabilities and agentic risk

Overview

The skill is not malware, but it should be reviewed because it gives actionable investment plans and its calculator can recommend allocating more money than the user has.

Install only if you want educational asset-allocation examples. Do not directly follow its fund names, percentages, automatic-investing suggestions, or rebalancing instructions without independently checking the math and considering taxes, fees, jurisdiction, liquidity needs, loss tolerance, and advice from a qualified financial professional.

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/allocation-calculator.py:42
Finding

Asset Allocation Calculator Produces a 110% Allocation

Content
View full analysis

Vulnerability Details

File Location: scripts/allocation-calculator.py, lines 42-96
Vulnerability Type: Financial calculation integrity error
Risk Level: Medium

Vulnerable Code

python
# Final stock ratio
stock_ratio = max(20, min(90, base_stock_ratio + adjustment))

# Bond ratio
bond_ratio = 100 - stock_ratio

# Stock subdivisions
domestic_stock_ratio = stock_ratio * 0.6
international_stock_ratio = stock_ratio * 0.4

# Bond subdivisions
government_bond_ratio = bond_ratio * 0.6
corporate_bond_ratio = bond_ratio * 0.4

# Calculate amounts
allocation = {
    'stocks': {
        'total': {
            'ratio': stock_ratio,
            'amount': total_assets * stock_ratio / 100
        },
        'domestic': {
            'ratio': domestic_stock_ratio,
            'amount': total_assets * domestic_stock_ratio / 100,
            'recommendation': '沪深 300ETF'
        },
        'international': {
            'ratio': international_stock_ratio,
            'amount': total_assets * international_stock_ratio / 100,
            'recommendation': '标普 500ETF'
        }
    },
    'bonds': {
        'total': {
            'ratio': bond_ratio,
            'amount': total_assets * bond_ratio / 100
        },
        'government': {
            'ratio': government_bond_ratio,
            'amount': total_assets * government_bond_ratio / 100,
            'recommendation': '国债 ETF'
        },
        'corporate': {
            'ratio': corporate_bond_ratio,
            'amount': total_assets * corporate_bond_ratio / 100,
            'recommendation': '信用债基金'
        }
    },
    'cash': {
        'ratio': 5,
        'amount': total_assets * 0.05,
        'recommendation': '货币基金'
    },
    'alternatives': {
        'ratio': 5,
        'amount': total_assets * 0.05,
        'recommendation': '黄金 ETF/REITs'
    }
}

Technical Ana

...[truncated 2804 chars]

Remediation
View remediation

Remediation Suggestions

Reserve cash and alternative allocations before calculating the bond allocation:

python
cash_ratio = 5
alternatives_ratio = 5
bond_ratio = 100 - stock_ratio - cash_ratio - alternatives_ratio

Use these variables consistently when calculating monetary amounts:

python
cash_amount = total_assets * cash_ratio / 100
alternatives_amount = total_assets * alternatives_ratio / 100

Add explicit invariant checks before returning or displaying the result:

python
total_ratio = stock_ratio + bond_ratio + cash_ratio + alternatives_ratio
if abs(total_ratio - 100.0) > 1e-9:
    raise ValueError(f"Allocation ratios must total 100%, got {total_ratio}%")

total_amount = (
    total_assets * stock_ratio / 100
    + total_assets * bond_ratio / 100
    + cash_amount
    + alternatives_amount
)
if abs(total_amount - total_assets) > 0.01:
    raise ValueError("Allocation amounts exceed or fall short of total assets")

Additional hardening should include:

  • Validate that total_assets is finite and greater than zero.
  • Validate age against a documented realistic range.
  • Add unit tests covering all risk profiles and boundary ages.
  • Assert that stock subdivisions equal the total stock allocation.
  • Assert that bond subdivisions equal the total bond allocation.
  • Assert that all top-level ratios are nonnegative and total exactly 100%.
  • Add regression tests using the examples documented in README.md and SKILL.md.
  • Prevent JSON output from being emitted when allocation invariants fail.
Vulnerability Patterns
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (16)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The README presents concrete asset-allocation logic and output categories as actionable guidance without a clear disclaimer that this is general educational content rather than personalized investment advice. Users may over-rely on simplified formulas such as '100 minus age' and implied product suggestions without understanding suitability, loss risk, liquidity needs, or jurisdiction-specific constraints.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The example output gives specific percentage allocations, monetary amounts, ETFs, and rebalancing instructions in a way that can be interpreted as direct recommendations for a real user's assets. In a financial-planning skill, this is risky because readers may treat illustrative examples as suitable advice despite missing warnings about principal loss, market volatility, concentration, fees, tax treatment, and user-specific suitability factors.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger description is broad enough to activate for general asset-allocation or lifecycle-planning requests without clearly scoping the skill to educational, non-execution use. In an investment context, ambiguous routing can cause the agent to provide specific financial guidance in situations requiring suitability checks, jurisdictional disclaimers, or human review.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill provides concrete fund recommendations, percentage allocations, and buy/sell style rebalancing instructions without strong suitability, verification, or execution-risk warnings adjacent to those instructions. Because this is financial advice-like content, users may act on the recommendations directly despite tax, liquidity, concentration, product-availability, and jurisdiction-specific risks.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The recurring-investment guidance encourages fixed-time, fixed-amount investing and mentions automatic deductions without clearly warning about linked-account execution, cash-flow constraints, or losses from continuing purchases during adverse conditions. In practice, users may enable automated transfers they do not fully understand, creating real financial consequences and reduced ability to reassess suitability over time.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The file is entirely in Chinese and does not provide a language choice or document a justified locale restriction, which can prevent non-Chinese-speaking users or reviewers from understanding investment guidance and associated warnings. In a financial-planning skill, this increases the risk of misuse, misunderstanding, and reduced safety review coverage because users may act on recommendations they cannot fully validate.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file contains user-facing guidance exclusively in Chinese, and there is no indication that the skill offers language opt-in or that it is intentionally limited to a Chinese-speaking or region-specific context. Under the policy rule, forcing a specific language without user choice is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file gives specific asset-allocation formulas, named fund recommendations, rebalance rules, and dollar-cost averaging instructions in a way that reads like actionable financial advice rather than a clearly labeled educational example. In a skill explicitly meant for users asking how to allocate assets, the lack of prominent warnings, suitability constraints, and personalization limits increases the chance that users follow inappropriate recommendations and suffer financial harm.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This example provides concrete asset allocations, named funds, contribution amounts, glide-path guidance, and return expectations without a clear user-facing disclaimer that it is illustrative only and not personalized financial advice. In a financial-planning skill, users may reasonably treat this as actionable advice despite the fact that suitability depends on jurisdiction, tax status, liabilities, liquidity needs, and many other personal factors not captured here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains user-facing docstrings, help text, and output strings entirely in Chinese, which effectively forces a specific language for all users. Under the policy, locale or language constraints should either be optional for the user or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The template gives concrete asset-allocation formulas and specific fund-recommendation structure without any disclaimer that the output is general educational information rather than personalized financial advice. Because the skill is explicitly intended for users asking how to allocate assets, users may reasonably rely on it for real investment decisions despite missing suitability, licensing, jurisdiction, tax, and loss-risk caveats.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The rebalancing and fixed-investment sections provide actionable trading instructions such as annual rebalancing, threshold-based adjustments, and a 'do not stop-loss' rule, but omit any warning about market volatility, drawdowns, liquidity needs, or the possibility of sustained losses. This can encourage users to follow rigid trading behavior that may be unsuitable for their circumstances and amplify harm during adverse market conditions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
72% confidence
Finding

The entire skill, including description, inputs, outputs, and examples, is written only in Chinese with no indication that users may choose another language. Under the stated policy, forcing a specific language without opt-in can be a natural-language policy issue unless the locale restriction is explicitly justified.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The example input uses an investment_goal value that does not match the declared enum, creating an inconsistent contract between documentation and implementation. In a financial-planning skill, this can cause downstream validation failures, silent fallback behavior, or user confusion that leads to incorrect planning outputs.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The content forces a specific language experience by presenting all instructions and recommendations solely in Chinese, with no opt-in, fallback, or stated locale restriction. Under SQP-3, language or locale policy violations should be flagged when a skill imposes a language without user choice or clear justification.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The top-level documentation states the output is 'JSON 格式的配置方案', which implies JSON is the normal behavior. However, the implementation prints human-readable formatted text by default and only returns JSON when the optional --json flag is supplied. This is a documentation-to-code contradiction, not just an omission.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.