Back to skill

Security audit

Openclaw Bot Prob Trade

Security checks for vulnerabilities and agentic risk

Overview

This is a disclosed Polymarket trading bot, but it needs Review because it can run persistent live trading while its safety controls and dependency pinning are weaker than advertised.

Install only after reviewing the live-trading path. Keep dry_run enabled first, use restricted trading API keys and small exchange-side limits, pin the probtrade dependency to a reviewed version or commit, and treat the built-in risk manager as incomplete rather than a hard safety boundary.

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

Error
Location
lib/risk_manager.py:43
Finding
Trading risk controls are incomplete, use stale state, and reset when the process restarts<![CDATA[ ## Vulnerability Details **File Location**: `lib/risk_manager.py:43-51, 93-102, 109-145`; `lib/engine.py:143-168` **Vulnerability Type**: Incomplete and non-persistent financial safety controls **Risk Level**: High ### Vulnerable Code ```python # lib/risk_manager.py:43-51 class RiskManager: def __init__(self, config: RiskConfig): self.config = config self.daily_spent = 0.0 self.daily_reset_date = _today() self.consecutive_losses = 0 self.initial_balance: Optional[float] = None self.circuit_breaker_active = False ``` ```python # lib/risk_manager.py:93-102 # Max total exposure total_exposure = sum( float(p.get("size", 0)) * float(p.get("avgPrice", 0)) for p in state.positions ) if state.balance > 0 and total_exposure / state.balance > self.config.max_total_exposure: return False, f"Total exposure {total_exposure / state.balance:.1%} > {self.config.max_total_exposure:.1%}" if len(state.positions) >= self.config.max_open_positions: return False, f"Max open positions ({self.config.max_open_positions}) reached" ``` ```python # lib/risk_manager.py:109-145 def validate_signal(self, signal: Signal, state: TradingState) -> tuple: """ Validate a specific trade signal. Returns (allowed: bool, reason: str). """ if signal.amount > self.config.max_position_size: return False, f"Amount ${signal.amount:.2f} > max position ${self.config.max_position_size:.2f}" if self.daily_spent + signal.amount > self.config.max_daily_spend: return False, f"Would exceed daily limit: ${self.daily_spent:.2f} + ${signal.amount:.2f} > ${self.config.max_daily_spend:.2f}" if signal.amount > state.balance: return False, f"Amount ${signal.amount:.2f} > balance ${state.balance:.2f}" if signal.order_type == "LIMIT" and signal.price is None: return False, "LIMIT order requires price" if signal.price is not None and (signal.price < 0.01 or signal.price > ...[truncated 5131 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Persist risk state in a transaction-safe local database or retrieve authoritative counters from the trading API. At minimum, persist: - Daily committed spend and its date. - Circuit-breaker state. - Consecutive realized losses. - Initial or high-water-mark balance used for drawdown calculations. 2. Reconcile local state with authoritative balances, positions, open orders, fills, cancellations, and realized profit/loss before every cycle. 3. Treat accepted but unfilled orders as reserved exposure and reserved spending. 4. After each successful submission, immediately update local reserved balance, exposure, open-order count, and projected position count before validating the next signal. 5. Validate an entire signal batch against aggregate limits before submitting any order. Use locking or transactional reservations if concurrent workers are possible. 6. Connect fill and settlement events to `record_loss()` and `record_win()`, or derive consecutive outcomes directly from authoritative trade history. 7. Implement the configured `stop_loss_pct` using monitored position prices and authenticated exit orders, or remove the option and documentation until it is actually supported. 8. Require an explicit, authenticated administrative action to reset a circuit breaker. A process restart must not reset safety state. 9. Add tests covering: - Multiple signals in one cycle. - Pending orders and partial fills. - Restart during an active breaker. - Daily-spend continuity across restarts. - Position limits reached during a batch. - Drawdown and consecutive-loss activation. ]]>

T08 · Insecure Dependencies

Warning
Location
README.md:31
Finding
Installation instructions execute and import unpinned third-party dependencies<![CDATA[ ## Vulnerability Details **File Location**: `README.md:31-33, 50-52`; `docs/deployment.md:31-40, 282-286` **Vulnerability Type**: Unpinned executable dependency and mutable source retrieval **Risk Level**: Medium ### Vulnerable Code ```bash # README.md:31-33 npx clawhub@latest install probtrade ``` ```bash # README.md:50-52 git clone https://github.com/vlprosvirkin/openclaw-bot-prob-trade.git cd openclaw-bot-prob-trade ``` ```bash # docs/deployment.md:31-40 npx clawhub@latest install probtrade ``` ```bash # docs/deployment.md:35-40 # Or clone manually: git clone https://github.com/vlprosvirkin/prob-trade-polymarket-analytics.git openclaw-skill ``` ```bash # docs/deployment.md:280-286 # As deploy user sudo -u deploy -i # Clone repos cd /opt git clone https://github.com/vlprosvirkin/openclaw-bot-prob-trade.git openclaw-bot git clone https://github.com/vlprosvirkin/prob-trade-polymarket-analytics.git openclaw-skill ``` The cloned dependency is loaded into the bot through the following code: ```python # lib/engine.py:17-25 _skill_path = os.environ.get( "PROBTRADE_SKILL_PATH", os.path.join(os.path.dirname(__file__), "..", "..", "openclaw-skill", "lib"), ) _skill_path = os.path.abspath(_skill_path) if _skill_path not in sys.path: sys.path.insert(0, _skill_path) from api_client import fetch, trading_request # noqa: E402 ``` ### Technical Analysis The installation documentation invokes `clawhub@latest` and clones the external probtrade repository without selecting an immutable version, commit hash, checksum, or verified signature. The bot subsequently prepends the external directory to `sys.path` and imports `api_client` from it. This means the effective executable dependency can differ between installations even when this audited project remains unchanged. A compromised package release, package publisher account, repository account, default branch, or upstream build process could supply a modified `api_client.py`. The imported modu ...[truncated 2025 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace `npx clawhub@latest` with an exact reviewed version. Use a lockfile and integrity metadata for npm-based tooling. 2. Pin the probtrade repository to an audited immutable commit: ```bash git clone https://github.com/vlprosvirkin/prob-trade-polymarket-analytics.git openclaw-skill cd openclaw-skill git checkout --detach <audited-commit-hash> ``` 3. Publish and verify SHA-256 checksums or signed release artifacts. Prefer signed tags and verify signatures before installation. 4. Record the expected dependency version or commit in this project and fail closed if the loaded dependency does not match it. 5. Install dependencies in an isolated virtual environment rather than inserting an arbitrary externally controlled path at the front of `sys.path`. 6. Import the dependency as a pinned package with explicit provenance rather than relying on a generic top-level module name such as `api_client`. 7. Restrict trading API credentials to the minimum required permissions, account, and spending limits. Use separate read-only credentials for scan and status operations where supported. 8. Run the bot as a dedicated unprivileged user with a read-only filesystem, no unnecessary capabilities, and outbound network access limited to explicitly required API hosts. 9. Include the referenced systemd and container definitions in the audited artifact so their least-privilege claims can be independently reviewed. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (84)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The description presents a broad autonomous trading bot for Polymarket that can run strategies, manage risk, and scan markets. The supplied code chunk is much narrower: it is only one strategy file for weather-market arbitrage. More importantly, its core advertised behavior—comparing official NOAA forecasts to market prices—is not actually implemented. The _get_forecast_probability method always returns None and contains only TODO comments, so in practice the strategy will not generate trades based on NOAA data. It does scan markets via prob.trade search, but the central arbitrage capability described in the module docstring is stubbed out. This makes the code’s actual behavior materially different from both the broad declared purpose and the specific implied weather-arbitrage functionality.

Credential Access

High
Category
Privilege Escalation
Content
### 2. Set up environment

```bash
cp .env.example .env
```

Edit `.env`:
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
cd /opt/openclaw-bot

# Create .env
cat > .env << 'EOF'
PROBTRADE_API_KEY=ptk_live_your_key
PROBTRADE_API_SECRET=pts_your_secret
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
cd /opt/openclaw-bot

# Create .env
cat > .env << 'EOF'
PROBTRADE_API_KEY=ptk_live_your_key
PROBTRADE_API_SECRET=pts_your_secret
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
cd /opt/openclaw-bot

# Create .env
cat > .env << 'EOF'
PROBTRADE_API_KEY=ptk_live_your_key
PROBTRADE_API_SECRET=pts_your_secret
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
cd /opt/openclaw-bot

# Create .env
cat > .env << 'EOF'
PROBTRADE_API_KEY=ptk_live_your_key
PROBTRADE_API_SECRET=pts_your_secret
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
cd /opt/openclaw-bot

# Create .env
cat > .env << 'EOF'
PROBTRADE_API_KEY=ptk_live_your_key
PROBTRADE_API_SECRET=pts_your_secret
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
cd /opt/openclaw-bot

# Create .env
cat > .env << 'EOF'
PROBTRADE_API_KEY=ptk_live_your_key
PROBTRADE_API_SECRET=pts_your_secret
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
cd /opt/openclaw-bot

# Create .env
cat > .env << 'EOF'
PROBTRADE_API_KEY=ptk_live_your_key
PROBTRADE_API_SECRET=pts_your_secret
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
cd /opt/openclaw-bot

# Create .env
cat > .env << 'EOF'
PROBTRADE_API_KEY=ptk_live_your_key
PROBTRADE_API_SECRET=pts_your_secret
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Session Persistence

Medium
Category
Rogue Agent
Content
Polymarket CLOB (order book)
```

You write a strategy as a simple Python class. The engine runs it on a schedule, checks risk limits, and executes orders through [prob.trade](https://app.prob.trade). All blockchain operations (wallet management, transaction signing, gas) are handled by prob.trade — your bot only makes HTTP calls.

## Quick Start
Confidence
60% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding
npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
### Systemd (VPS)
```bash
sudo cp deploy/openclaw-bot.service /etc/systemd/system/
sudo systemctl enable --now openclaw-bot
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
### Systemd (VPS)
```bash
sudo cp deploy/openclaw-bot.service /etc/systemd/system/
sudo systemctl enable --now openclaw-bot
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
### Systemd (VPS)
```bash
sudo cp deploy/openclaw-bot.service /etc/systemd/system/
sudo systemctl enable --now openclaw-bot
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
### Systemd (VPS)
```bash
sudo cp deploy/openclaw-bot.service /etc/systemd/system/
sudo systemctl enable --now openclaw-bot
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
### Systemd (VPS)
```bash
sudo cp deploy/openclaw-bot.service /etc/systemd/system/
sudo systemctl enable --now openclaw-bot
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
### Systemd (VPS)
```bash
sudo cp deploy/openclaw-bot.service /etc/systemd/system/
sudo systemctl enable --now openclaw-bot
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
### Systemd (VPS)
```bash
sudo cp deploy/openclaw-bot.service /etc/systemd/system/
sudo systemctl enable --now openclaw-bot
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
### Systemd (VPS)
```bash
sudo cp deploy/openclaw-bot.service /etc/systemd/system/
sudo systemctl enable --now openclaw-bot
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
### Systemd (VPS)
```bash
sudo cp deploy/openclaw-bot.service /etc/systemd/system/
sudo systemctl enable --now openclaw-bot
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
### Systemd (VPS)
```bash
sudo cp deploy/openclaw-bot.service /etc/systemd/system/
sudo systemctl enable --now openclaw-bot
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
### Systemd (VPS)
```bash
sudo cp deploy/openclaw-bot.service /etc/systemd/system/
sudo systemctl enable --now openclaw-bot
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
### Systemd (VPS)
```bash
sudo cp deploy/openclaw-bot.service /etc/systemd/system/
sudo systemctl enable --now openclaw-bot
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
### Systemd (VPS)
```bash
sudo cp deploy/openclaw-bot.service /etc/systemd/system/
sudo systemctl enable --now openclaw-bot
```
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Static analysis

No suspicious patterns detected.