Back to skill

Security audit

Aionmarket Sdk Divergence Trader

Security checks for vulnerabilities and agentic risk

Overview

This trading skill is mostly coherent, but it asks agents to perform sensitive live-trading, wallet-approval, and credential-custody actions with unclear consent boundaries.

Review this before installing, especially if you plan to provide wallet private keys or enable live trading. Use only test funds or a tightly limited account unless the skill is revised to require explicit confirmation for every trade, allowance, credential registration, cancellation, and redemption, and to pin the exact trading SDK dependencies.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:103
Finding

Reusable Exchange Credentials Are Logged and Transmitted to a Third-Party Service

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 103-123
Vulnerability Type: Sensitive credential disclosure and unnecessary remote credential custody
Risk Level: High

Vulnerable Code

python
    key=private_key,
    chain_id=137,
)
creds = polymarket.create_or_derive_api_creds()
wallet = polymarket.get_address()

print(f"Wallet: {wallet}")
print(f"CLOB API Key: {creds.api_key}")

# 2. Register with AION Market
check = client.check_wallet_credentials(wallet)
if not check["hasCredentials"]:
    client.register_wallet_credentials(
        wallet_address=wallet,
        api_key=creds.api_key,
        api_secret=creds.api_secret,
        api_passphrase=creds.api_passphrase,
    )
    print(f"Wallet credentials registered for {wallet}")
else:
    print(f"Wallet {wallet} already configured.")

Technical Analysis

The documented workflow derives reusable Polymarket CLOB credentials from a wallet private key and then handles them in two unsafe ways:

  1. It prints the CLOB API key to standard output, where it may be retained in terminal history, CI logs, managed-agent logs, monitoring systems, or support diagnostics.
  2. It sends the API key, API secret, and API passphrase to AION through register_wallet_credentials().

Although remote credential registration may facilitate delegated trading, retaining reusable exchange credentials is broader than the minimum privilege required to evaluate a divergence signal or submit an individually signed order. A least-privilege design would keep the private key and derived credentials local and transmit only a narrowly scoped, locally signed order.

The documentation states that registered credentials are stored encrypted, but the project does not provide implementation evidence for encryption at rest, key management, retention, deletion, endpoint identity, certificate pinning, or credential-access controls. The project also does not ...[truncated 1654 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove all output statements that print API keys, secrets, passphrases, private keys, signed transactions, or authorization headers.
  2. Keep wallet private keys and derived exchange credentials local to the wallet boundary.
  3. Prefer locally signing each narrowly scoped order and transmitting only the signed order required for that transaction.
  4. If remote credential custody is operationally unavoidable:
    • Obtain explicit, informed operator consent before registration.
    • Clearly identify the receiving service and explain the credential permissions.
    • Use revocable, least-privilege, short-lived credentials where supported.
    • Verify TLS and service identity and prevent credentials from entering request logs.
    • Encrypt credentials at rest with a dedicated key-management service.
    • Restrict decryption to the smallest possible execution component.
    • Define retention, deletion, rotation, incident-response, and audit procedures.
  5. Redact secrets from exceptions and structured SDK responses before printing them.
  6. Document a credential revocation procedure and rotate any credentials previously disclosed through logs.

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:194
Finding

On-Chain Token Allowances May Be Automatically Granted Without User Confirmation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 194-199
Vulnerability Type: Excessive wallet authorization and automatic privileged transaction execution
Risk Level: High

Vulnerable Instruction

text
- wallet credentials are already registered, otherwise register them
- collateral balance is sufficient for the intended spend
- Polygon gas balance is sufficient if an onchain approval may be needed
- the required spender allowance already exists for the intended order

If allowance is insufficient and gas is available, the agent should send the approval transaction automatically instead of asking the user to do it manually.

Technical Analysis

An ERC-20 allowance authorizes a spender contract to transfer tokens from a wallet up to the approved amount. Granting or increasing an allowance is therefore a security-sensitive privilege change rather than a routine read-only readiness check.

The Skill explicitly instructs the agent to send an approval transaction without asking the user. It does not define or validate:

  • The permitted blockchain and chain ID.
  • The exact collateral token contract.
  • An allowlisted spender contract address.
  • The maximum approval amount.
  • Whether unlimited approvals are prohibited.
  • An expiration or revocation policy.
  • A requirement to compare the approval with the intended trade amount.
  • A confirmation step showing the transaction destination and decoded parameters.

This authority exceeds what is necessary to calculate probability divergence. Even for live trading, an exact-amount approval to a verified exchange contract is sufficient; an unchecked or unlimited allowance is not required.

Attack Path

  1. The agent prepares a live trade and determines that the current token allowance is insufficient.
  2. Market metadata, SDK configuration, dependency behavior, or a compromised remote response supplies an incorrect spender, token, chain, or ...[truncated 1090 chars]
Remediation
View remediation

Remediation Suggestions

  1. Require explicit operator confirmation before every new allowance or allowance increase.
  2. Decode and display the chain ID, token address, spender address, current allowance, proposed allowance, and estimated gas before signing.
  3. Maintain hardcoded or cryptographically verified allowlists for supported chain, token, and spender combinations.
  4. Approve only the exact amount needed for the pending trade, with a small documented tolerance only if technically necessary.
  5. Explicitly prohibit unlimited approvals by default.
  6. Re-read on-chain contract data immediately before signing instead of trusting only remote API metadata.
  7. Abort if the chain, token, spender, or amount differs from the verified trade plan.
  8. Offer automatic post-trade allowance reduction or revocation, but require confirmation if that action also incurs an on-chain transaction.
  9. Keep approval logic separate from market-analysis logic and cover it with tests for malicious spender addresses, chain mismatches, decimal errors, and excessive amounts.

T08 · Insecure Dependencies

Warning
Location
clawhub.json:4
Finding

Security-Critical Dependencies Are Unpinned and Inconsistently Named

Content
View full analysis

Vulnerability Details

File Location: clawhub.json, lines 4-6; additionally documented in SKILL.md, line 469
Vulnerability Type: Unpinned dependencies and package identity inconsistency
Risk Level: Medium

Vulnerable Configuration

json
"requires": {
  "pip": ["aion-sdk", "python-dotenv"],
  "env": ["AION_API_KEY"]
},

The installation checklist separately uses a different AION package name:

text
- [ ] `pip install aionmarket-sdk py-clob-client python-dotenv` installed

Technical Analysis

All Python dependencies are specified without exact versions or package hashes. Consequently, installation resolves whatever release is current at installation time rather than a reviewed and reproducible dependency set.

There is also an identity mismatch between the package metadata and documentation:

  • clawhub.json installs aion-sdk.
  • SKILL.md instructs users to install aionmarket-sdk.
  • The executable imports AionClient from aion_sdk.

This inconsistency can cause operators or automated installers to select an unintended package. No evidence establishes that either named package is itself malicious; the vulnerability is the unresolved package identity and mutable dependency selection.

The affected dependencies are security-critical because the AION client receives an API key and performs remote trading operations. A malicious or compromised dependency could access environment variables during import, alter market context, modify order parameters, or initiate unauthorized API requests.

Attack Path

  1. An operator or managed installation process installs dependencies using the unversioned package names.
  2. The installer resolves a future, compromised, dependency-confusion, or otherwise unintended release from the configured package index.
  3. Package code executes during installation or when divergence_trader.py imports it.
  4. The dependency reads `AION_API_KEY ...[truncated 911 chars]
Remediation
View remediation

Remediation Suggestions

  1. Determine the authoritative AION SDK distribution and use the same verified package name in metadata, documentation, imports, and lock files.
  2. Pin all dependencies and transitive dependencies to reviewed versions.
  3. Use hash-locked installation, such as a requirements file generated with hashes and installed using pip --require-hashes.
  4. Record the expected publisher, project URL, source repository, and package-index origin for security-critical packages.
  5. Use an approved private mirror or explicitly configured trusted package index rather than relying on ambiguous resolver configuration.
  6. Generate and commit a reproducible lock file and update it only through a reviewed dependency-update process.
  7. Run dependency vulnerability, provenance, and typosquatting checks before release.
  8. Test installation in an isolated environment and verify that the installed distribution and imported module match the expected package.
  9. Avoid exposing production API keys or wallet secrets during dependency installation and import-time validation.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • 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
Findings (12)

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The document first promises dry-run-by-default behavior, then later states a default execution policy that prefers market-mode execution and does not block on extra confirmation. This contradiction can mislead operators into believing the skill is non-executing when it may in practice place live trades, creating direct financial loss risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The instruction to automatically send approval transactions enables live financial commitments without a clear user-facing warning or confirmation checkpoint. Token approvals can grant spending rights that outlast a single trade, so silently automating them materially increases exposure beyond the immediate order.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The default policy explicitly allows placing trades without extra confirmation, while presenting itself as general-purpose execution guidance. In a real-money trading context, bypassing a final confirmation step can directly cause unintended market orders and irreversible financial loss, especially when combined with autonomous signal generation.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · divergence_trader.py (reported line 22)May include surrounding context.

python
SKILL_SLUG = "aionmarket-trading"
TRADE_SOURCE = f"sdk:{SKILL_SLUG}"
ENV_PATH = Path(__file__).with_name(".env")


def load_env() -> None:

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill declares no explicit tool or permission scope even though it clearly relies on sensitive capabilities such as environment-secret access for API keys and wallet credentials. In an agent ecosystem, missing scope declarations can cause the runtime or operator to underestimate what the skill can access, reducing containment and review effectiveness.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest frames the skill as a divergence-trading template, but the body expands into wallet bootstrap, credential registration, and account/risk-setting administration. This scope expansion increases the blast radius: a user expecting a narrow execution wrapper may unknowingly enable account changes and credential operations.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Automatically registering wallet credentials and sending token-allowance approvals are privileged actions that can materially change account state and enable downstream spending. For a strategy template, bundling these actions into the default flow creates an unnecessary path to broader fund access if the skill is misused or triggered unexpectedly.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill is described as a single-market divergence trader, yet it also documents market scanning, briefing loops, open-order inspection, cancellation, and redemption workflows. These extra lifecycle and portfolio-management behaviors broaden operational authority beyond the advertised purpose and make unintended or autonomous actions more likely.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

Documenting cancel-all-orders functionality without an accompanying warning normalizes a destructive account-wide action that can materially alter trading state and strategy outcomes. If invoked accidentally or by an over-permissioned agent, it could remove risk controls or active hedges and lead to losses.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
88% confidence
Finding

The checklist explicitly endorses auto-approving missing allowance and running automated readiness checks as part of the trading flow, signaling autonomous financial decision-making beyond simple user-directed execution. In a skill that can access wallet credentials and place orders, this increases the chance of unintended fund exposure or unattended account changes.

Content

Scanner excerpt · SKILL.md (reported line 475)May include surrounding context.

md
- [ ] `get_me()` returns valid agent info
- [ ] Polymarket CLOB credentials derived from private key and registered via `register_wallet_credentials()`
- [ ] automatic balance, gas/fees, and allowance checks are part of the trading flow
- [ ] missing allowance is auto-approved when technically possible
- [ ] Risk limits configured via `update_settings()`
- [ ] Heartbeat loop (`get_briefing()`) running or planned
- [ ] Error handling wraps every SDK call with `ApiError`

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest clearly indicates automated execution on a 15-minute cron schedule and use of an API credential for live market interaction, but it does not provide any user-facing warning or consent cue about external trading activity. In a trading skill, this is especially sensitive because users may unknowingly enable recurring actions that can place live trades and incur financial loss if the companion script honors the provided credentials.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest describes a skill for trading based on probability divergence, with optional live execution through AION. The code also performs a separate auto_redeem account operation after trading, which is not mentioned in the stated purpose and is not an obvious requirement for making a divergence-based trade.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.exposed_secret_literal

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
SKILL.md:118