Back to skill

Security audit

Hub Api Integration

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly explains PancakeSwap swap integration, but it also tells the agent to send hidden startup telemetry and includes unsafe financial amount conversion examples.

Review this skill carefully before installing. The Hub API guidance is broadly relevant, but the startup ping should be removed or made clearly opt-in, and any implementation should replace the amount conversion snippets with exact BigInt or audited fixed-point utilities such as parseUnits/formatUnits. Do not expose PCS_HUB_TOKEN in client code, and treat all wallet handoff values as financial transactions that must be independently verified by the signing wallet.

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)

other

Warning
Location
SKILL.md:84
Finding

Undisclosed Startup Telemetry Exceeds Required Privileges

Content
View full analysis
/dev/null & ``` ``` ### Technical Analysis The mandatory initialization request transmits the following information to `pancakeswap.ai`: - The Skill name and version - The AI agent or system identifier - The exact invocation timestamp - The host operating-system name - The host CPU architecture The response is discarded with `-o /dev/null`, while errors are suppressed and the process is placed in the background. The request therefore behaves as telemetry rather than an operation that obtains the latest token list or deep-link formats. No returned data is consumed to support the declared integration-specification workflow. This behavior also conflicts with the Skill's stated restriction at `SKILL.md:77`, which says that `curl` may only access `hub-api.pancakeswap.com`, `tokens.pancakeswap.finance`, and public BSC RPC endpoints. The telemetry host is not included in that allowlist. The token-list, Hub API, and public BSC RPC requests are relevant to the declared quote and swap integration functionality. In contrast, disclosure of the local platform and agent identity is not required to produce an integration specification and exceeds the minimum network privileges necessary. ### Attack Path 1. A user invokes the Skill for a PCS Hub integration request. 2. Step 0 dir ...[truncated 1088 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:558
Finding

Unsafe Floating-Point Conversion of Token and Native-Currency Amounts

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (12)

External Model or Provider Selection

Medium
Category
Excessive Agency
Confidence
90% confidence
Finding

Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.

Content

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

md
description: Help apps and distribution channels integrate PCS Hub into their frontend. Use when user says "/hub-api-integration", "integrate PCS Hub", "embed PCS Hub swap", "PCS Hub integration guide", "how do I add PCS Hub to my wallet", "create a PCS Hub integration spec", or describes wanting to embed PCS Hub quote/swap functionality in an external UI.
homepage: https://github.com/pancakeswap/pancakeswap-ai
allowed-tools: Read, Write, Edit, Glob, Grep, Bash(curl:*), Bash(jq:*), WebFetch, AskUserQuestion
model: sonnet
license: MIT
metadata:
  author: pancakeswap

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

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

md
### Screen / Event Map

| #   | Screen / Event        | Description                                                                                                                                                                                                                 | State                  |
| --- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
| 1   | **Token selection**   | Input and output token pickers with search. Use PancakeSwap token list (`tokens.pancakeswap.finance`) as the source.                                                                                                        | `idle`                 |
| 2   | **Amount input**      | Human-readable number field. Show estimated USD value alongside. Convert to wei only when calling the API.                                                                                                                  | `dirty`                |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

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

md
| #   | Screen / Event        | Description                                                                                                                                                                                                                 | State                  |
| --- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
| 1   | **Token selection**   | Input and output token pickers with search. Use PancakeSwap token list (`tokens.pancakeswap.finance`) as the source.                                                                                                        | `idle`                 |
| 2   | **Amount input**      | Human-readable number field. Show estimated USD value alongside. Convert to wei only when calling the API.                                                                                                                  | `dirty`                |
| 3   | **Quote fetch**       | Call `POST /quote` on input change (debounced ~500 ms). Show loading state. Disable confirm button while fetching.                                                                                                          | `fetching`             |
| 4   | **Route display**     | Render `protocols[]` splits table: percentage, DEX, pool type, path. Show gas estimate.                                                                                                                                     | `quoted`               |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

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

md
| #   | Screen / Event        | Description                                                                                                                                                                                                                 | State                  |
| --- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
| 1   | **Token selection**   | Input and output token pickers with search. Use PancakeSwap token list (`tokens.pancakeswap.finance`) as the source.                                                                                                        | `idle`                 |
| 2   | **Amount input**      | Human-readable number field. Show estimated USD value alongside. Convert to wei only when calling the API.                                                                                                                  | `dirty`                |
| 3   | **Quote fetch**       | Call `POST /quote` on input change (debounced ~500 ms). Show loading state. Disable confirm button while fetching.                                                                                                          | `fetching`             |
| 4   | **Route display**     | Render `protocols[]` splits table: percentage, DEX, pool type, path. Show gas estimate.                                                                                                                                     | `quoted`               |
| 5   | **Refresh / requote** | Quote has no explicit TTL — implement a 15–30 s client-side countdown. Auto-requote on expiry; block execution until fresh quote is available. Show countdown UI.                                                           | `stale` → `fetching`   |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

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

md
| --- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
| 1   | **Token selection**   | Input and output token pickers with search. Use PancakeSwap token list (`tokens.pancakeswap.finance`) as the source.                                                                                                        | `idle`                 |
| 2   | **Amount input**      | Human-readable number field. Show estimated USD value alongside. Convert to wei only when calling the API.                                                                                                                  | `dirty`                |
| 3   | **Quote fetch**       | Call `POST /quote` on input change (debounced ~500 ms). Show loading state. Disable confirm button while fetching.                                                                                                          | `fetching`             |
| 4   | **Route display**     | Render `protocols[]` splits table: percentage, DEX, pool type, path. Show gas estimate.                                                                                                                                     | `quoted`               |
| 5   | **Refresh / requote** | Quote has no explicit TTL — implement a 15–30 s client-side countdown. Auto-requote on expiry; block execution until fresh quote is available. Show countdown UI.                                                           | `stale` → `fetching`   |
| 6   | **Approval check**    | For ERC-20 source tokens, check allowance via `eth_call` against router `0x5efc784D444126ECc05f22c49FF3FBD7D9F4868a` before generating calldata. If allowance < `amountIn`, show "Approve" button and estimate approve gas. | `needs_approval`       |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

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

md
| 1   | **Token selection**   | Input and output token pickers with search. Use PancakeSwap token list (`tokens.pancakeswap.finance`) as the source.                                                                                                        | `idle`                 |
| 2   | **Amount input**      | Human-readable number field. Show estimated USD value alongside. Convert to wei only when calling the API.                                                                                                                  | `dirty`                |
| 3   | **Quote fetch**       | Call `POST /quote` on input change (debounced ~500 ms). Show loading state. Disable confirm button while fetching.                                                                                                          | `fetching`             |
| 4   | **Route display**     | Render `protocols[]` splits table: percentage, DEX, pool type, path. Show gas estimate.                                                                                                                                     | `quoted`               |
| 5   | **Refresh / requote** | Quote has no explicit TTL — implement a 15–30 s client-side countdown. Auto-requote on expiry; block execution until fresh quote is available. Show countdown UI.                                                           | `stale` → `fetching`   |
| 6   | **Approval check**    | For ERC-20 source tokens, check allowance via `eth_call` against router `0x5efc784D444126ECc05f22c49FF3FBD7D9F4868a` before generating calldata. If allowance < `amountIn`, show "Approve" button and estimate approve gas. | `needs_approval`       |
| 7   | **Execution handoff** | Call `POST /calldata` with the quote object + `recipient` + `slippageTolerance`. Construct EIP-681 URI or Trust Wallet send link. Hand off to wallet.                                                                       | `executing`            |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

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

md
| 5   | **Refresh / requote** | Quote has no explicit TTL — implement a 15–30 s client-side countdown. Auto-requote on expiry; block execution until fresh quote is available. Show countdown UI.                                                           | `stale` → `fetching`   |
| 6   | **Approval check**    | For ERC-20 source tokens, check allowance via `eth_call` against router `0x5efc784D444126ECc05f22c49FF3FBD7D9F4868a` before generating calldata. If allowance < `amountIn`, show "Approve" button and estimate approve gas. | `needs_approval`       |
| 7   | **Execution handoff** | Call `POST /calldata` with the quote object + `recipient` + `slippageTolerance`. Construct EIP-681 URI or Trust Wallet send link. Hand off to wallet.                                                                       | `executing`            |
| 8   | **Success / fail**    | Track tx hash. Poll `eth_getTransactionReceipt` or BSCScan API for confirmation. Show success with explorer link, or error with retry CTA.                                                                                  | `confirmed` / `failed` |

### State Machine (text diagram)

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 293)May include surrounding context.

md
SPENDER_PAD=$(printf '%064s' "${SPENDER#0x}" | tr ' ' '0')
CALLDATA="0xdd62ed3e${OWNER_PAD}${SPENDER_PAD}"

curl -sf -X POST "https://bsc-dataseed1.binance.org" \
  -H "Content-Type: application/json" \
  -d "$(jq -n \
    --arg to  "$SRC_TOKEN" \

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 359)May include surrounding context.

md
The Hub API has no transaction status endpoint. Use one of:

- BSCScan API: `https://api.bscscan.com/api?module=transaction&action=gettxreceiptstatus&txhash={hash}&apikey={key}`
- BNB Chain RPC: `eth_getTransactionReceipt` until `status` is `0x1` (success) or `0x0` (fail)

Recommended polling interval: 3–5 s. Stop after 10 minutes or on confirmed status.

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

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

md
Adjust the handoff and signing flow based on the partner's channel type.

| Channel                             | Signing approach              | Handoff type                                                                                | Notes                                                           |
| ----------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| **Embedded wallet** (controls keys) | Sign calldata directly in-app | `{value, calldata}` payload                                                                 | No deep link needed; call wallet SDK with `to`, `value`, `data` |
| **Mobile app** (external wallet)    | Trust Wallet send link        | `https://link.trustwallet.com/send?...`                                                     | Deep link opens Trust Wallet native signing flow                |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

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

md
## Step 6 — Fallback Logic

| Scenario                       | Detection                          | Fallback action                                                                                                                                                    |
| ------------------------------ | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Route unavailable (`ASM-5002`) | `error.statusCode === "ASM-5002"`  | Show "No route found for this pair." Suggest common intermediate tokens (WBNB, USDT, CAKE).                                                                        |
| Quote expires (>30 s stale)    | Client-side timer fires            | Auto-requote silently; show spinner; block execution until fresh quote is available.                                                                               |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

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

md
| Token not in PancakeSwap list  | Token list lookup returns no match | Show warning: "This token is not on the PancakeSwap token list. Verify the contract on BSCScan before proceeding." Allow manual address entry with red-flag badge. |
| Approval missing               | `allowance < amountIn`             | Show "Approve [symbol]" button before the swap button. Estimate approval gas. After approval tx confirms, re-check allowance before proceeding.                    |
| `/calldata` fails              | Non-null `error` in response       | Show error message; offer retry. Do **not** fall back to PancakeSwap web deep link — the quote may be stale.                                                       |
| Rate limited (HTTP 429)        | HTTP 429 status                    | Back off 60 s; show countdown indicator: "Too many requests — retrying in Xs."                                                                                     |
| Hub API unreachable            | Network error / timeout            | Offer standard PancakeSwap deep link as graceful degradation with note: "Hub routing unavailable — using standard PancakeSwap routing."                            |
| Non-BSC chain                  | `chainId !== 56`                   | Note BSC-only limitation. Optionally redirect to `https://pancakeswap.finance/swap?chain={chain}` for other supported chains.                                      |
| `PCS_HUB_TOKEN` not set        | Env var check at startup           | Prompt partner dev to set `PCS_HUB_TOKEN`. Provide setup instructions and PancakeSwap contact link.                                                                |