Back to skill

Security audit

自动下单执行虾

Security checks for vulnerabilities and agentic risk

Overview

This skill can place real supplier orders automatically and run continuously, but its controls are too weak for payment-capable automation.

Review carefully before installing. Do not use it for live purchasing until it defaults to dry-run, requires explicit human approval for payment-capable actions, validates supplier endpoints, uses least-privilege credentials, removes eval/source interpolation, parameterizes database access, adds idempotency controls, and provides a clear stop mechanism for monitoring.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (7)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/monitor-and-execute.sh:204
Finding

Arbitrary Python Code Execution in Budget Validation

Content
View full analysis
$budget_limit" | python3 -c "import sys; print(eval(sys.stdin.read()))") )); then log "WARN" "订单金额 ${total_amount} 超过预算上限 ${budget_limit},暂停并通知财务" notify_feishu "⚠️ 采购预算超限" "规则 ${rule_id}\n订单金额: ¥${total_amount}\n预算上限: ¥${budget_limit}\n请财务审批后手动执行" return 1 fi ``` ### Technical Analysis The script builds a Python expression from `total_amount` and `budget_limit`, then processes it with unrestricted Python `eval()`. The `budget_limit` value comes from the `purchase_rules` database table and is not validated as a numeric value before reaching this sink. An attacker who can alter a purchase rule, exploit the separate SQL injection path, or otherwise influence `budget_per_order` can supply Python syntax instead of a number. Because `eval()` has access to Python built-ins, the expression can invoke functions such as `__import__()` and execute operating-system commands. This operation is unnecessary for numeric comparison and exceeds the minimum privileges needed for budget validation. ### Attack Path 1. The attacker gains the ability to create or modify `budget_per_order`, directly or through an application/database vulnerability. 2. The attacker stores a value containing a valid Python expression with side effects. 3. The affected rule is triggered by monitor mode or invoked through `execute --rule-id`. 4. `execute_purchase` passes the malicious budget value into the string evaluated by Python. 5. The injected Python executes with the operating-system identity and environment of the purchase process. 6. The attacker can read inherited secrets, alter files, invoke local programs, or manipulate subseq ...[truncated 610 chars]
Remediation
View remediation
limit else 1) PY ``` The surrounding shell logic should be adjusted to handle the explicit result without evaluating generated code. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/monitor-and-execute.sh:25
Finding

SQL Injection Through Unescaped Rule and Order Identifiers

Content
View full analysis
/dev/null } ``` Representative unsafe queries include: ```bash rule_json=$(db_query "SELECT rule_config FROM purchase_rules WHERE rule_id='${rule_id}' AND enabled=1 LIMIT 1") ``` ```bash recent_count=$(db_query "SELECT COUNT(*) FROM purchase_orders WHERE rule_id='${rule_id}' AND created_at > DATE_SUB(NOW(), INTERVAL 60 MINUTE)") ``` ```bash db_query "INSERT INTO purchase_orders (order_id, rule_id, supplier_id, amount, status, created_at) VALUES ('${order_id}', '${rule_id}', '${supplier_id}', ${total_amount}, 'success', NOW())" ``` ```bash SUPPLIER_ID=$(db_query "SELECT supplier_id FROM purchase_rules WHERE rule_id='${RULE_ID}' LIMIT 1") BUDGET=$(db_query "SELECT budget_per_order FROM purchase_rules WHERE rule_id='${RULE_ID}' LIMIT 1") ``` ### Technical Analysis `db_query` executes an arbitrary SQL string through the MySQL command-line client. Values such as the command-line `RULE_ID` and database-derived identifiers are interpolated directly into quoted SQL literals without validation, escaping, or parameter binding. A crafted identifier containing a quote and SQL syntax can change the meaning of a query. Depending on MySQL client and server settings, this may allow unauthorized row selection, modification, or additional statements. Even where stacked statements are unavailable, Boolean or union-based injection may select a different rule and cause an unintended purchase. ### Attack Path 1. The attacker invokes the script with a crafted `--rule-id`, or causes a malicious identifier to enter a purchase rule. 2. The identifier is interpolated directly into one or more SQL statements. 3. The su ...[truncated 947 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/monitor-and-execute.sh:96
Finding

Python Source Injection Through Rule Identifier

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/monitor-and-execute.sh:204
Finding

Mandatory Financial Approval Controls Are Not Enforced

Content
View full analysis
$budget_limit" | python3 -c "import sys; print(eval(sys.stdin.read()))") )); then log "WARN" "订单金额 ${total_amount} 超过预算上限 ${budget_limit},暂停并通知财务" notify_feishu "⚠️ 采购预算超限" "规则 ${rule_id}\n订单金额: ¥${total_amount}\n预算上限: ¥${budget_limit}\n请财务审批后手动执行" return 1 fi # 查询供应商库存 local sku sku=$(echo "$order_json" | jq -r '.order.items[0].sku') local inventory_resp inventory_resp=$(check_supplier_inventory "$supplier_id" "$sku") || { log "WARN" "主供应商 ${supplier_id} 库存查询失败,尝试备选供应商" # TODO: 切换备选供应商逻辑 return 1 } local available_qty available_qty=$(echo "$inventory_resp" | jq -r '.available_quantity // 0') local need_qty need_qty=$(echo "$order_json" | jq '[.order.items[].quantity] | add // 0') if [[ "$available_qty" -lt "$need_qty" ]]; then log "WARN" "供应商 ${supplier_id} 库存不足 (需要: ${need_qty}, 可用: ${available_qty})" notify_feishu "⚠️ 供应商库存不足" "规则 ${rule_id}\n供应商: ${supplier_id}\n需要: ${need_qty},可用: ${available_qty}" return 1 fi # 执行支付 local result result=$(execute_payment "$order_json" "$supplier_id") || { log "ERROR" "支付执行失败,规则 ${rule_id}" notify_feishu "❌ 采购支付失败" "规则 ${rule_id}\n供应商: ${supplier_id}\n请人工处理" return 1 } ``` ### Technical Analysis The implementation treats a rule-specific `budget_limit` as sufficient authorization to submit an order. It does not verify an approval record, approver identity, organizational spending threshold, monthly or daily cumulative limits, new-supplier status, recent supplier-account changes, or unusual price deviation. This conflicts with the mandatory controls described in `references/payment-security.md`, including approval above CNY 5,000, a ...[truncated 1389 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/monitor-and-execute.sh:25
Finding

Database Password Exposed Through Process Command-Line Arguments

Content
View full analysis
/dev/null } ``` ```bash triggered=$(python3 "${SCRIPT_DIR}/evaluate_condition.py" \ --rule-id "$rule_id" \ --condition "$trigger_condition" \ --db-host "${DB_HOST:-localhost}" \ --db-user "${DB_USER}" \ --db-password "${DB_PASSWORD}" \ --db-name "${DB_NAME}" 2>/dev/null || echo "false") ``` ### Technical Analysis The database password is provided in command-line arguments to both `mysql` and the referenced Python evaluator. Command-line arguments can be collected by process-monitoring tools, crash diagnostics, audit systems, or other local users where process visibility is not restricted. Suppressing standard error does not protect the argument. It may also hide MySQL's warning about providing a password on the command line. The referenced `scripts/evaluate_condition.py` file is absent from the reviewed package, but the invocation still demonstrates unsafe secret handling if that dependency is later supplied. ### Attack Path 1. The purchase monitor executes a database query or condition evaluation. 2. The database password appears in the spawned process's argument vector. 3. A local user, monitoring agent, diagnostic collector, or compromised process reads or records the command line. 4. The observer recovers `DB_PASSWORD`. 5. The credential is used to access database resources allowed to `DB_USER`. ### Impact Assessment Credential compromise may expose purchase rules, supplier identifiers, budget information, and order records. If the database user has write access, an attacker may alter purchase rules, manipulate deduplication records, or prepare data that triggers the code-execution v ...[truncated 117 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/monitor-and-execute.sh:58
Finding

Supplier API Credentials Can Be Sent to Untrusted or Insecure Endpoints

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/monitor-and-execute.sh:164
Finding

Race Condition and Missing Idempotency Can Produce Duplicate Orders

Content
View full analysis
DATE_SUB(NOW(), INTERVAL 60 MINUTE)") if [[ "${recent_count:-0}" -gt 0 ]]; then log "INFO" "规则 ${rule_id} 在去重窗口内已执行,跳过" continue fi ``` The external request can be retried without an idempotency key: ```bash while [[ $retry -lt $max_retries ]]; do local response http_code response=$(curl -s -w "\n%{http_code}" -X POST "${api_url}/orders" \ -H "Authorization: Bearer ${api_key}" \ -H "Content-Type: application/json" \ -d "$order_json") http_code=$(echo "$response" | tail -1) local body body=$(echo "$response" | head -n -1) case "$http_code" in 200|201) log "INFO" "下单成功,HTTP ${http_code}" echo "$body" return 0 ;; 429|503) retry=$((retry + 1)) local wait_sec=$((retry * 300)) log "WARN" "供应商限流/不可用 (${http_code}),${wait_sec}s 后重试 (${retry}/${max_retries})" sleep "$wait_sec" ;; ``` The local record is created only after the remote request succeeds: ```bash db_query "INSERT INTO purchase_orders (order_id, rule_id, supplier_id, amount, status, created_at) VALUES ('${order_id}', '${rule_id}', '${supplier_id}', ${total_amount}, 'success', NOW())" ``` ### Technical Analysis The deduplication query and the external order submission are not protected by a transaction, lock, or unique reservation. Two monitor instances, or a monitor and a manual invocation, can both observe zero recent orders and submit independently. Additionally, supplier requests do not include a stable idempotency key. If the supplier accepts an ord ...[truncated 1167 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (17)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill explicitly enables automatic purchasing and payment execution but does not present a prominent warning that these actions can spend funds, create binding orders, and may be difficult or impossible to reverse. Because the stated goal is end-to-end unattended purchasing, users may invoke it without appreciating the financial and operational consequences of a misfire, bad rule, or malicious upstream data.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill documents daemonized background monitoring and autonomous execution commands without a strong warning about continuous unattended actions. In this context, a persistent monitor tied to order generation and payment can repeatedly spend money or create duplicate commitments if rules, inputs, retries, or integrations malfunction.

Content

No source excerpt is available for this finding.

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · scripts/monitor-and-execute.sh (reported line 36)May include surrounding context.

sh
log "WARN" "FEISHU_WEBHOOK_URL 未配置,跳过通知"
    return 0
  fi
  curl -s -X POST "${FEISHU_WEBHOOK_URL}" \
    -H "Content-Type: application/json" \
    -d "{\"msg_type\":\"text\",\"content\":{\"text\":\"【自动采购通知】${title}\n${content}\"}}" \
    > /dev/null

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script can automatically proceed from trigger evaluation to order creation and payment execution without any explicit interactive confirmation, approval gate, or user-visible warning at execution time. In the context of a purchasing skill that can spend money and place external orders, this creates a direct risk of unauthorized or erroneous financial transactions from bad rules, compromised data, or misfired triggers.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill describes shell-based execution and a background monitoring script that can generate orders and execute payments, but it does not declare any explicit tool scope or permission boundary. In a financial automation context, missing scope declarations increases the risk of overbroad execution, unclear authorization, and unintended command or network access during autonomous operation.

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

API Key 认证(最常见)

bash
curl -X POST https://api.supplier.com/orders \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d @order.json

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/supplier-api.md (reported line 39)May include surrounding context.

API Key 认证(最常见)

bash
curl -X POST https://api.supplier.com/orders \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d @order.json

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/supplier-api.md (reported line 48)May include surrounding context.

API Key 认证(最常见)

bash
curl -X POST https://api.supplier.com/orders \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d @order.json

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/supplier-api.md (reported line 52)May include surrounding context.

API Key 认证(最常见)

bash
curl -X POST https://api.supplier.com/orders \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d @order.json

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/supplier-api.md (reported line 86)May include surrounding context.

API Key 认证(最常见)

bash
curl -X POST https://api.supplier.com/orders \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d @order.json

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/supplier-api.md (reported line 103)May include surrounding context.

API Key 认证(最常见)

bash
curl -X POST https://api.supplier.com/orders \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d @order.json

External Transmission

Medium
Category
Data Exfiltration
Confidence
84% confidence
Finding

The script sends purchase-related notifications to an externally configured Feishu webhook, which can leak operational and transactional details outside the local environment. Because the destination is entirely environment-controlled and there is no validation, allowlisting, or content minimization, misconfiguration or abuse could exfiltrate sensitive order, budget, or supplier information.

Content

Scanner excerpt · scripts/monitor-and-execute.sh (reported line 36)May include surrounding context.

sh
log "WARN" "FEISHU_WEBHOOK_URL 未配置,跳过通知"
    return 0
  fi
  curl -s -X POST "${FEISHU_WEBHOOK_URL}" \
    -H "Content-Type: application/json" \
    -d "{\"msg_type\":\"text\",\"content\":{\"text\":\"【自动采购通知】${title}\n${content}\"}}" \
    > /dev/null

External Transmission

Medium
Category
Data Exfiltration
Confidence
95% confidence
Finding

This POST transmits full order data and authorization credentials to a supplier endpoint derived from configuration, and the workflow will automatically execute payment when triggers fire. If the supplier URL is misconfigured, maliciously altered, or points to an untrusted host, the system could send purchasing details and payment-bearing requests to an attacker-controlled destination, causing fraud or data leakage.

Content

Scanner excerpt · scripts/monitor-and-execute.sh (reported line 120)May include surrounding context.

sh
while [[ $retry -lt $max_retries ]]; do
    local response http_code
    response=$(curl -s -w "\n%{http_code}" -X POST "${api_url}/orders" \
      -H "Authorization: Bearer ${api_key}" \
      -H "Content-Type: application/json" \
      -d "$order_json")

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% 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.

Content

Scanner excerpt · scripts/monitor-and-execute.sh (reported line 260)May include surrounding context.

sh
mkdir -p "$(dirname "$LOG_FILE")"
    if [[ "${1:-}" == "--daemon" ]]; then
      log "INFO" "以后台模式启动监控..."
      nohup bash "$0" monitor >> "$LOG_FILE" 2>&1 &
      echo $! > "$PID_FILE"
      log "INFO" "监控进程已启动,PID: $(cat "$PID_FILE")"
    else

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The skill content is presented entirely in Chinese from the title onward, with no indication that users may choose another language or that the locale restriction is optional. Under the policy rule, forcing a specific language without user opt-in can be a natural-language policy violation unless the regional constraint is explicitly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

This markdown file contains user-facing instructional content exclusively in Chinese and does not indicate that language selection is optional. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale restriction is clearly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

Comments, usage text, logs, and notifications are written exclusively in Chinese, which creates a fixed locale experience with no user opt-in or alternative. Under the stated policy, forcing a specific language without offering choice is a natural-language policy violation.

Content

No source excerpt is available for this finding.