Back to skill

Security audit

DEX Aggregator Quote

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed OKX quote helper that sends user-provided token quote parameters to OKX but does not execute swaps or persist access.

Install only if you are comfortable giving the skill access to OKX Web3 API credentials and sending quote details to OKX. For precision-sensitive trades, pass raw token amounts or review/fix the Python float handling before relying on quote results for financial decisions, and install dependencies from a trusted package source.

Vulnerability Patterns
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/dex_quote.py:247
Finding
Floating-Point Conversion Can Alter Financial Quote Amounts## Vulnerability Details **File Location**: `scripts/dex_quote.py`, lines 247–260 and line 383 **Vulnerability Type**: Numeric precision loss in financial amount processing **Risk Level**: Medium ### Vulnerable Code ```python @staticmethod def to_raw_amount(human_amount: float, decimals: int) -> str: """Convert human-readable amount to raw amount string. Uses integer math to avoid floating-point precision issues. """ # Handle decimal amounts by splitting on '.' amount_str = f"{human_amount:.{decimals}f}" if "." in amount_str: integer_part, decimal_part = amount_str.split(".") decimal_part = decimal_part[:decimals].ljust(decimals, "0") raw = int(integer_part) * (10 ** decimals) + int(decimal_part) else: raw = int(amount_str) * (10 ** decimals) return str(raw) ``` The command-line interface introduces the same issue: ```python parser.add_argument("--amount", type=float, required=True, help="Human-readable amount") ``` ### Technical Analysis Token amounts require exact fixed-point arithmetic. The CLI parses the user-supplied decimal as an IEEE-754 binary floating-point value, and `to_raw_amount()` also declares and processes the value as a `float`. Many decimal values cannot be represented exactly in binary floating point. Large values and values near token-unit boundaries can therefore be rounded before conversion into raw units. Formatting the already-rounded float does not recover the original user input. This implementation also contradicts the guidance in `SKILL.md`, which explicitly states that Python amount calculations should never use `float()`. The resulting raw amount is included in the authenticated request. Consequently, the API may quote an amount different from the one entered by the user. ### Attack Path 1. A user or calling application supplies a precision-sensitive decimal through `--amount`. 2. `argparse` conver ...[truncated 1048 chars]
Remediation
## Remediation Suggestions - Accept human-readable amounts as strings rather than floats. - Parse them using `decimal.Decimal` with explicit validation. - Reject negative, zero, non-finite, exponential, and over-precision values as appropriate. - Convert to raw units using exact decimal or integer arithmetic. - Change the CLI argument to preserve the original input: ```python parser.add_argument( "--amount", type=str, required=True, help="Human-readable decimal amount", ) ``` - Use an exact conversion implementation, for example: ```python from decimal import Decimal, InvalidOperation @staticmethod def to_raw_amount(human_amount: str, decimals: int) -> str: if not isinstance(decimals, int) or decimals < 0: raise ValueError("decimals must be a non-negative integer") try: value = Decimal(human_amount) except InvalidOperation as exc: raise ValueError("Invalid decimal amount") from exc if not value.is_finite() or value <= 0: raise ValueError("Amount must be finite and greater than zero") scale = Decimal(10) ** decimals scaled = value * scale if scaled != scaled.to_integral_value(): raise ValueError( f"Amount has more than {decimals} decimal places" ) return str(int(scaled)) ``` - Add tests for values such as `0.1`, the smallest supported token unit, values with excessive precision, and large quantities.

T08 · Insecure Dependencies

Note
Location
scripts/dex_quote.py:42
Finding
Third-Party Dependency Is Recommended Without Version or Integrity Pinning## Vulnerability Details **File Location**: `scripts/dex_quote.py`, lines 42–45 **Vulnerability Type**: Unpinned third-party dependency installation **Risk Level**: Low ### Vulnerable Code ```python try: import requests except ImportError: raise ImportError("Please install requests: pip install requests") ``` The project documentation also lists `requests` as a prerequisite without providing a version constraint, lock file, or package hash. ### Technical Analysis The error message instructs users to install the latest version of `requests` available from their configured Python package index. The repository does not provide a pinned requirements file, lock file, or cryptographic hashes for the package and its transitive dependencies. `requests` is a well-known package and there is no evidence that this project intentionally references a malicious or misspelled dependency. Nevertheless, resolving an unconstrained package at installation time makes builds non-reproducible and allows future package or transitive-dependency changes to enter the environment without being reviewed with the Skill. ### Attack Path 1. A user runs the script in an environment where `requests` is absent. 2. The import error directs the user to execute `pip install requests`. 3. The package manager resolves the current package and transitive dependency versions from the user’s configured index. 4. A compromised package release, compromised index, unsafe custom index, or future incompatible release is installed. 5. Installed package code executes in the user’s Python environment when imported or used. Successful exploitation depends on an external supply-chain or package-index compromise; no malicious package source is embedded in the audited project. ### Impact Assessment A compromised dependency would execute with the same operating-system privileges as the Python process. It could potentially access the OKX credential enviro ...[truncated 358 chars]
Remediation
## Remediation Suggestions - Add a reviewed dependency manifest with a compatible, bounded version of `requests`. - For reproducible deployments, provide a lock file containing exact versions of all transitive dependencies. - Use cryptographic hashes with `pip --require-hashes` in security-sensitive environments. - Document installation from the official Python Package Index or a trusted internal mirror. - Automate dependency vulnerability and update review rather than allowing unrestricted upgrades. - Avoid automatically installing missing dependencies at runtime; the current script only emits guidance and should retain that non-automatic behavior.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

Lp3

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding
Without declared permissions the skill's intent is opaque and cannot be validated.

Missing User Warnings

Low
Confidence
82% confidence
Finding
This code sends token addresses, amounts, and authenticated account headers to the OKX web service via an HTTP GET request. Although the module docstring describes the API client generally, there is no user-facing log, print, or inline warning at the point of transmission to make the network disclosure visible during execution.

Static analysis

No suspicious patterns detected.