Back to skill

Security audit

game-negotiation

Security checks for vulnerabilities and agentic risk

Overview

The negotiation engine itself is local and understandable, but it includes a persistent learning module that can store user preferences, notes, usage history, and errors without clear consent or deletion controls.

Review this skill before installing if your negotiations involve private business strategy, pricing, or personal preferences. The calculation script is local and has no observed network behavior, but the learner component can persist notes and preferences locally, so use it only if that storage is acceptable and avoid recording sensitive free-form details.

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

Unbounded Shapley Permutation Computation Enables Denial of Service

Content
View full analysis

Vulnerability Details

File Location: scripts/negotiator.py, lines 42–52; reachable from lines 88–91
Vulnerability Type: Uncontrolled resource consumption
Risk Level: Medium

Vulnerable Code

python
def shapley(players, char_func):
    """char_func(subset frozenset)->实数贡献值。返回每玩家平均边际贡献。"""
    n = len(players)
    vals = {p: 0.0 for p in players}
    for perm in itertools.permutations(players):
        seen = frozenset()
        for i, p in enumerate(perm):
            contrib = char_func(seen | {p}) - char_func(seen)
            vals[p] += contrib
            seen = seen | {p}
    fact = _factorial(n)
    return {p: vals[p] / fact for p in players}

The vulnerable function is directly reachable through user-controlled command-line JSON:

python
elif a.mode == "shapley":
    players = kw["players"]
    cf = lambda s: (kw["char"][",".join(sorted(s))] if s else 0.0)
    print(json.dumps(shapley(players, cf), ensure_ascii=False))

Technical Analysis

The Shapley implementation exhaustively enumerates every permutation of the user-supplied players list. For n players, it processes n! permutations and performs up to n marginal-contribution calculations for each permutation, resulting in approximately O(n × n!) work.

Neither the CLI entry point nor shapley() limits the number of players, enforces a computational budget, or switches to bounded sampling for large inputs. Although SKILL.md warns that complexity is exponential and suggests sampling above approximately 12 players, that limitation is not enforced in code.

An attacker who can control the JSON supplied to the command can therefore provide a sufficiently large player list and matching characteristic-function entries. Enumeration begins lazily but consumes extreme CPU time as the list grows, tying up the process until it is terminated or completes.

Attack Path

  1. The attacker gains the ability to submit input to an integration that invokes `negotiator. ...[truncated 1018 chars]
Remediation
View remediation

Remediation Suggestions

  1. Enforce a conservative maximum player count before permutation enumeration. Reject larger exact-computation requests with a clear error.
  2. Implement an approximate Shapley algorithm based on a bounded number of randomly sampled permutations for larger games.
  3. Place explicit limits on iterations, execution time, input size, and coalition-map size.
  4. Validate that players is a list of unique, bounded-length identifiers and that all required characteristic-function values are finite numeric values.
  5. Expose exact and approximate modes explicitly so callers understand the accuracy and resource tradeoffs.
  6. If the Skill is exposed through a service, add request timeouts, CPU or process quotas, concurrency limits, and rate limiting as defense-in-depth.
  7. Add tests confirming that oversized inputs are rejected or processed through the bounded approximation path.

A minimal guard for exact evaluation could follow this pattern:

python
MAX_EXACT_PLAYERS = 10

def shapley(players, char_func):
    if not isinstance(players, list):
        raise ValueError("players must be a list")
    if len(players) > MAX_EXACT_PLAYERS:
        raise ValueError(
            f"Exact Shapley computation supports at most "
            f"{MAX_EXACT_PLAYERS} players"
        )
    if len(set(players)) != len(players):
        raise ValueError("players must be unique")

    n = len(players)
    vals = {p: 0.0 for p in players}
    for perm in itertools.permutations(players):
        seen = frozenset()
        for p in perm:
            contrib = char_func(seen | {p}) - char_func(seen)
            vals[p] += contrib
            seen = seen | {p}

    fact = _factorial(n)
    return {p: vals[p] / fact for p in players}
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (9)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared purpose is a negotiation/game-theory engine, but the skill also indicates learner behavior that records history, stores user preferences, tracks repeated errors, and writes persistent learning data. This hidden statefulness materially expands the data-handling and privacy surface beyond user expectations, enabling silent retention of behavioral data and cross-session profiling in a skill whose description does not disclose that behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file implements a generic persistent learning/telemetry component that is not necessary for a game-theoretic negotiation engine. Because it is reusable across arbitrary skills and stores cross-session usage data, it expands the skill's data-collection scope beyond its stated purpose and creates an unjustified persistence channel for operational and user data.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

The skill advertises executable behavior including self-evolution and persistence, while declaring no explicit tool scope or permissions. If the runtime permits implicit file access, this creates a least-privilege violation and makes undocumented file writes possible, which can be abused to persist data or alter local state without clear user or platform consent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description and the entire SKILL.md content are written in Chinese, with no indication that users may interact in other languages or opt into this locale. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This file contains user-facing natural-language descriptions, usage instructions, and output strings that force a specific language/locale. The policy requires flagging language or locale constraints when the skill does not explicitly offer the user a language choice or justify the restriction.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code persistently records preferences, notes, recent operations, capabilities used, and error history into learned_patterns.json without any consent, minimization, or retention controls. In a negotiation context, notes and preferences may contain sensitive strategic, business, or personal information, so this creates privacy leakage and unintended data retention risks.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module and function present this as a general '零和 minimax' equilibrium computation, but for m>2 the implementation does not search the simplex: _simplex_point explicitly returns equal weights for all strategies and its comment says it is only for m==2. This means the documented intent of computing a minimax equilibrium is contradicted by the actual code path for higher-dimensional games, which only evaluates a fixed equal-weight strategy rather than a true maximization.

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 all user-facing descriptive text in Chinese, including the skill name, capabilities, and argument help text context, with no indication that users may choose another language. Under the policy, forcing a specific language without opt-in can be a natural-language policy violation unless the locale restriction is justified, which is not stated here.

Content

No source excerpt is available for this finding.