Back to skill

Security audit

Moltmarkets Trader

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent MoltMarkets trading assistant, but it can perform live account actions and contains unsafe script argument handling that should be reviewed before use.

Review this before installing if the agent has access to your MoltMarkets key. Treat every betting, market-creation, and resolution script as a live action, not a simulation. The create-market-with-odds.sh argument handling should be fixed before use, and live writes should require explicit confirmation, clear spending limits, and preferably a dry-run mode.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/create-market-with-odds.sh:35
Finding
Arbitrary Python Code Execution Through estimated_prob Argument<![CDATA[ ## Vulnerability Details **File Location**: `scripts/create-market-with-odds.sh`, lines 35–39 **Vulnerability Type**: Python source-code injection **Risk Level**: High ### Vulnerable Code ```bash # Validate estimated_prob if ! python3 -c " p = float('$EST_PROB') assert 0.01 <= p <= 0.99, f'estimated_prob must be 0.01-0.99, got {p}' " 2>/dev/null; then echo "Error: estimated_prob must be between 0.01 and 0.99 (got: $EST_PROB)" exit 1 fi ``` ### Technical Analysis The attacker-controlled `EST_PROB` shell argument is interpolated directly into source code supplied to `python3 -c`. Shell quoting does not make this safe because the resulting value becomes part of the Python program rather than data passed to that program. An argument containing a closing quote and additional Python statements can terminate the intended `float()` expression and inject arbitrary Python code. The injected statement executes while validation is being performed. It can execute even if the subsequent assertion fails and the script exits. This violates the code/data separation required for safe interpreter invocation. Numeric validation occurs only after the untrusted value has already been interpreted as executable Python. ### Attack Path 1. An attacker influences the fourth argument passed to `create-market-with-odds.sh`. 2. The argument is constructed to close the single-quoted Python string and append a Python statement. 3. Bash substitutes the crafted value into the multiline `python3 -c` program. 4. Python parses the attacker-supplied content as source code. 5. The injected code executes with the permissions of the user running the Skill. 6. The code can read `~/secrets/moltmarkets-api-key`, modify user-accessible files, launch subprocesses, or make authenticated API requests. ### Impact Assessment Successful exploitation provides arbitrary code execution under the invoking user's account. The resulting process can access all files and services available to tha ...[truncated 420 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Pass the value as data through `sys.argv` instead of interpolating it into Python source: ```bash if ! python3 -c ' import sys try: probability = float(sys.argv[1]) except ValueError: raise SystemExit(1) if not 0.01 <= probability <= 0.99: raise SystemExit(1) ' "$EST_PROB"; then printf 'Error: estimated_prob must be between 0.01 and 0.99 (got: %s)\n' "$EST_PROB" >&2 exit 1 fi ``` Additional hardening should include: - Perform strict shell-level syntax validation before invoking Python, such as accepting only a documented decimal format. - Pass all external values through positional arguments, standard input, or environment variables and never concatenate them into interpreter source. - Add regression tests containing quotes, semicolons, newlines, backslashes, and Python syntax. - Run the trading scripts under a dedicated, minimally privileged account whose credential can perform only required API operations. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/create-market-with-odds.sh:105
Finding
Arbitrary Python Code Execution Through seed_amount Argument<![CDATA[ ## Vulnerability Details **File Location**: `scripts/create-market-with-odds.sh`, lines 105–115 **Vulnerability Type**: Python source-code injection **Risk Level**: High ### Vulnerable Code ```bash SEED_INFO=$(python3 -c " est = float('$EST_PROB') if abs(est - 0.5) < 0.02: print('SKIP|SKIP|Market already near estimated odds') elif est > 0.5: print(f'YES|$SEED_AMOUNT|Push from 50% toward {est:.0%}') else: print(f'NO|$SEED_AMOUNT|Push from 50% toward {est:.0%}') ") OUTCOME=$(echo "$SEED_INFO" | cut -d'|' -f1) ``` ### Technical Analysis `SEED_AMOUNT` is inserted directly into Python source inside an f-string literal. The argument is not validated before this interpolation. A crafted value can close the string or function call and append arbitrary Python statements. The dangerous branch is reached after the market has already been created. Consequently, exploitation can produce both local code execution and an unintended remote side effect. Depending on the selected estimated probability, the injected content is evaluated in the corresponding `YES` or `NO` branch. This is a separate injection surface from the `EST_PROB` validation flaw. Even a legitimate numeric `EST_PROB` does not make the unvalidated `SEED_AMOUNT` safe. ### Attack Path 1. An attacker controls or influences the optional fifth `seed_amount` argument. 2. The attacker supplies a value containing Python quote-termination syntax and an additional statement. 3. The script first creates a market through the authenticated MoltMarkets API. 4. The crafted seed amount is substituted into the `python3 -c` source used to calculate `SEED_INFO`. 5. When the applicable branch runs, Python executes the injected statement with the invoking user's permissions. 6. The payload can read local secrets, execute system commands, alter files, or submit unauthorized authenticated API operations. ### Impact Assessment Exploitation permits arbitrary code execution in the context of the Skill us ...[truncated 465 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Validate the seed amount as a bounded positive number and pass both values through `sys.argv`: ```bash SEED_INFO=$(python3 -c ' import sys try: estimated_probability = float(sys.argv[1]) seed_amount = float(sys.argv[2]) except ValueError: raise SystemExit("probability and seed amount must be numeric") if not 0.01 <= estimated_probability <= 0.99: raise SystemExit("probability is outside the allowed range") if not 0 < seed_amount <= 100: raise SystemExit("seed amount is outside the allowed range") if abs(estimated_probability - 0.5) < 0.02: print("SKIP|SKIP|Market already near estimated odds") elif estimated_probability > 0.5: print(f"YES|{seed_amount}|Push from 50% toward {estimated_probability:.0%}") else: print(f"NO|{seed_amount}|Push from 50% toward {estimated_probability:.0%}") ' "$EST_PROB" "$SEED_AMOUNT") ``` The upper bound should be selected according to the platform's documented risk policy. Further hardening should: - Require explicit confirmation or a dedicated `--yes` option before placing the seed bet. - Check the account balance and enforce the documented quarter-Kelly and 20% bankroll limits. - Avoid constructing JSON manually; generate request bodies with a JSON serializer. - Treat all command-line arguments as untrusted data across every Python snippet in this script. - Add tests proving that metacharacters and multiline arguments cannot alter interpreter control flow. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (46)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
If the implemented code lacks some of the described safeguards or capabilities, users may rely on nonexistent forecasting or sizing logic while still granting access to execute financial operations. In security terms, overbroad claims around a write-capable skill create unsafe trust and authorization decisions.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
If the implemented code lacks some of the described safeguards or capabilities, users may rely on nonexistent forecasting or sizing logic while still granting access to execute financial operations. In security terms, overbroad claims around a write-capable skill create unsafe trust and authorization decisions.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
If the implemented code lacks some of the described safeguards or capabilities, users may rely on nonexistent forecasting or sizing logic while still granting access to execute financial operations. In security terms, overbroad claims around a write-capable skill create unsafe trust and authorization decisions.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
If the implemented code lacks some of the described safeguards or capabilities, users may rely on nonexistent forecasting or sizing logic while still granting access to execute financial operations. In security terms, overbroad claims around a write-capable skill create unsafe trust and authorization decisions.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
If the implemented code lacks some of the described safeguards or capabilities, users may rely on nonexistent forecasting or sizing logic while still granting access to execute financial operations. In security terms, overbroad claims around a write-capable skill create unsafe trust and authorization decisions.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
If the implemented code lacks some of the described safeguards or capabilities, users may rely on nonexistent forecasting or sizing logic while still granting access to execute financial operations. In security terms, overbroad claims around a write-capable skill create unsafe trust and authorization decisions.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
If the implemented code lacks some of the described safeguards or capabilities, users may rely on nonexistent forecasting or sizing logic while still granting access to execute financial operations. In security terms, overbroad claims around a write-capable skill create unsafe trust and authorization decisions.

Missing User Warnings

High
Confidence
95% confidence
Finding
The skill includes instructions for placing bets, creating markets, and resolving markets without an explicit warning that these are financially and operationally irreversible actions. In a trading context, missing safety language materially increases the risk of unintended loss, market manipulation, or improper resolution by a user or agent acting too quickly.

Memory Manipulation

High
Category
Memory Poisoning
Content
While trading, notice and report:
- API errors or unexpected responses
- Missing fields in market data
- UX friction (confusing flows, unclear states)
- CPMM edge cases (rounding, extreme prices)

File issues at: `shirtlessfounder/moltmarkets-api` (NOT futarchy-cabal)
Confidence
80% confidence
Finding
Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

External Script Fetching

High
Category
Supply Chain
Content
[[ "${1:-}" == "--json" ]] && JSON_MODE=true

# Fetch markets
MARKETS=$(curl -s --max-time 10 -H "Authorization: Bearer $MM_KEY" "$API_BASE/markets")
if [ -z "$MARKETS" ]; then
  echo "ERROR: Could not fetch markets from API" >&2
  exit 1
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

External Script Fetching

High
Category
Supply Chain
Content
}))
" "$TITLE" "$DESCRIPTION" "$CLOSES_AT")

CREATE_RESPONSE=$(curl -s -X POST \
  -H "Authorization: Bearer $MM_KEY" \
  -H "Content-Type: application/json" \
  -d "$PAYLOAD" \
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

External Script Fetching

High
Category
Supply Chain
Content
# Small delay to let the market settle in the API
sleep 1

BET_RESPONSE=$(curl -s -X POST \
  -H "Authorization: Bearer $MM_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"outcome\": \"$OUTCOME\", \"amount\": $AMOUNT}" \
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

External Script Fetching

High
Category
Supply Chain
Content
}))
" "$TITLE" "$DESCRIPTION" "$CLOSES_AT")

RESPONSE=$(curl -s -X POST \
  -H "Authorization: Bearer $MM_KEY" \
  -H "Content-Type: application/json" \
  -d "$PAYLOAD" \
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

External Script Fetching

High
Category
Supply Chain
Content
echo "═══════════════════════════════════════════════════════════════"

# Fetch profile
PROFILE=$(curl -s -H "Authorization: Bearer $MM_KEY" "$API_BASE/me")

echo "$PROFILE" | python3 -c "
import json, sys
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

External Script Fetching

High
Category
Supply Chain
Content
echo "───────────────────────────────────────────────────────────────"

# Fetch all markets to find ones we've participated in
MARKETS=$(curl -s -H "Authorization: Bearer $MM_KEY" "$API_BASE/markets")

echo "$MARKETS" | python3 -c "
import json, sys
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

External Script Fetching

High
Category
Supply Chain
Content
echo "  Amount: ${AMOUNT}ŧ"
echo "───────────────────────────────────────"

RESPONSE=$(curl -s -X POST \
  -H "Authorization: Bearer $MM_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"outcome\": \"$OUTCOME\", \"amount\": $AMOUNT}" \
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Missing User Warnings

High
Confidence
96% confidence
Finding
The script performs a live POST to the betting API immediately after basic argument validation, with no interactive confirmation, dry-run mode, or explicit acknowledgement that funds will be committed. In an agent skill context, this is especially dangerous because automated invocation, prompt mistakes, or malicious chaining can trigger irreversible financial transactions without meaningful human review.

External Script Fetching

High
Category
Supply Chain
Content
echo "  Resolution: $RESOLUTION"
echo "───────────────────────────────────────"

RESPONSE=$(curl -s -X POST \
  -H "Authorization: Bearer $MM_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"outcome\": \"$RESOLUTION\"}" \
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill advertises and instructs use of shell scripts and authenticated API operations, but it declares no tool scope or permissions. That means a caller or review system cannot accurately understand that shell execution, network access, and local secret access are required, which weakens containment and informed consent for sensitive actions.

Vague Triggers

Medium
Confidence
97% confidence
Finding
The trigger text says the skill applies to essentially any MoltMarkets trading activity, prediction market analysis, or forecasting task. Such broad routing can cause accidental activation during routine discussion, increasing the chance that sensitive shell/API actions are suggested or executed in contexts where the user only wanted advice.

External Transmission

Medium
Category
Data Exfiltration
Content
## API Basics

- **Base URL**: `https://api.zcombinator.io/molt`
- **Auth**: `Authorization: Bearer $(cat ~/secrets/moltmarkets-api-key)`
- **Currency**: ŧ (moltmarks)
- **CPMM**: Constant Product Market Maker (YES shares × NO shares = constant)
Confidence
84% confidence
Finding
The skill is designed to transmit data to an external API endpoint, including authenticated requests. External transmission is expected for a trading skill, but it remains security-relevant because prompts, identifiers, and market actions may leave the local environment and affect a real third-party service.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
This file gives concrete bankroll sizing and betting execution guidance for prediction markets but does not include any explicit warning about financial loss, gambling-related harm, or suitability limits. In a trading skill context, that omission can encourage users to act on risky betting advice as if it were safe or generally appropriate, increasing the chance of material losses or compulsive behavior.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The script reads an API key from a local secrets file at runtime, which is a sensitive credential access operation. While the script comments describe its purpose, there is no visible user-facing warning, prompt, or disclosure that it will access credentials from ~/secrets/moltmarkets-api-key.

Missing User Warnings

Medium
Confidence
83% confidence
Finding
This code accesses a credential file at ~/secrets/moltmarkets-api-key to authenticate API requests. While the script comments explain market creation and betting behavior, they do not disclose that it will read a local secret from disk, which is a sensitive operation under the warning criteria for code files.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The script reads an API credential from ~/secrets/moltmarkets-api-key, which is a sensitive operation. Although the script's purpose is to query account data, there is no inline warning, confirmation, or explicit disclosure that it will access local credentials.

Static analysis

No suspicious patterns detected.