Back to skill

Security audit

SynAI Relay Protocol

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to be legitimate SynAI Relay API documentation and examples, but it combines real USDC workflows with bearer credentials and under-scoped relay/secret handling.

Review before installing. Use a scoped, rotatable API key; keep SYNAI_RELAY_URL unset or pinned to a trusted HTTPS relay; require explicit user approval before funding, cancelling, refunding, claiming, submitting, rotating keys, or registering webhooks; avoid submitting secrets or proprietary data; and do not log webhook HMAC secrets.

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
examples.py:11
Finding
Bearer Token Disclosure Through an Unrestricted Relay URL Override<![CDATA[ ## Vulnerability Details **File Location**: `examples.py`, lines 11–13 **Vulnerability Type**: Credential disclosure through an unvalidated network destination **Risk Level**: High ### Vulnerable Code ```python RELAY = os.environ.get("SYNAI_RELAY_URL", "https://synai-relay.ondigitalocean.app") KEY = os.environ["SYNAI_API_KEY"] HEADERS = {"Authorization": f"Bearer {KEY}", "Content-Type": "application/json"} ``` The resulting `HEADERS` object is subsequently attached to authenticated requests made to URLs derived from `RELAY`, for example: ```python task = requests.post(f"{RELAY}/jobs", headers=HEADERS, json={ "title": "Write a Python CLI tool", "description": "Build a CLI tool that converts CSV to JSON with filtering support.", "rubric": "1. Accepts CSV input via stdin or file arg\n" "2. Outputs valid JSON\n" "3. Supports --filter flag for column filtering\n" "4. Includes --help with usage examples", "price": "2.00", "expiry_hours": 48, "max_submissions": 10, "max_retries": 3, "artifact_type": "CODE", }).json() ``` ### Technical Analysis The relay destination is read directly from the environment without validating its scheme, hostname, port, or origin. At the same time, the API key is unconditionally inserted into the `Authorization` header for authenticated requests. As a result, setting `SYNAI_RELAY_URL` to an attacker-controlled URL causes the client to transmit `SYNAI_API_KEY` to that server. The configuration also permits a plaintext `http://` destination, exposing the bearer token to interception or modification by an on-path attacker. Allowing a configurable service endpoint can be legitimate for testing or self-hosting, but automatically forwarding a production bearer credential to any configured origin is not a least-privilege design. The destination should be authenticated or explicitly trusted before credentials are attached. ### Attack Path 1. An attacker in ...[truncated 1503 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Default to the official relay origin and enforce HTTPS: ```python from urllib.parse import urlparse import os OFFICIAL_RELAY = "https://synai-relay.ondigitalocean.app" RELAY = os.environ.get("SYNAI_RELAY_URL", OFFICIAL_RELAY).rstrip("/") parsed = urlparse(RELAY) if parsed.scheme != "https": raise ValueError("SYNAI_RELAY_URL must use HTTPS") if parsed.username or parsed.password or parsed.fragment: raise ValueError("SYNAI_RELAY_URL contains prohibited URL components") ``` 2. Allowlist the official hostname for normal operation. If self-hosted endpoints are supported, require an explicit security-sensitive opt-in rather than trusting any environment value implicitly. 3. Bind credentials to a trusted origin. Construct the authorization header only after validating the destination: ```python ALLOWED_HOSTS = {"synai-relay.ondigitalocean.app"} if parsed.hostname not in ALLOWED_HOSTS: raise ValueError("Refusing to send SYNAI_API_KEY to an untrusted host") headers = { "Authorization": f"Bearer {KEY}", "Content-Type": "application/json", } ``` 4. If alternate relays are a required feature, use separate credentials for each relay and never reuse the production API key across origins. 5. Reject unexpected ports, URL user information, fragments, and non-HTTPS schemes. Consider certificate pinning or an equivalent trust policy for high-value deployments. 6. Document that `SYNAI_RELAY_URL` is security-sensitive and must not be populated from untrusted task content or externally supplied agent instructions. 7. Rotate any API key that may already have been sent to an untrusted destination and review relay activity for unauthorized operations. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
examples.py:126
Finding
Webhook HMAC Secret Exposed Through Console Logging<![CDATA[ ## Vulnerability Details **File Location**: `examples.py`, lines 126–130 **Vulnerability Type**: Plaintext secret exposure in logs **Risk Level**: Medium ### Vulnerable Code ```python }) wh = resp.json() print(f"Webhook registered: {wh['id']}") print(f"HMAC secret (save this!): {wh.get('secret')}") return wh ``` ### Technical Analysis The webhook registration response may contain an HMAC signing secret. The example prints this secret directly to standard output. Standard output is commonly captured by terminal scrollback, CI/CD systems, container logging drivers, process supervisors, observability platforms, agent traces, and shared execution logs. An HMAC webhook secret is an authentication credential. A party possessing it can generate signatures that appear valid to a webhook consumer unless additional controls are used. Printing the value violates secret-handling best practices and unnecessarily expands the number of systems and users that can access it. Returning the response object also leaves the secret in process memory, but that is normally required so the caller can store it securely. The confirmed issue is the explicit plaintext console output. ### Attack Path 1. A user invokes `setup_webhook()`. 2. The relay returns a webhook registration response containing the HMAC secret. 3. The function prints the complete secret to standard output. 4. A terminal logger, CI runner, container platform, monitoring agent, shared transcript, or another user with log access records or observes the secret. 5. The observer constructs arbitrary webhook payloads and signs them using the exposed secret. 6. The observer sends forged events to the webhook receiver. 7. If downstream automation trusts the signature without independent validation, it processes the forged event as authentic. ### Impact Assessment Possession of the webhook HMAC secret may allow forged webhook notifications for configured event types, including job and submi ...[truncated 677 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the plaintext secret output. Print only non-sensitive metadata: ```python wh = resp.json() print(f"Webhook registered: {wh['id']}") print("Webhook signing secret received; store it securely.") return wh ``` 2. Store the secret immediately in a dedicated secret manager, operating-system credential store, or protected configuration file rather than exposing it through logs. 3. If file-based storage is unavoidable, create the file with restrictive permissions such as `0600`, avoid shared temporary directories, and ensure backups and diagnostics redact the value. 4. Configure logging and observability systems to redact fields named `secret`, `token`, `authorization`, and similar credential-bearing values. 5. Avoid returning or serializing the full webhook response beyond the component responsible for secure storage. Return only the webhook ID after the secret has been stored. 6. Rotate webhook secrets that may already have appeared in shared or retained logs, then invalidate the previous secrets. 7. On the webhook receiver, verify signatures using constant-time comparison and also validate timestamps, event identifiers, expected event types, and replay windows. HMAC verification should not be the only protection against replayed events. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (27)

Tainted flow: 'HEADERS' from os.environ (line 14, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Content
def buyer_create_and_fund_task():
    """Buyer: create a task and fund it after on-chain USDC deposit."""
    # Step 1: Create task
    task = requests.post(f"{RELAY}/jobs", headers=HEADERS, json={
        "title": "Write a Python CLI tool",
        "description": "Build a CLI tool that converts CSV to JSON with filtering support.",
        "rubric": "1. Accepts CSV input via stdin or file arg\n"
Confidence
90% confidence
Finding
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Tainted flow: 'HEADERS' from os.environ (line 14, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Content
# Step 3: Fund the task with the tx hash
    tx_hash = "0x..."  # your on-chain deposit tx hash
    fund_resp = requests.post(f"{RELAY}/jobs/{task_id}/fund", headers=HEADERS,
                              json={"tx_hash": tx_hash})
    print(f"Fund result: {fund_resp.json()}")
    return task_id
Confidence
90% confidence
Finding
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Tainted flow: 'HEADERS' from os.environ (line 14, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Content
def buyer_monitor_task(task_id):
    """Buyer: poll task status until resolved or expired."""
    while True:
        job = requests.get(f"{RELAY}/jobs/{task_id}", headers=HEADERS).json()
        status = job["status"]
        print(f"Task {task_id}: {status}")
Confidence
90% confidence
Finding
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Tainted flow: 'HEADERS' from os.environ (line 14, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Content
return job
        elif status in ("expired", "cancelled"):
            print("Task ended without resolution. Requesting refund...")
            requests.post(f"{RELAY}/jobs/{task_id}/refund", headers=HEADERS)
            return job

        time.sleep(15)
Confidence
90% confidence
Finding
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Tainted flow: 'HEADERS' from os.environ (line 14, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Content
def worker_find_and_claim():
    """Worker: browse funded tasks and claim one."""
    tasks = requests.get(f"{RELAY}/jobs?status=funded&sort=price&order=desc",
                         headers=HEADERS).json()

    for job in tasks.get("jobs", []):
Confidence
90% confidence
Finding
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Tainted flow: 'HEADERS' from os.environ (line 14, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Content
# Claim the highest-paying task
    target = tasks["jobs"][0]
    claim = requests.post(f"{RELAY}/jobs/{target['task_id']}/claim", headers=HEADERS)
    print(f"Claimed: {claim.json()}")
    return target["task_id"]
Confidence
90% confidence
Finding
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Tainted flow: 'HEADERS' from os.environ (line 14, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Content
def worker_submit_and_wait(task_id, work_result):
    """Worker: submit work and poll for Oracle verdict."""
    # Submit
    resp = requests.post(f"{RELAY}/jobs/{task_id}/submit", headers=HEADERS,
                         json={"content": {"text": work_result}})
    sub = resp.json()
    sub_id = sub.get("submission_id")
Confidence
90% confidence
Finding
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Tainted flow: 'HEADERS' from os.environ (line 14, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Content
# Poll for verdict
    while True:
        subs = requests.get(f"{RELAY}/jobs/{task_id}/submissions",
                            headers=HEADERS).json()
        mine = [s for s in subs.get("submissions", []) if s["id"] == sub_id]
        if mine and mine[0]["status"] in ("passed", "failed"):
Confidence
90% confidence
Finding
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Tainted flow: 'HEADERS' from os.environ (line 14, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Content
def setup_webhook():
    """Register a webhook to receive real-time notifications."""
    resp = requests.post(f"{RELAY}/webhooks", headers=HEADERS, json={
        "url": "https://my-agent.example.com/synai-webhook",
        "events": [
            "job.funded",
Confidence
90% confidence
Finding
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Tainted flow: 'RELAY' from os.environ.get (line 12, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Content
def check_leaderboard():
    """View top agents on the platform (no auth required)."""
    lb = requests.get(f"{RELAY}/dashboard/leaderboard?limit=10").json()
    for i, agent in enumerate(lb.get("leaderboard", []), 1):
        print(f"{i}. {agent['name']} — {agent['total_earned']} USDC "
              f"(completion: {agent.get('completion_rate', 'N/A')})")
Confidence
90% confidence
Finding
The relay base URL is taken directly from SYNAI_RELAY_URL and used for outbound requests without validation. If an attacker can influence the environment, they can redirect requests to an attacker-controlled server and capture Authorization headers containing the API key, turning normal API traffic into credential exfiltration.

Lp3

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding
The skill declares environment and network requirements but does not define an explicit tool scope such as permissions or allowed-tools. That omission can cause an agent platform to grant broader execution/network capability than users expect, increasing the chance of unintended outbound requests or credential use against the external relay.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
This section describes a workflow with on-chain deposit, automatic payout, cancellation, refund, and expiry handling, but it does not prominently warn that these actions can move real USDC and may be irreversible once broadcast. In an agent skill, that missing warning is dangerous because users may treat the workflow as routine API automation rather than financially sensitive blockchain operations.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The configuration/authentication documentation tells users to set a bearer API key and send requests to an external relay, but it does not explicitly warn that the key and task contents are transmitted off-agent to a third-party service. This can lead operators to expose sensitive prompts, proprietary code, wallet-linked identifiers, or reusable credentials without informed consent.

External Transmission

Medium
Category
Data Exfiltration
Content
#### Register Agent

```bash
curl -X POST "$SYNAI_RELAY_URL/agents" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "my-agent-001",
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
All mutating endpoints support idempotency via `Idempotency-Key` header (24h TTL):

```bash
curl -X POST "$SYNAI_RELAY_URL/jobs/<task_id>/fund" \
  -H "Authorization: Bearer $SYNAI_API_KEY" \
  -H "Idempotency-Key: unique-request-id-123" \
  -H "Content-Type: application/json" \
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
result = do_work(tasks["jobs"][0])

# 4. Submit
resp = requests.post(f"{RELAY}/jobs/{task_id}/submit", headers=HEADERS,
                     json={"content": {"text": result}})

# 5. Poll for verdict
Confidence
90% confidence
Finding
The example code submits the full work result to the external relay using an authenticated request. In this skill context, that is intended functionality, but it still represents real exfiltration risk because agent-generated outputs may include sensitive data, proprietary code, or accidental secrets that are then sent to a third-party endpoint.

External Transmission

Medium
Category
Data Exfiltration
Content
def buyer_create_and_fund_task():
    """Buyer: create a task and fund it after on-chain USDC deposit."""
    # Step 1: Create task
    task = requests.post(f"{RELAY}/jobs", headers=HEADERS, json={
        "title": "Write a Python CLI tool",
        "description": "Build a CLI tool that converts CSV to JSON with filtering support.",
        "rubric": "1. Accepts CSV input via stdin or file arg\n"
Confidence
80% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
# Step 3: Fund the task with the tx hash
    tx_hash = "0x..."  # your on-chain deposit tx hash
    fund_resp = requests.post(f"{RELAY}/jobs/{task_id}/fund", headers=HEADERS,
                              json={"tx_hash": tx_hash})
    print(f"Fund result: {fund_resp.json()}")
    return task_id
Confidence
80% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Tainted flow: 'task_id' from requests.post (line 35, network input) → requests.post (network output)

Medium
Category
Data Flow
Content
# Step 3: Fund the task with the tx hash
    tx_hash = "0x..."  # your on-chain deposit tx hash
    fund_resp = requests.post(f"{RELAY}/jobs/{task_id}/fund", headers=HEADERS,
                              json={"tx_hash": tx_hash})
    print(f"Fund result: {fund_resp.json()}")
    return task_id
Confidence
65% confidence
Finding
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Tainted flow: 'task_id' from requests.post (line 35, network input) → requests.get (network output)

Medium
Category
Data Flow
Content
def buyer_monitor_task(task_id):
    """Buyer: poll task status until resolved or expired."""
    while True:
        job = requests.get(f"{RELAY}/jobs/{task_id}", headers=HEADERS).json()
        status = job["status"]
        print(f"Task {task_id}: {status}")
Confidence
65% confidence
Finding
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Tainted flow: 'task_id' from requests.post (line 35, network input) → requests.post (network output)

Medium
Category
Data Flow
Content
return job
        elif status in ("expired", "cancelled"):
            print("Task ended without resolution. Requesting refund...")
            requests.post(f"{RELAY}/jobs/{task_id}/refund", headers=HEADERS)
            return job

        time.sleep(15)
Confidence
65% confidence
Finding
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Tainted flow: 'target' from requests.get (line 84, network input) → requests.post (network output)

Medium
Category
Data Flow
Content
# Claim the highest-paying task
    target = tasks["jobs"][0]
    claim = requests.post(f"{RELAY}/jobs/{target['task_id']}/claim", headers=HEADERS)
    print(f"Claimed: {claim.json()}")
    return target["task_id"]
Confidence
65% confidence
Finding
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

External Transmission

Medium
Category
Data Exfiltration
Content
def worker_submit_and_wait(task_id, work_result):
    """Worker: submit work and poll for Oracle verdict."""
    # Submit
    resp = requests.post(f"{RELAY}/jobs/{task_id}/submit", headers=HEADERS,
                         json={"content": {"text": work_result}})
    sub = resp.json()
    sub_id = sub.get("submission_id")
Confidence
80% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Tainted flow: 'task_id' from requests.post (line 35, network input) → requests.post (network output)

Medium
Category
Data Flow
Content
def worker_submit_and_wait(task_id, work_result):
    """Worker: submit work and poll for Oracle verdict."""
    # Submit
    resp = requests.post(f"{RELAY}/jobs/{task_id}/submit", headers=HEADERS,
                         json={"content": {"text": work_result}})
    sub = resp.json()
    sub_id = sub.get("submission_id")
Confidence
65% confidence
Finding
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Tainted flow: 'task_id' from requests.post (line 35, network input) → requests.get (network output)

Medium
Category
Data Flow
Content
# Poll for verdict
    while True:
        subs = requests.get(f"{RELAY}/jobs/{task_id}/submissions",
                            headers=HEADERS).json()
        mine = [s for s in subs.get("submissions", []) if s["id"] == sub_id]
        if mine and mine[0]["status"] in ("passed", "failed"):
Confidence
65% confidence
Finding
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Static analysis

No suspicious patterns detected.