Back to skill

Security audit

Trading Bot Risk-as-a-Service: Real-Time Portfolio Risk Monitoring for Multi-Exchange Operations

Security checks for vulnerabilities and agentic risk

Overview

This non-executing guide is mostly purpose-aligned, but it under-discloses live exchange credentials and order-cancellation examples that could affect real trading accounts if copied.

Treat this as a review-required trading guide, not a drop-in safe component. Use sandbox credentials first, do not grant write-capable exchange API keys unless you intend automated order cancellation, add explicit confirmations or dry-run controls, and store signing keys in a secret manager rather than terminal output or logs.

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
SKILL.md:225
Finding

Ed25519 Private Signing Key Exposed Through Standard Output

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 225–235
Vulnerability Type: Plaintext secret disclosure through standard output
Risk Level: Medium

Vulnerable Code

python
priv_bytes = private_key.private_bytes(
    encoding=serialization.Encoding.Raw,
    format=serialization.PrivateFormat.Raw,
    encryption_algorithm=serialization.NoEncryption()
)
pub_bytes = public_key.public_bytes(
    encoding=serialization.Encoding.Raw,
    format=serialization.PublicFormat.Raw
)

print(f'PRIVATE_KEY_B64={base64.b64encode(priv_bytes).decode()}')
print(f'PUBLIC_KEY_B64={base64.b64encode(pub_bytes).decode()}')

Technical Analysis

The guide exports the generated Ed25519 private key using raw, unencrypted serialization and prints the complete key to standard output after Base64 encoding. Base64 provides no confidentiality and can be trivially reversed.

Standard output is frequently retained in shell scrollback, CI/CD job logs, agent transcripts, terminal-recording systems, centralized observability platforms, and support artifacts. Consequently, following the documented command can unintentionally disclose the agent's signing identity beyond the intended security boundary.

The behavior is unrelated to code execution: the pre-scan's “decode then execute” warning is a false positive. Elsewhere, Base64 decoding is used only to reconstruct an Ed25519 key object. The confirmed weakness is the disclosure of the private key through output.

Attack Path

  1. An operator or automation agent runs the documented key-generation command.
  2. The command serializes the Ed25519 private key without encryption.
  3. The full private key is printed as PRIVATE_KEY_B64.
  4. Terminal output is captured in a transcript, CI log, monitoring platform, or other readable artifact.
  5. An attacker with access to that artifact decodes the Base64 value.
  6. The attacker reconstructs the Ed25519 private key and signs forged GreenHelix events under the victim agent's ...[truncated 793 chars]
Remediation
View remediation

Remediation Suggestions

  1. Do not print private keys, bearer tokens, webhook secrets, or exchange credentials to standard output.
  2. Generate and store the private key directly in an approved secret manager, hardware-backed keystore, or permission-restricted file.
  3. If file storage is necessary, create the file with owner-only permissions such as 0600 and avoid intermediate plaintext files.
  4. Prefer encrypted private-key serialization with a strong passphrase when compatible with the deployment model.
  5. Expose only the public key in logs and registration commands.
  6. Redact secret values from CI logs, agent transcripts, debugging output, and observability pipelines.
  7. Rotate any signing key previously generated using the documented command if its output may have been retained or shared.
  8. Document a key-rotation and incident-response process for suspected signing-key disclosure.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (14)

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The document states that the risk engine never polls exchanges directly, yet later implements direct exchange API adapters for positions, equity, and order cancellation. This architectural contradiction can mislead reviewers about trust boundaries and data flows, causing them to underestimate the exposure of exchange credentials and the system's ability to act on live accounts.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

A risk-monitoring skill should observe and alert, but this code adds direct exchange trading-control capability through cancel_all_orders(). If copied into production, the skill can materially affect live accounts and becomes capable of disruptive or destructive actions beyond its stated monitoring role.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The guide claims to be non-executing educational content, but it includes operational code for authenticated API use, webhook registration, exchange access, and later order-cancellation logic. That mismatch lowers user caution and can cause operators to run sensitive code with real credentials under the false impression that the skill is passive documentation.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

Before building the full risk engine, verify that your GreenHelix API credentials work:

bash
curl -X POST https://sandbox.greenhelix.net/v1 \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

python
import requests

API_BASE = "https://api.greenhelix.net/v1"
API_KEY = "your-api-key"

response = requests.post(

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

python
import requests

API_BASE = "https://api.greenhelix.net/v1"
API_KEY = "your-api-key"

response = requests.post(

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

python
import requests

API_BASE = "https://api.greenhelix.net/v1"
API_KEY = "your-api-key"

response = requests.post(

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

md
API_BASE = "https://api.greenhelix.net/v1"
API_KEY = "your-api-key"

response = requests.post(
    f"{API_BASE}/v1",
    headers={
        "Authorization": f"Bearer {API_KEY}",

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

text

```bash
# Query drawdown alert history via curl
curl -X POST https://sandbox.greenhelix.net/v1 \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The circuit breaker description promises automatic order cancellation and trading halt, but the implementation only emits events and depends on optional callbacks to enforce action. In production, operators may assume protections exist when they do not, creating a dangerous false sense of safety during fast-moving liquidation events.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

})

text

### Circuit Breaker Operations via curl

```bash
# Register a webhook for circuit breaker state transitions

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest declares only an agent signing key, but the code also requires authenticated exchange API keys and secrets to fetch private positions and account equity. This credential-scope mismatch can lead users to expose more sensitive secrets than expected and undermines informed consent about what access the skill actually needs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This markdown/manifest file declares AGENT_SIGNING_KEY as a required credential, but the surrounding user-facing warning only explains it generically as a cryptographic signing key. The document does not clearly warn that users are expected to supply and manage a private signing credential for examples that publish signed events, which is a safety-relevant credential-handling behavior.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The guide defines a classification scheme for shallow/fast/oscillating drawdowns and states that the drawdown tracker publishes this classification in the event payload. The actual DrawdownTracker.check_alerts() payload contains alert level, threshold, timeframe, timestamp, and peak equity, but no classification field or logic computing those categories. This is a direct mismatch between documentation and implementation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.