Back to skill

Security audit

DeFi Risk Scanner

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent DeFi risk scanner, but its shell script has a real unsafe parsing pattern that could let malicious API data execute local commands.

Review before installing. The main concern is not the DeFi data lookup itself, but the script's unsafe handling of API response values in AWK. Run it only in a low-privilege environment until numeric validation or awk -v style argument passing is fixed, and avoid submitting confidential investigation targets if third-party API disclosure matters to you.

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
scripts/risk-check.sh:125
Finding

Remote API Data Is Interpolated Directly into AWK Programs

Content
View full analysis
0)}"; then ratio=$(awk "BEGIN {printf \"%.4f\", $market_cap / $fdv}") if awk "BEGIN {exit !($ratio >= 0.8)}"; then score=$((score + 20)) elif awk "BEGIN {exit !($ratio >= 0.5)}"; then score=$((score + 10)) elif awk "BEGIN {exit !($ratio >= 0.2)}"; then score=$((score + 0)) else score=$((score - 15)) fi fi # Liquidity vs Market Cap (20 pts) if [[ -n "$liquidity_usd" && "$liquidity_usd" != "null" && -n "$market_cap" && "$market_cap" != "null" ]] && awk "BEGIN {exit !($market_cap > 0)}"; then local liq_ratio=$(awk "BEGIN {printf \"%.4f\", $liquidity_usd / $market_cap}") if awk "BEGIN {exit !($liq_ratio >= 0.1)}"; then score=$((score + 20)) elif awk "BEGIN {exit !($liq_ratio >= 0.05)}"; then score=$((score + 10)) elif awk "BEGIN {exit !($liq_ratio >= 0.01)}"; then score=$((score + 0)) else score=$((score - 20)) fi fi # 24h Volume / Liquidity ratio (10 pts) if [[ -n "$h24_vol" && "$h24_vol" != "null" && -n "$liquidity_usd" && "$liquidity_usd" != "null" ]] && awk "BEGIN {exit !($liquidity_usd > 0)}"; then local vol_ratio=$(awk "BEGIN {printf \"%.4f\", $h24_vol / $liquidity_usd}") if awk "BEGIN {exit !($vol_ratio >= 0.05)}"; then score=$((score + 10)) elif awk "BEGIN {exit !($vol_ratio >= 0.01)}"; then score=$((score + 5)) fi fi # FDV check if [[ -n "$fdv" && "$fdv" != "null" ]]; then if awk "BEGIN {exit !($fdv < 10000000)}"; then score=$((score - 5)) fi if awk "BEGIN {exit !($fdv > 10000000000)}"; then score=$((score + 5)) fi fi ``` The same unsafe construction is repeated during report generation: ```b ...[truncated 4085 chars]
Remediation
View remediation
0) }' ``` For calculations: ```bash ratio=$(awk -v market_cap="$market_cap" -v fdv="$fdv" \ 'BEGIN { printf "%.4f", market_cap / fdv }') ``` 2. **Enforce JSON types with `jq`.** Reject fields that are not numbers: ```bash FDV=$(jq -er ' .pairs | sort_by(.liquidity.usd // 0) | reverse | .[0].fdv | select(type == "number") ' <<<"$DEX_DATA") || { echo "Invalid FDV returned by API" >&2 exit 1 } ``` 3. **Apply strict numeric validation before arithmetic.** Support only the formats actually required by the APIs: ```bash is_number() { [[ "$1" =~ ^-?[0-9]+([.][0-9]+)?([eE][+-]?[0-9]+)?$ ]] } is_number "$MARKET_CAP" || { echo "Invalid market-cap value" >&2 exit 1 } ``` 4. **Apply the same fix to every API-derived numeric value**, including: - `TVL_SUM` - `STAKE_TVL` - `POOL2_TVL` - `MARKET_CAP` - `LIQUIDITY_USD` - `H24_VOL` - `FDV` - Calculated ratio values 5. **Fail closed on malformed API responses.** Do not assign a risk score from data that fails schema or type validation. 6. **Harden network error handling.** Use options such as `--fail`, `--show-error`, response-size limits where practical, and explicit JSON validation before processing: ```bash DEX_DATA=$(curl --fail --silent --show-error --max-time 10 \ "https://api.dexscreener.com/latest/dex/tokens/$TARGET") || exit 1 ``` 7. **Remove the unused `eval` helper at lines 35-41.** It has no current call site, but retaining an `eval`-based utility creates an avoidable future command-injection hazard. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • 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 (17)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill documentation is written entirely in Chinese, including operational instructions and risk explanations, with no indication that users can opt into another language. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill instructs users to invoke a local shell script (./scripts/risk-check.sh) but does not declare any permissions or allowed-tools scope. This creates an undeclared execution boundary where an agent may run shell-capable actions without explicit least-privilege constraints, increasing the risk of command execution abuse or unexpected local side effects if supporting files are modified or malicious.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest description explicitly says the skill should be used for requests like checking whether a token is a Rug Pull. However, the documented roadmap later marks 'Rug Pull 评分' as unavailable in the free version, creating a mismatch between the advertised current behavior and the documented actual scope. This can mislead users into invoking a capability the skill does not currently justify as implemented.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest description is entirely in Chinese and the rest of the skill content is also written in Chinese, but there is no indication that the skill is region-specific or that users may choose another language. This creates a natural-language policy concern because the skill implicitly enforces a locale/language without opt-in.

Content

No source excerpt is available for this finding.

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 · references/sources.md (reported line 6)May include surrounding context.

md
## 免费 API 汇总

### TVL / 协议数据
- **DefiLlama**: `https://api.llama.fi/protocol/{name}` — 无需 Key,返回 TVL、chain、category
- **DeBank**: `https://api.debank.com/v1/protocol?id={id}` — 需 Key,免费注册
- **DappRadar**: `https://api.dappradar.com/v2/{chain}/protocols` — 需 Key

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 · references/sources.md (reported line 7)May include surrounding context.

md
### TVL / 协议数据
- **DefiLlama**: `https://api.llama.fi/protocol/{name}` — 无需 Key,返回 TVL、chain、category
- **DeBank**: `https://api.debank.com/v1/protocol?id={id}` — 需 Key,免费注册
- **DappRadar**: `https://api.dappradar.com/v2/{chain}/protocols` — 需 Key

### 代币安全

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 · references/sources.md (reported line 8)May include surrounding context.

md
### TVL / 协议数据
- **DefiLlama**: `https://api.llama.fi/protocol/{name}` — 无需 Key,返回 TVL、chain、category
- **DeBank**: `https://api.debank.com/v1/protocol?id={id}` — 需 Key,免费注册
- **DappRadar**: `https://api.dappradar.com/v2/{chain}/protocols` — 需 Key

### 代币安全
- **Token Sniffer**: `https://token-sniffer.com/api/v2/token/{address}` — 无需 Key,返回 scamScore、honeypot

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 · references/sources.md (reported line 15)May include surrounding context.

md
- **Rug Check**: `https://rugcheck.xyz/tokens/{address}` — 无需 Key

### 合约分析
- **Etherscan API**: `https://api.etherscan.io/api` — 免费 Key 有频率限制
- **Tenderly**: `https://api.tenderly.co/api/v1/public_contract/{chain}/{address}` — 需注册
- **Blockscout** (L2): `https://blockscout.com/{chain}/api` — 免费

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 · references/sources.md (reported line 16)May include surrounding context.

md
### 合约分析
- **Etherscan API**: `https://api.etherscan.io/api` — 免费 Key 有频率限制
- **Tenderly**: `https://api.tenderly.co/api/v1/public_contract/{chain}/{address}` — 需注册
- **Blockscout** (L2): `https://blockscout.com/{chain}/api` — 免费

### 解锁/归属

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

User-facing strings throughout the script, including usage, section headers, conclusions, and disclaimers, are presented in Chinese only. This is a natural-language locale constraint applied universally, with no opt-in, fallback, or justification that the tool is intended only for a Chinese-speaking context.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
95% confidence
Finding

This external transmission is real: the script performs a live curl request to DefiLlama using unredacted user input. In the context of a DeFi risk scanner, users may analyze unreleased, suspicious, or investigative targets, so outbound requests can leak confidential interest patterns and metadata to third parties.

Content

Scanner excerpt · scripts/risk-check.sh (reported line 215)May include surrounding context.

sh
print_section "📊 DefiLlama 链上数据"
  
  # Fetch protocol data
  LLAMA_DATA=$(curl -s --max-time 10 "https://api.llama.fi/protocol/$TARGET" 2>/dev/null)
  
  if echo "$LLAMA_DATA" | jq -e '.name' >/dev/null 2>&1; then
    NAME=$(echo "$LLAMA_DATA" | jq -r '.name')

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script sends the user-supplied protocol name directly to DefiLlama, which discloses user input to a third-party service without any explicit notice or consent. In a security-analysis skill, targets may be sensitive research subjects, so this creates a privacy and operational-security leak even if no code execution occurs.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
96% confidence
Finding

This is a genuine external transmission of the supplied token address to DexScreener. Because the skill is intended for security and rug-pull assessment, the queried addresses may reflect sensitive investigations, making silent third-party disclosure more dangerous than in a generic market-data tool.

Content

Scanner excerpt · scripts/risk-check.sh (reported line 313)May include surrounding context.

sh
print_section "📊 DexScreener 流动性数据"
  
  DEX_DATA=$(curl -s --max-time 10 "https://api.dexscreener.com/latest/dex/tokens/$TARGET" 2>/dev/null)
  
  if echo "$DEX_DATA" | jq -e '.pairs | length > 0' >/dev/null 2>&1; then
    # Get the pair with highest liquidity

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script transmits the user-provided token address to DexScreener without warning that the address is shared with an external API. Wallets, token addresses, and investigation targets can be sensitive in Web3 workflows, so this can expose analyst intent or proprietary due-diligence activity to third parties.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The '核心优势' section claims the skill requires no API key, but the data source table states that contract source verification uses the Etherscan API with a free key. That is an active contradiction in the skill's own documentation about operational requirements, not merely an omission.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The description text includes Chinese-language wording in the skill metadata, which can indicate a fixed language presentation for the skill. The file does not provide any user opt-in, multilingual alternative, or justification that the skill is intentionally region- or locale-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

该 markdown 文件标题及全文均以中文编写,但未说明这是面向特定中文用户群体的限定文档,也未提供语言选择或英文替代说明。根据规则,未经过用户选择而隐含强制特定语言/locale 可能构成自然语言政策问题。

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.