Back to skill

Security audit

Crypto DRT Scalping

Security checks for vulnerabilities and agentic risk

Overview

The skill discloses its paid crypto signal feature, but its script can spend a user API key and can be redirected to non-default endpoints, so it needs review before use.

Install only if you understand that running scripts/signals.py makes a paid external request using X402_API_KEY. Use a limited, revocable API key, avoid setting X402_BASE or X402_ALLOW_HTTP unless you control and trust the endpoint, and do not treat the trading outputs or backtest claims as guaranteed results.

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/x402_client.py:12
Finding

Spending-Capable API Key Can Be Redirected to an Arbitrary or Plaintext Endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/x402_client.py:12-31
Vulnerability Type: Configurable credential exfiltration destination and optional plaintext transport
Risk Level: Medium

Vulnerable Code

python
BASE = os.environ.get("X402_BASE", "https://186.240.156.169:8791")
KEY = os.environ.get("X402_API_KEY", "")
ALLOW_HTTP = os.environ.get("X402_ALLOW_HTTP", "") == "1"


def call(endpoint, params=None, method="GET"):
    if not KEY:
        print("ERROR: Set X402_API_KEY (get it at https://github.com/MohamedAbdisamed/x402-api)")
        sys.exit(1)
    if BASE.startswith("http://") and not ALLOW_HTTP:
        print("ERROR: X402_BASE uses HTTP, but the API key is spending-capable.")
        print("   Use HTTPS (X402_BASE=https://...), or set X402_ALLOW_HTTP=1 consciously.")
        sys.exit(1)
    url = BASE.rstrip("/") + endpoint
    if params:
        url += "?" + urllib.parse.urlencode(params)
    req = urllib.request.Request(url, headers={"x-api-key": KEY})
    try:
        with urllib.request.urlopen(req, timeout=20) as r:
            return json.loads(r.read().decode())

Technical Analysis

The client reads a spending-capable credential from X402_API_KEY and transmits it in the x-api-key request header. Sending this credential to the paid signal service is necessary for the declared premium functionality and is disclosed in both the documentation and script output.

However, the credential destination is controlled by the unrestricted X402_BASE environment variable. No hostname allowlist, endpoint validation, or explicit confirmation is applied before the credential is attached. An additional X402_ALLOW_HTTP=1 setting disables the default plaintext-transport protection.

Consequently, process configuration can redirect the credential to an arbitrary HTTPS server or, when the bypass is enabled, transmit it over unencrypted HTTP. HTTPS to an arbitrary destina ...[truncated 2021 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the unrestricted production override or validate X402_BASE against an explicit allowlist of approved HTTPS origins.
  2. Delete the X402_ALLOW_HTTP bypass and reject all non-HTTPS destinations when transmitting credentials.
  3. Use a stable service hostname with a valid certificate instead of a bare IP address, and document the expected origin.
  4. Parse the URL before use and require an exact approved scheme, hostname, and port. Reject embedded credentials, unexpected ports, fragments, and deceptive hostname suffixes.
  5. Require an interactive confirmation or a separate development-only client before sending a production key to any non-default origin.
  6. Issue narrowly scoped keys with strict per-call, daily spending, and rate limits. Support immediate revocation and rotation.
  7. Avoid following cross-origin redirects while retaining the sensitive header. Explicitly ensure that x-api-key is never forwarded to a redirected host.
  8. Keep the existing paid-call warning, and add documentation stating the exact recipient, data transmitted, charging behavior, key scope, and revocation procedure.
  9. Add automated tests confirming that HTTP URLs, unapproved hosts, malformed URLs, and cross-origin redirects cannot receive the API key.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (12)

Tainted flow: 'req' from os.environ.get (line 32, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/x402_client.py (reported line 34)May include surrounding context.

python
url += "?" + urllib.parse.urlencode(params)
    req = urllib.request.Request(url, headers={"x-api-key": KEY})
    try:
        with urllib.request.urlopen(req, timeout=20) as r:
            return json.loads(r.read().decode())
    except urllib.error.HTTPError as e:
        print(f"ERROR: HTTP {e.code}: {e.read().decode()[:200]}")

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill appears to be a trading-plan document, yet it instructs the agent to use a spending-capable API key for remote authenticated calls to external infrastructure. In this context, undisclosed authenticated network behavior materially increases the risk of unexpected charges, secret exposure to third-party services, and misuse outside the user's intended backtesting workflow.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill appears to be a trading-plan document, yet it instructs the agent to use a spending-capable API key for remote authenticated calls to external infrastructure. In this context, undisclosed authenticated network behavior materially increases the risk of unexpected charges, secret exposure to third-party services, and misuse outside the user's intended backtesting workflow.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
93% confidence
Finding

The code is designed to send a spending-capable API key to an external service, yet the skill description only covers scalping/backtesting behavior and does not justify payment-enabled external calls. In this context, the hidden billing capability materially increases risk: a user running the skill could incur charges or leak a valuable credential without understanding that such payment infrastructure exists.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill requests sensitive capabilities via metadata (network access and X402_API_KEY) but does not declare an explicit tool/permission scope for users or platforms to review. This reduces transparency and can lead to unintended external calls or secret use, especially since the skill also advertises paid API usage.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The skill promotes paid live trading signals and an on-chain payment flow with only limited caution, despite encouraging use of actionable LONG/SHORT entries, stops, and targets. In a financial-trading context, insufficient risk warning around paid real-time signals can facilitate harmful decision-making and unexpected monetary loss, making the context more sensitive than ordinary documentation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script performs a live paid network call that consumes funds and transmits an API key, while the skill metadata emphasizes backtesting/scalping context rather than an explicitly billable live-fetch operation. This mismatch can mislead users or automation into executing a cost-incurring external action they did not reasonably expect, creating financial loss and credential-exposure risk.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script invokes an external paid API capability not clearly justified by the stated manifest scope, which increases the chance that users or orchestration systems will authorize network and payment actions without informed consent. Because the call sends an API key and charges the caller, the gap between declared scope and actual capability is security-relevant even if the endpoint itself is legitimate.

Content

No source excerpt is available for this finding.

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/signals.py (reported line 8)May include surrounding context.

python
your API key to the API. Run only when you consciously want live signals.
"""
import sys, json
sys.path.insert(0, __import__('os').path.dirname(__file__))
from x402_client import call

print("⚠️ Executing PAID x402 call (/v1/signals) — charged to your key.")

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file implements a generic pay-per-call network client, which is unrelated to the stated crypto scalping/backtesting skill purpose. That mismatch is dangerous because it introduces hidden external connectivity and monetized API behavior users would not reasonably expect from a trading strategy skill, increasing the chance of undisclosed data exfiltration or unauthorized charges.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The manifest description says the skill covers 12 crypto pairs, but the in-file documentation later claims backtest totals for 18 pairs and lists additional instruments such as ATOM, LTC, DOT, and OP. This is an active contradiction in the skill's own documentation about what universe the strategy applies to, which can mislead users about the actual intended scope.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The daily routine says to scan all 7 pairs on 1h, but the manifest says 12 crypto pairs and other sections discuss 12 or even 18 pairs. This is not merely incomplete documentation; it gives conflicting operational instructions about the strategy's actual coverage.

Content

No source excerpt is available for this finding.