Back to skill

Security audit

HPM Solver

Security checks for vulnerabilities and agentic risk

Overview

This is a game-specific HPM purchase calculator with local price/history storage; I found reliability and disclosure issues, but no evidence of malicious behavior.

Before installing, confirm you want a Chinese-language HPM game calculator that keeps local price settings, recent solve parameters, and solve history. Treat the external tar.gz link in SKILL.md as unreviewed unless separately checked, and avoid exposing the standalone solver to untrusted inputs until numeric validation and search limits are tightened.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/solver.py:343
Finding

Zero computed prices cause unhandled division-by-zero failures in the Python solver

Content
View full analysis
Remediation
View remediation
float: if not math.isfinite(value) or value <= 0: raise ValueError(f"{name} must be a finite positive number") return value ``` 2. Validate every computed price at the solver boundary: ```python actual_price = round(base_price * multiplier) if actual_price <= 0: raise ValueError( f"Computed price for {name!r} must be greater than zero" ) ``` 3. Validate loaded base-price data. Require positive integers and reject booleans, floats, negative values, and zero. 4. Add defensive checks before all modulo and division operations: ```python if low_group.actual_price <= 0: continue ``` 5. Apply reasonable upper and lower bounds to targets and multipliers. 6. Catch validation errors in the command handler and return a controlled error message instead of a traceback. 7. Add regression tests for zero, negative, very small, `NaN`, and infinite multipliers. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/solver.js:273
Finding

Unbounded exhaustive search can cause severe JavaScript resource exhaustion

Content
View full analysis
= ratio && lowGroup.maxValue >= target) { filterTable.push({ highPriceGroup: group, lowPriceGroup: lowGroup, ratio: ratio }) canFilter = true break } } ``` ```javascript // scripts/solver.js:252-254 var maxQuantities = filtered.kept.map(function(g) { return Math.min(Math.floor(target / g.actualPrice), g.getMaxQuantity()) }) ``` ```javascript // scripts/solver.js:273-295 function iterate(index, currentCost, currentGroups) { if (currentCost > target) return null if (index === sortedData.length) { var residual = target - currentCost if (residual >= 0 && residual < minPrice) { var solution = new Solution(currentGroups.slice(), currentCost, residual) if (solution.isPerfect) return solution if (!bestSolution || residual < bestSolution.residual) bestSolution = solution } return null } var data = sortedData[index] var effectiveMaxQty = Math.min( data.maxQty, Math.floor((target - currentCost) / data.group.actualPrice) ) for (var q = effectiveMaxQty; q >= 0; q--) { var cost = currentCost + q * data.group.actualPrice if (cost > target) continue if (q > 0) currentGroups.push({ group: data.group, quantity: q }) var result = iterate(index + 1, cost, currentGroups) if (result && result.isPerfect) return result if (q > 0) currentGroups.pop() } return null } ``` ### Technical Analysis ...[truncated 2296 chars]
Remediation
View remediation
MAX_COMBINATIONS) { throw new RangeError('Search space exceeds the configured limit') } } ``` 4. Add an iteration budget and elapsed-time deadline inside `iterate()`. 5. For server-side use, execute expensive searches in a worker thread or isolated subprocess with memory and CPU limits. 6. Replace exhaustive enumeration with a bounded dynamic-programming, branch-and-bound, or integer-programming strategy. 7. Add cancellation support so callers can terminate stale searches. 8. Add tests demonstrating bounded behavior for maximum group counts, unreachable targets, zero prices, and adversarial multipliers. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
miniprogram/pages/price/price.js:101
Finding

Mini Program persists invalid edited prices and accepts unsafe solver parameters

Content
View full analysis
{ if (item.name === name) { return { ...item, price: newPrice }; } return item; }); this.setData({ itemList }); // Zero or otherwise invalid edited prices are persisted here. this.savePriceToGlobal(name, newPrice); console.log('[Price] onPriceBlur 完成'); } ``` ```javascript // miniprogram/pages/index/index.js:97-100 const targetGold = parseInt(this.data.targetGold) || 0; const targetDiamond = parseInt(this.data.targetDiamond) || 0; const multiplierP = parseFloat(this.data.multiplierP) || 1.0; const multiplierQ = parseFloat(this.data.multiplierQ) || 1.0; ``` ```javascript // miniprogram/utils/solver.js:345-361 function buildItems(basePrices, category, currency, multiplier = 1.0, maxqtyMap = {}) { console.log('[Solver] buildItems 开始, category=', category, 'currency=', currency, 'multiplier=', multiplier); const items = []; const priceData = basePrices[category]?.[currency] || {}; for (const name in priceData) { const basePrice = priceData[name]; const actualPrice = Math.round(basePrice * multiplier); const maxqty = maxqtyMap[name] || 99; items.push({ name, price: actualPrice, basePrice, currency, category, maxqty }); } return items; } ``` ```javascript // miniprogram/utils/solver.js:224 const maxQuantities = miniPriceCell.map( g => Math.min(Math.floor(target / g ...[truncated 2227 chars]
Remediation
View remediation
Vulnerability Patterns
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (23)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared description emphasizes a computational solver for HPM trading/purchase combinations using linear-equation enumeration and several optimization/restoration features. The supplied code instead handles app startup, local caching of base prices, default dataset initialization, and persistence of solve history via WeChat storage APIs. These behaviors are related to the broader app domain, but they do not match the declared primary purpose of solving combinations. Since the chunk lacks any solving, filtering, equation-processing, or equivalent-item logic, the description does not accurately represent what this specific code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description is for the core HPM solver functionality, but the supplied code chunk does not perform equation solving, purchase-combination enumeration, equivalent-item merging, smart filtering, or replacement restoration. Instead, it is a UI/history-management page supporting the solver workflow. While this may be part of the same application, the chunk’s primary behavior is materially different from the declared purpose of being a solver.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description centers on a mathematical solver for HPM trading/purchase combinations using systems of linear equations and related optimization features. The supplied code does not implement any solving logic, equation processing, coefficient models, equivalence merging, filtering, or solution restoration. Instead, it is a price-maintenance page that loads price tables, sorts them, allows users to modify prices, add/delete items, switch categories/currencies, and restore defaults. This is a materially different primary purpose, so the description does not accurately represent the code.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

声明描述的是一个面向 HPM 交易/购买组合计算的求解器,预期应包含数值建模、组合搜索、方程求解或结果过滤等逻辑。但本代码片段仅实现前端数据排序与展示辅助:依据名称后缀识别颜色类型,按价格排序,并将同基础名的“蓝/紫”变体插入基础物品后。虽然这种排序可能是整个应用的配套工具,但就该代码片段本身而言,其实际行为与声明的核心能力明显不一致,且主目的不同。因此应判定为描述与代码行为不匹配。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The trigger list includes broad generic phrases such as '购买组合', '残值计算', 'hpm工具', and 'hpm计算器', which can cause the skill to activate for unrelated conversations. Over-broad invocation increases the chance of unintended handling of user input, confusing routing, and accidental access to data or actions in the wrong context.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The documented trigger conditions are ambiguous and insufficiently constrained, making accidental invocation likely when users ask for generic calculation, pricing, or history-related help. In agent systems, poor trigger specificity can become a security and safety issue because the wrong skill may process requests outside its intended domain.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest describes an HPM transaction solver/calculator focused on equation-based purchase-combination solving and residual-value calculation. This page implements editing and persistence of base price configuration data via global state and app.saveBasePrices, which is a data-management capability rather than solving logic itself.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest emphasizes solving purchase combinations and related calculations, but this file allows destructive deletion of items and full restoration of default prices. Those are administrative dataset-maintenance behaviors that materially exceed a narrow 'solver/calculator' description.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This Python skill hardcodes user-facing CLI descriptions, help text, natural-language parsing keywords, and output formatting in Chinese only. Users are not offered any language or locale selection, so the skill imposes a specific language by default, which matches the policy-violation criterion for locale/language constraints.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This is a code file, so SQP-3 applies to natural-language content embedded in docstrings, comments, and printed strings. The script consistently hard-codes Chinese-only descriptions and output messages throughout, with no indication that users can select another language or that the locale restriction is intentionally justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This JSON data file uses Chinese-language item names throughout, but there is no accompanying indication in the file that the locale is intentional, configurable, or limited to a region-specific use case. Under the policy rule, forcing a specific language without user opt-in or documented justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

This manifest-style data file contains natural-language values exclusively in Chinese, beginning with item names such as at L010 and continuing throughout the records. Because SQP-3 applies to all file types and flags language/locale constraints without user opt-in or documented justification, this appears to impose a specific language locale implicitly.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The JSON data uses Chinese item names throughout the pricing template, which imposes a specific language representation in the skill artifact. There is no indication in this file that alternative locales are supported or that the Chinese-only format is a justified region-specific requirement.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The JSON contains the string "南瓜汁" as a config key, which implies a fixed language choice in the skill's natural-language surface. Because this file does not document any user opt-in, language selection, or region-specific justification, it may violate the policy against forcing a specific language or locale.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

This JavaScript file contains multiple natural-language log strings exclusively in Chinese, such as the startup and storage-operation messages. Under the policy rule for language/locale, forcing a single language without user opt-in or a documented region-specific justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The page logs raw user-supplied values for gold, diamond, and multiplier inputs to the console during input handling and solving. While these fields are not highly sensitive in this app’s context, console logs can expose user activity and persisted parameters to developers, debuggers, shared devices, or third-party logging pipelines if logs are collected in production.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

This JavaScript file uses Chinese-only natural-language comments and user-visible console log messages throughout, such as solver status output and operational messages. Under the policy, forcing a specific language without offering a language choice or documenting a justified locale constraint is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill creates and maintains persistent local files for base prices, cache, and history under a data directory, which goes beyond a pure in-memory solver and is not evident from the stated functionality. While the stored data is not highly sensitive by itself, undisclosed persistence increases privacy and data-retention risk because user activity and configuration can remain on disk without explicit consent.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

Every solve operation automatically writes a history record containing timestamps, user-supplied targets, coefficients, and solution details to disk. Automatic query logging without explicit notice or consent is a privacy issue because it creates an audit trail of user behavior beyond what is necessary to return a result.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

This .py file contains natural-language comments, docstrings, and all user-facing console output in Chinese, and there is no indication that the tool is intentionally limited to a Chinese-speaking audience or that users can select another language. That can violate language/locale policy when a skill forces a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

This Python file contains its module docstring, comments, debug logs, and result output entirely in Chinese, which imposes a specific language on users. Under the policy rule, locale or language constraints should either provide user opt-in/choice or be explicitly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file’s docstrings and all user-facing console output are written in Chinese, and the script does not provide any option for the user to select another language. This is a natural-language locale constraint that applies to all users by default rather than being explicitly opt-in or justified as region-specific.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.